Пример #1
0
void instance_naxxramas::SetData(uint32 uiType, uint32 uiData)
{
    switch(uiType)
    {
        case TYPE_ANUB_REKHAN:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_ARAC_ANUB_DOOR);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_ARAC_ANUB_GATE);
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_MAEXXNA_ID);
            }
            break;
        case TYPE_FAERLINA:
            DoUseDoorOrButton(GO_ARAC_FAER_WEB);
            if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_KNOCK_YOU_OUT, true);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_ARAC_FAER_DOOR);
                DoUseDoorOrButton(GO_ARAC_FAER_WEB);
                DoUseDoorOrButton(GO_ARAC_MAEX_OUTER_DOOR);
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_MAEXXNA:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_ARAC_MAEX_INNER_DOOR, uiData);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_ARAC_EYE_RAMP);
                DoRespawnGameObject(GO_ARAC_PORTAL, 30*MINUTE);
                m_uiTauntTimer = 5000;
            }
            break;
        case TYPE_NOTH:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_PLAG_NOTH_ENTRY_DOOR);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_PLAG_NOTH_EXIT_DOOR);
                DoUseDoorOrButton(GO_PLAG_HEIG_ENTRY_DOOR);
            }
            break;
        case TYPE_HEIGAN:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_PLAG_HEIG_ENTRY_DOOR);
            if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_SAFETY_DANCE, true);
            if (uiData == DONE)
                DoUseDoorOrButton(GO_PLAG_HEIG_EXIT_DOOR);
            break;
        case TYPE_LOATHEB:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_PLAG_LOAT_DOOR);
            if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_SPORE_LOSER, true);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_PLAG_EYE_RAMP);
                DoRespawnGameObject(GO_PLAG_PORTAL, 30*MINUTE);
                m_uiTauntTimer = 5000;
            }
            break;
        case TYPE_RAZUVIOUS:
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_GOTHIK:
            switch(uiData)
            {
                case IN_PROGRESS:
                    DoUseDoorOrButton(GO_MILI_GOTH_ENTRY_GATE);
                    DoUseDoorOrButton(GO_MILI_GOTH_COMBAT_GATE);
                    break;
                case SPECIAL:
                    DoUseDoorOrButton(GO_MILI_GOTH_COMBAT_GATE);
                    break;
                case FAIL:
                    if (m_auiEncounter[uiType] == IN_PROGRESS)
                        DoUseDoorOrButton(GO_MILI_GOTH_COMBAT_GATE);

                    DoUseDoorOrButton(GO_MILI_GOTH_ENTRY_GATE);
                    break;
                case DONE:
                    DoUseDoorOrButton(GO_MILI_GOTH_ENTRY_GATE);
                    DoUseDoorOrButton(GO_MILI_GOTH_EXIT_GATE);
                    DoUseDoorOrButton(GO_MILI_HORSEMEN_DOOR);
                    break;
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_FOUR_HORSEMEN:
            m_auiEncounter[uiType] = uiData;
            if (uiData != SPECIAL)
                DoUseDoorOrButton(GO_MILI_HORSEMEN_DOOR);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_MILI_EYE_RAMP);
                DoRespawnGameObject(GO_MILI_PORTAL, 30*MINUTE);
                DoRespawnGameObject(instance->IsRegularDifficulty() ? GO_CHEST_HORSEMEN_NORM : GO_CHEST_HORSEMEN_HERO, 30*MINUTE);
                m_uiTauntTimer = 5000;

                Map::PlayerList const& players = instance->GetPlayers();

                if (!players.isEmpty())
                {
                    for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                    {
                        if (Player* pPlayer = itr->getSource())
                        {
                            pPlayer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_HORSEMEN_CREDIT);
                        }
                    }
                }
            }
            break;
        case TYPE_PATCHWERK:
            m_auiEncounter[uiType] = uiData;
            if (uiData == IN_PROGRESS)
                DoStartTimedAchievement(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_PATCHWERK_ID);
            if (uiData == DONE)
                DoUseDoorOrButton(GO_CONS_PATH_EXIT_DOOR);
            break;
        case TYPE_GROBBULUS:
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_GLUTH:
            m_auiEncounter[uiType] = uiData;
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_CONS_GLUT_EXIT_DOOR);
                DoUseDoorOrButton(GO_CONS_THAD_DOOR);
            }
            break;
        case TYPE_THADDIUS:
            // Only process real changes here
            if (m_auiEncounter[uiType] == uiData)
                return;

            m_auiEncounter[uiType] = uiData;
            if (uiData != SPECIAL)
                DoUseDoorOrButton(GO_CONS_THAD_DOOR, uiData);
            // Uncomment when this achievement is implemented
            //if (uiData == IN_PROGRESS)
            //    SetSpecialAchievementCriteria(TYPE_ACHIEV_SHOCKING, true);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_CONS_EYE_RAMP);
                DoRespawnGameObject(GO_CONS_PORTAL, 30*MINUTE);
                m_uiTauntTimer = 5000;
            }
            break;
        case TYPE_SAPPHIRON:
            m_auiEncounter[uiType] = uiData;
            // Uncomment when achiev check implemented
            //if (uiData == IN_PROGRESS)
            //    SetSpecialAchievementCriteria(TYPE_ACHIEV_HUNDRED_CLUB, true);
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_KELTHUZAD_WATERFALL_DOOR);
                m_dialogueHelper.StartNextDialogueText(SAY_SAPP_DIALOG1);
            }
            break;
        case TYPE_KELTHUZAD:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_KELTHUZAD_EXIT_DOOR);
            if (uiData == IN_PROGRESS)
                SetSpecialAchievementCriteria(TYPE_ACHIEV_GET_ENOUGH, false);
            break;
        case TYPE_UNDYING_FAILED:
            m_auiEncounter[uiType] = uiData;
            break;
    }

    if (uiData == DONE)
    {
        OUT_SAVE_INST_DATA;

        std::ostringstream saveStream;
        saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
            << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " "
            << m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8] << " "
            << m_auiEncounter[9] << " " << m_auiEncounter[10] << " " << m_auiEncounter[11] << " "
            << m_auiEncounter[12] << " " << m_auiEncounter[13] << " " << m_auiEncounter[14] << " " << m_auiEncounter[15];

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
Пример #2
0
        void UpdateAI(const uint32 diff)
        {
            npc_escortAI::UpdateAI(diff);

            if(!UpdateVictim())
                return;

            if(uiBuffTimer <= diff)
            {
                if(!me->HasAura(SPELL_SHIELD))
                    DoCastSpellShield();

                uiBuffTimer = urand(30000, 45000);
            } else uiBuffTimer -= diff;

            if(uiChargeTimer <= diff)
            {
                Map::PlayerList const& players = me->GetMap()->GetPlayers();
                if(me->GetMap()->IsDungeon() && !players.isEmpty())
                {
                    for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                    {
                        Player* pPlayer = itr->getSource();
                        if(pPlayer && me->IsInRange(pPlayer, 8.0f, 25.0f,false) && pPlayer->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
                        {
                            Creature* pVehicle = pPlayer->GetVehicleBase()->ToCreature();
                            if(pVehicle)
                            {
                                DoResetThreat();
                                me->AddThreat(pVehicle, 1.0f);
                                DoCast(pVehicle, SPELL_CHARGE);
                            }
                            break;
                        }
                    }
                }
                uiChargeTimer = 5000;
            } else uiChargeTimer -= diff;

            /*if(uiShieldBreakerTimer <= diff)
            {
                Map::PlayerList const& players = me->GetMap()->GetPlayers();
                if(me->GetMap()->IsDungeon() && !players.isEmpty())
                {
                    for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                    {
                        Player* pPlayer = itr->getSource();
                        if(pPlayer && me->IsInRange(pPlayer, 10.0f, 30.0f,false) && pPlayer->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
                        {
                            Creature* pVehicle = pPlayer->GetVehicleBase()->ToCreature();
                            if(pVehicle)
                            {
                                DoResetThreat();
                                me->AddThreat(pVehicle, 1.0f);
                                //DoCast(pVehicle,SPELL_SHIELD_BREAKER);
                                if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true))
                                    me->CastSpell(target, SPELL_SHIELD_BREAKER, true);
                            }
                            break;
                        }
                    }
                 }
                 uiShieldBreakerTimer = 7000;
            } else uiShieldBreakerTimer -= diff;
            */
            if(uiShieldBreakerTimer <= diff)
            {
                if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                {
                    switch(urand(1, 3)) {
                        case 1:
                        case 2:
                            break;
                        case 3:
                            me->CastSpell(target, SPELL_SHIELD_BREAKER, true);
                            break;
                    }
                }
                uiShieldBreakerTimer = 7000;
            } else uiShieldBreakerTimer -= diff;
            /*
            if(uiChargeTimer <= diff)
            {
                if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true))
                    me->CastSpell(target, SPELL_CHARGE, true);
                uiChargeTimer = 3000;
            } else uiChargeTimer -= diff;
            */
            DoMeleeAttackIfReady();
        }
Пример #3
0
        void UpdateAI(const uint32 uiDiff)
        {
            npc_escortAI::UpdateAI(uiDiff);

            if (!UpdateVictim())
                return;

            if (uiBuffTimer <= uiDiff)
            {
                if (!me->HasAura(SPELL_SHIELD))
                    DoCastSpellShield();

                uiBuffTimer = urand(30000, 45000);
            }else uiBuffTimer -= uiDiff;

            if (uiChargeTimer <= uiDiff)
            {
                Map::PlayerList const& players = me->GetMap()->GetPlayers();
                if (me->GetMap()->IsDungeon() && !players.isEmpty())
                {
                    for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                    {
                        Player* player = itr->getSource();
                        if (player && !player->isGameMaster() && me->IsInRange(player, 8.0f, 25.0f, false))
                        {
                            DoResetThreat();
                            me->AddThreat(player, 1.0f);
                            DoCast(player, SPELL_CHARGE);
                            break;
                        }
                    }
                }
                uiChargeTimer = 5000;
            }else uiChargeTimer -= uiDiff;

            //dosen't work at all
            if (uiShieldBreakerTimer <= uiDiff)
            {
                Vehicle* pVehicle = me->GetVehicleKit();
                if (!pVehicle)
                    return;

                if (Unit* pPassenger = pVehicle->GetPassenger(SEAT_ID_0))
                {
                    Map::PlayerList const& players = me->GetMap()->GetPlayers();
                    if (me->GetMap()->IsDungeon() && !players.isEmpty())
                    {
                        for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                        {
                            Player* player = itr->getSource();
                            if (player && !player->isGameMaster() && me->IsInRange(player, 10.0f, 30.0f, false))
                            {
                                pPassenger->CastSpell(player, SPELL_SHIELD_BREAKER, true);
                                break;
                            }
                        }
                    }
                }
                uiShieldBreakerTimer = 7000;
            }else uiShieldBreakerTimer -= uiDiff;

            DoMeleeAttackIfReady();
        }
Пример #4
0
        void UpdateAI(const uint32 uiDiff)
        {
            if (!bDone && GrandChampionsOutVehicle(me))
            {
                bDone = true;

                if (instance && me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_1))
                    me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f);
                else if (instance && me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_2))
                    me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f);
                else if (instance && me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_3))
                    me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f);

                if (instance)
                    instance->SetData(BOSS_GRAND_CHAMPIONS, IN_PROGRESS);

                EnterEvadeMode();
                bHome = true;
            }

            if (uiPhaseTimer <= uiDiff)
            {
                if (uiPhase == 1)
                {
                    AggroAllPlayers(me);
                    uiPhase = 0;
                }
            }else uiPhaseTimer -= uiDiff;

            if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
                return;

            if (uiLightningArrowsTimer <= uiDiff)
            {
                DoCastAOE(SPELL_LIGHTNING_ARROWS, false);
                uiLightningArrowsTimer = 7000;
            } else uiLightningArrowsTimer -= uiDiff;

            if (uiShootTimer <= uiDiff)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_FARTHEST, 0, 30.0f))
                {
                    uiTargetGUID = target->GetGUID();
                    DoCast(target, SPELL_SHOOT);
                }
                uiShootTimer = 12000;
                uiMultiShotTimer = 3000;
                bShoot = true;
            } else uiShootTimer -= uiDiff;

            if (bShoot && uiMultiShotTimer <= uiDiff)
            {
                me->InterruptNonMeleeSpells(true);
                Unit* target = Unit::GetUnit(*me, uiTargetGUID);

                if (target && me->IsInRange(target, 5.0f, 30.0f, false))
                {
                    DoCast(target, SPELL_MULTI_SHOT);
                }
                else if (target)
                {
                    Map::PlayerList const& players = me->GetMap()->GetPlayers();
                    if (me->GetMap()->IsDungeon() && !players.isEmpty())
                    {
                        for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                        {
                            Player* player = itr->getSource();
                            if (player && !player->isGameMaster() && me->IsInRange(player, 5.0f, 30.0f, false))
                            {
                                DoCast(target, SPELL_MULTI_SHOT);
                                break;
                            }
                        }
                    }
                }
                bShoot = false;
            } else uiMultiShotTimer -= uiDiff;

            DoMeleeAttackIfReady();
        }
        void SetData(uint32 type, uint32 data)
        {
            switch (type)
            {
            case TYPE_MEDIVH:
                if (data == SPECIAL && m_auiEncounter[0] == IN_PROGRESS)
                {
                    --mShieldPercent;

                    DoUpdateWorldState(WORLD_STATE_BM_SHIELD, mShieldPercent);

                    if (!mShieldPercent)
                    {
                        if (Creature* pMedivh = instance->GetCreature(MedivhGUID))
                        {
                            if (pMedivh->isAlive())
                            {
                                pMedivh->DealDamage(pMedivh, pMedivh->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
                                m_auiEncounter[0] = FAIL;
                                m_auiEncounter[1] = NOT_STARTED;
                            }
                        }
                    }
                }
                else
                {
                    if (data == IN_PROGRESS)
                    {
                        sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Starting event.");
                        InitWorldState();
                        m_auiEncounter[1] = IN_PROGRESS;
                        NextPortal_Timer = 15000;
                    }

                    if (data == DONE)
                    {
                        //this may be completed further out in the post-event
                        sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Dark Portal: Event completed.");
                        Map::PlayerList const& players = instance->GetPlayers();

                        if (!players.isEmpty())
                        {
                            for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                            {
                                if (Player* player = itr->getSource())
                                {
                                    if (player->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE)
                                        player->AreaExploredOrEventHappens(QUEST_OPENING_PORTAL);

                                    if (player->GetQuestStatus(QUEST_MASTER_TOUCH) == QUEST_STATUS_INCOMPLETE)
                                        player->AreaExploredOrEventHappens(QUEST_MASTER_TOUCH);
                                }
                            }
                        }
                    }

                    m_auiEncounter[0] = data;
                }
                break;
            case TYPE_RIFT:
                if (data == SPECIAL)
                {
                    if (mRiftPortalCount < 7)
                        NextPortal_Timer = 5000;
                }
                else
                    m_auiEncounter[1] = data;
                break;
            }
        }
void instance_dire_maul::SetData(uint32 uiType, uint32 uiData)
{
    switch (uiType)
    {
            // East
        case TYPE_ZEVRIM:
            if (uiData == DONE)
            {
                // Update Old Ironbark so he can open the conservatory door
                if (Creature* pIronbark = GetSingleCreatureFromStorage(NPC_OLD_IRONBARK))
                {
                    DoScriptText(SAY_IRONBARK_REDEEM, pIronbark);
                    pIronbark->UpdateEntry(NPC_IRONBARK_REDEEMED);
                }
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_IRONBARK:
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_ALZZIN:                                   // This Encounter is expected to be handled within Acid (reason handling at 50% hp)
            if (uiData == DONE)
            {
                if (!m_bWallDestroyed)
                {
                    DoUseDoorOrButton(GO_CRUMBLE_WALL);
                    m_bWallDestroyed = true;
                }

                DoUseDoorOrButton(GO_CORRUPT_VINE);

                if (!m_lFelvineShardGUIDs.empty())
                {
                    for (GuidList::const_iterator itr = m_lFelvineShardGUIDs.begin(); itr != m_lFelvineShardGUIDs.end(); ++itr)
                        DoRespawnGameObject(*itr);
                }
            }
            else if (uiData == SPECIAL && !m_bWallDestroyed)
            {
                DoUseDoorOrButton(GO_CRUMBLE_WALL);
                m_bWallDestroyed = true;
            }
            m_auiEncounter[uiType] = uiData;
            break;

            // West
        case TYPE_WARPWOOD:
            if (uiData == DONE)
                DoUseDoorOrButton(GO_WARPWOOD_DOOR);
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_IMMOLTHAR:
            if (uiData == DONE)
            {
                if (Creature* pPrince = GetSingleCreatureFromStorage(NPC_PRINCE_TORTHELDRIN))
                {
                    DoScriptText(SAY_FREE_IMMOLTHAR, pPrince);
                    pPrince->setFaction(FACTION_HOSTILE);
                    // Despawn Chest-Aura
                    if (GameObject* pChestAura = GetSingleGameObjectFromStorage(GO_PRINCES_CHEST_AURA))
                        pChestAura->Use(pPrince);
                }
            }
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_PRINCE:
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_PYLON_1:
        case TYPE_PYLON_2:
        case TYPE_PYLON_3:
        case TYPE_PYLON_4:
        case TYPE_PYLON_5:
            m_auiEncounter[uiType] = uiData;
            if (uiData == DONE)
            {
                DoUseDoorOrButton(m_aCrystalGeneratorGuid[uiType - TYPE_PYLON_1]);
                if (CheckAllGeneratorsDestroyed())
                    ProcessForceFieldOpening();
            }
            break;

            // North
        case TYPE_KING_GORDOK:
            m_auiEncounter[uiType] = uiData;
            if (uiData == DONE)
            {
                // Apply Aura to players in the map
                Map::PlayerList const& players = instance->GetPlayers();
                for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                {
                    if (Player* pPlayer = itr->getSource())
                        pPlayer->CastSpell(pPlayer, SPELL_KING_OF_GORDOK, true);
                }
            }
            break;
    }

    if (uiData == DONE)
    {
        OUT_SAVE_INST_DATA;

        std::ostringstream saveStream;
        saveStream    << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
                      << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " "
                      << m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8] << " "
                      << m_auiEncounter[9] << " " << m_auiEncounter[10] << " " << m_auiEncounter[11];

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
Пример #7
0
        void UpdateAI(const uint32 uiDiff)
        {
            //Return since we have no target
            if (!UpdateVictim())
                return;

            if (m_bIsAura)
            {
                // workaround for PULSING_SHOCKWAVE
                if (m_uiPulsingShockwave_Timer <= uiDiff)
                {
                    Map* map = me->GetMap();
                    if (map->IsDungeon())
                    {
                        Map::PlayerList const &PlayerList = map->GetPlayers();

                        if (PlayerList.isEmpty())
                            return;

                        for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                            if (i->getSource() && i->getSource()->isAlive() && i->getSource()->isTargetableForAttack())
                            {
                                int32 dmg;
                                float m_fDist = me->GetExactDist(i->getSource()->GetPositionX(), i->getSource()->GetPositionY(), i->getSource()->GetPositionZ());

                                dmg = DUNGEON_MODE(100, 150); // need to correct damage
                                if (m_fDist > 1.0f) // Further from 1 yard
                                    dmg = int32(dmg*m_fDist);

                                me->CastCustomSpell(i->getSource(), DUNGEON_MODE(52942, 59837), &dmg, 0, 0, false);
                            }
                    }
                    m_uiPulsingShockwave_Timer = 2000;
                } else m_uiPulsingShockwave_Timer -= uiDiff;
            }
            else
            {
                if (m_uiResumePulsingShockwave_Timer <= uiDiff)
                {
                    //breaks at movement, can we assume when it's time, this spell is casted and also must stop movement?
                    DoCast(me, SPELL_PULSING_SHOCKWAVE_AURA, true);

                    DoCast(me, SPELL_PULSING_SHOCKWAVE_N); // need core support
                    m_bIsAura = true;
                    m_uiResumePulsingShockwave_Timer = 0;
                }
                else
                    m_uiResumePulsingShockwave_Timer -= uiDiff;
            }

            if (m_uiArcLightning_Timer <= uiDiff)
            {
                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
                    DoCast(target, SPELL_ARC_LIGHTNING);

                m_uiArcLightning_Timer = 15000 + rand()%1000;
            }
            else
                m_uiArcLightning_Timer -= uiDiff;

            if (m_uiLightningNova_Timer <= uiDiff)
            {
                DoScriptText(RAND(SAY_NOVA_1, SAY_NOVA_2, SAY_NOVA_3), me);
                DoScriptText(EMOTE_NOVA, me);
                DoCast(me, SPELL_LIGHTNING_NOVA_N);

                m_bIsAura = false;
                m_uiResumePulsingShockwave_Timer = DUNGEON_MODE(5000, 4000); // Pause Pulsing Shockwave aura
                m_uiLightningNova_Timer = 20000 + rand()%1000;
            }
            else
                m_uiLightningNova_Timer -= uiDiff;

            // Health check
            if (HealthBelowPct(100 - 25 * m_uiHealthAmountModifier))
            {
                switch (m_uiHealthAmountModifier)
                {
                    case 1: DoScriptText(SAY_75HEALTH, me); break;
                    case 2: DoScriptText(SAY_50HEALTH, me); break;
                    case 3: DoScriptText(SAY_25HEALTH, me); break;
                }

                ++m_uiHealthAmountModifier;
            }

            DoMeleeAttackIfReady();
        }
        bool SetBossState(uint32 id, EncounterState state)
        {
            if (!InstanceScript::SetBossState(id, state))
                return false;

            switch (id)
            {
            case DATA_GU_CLOUDSTRIKE:
                {
                    switch (state)
                    {
                    case NOT_STARTED:
                    case FAIL:
                        {
                            HandleGameObject(cloudstikeEntranceGuid, true);
                            HandleGameObject(cloudstikeExitGuid,     false);
                            break;
                        }
                    case IN_PROGRESS:
                        {
                            HandleGameObject(cloudstikeEntranceGuid, false);
                            HandleGameObject(cloudstikeExitGuid,     false);
                            break;
                        }
                    case DONE:
                        {
                            HandleGameObject(cloudstikeEntranceGuid, true);
                            HandleGameObject(cloudstikeExitGuid,     true);
                            HandleGameObject(snowdriftEntranceGuid,  true);
                            break;
                        }
                    default:
                        break;
                    }
                    break;
                }
            case DATA_MASTER_SNOWDRIFT:
                {
                    switch (state)
                    {
                    case NOT_STARTED:
                    case FAIL:
                        aliveNoviceCount = MAX_NOVICE;
                        aliveMinibossCount = 2;
                        minibossPositionsGuid.clear();
                        firstDefeatedNovicePositionsGuid.clear();
                        secondDefeatedNovicePositionsGuid.clear();

                        HandleGameObject(snowdriftEntranceGuid, true);
                        HandleGameObject(snowdriftFirewallGuid, false);
                        HandleGameObject(snowdriftDojoDoorGuid, false);
                        HandleGameObject(snowdriftExitGuid, false);
                        break;
                    case IN_PROGRESS:
                        HandleGameObject(snowdriftEntranceGuid, false);
                        HandleGameObject(snowdriftDojoDoorGuid, false);
                        break;
                    case DONE:
                        if (GameObject* possessions = instance->GetGameObject(snowdriftPossessionsGuid))
                            possessions->SetPhaseMask(1, true);

                        HandleGameObject(snowdriftEntranceGuid, true);
                        HandleGameObject(snowdriftFirewallGuid, true);
                        HandleGameObject(snowdriftDojoDoorGuid, true);
                        HandleGameObject(snowdriftExitGuid,     true);
                        HandleGameObject(shaEntranceGuid,       true);
                        break;
                    default:
                        break;
                    }
                    break;
                }
            case DATA_SHA_VIOLENCE:
                {
                    switch (state)
                    {
                    case NOT_STARTED:
                    case FAIL:
                        HandleGameObject(shaEntranceGuid,   true);
                        HandleGameObject(shaExitGuid,       false);
                        break;
                    case IN_PROGRESS:
                        HandleGameObject(shaEntranceGuid,   false);
                        break;
                    case DONE:
                        HandleGameObject(shaEntranceGuid,   true);
                        HandleGameObject(shaExitGuid,       true);
                        break;
                    default:
                        break;
                    }
                    break;
                }
            case DATA_TARAN_ZHU:
                {
                    if (state == IN_PROGRESS)
                        DoAddAuraOnPlayers(SPELL_HATE);
                    else
                    {
                        Map::PlayerList const &PlayerList = instance->GetPlayers();

                        if (!PlayerList.isEmpty())
                            for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                                if (Player* player = i->GetSource())
                                {
                                    player->RemoveAurasDueToSpell(SPELL_HATE);
                                    player->RemoveAurasDueToSpell(SPELL_HAZE_OF_HATE);
                                    player->RemoveAurasDueToSpell(SPELL_HAZE_OF_HATE_VISUAL);
                                }
                    }

                    if (state == DONE)
                        if (GameObject* possessions = instance->GetGameObject(taranzhuPossessionsGuid))
                            possessions->SetPhaseMask(1, true);
                    break;
                }
            default:
                break;
            }

            return true;
        }
Пример #9
0
    void UpdateAI(const uint32 diff)
    {
        if (!UpdateVictim())
            return;

        if (ResetTimer <= diff)
        {
            if (me->IsWithinDist3d(119.223f, 1035.45f, 29.4481f, 10))
            {
                EnterEvadeMode();
                return;
            }
            ResetTimer = 5000;
        } else ResetTimer -= diff;

        if (CheckAddState_Timer <= diff)
        {
            for (uint8 i = 0; i < 4; ++i)
                if (Creature *pTemp = Unit::GetCreature(*me, AddGUID[i]))
                    if (pTemp->isAlive() && !pTemp->getVictim())
                        pTemp->AI()->AttackStart(me->getVictim());

            CheckAddState_Timer = 5000;
        } else CheckAddState_Timer -= diff;

        if (DrainPower_Timer <= diff)
        {
            DoCast(me, SPELL_DRAIN_POWER, true);
            Map *map = me->GetMap();
            if (!map->IsDungeon()) return;
            Map::PlayerList const &PlayerList = map->GetPlayers();
            for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
            {
                if (Player* i_pl = i->getSource())
                    if (i_pl->isAlive())me->AddAura(44132, me); //+1% Damage for each active player on boss (+ActivePlayer_Stack)
            }
            //me->AddAura(44132, me);
            me->MonsterYell(YELL_DRAIN_POWER, LANG_UNIVERSAL, NULL);
            DoPlaySoundToSet(me, SOUND_YELL_DRAIN_POWER);
            DrainPower_Timer = urand(40000,55000);    // must cast in 60 sec, or buff/debuff will disappear
        } else DrainPower_Timer -= diff;

        if (SpiritBolts_Timer <= diff)
        {
            if (DrainPower_Timer < 12000)    // channel 10 sec
                SpiritBolts_Timer = 13000;   // cast drain power first
            else
            {
                DoCast(me, SPELL_SPIRIT_BOLTS, true);
                me->MonsterYell(YELL_SPIRIT_BOLTS, LANG_UNIVERSAL, NULL);
                DoPlaySoundToSet(me, SOUND_YELL_SPIRIT_BOLTS);
                SpiritBolts_Timer = 40000;
                SiphonSoul_Timer = 10000;    // ready to drain
                PlayerAbility_Timer = 99999;
            }
        } else SpiritBolts_Timer -= diff;

        if (SiphonSoul_Timer <= diff)
        {
            Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 70, true);
            Unit *trigger = DoSpawnCreature(MOB_TEMP_TRIGGER, 0, 0, 0, 0, TEMPSUMMON_TIMED_DESPAWN, 30000);
            if (!pTarget || !trigger)
            {
                EnterEvadeMode();
                return;
            }
            else
            {
                trigger->SetDisplayId(11686);
                trigger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                trigger->CastSpell(pTarget, SPELL_SIPHON_SOUL, true);
                trigger->GetMotionMaster()->MoveChase(me);

                //DoCast(pTarget, SPELL_SIPHON_SOUL, true);
                //me->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, pTarget->GetGUID());
                //me->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SIPHON_SOUL);

                PlayerGUID = pTarget->GetGUID();
                PlayerAbility_Timer = urand(8000,10000);
                PlayerClass = pTarget->getClass() - 1;

                if (PlayerClass == 10)
                    PlayerClass = 9; // druid
                else if (PlayerClass == 4 && pTarget->HasSpell(15473))
                    PlayerClass = 5; // shadow priest

                SiphonSoul_Timer = 99999;   // buff lasts 30 sec
            }
        } else SiphonSoul_Timer -= diff;

        if (PlayerAbility_Timer <= diff)
        {
            //Unit *pTarget = Unit::GetUnit(*me, PlayerGUID);
            //if (pTarget && pTarget->isAlive())
            //{
                UseAbility();
                PlayerAbility_Timer = urand(8000,10000);
            //}
        } else PlayerAbility_Timer -= diff;

        DoMeleeAttackIfReady();
    }
Пример #10
0
void CreatureAI::DoZoneInCombat(Creature* creature)
{
    if (!creature)
        creature = me;

    if(!creature->CanHaveThreatList())
        return;

    Map *map = creature->GetMap();
    if (!map->IsDungeon())                                  //use IsDungeon instead of Instanceable, in case battlegrounds will be instantiated
    {
        sLog.outError("DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? ((Creature*)creature)->GetEntry() : 0);
        return;
    }

    if(!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
    {
        if(Unit *target = creature->SelectNearestTarget(50))
            creature->AI()->AttackStart(target);
        else if(creature->isSummon())
        {
            if(Unit *summoner = ((TempSummon*)creature)->GetSummoner())
            {
                Unit *target = summoner->getAttackerForHelper();
                if(!target && summoner->CanHaveThreatList() && !summoner->getThreatManager().isThreatListEmpty())
                    target = summoner->getThreatManager().getHostilTarget();
                if(target && (creature->IsFriendlyTo(summoner) || creature->IsHostileTo(target)))
                    creature->AI()->AttackStart(target);
            }
        }
    }

    if(!creature->HasReactState(REACT_PASSIVE) && !creature->getVictim())
    {
        sLog.outError("DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry());
        return;
    }

    Map::PlayerList const &PlList = map->GetPlayers();

    if(PlList.isEmpty())
        return;

    for(Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
    {
        if(Player* pPlayer = i->getSource())
        {
            if(pPlayer->isGameMaster())
                continue;

            if(pPlayer->isAlive())
            {
                creature->SetInCombatWith(pPlayer);
                pPlayer->SetInCombatWith(creature);
                creature->AddThreat(pPlayer, 0.0f);
            }

            /* Causes certain things to never leave the threat list (Priest Lightwell, etc):
            for(Unit::ControlList::const_iterator itr = pPlayer->m_Controlled.begin(); itr != pPlayer->m_Controlled.end(); ++itr)
            {
                creature->SetInCombatWith(*itr);
                (*itr)->SetInCombatWith(creature);
                creature->AddThreat(*itr, 0.0f);
            }*/
        }
    }
}
Пример #11
0
        void SetData(uint32 type, uint32 data)
        {
            switch (type)
            {
            case DATA_MEATHOOK_EVENT:
                _encounterState[0] = data;
                break;
            case DATA_SALRAMM_EVENT:
                if(data == DONE)
                {
                    DoUpdateWorldState(WORLDSTATE_WAVE_COUNT, 0);
                    if(ArthasNeedsTeleport())
                        if(Creature* arthas = instance->GetCreature(_arthasGUID))
                            arthas->AI()->SetData(1, 0);
                }
                _encounterState[1] = data;
                break;
            case DATA_EPOCH_EVENT:
                _encounterState[2] = data;
                break;
            case DATA_MAL_GANIS_EVENT:
                _encounterState[3] = data;

                switch (_encounterState[3])
                {
                case NOT_STARTED:
                    HandleGameObject(_malGanisGate2GUID, true);
                    break;
                case IN_PROGRESS:
                    HandleGameObject(_malGanisGate2GUID, false);
                    break;
                case DONE:
                    HandleGameObject(_exitGateGUID, true);
                    if (GameObject* go = instance->GetGameObject(_malGanisChestGUID))
                        go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_INTERACT_COND);
                    instance->SummonCreature(NPC_CHROMIE_3, ChromieExitSummonPos);
                    Map::PlayerList const &players = instance->GetPlayers();
                    for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                        itr->getSource()->KilledMonsterCredit(31006, 0);
                    break;
                }
                break;
            case DATA_INFINITE_EVENT:
                _encounterState[4] = data;
                switch (data)
                {
                case DONE:
                    DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN_SHOW, 0);
                    DoCompleteAchievement(ACHIEVEMENT_CULLING_TIME);
                    break;
                case FAIL:
                    DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN_SHOW, 0);
                    if(Creature* infinite = instance->GetCreature(_infiniteGUID))
                        infinite->AI()->DoAction(0);
                    break;
                case IN_PROGRESS:
                    DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN_SHOW, 1);
                    DoUpdateWorldState(WORLDSTATE_TIME_GUARDIAN, 25);
                    instance->SummonCreature(NPC_INFINITE, InfiniteSummonPos);
                    break;
                }
                break;
            case DATA_ARTHAS_EVENT:
                if (data == FAIL)
                {
                    if (Creature* deadArthas = instance->GetCreature(_arthasGUID))
                    {
                        deadArthas->DespawnOrUnsummon(10000);

                        int index;

                        if(_artasStepUi >= 83) // Before last run
                            index = 2;
                        else if (_artasStepUi >= 60) // Before the council
                            index = 1;
                        else // entrance of city
                            index = 0;

                        if(Creature* newArthas = instance->SummonCreature(NPC_ARTHAS, ArthasSpawnPositions[index]))
                            newArthas->AI()->SetData(0, pow(2.0, index));
                    }
                }
                break;
            case DATA_CRATE_COUNT:
                _crateCount = data;
                DoUpdateWorldState(WORLDSTATE_CRATES_REVEALED, _crateCount);
                if (_crateCount == 5)
                {
                    Map::PlayerList const &players = instance->GetPlayers();
                    for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                        itr->getSource()->KilledMonsterCredit(30996, 0);

                    // Summon Chromie and global whisper
                    if (Creature* chromie = instance->SummonCreature(NPC_CHROMIE_2, ChromieEntranceSummonPos))
                        if (!instance->GetPlayers().isEmpty())
                            if (Player* player = instance->GetPlayers().getFirst()->getSource())
                                sCreatureTextMgr->SendChat(chromie, SAY_CRATES_COMPLETED, player->GetGUID(), CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);
                    DoUpdateWorldState(WORLDSTATE_SHOW_CRATES, 0);
                }
                break;
            case DATA_TRANSFORM_CITIZENS:
                switch(data)
                {
                case SPECIAL: // Respawn Zombies
                    while (!_zombiesList.empty())
                    {
                        Creature *summon = instance->GetCreature(*_zombiesList.begin());
                        if (!summon)
                            _zombiesList.erase(_zombiesList.begin());
                        else
                        {
                            _zombiesList.erase(_zombiesList.begin());
                            if (TempSummon* summ = summon->ToTempSummon())
                            {
                                summon->DestroyForNearbyPlayers();
                                summ->UnSummon();
                            }
                            else
                                summon->DisappearAndDie();
                        }
                    }
                case IN_PROGRESS: // Transform Citizens
                    for (std::list<uint64>::iterator itr = _citizensList.begin(); itr != _citizensList.end(); ++itr)
                        if(Creature* citizen = instance->GetCreature((*itr)))
                        {
                            if(Creature* arthas = instance->GetCreature(GetData64(DATA_ARTHAS)))
                                if(Creature* risenZombie = arthas->SummonCreature(NPC_ZOMBIE, citizen->GetPositionX(), citizen->GetPositionY(), citizen->GetPositionZ(), citizen->GetOrientation())) //, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000))
                                    _zombiesList.push_back(risenZombie->GetGUID());
                            citizen->SetPhaseMask(2, true);
                        }
                    break;
                }
                break;
            case DATA_ZOMBIEFEST:
                if (!instance->IsHeroic() || GetData(DATA_ZOMBIEFEST) == DONE)
                    break;

                switch(data)
                {
                case DONE:
                    DoCompleteAchievement(ACHIEVEMENT_ZOMBIEFEST);
                    DoSendNotifyToInstance(zombiefestWarnings[10]);
                    _zombieFest = data;
                    break;
                case IN_PROGRESS:
                    DoSendNotifyToInstance(zombiefestWarnings[0]);
                    _zombieFest = data;
                    break;
                case FAIL:
                    _killedZombieCount = 0;
                    _zombieTimer = 60000;
                    _zombieFest = data;
                    DoSendNotifyToInstance(zombiefestWarnings[11]);
                    break;
                case SPECIAL:
                    _killedZombieCount++;
                    if(_killedZombieCount == 1)
                        SetData(DATA_ZOMBIEFEST, IN_PROGRESS);
                    else if(_killedZombieCount >= 100 && GetData(DATA_ZOMBIEFEST) == IN_PROGRESS)
                        SetData(DATA_ZOMBIEFEST, DONE);
                    else
                    {
                        if(_killedZombieCount%10 == 0)
                            DoSendNotifyToInstance(zombiefestWarnings[_killedZombieCount/10]);
                    }
                    break;
                }
                break;
            case DATA_ARTHAS_STEP:
                _artasStepUi = data;
                return;
            }

            if (data == DONE)
                SaveToDB();
        }
Пример #12
0
            void UpdateAI(const uint32 diff)
            {
                if (isFlameBreathing)
                {
                    if (!me->IsNonMeleeSpellCasted(false))
                        isFlameBreathing = false;
                    else
                        return;
                }

                if (isBombing)
                {
                    if (BombSequenceTimer <= diff)
                        HandleBombSequence();
                    else
                        BombSequenceTimer -= diff;
                    return;
                }

                if (!UpdateVictim())
                    return;

                //enrage if under 25% hp before 5 min.
                if (!enraged && HealthBelowPct(25))
                    EnrageTimer = 0;

                if (EnrageTimer <= diff)
                {
                    if (!enraged)
                    {
                        DoCast(me, SPELL_ENRAGE, true);
                        enraged = true;
                        EnrageTimer = 300000;
                    }
                    else
                    {
                        DoScriptText(SAY_BERSERK, me);
                        DoCast(me, SPELL_BERSERK, true);
                        EnrageTimer = 300000;
                    }
                } else EnrageTimer -= diff;

                if (BombTimer <= diff)
                {
                    DoScriptText(SAY_FIRE_BOMBS, me);

                    me->AttackStop();
                    me->GetMotionMaster()->Clear();
                    DoTeleportTo(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2]);
                    me->StopMoving();
                    DoCast(me, SPELL_FIRE_BOMB_CHANNEL, false);
                    //DoTeleportPlayer(me, JanalainPos[0][0], JanalainPos[0][1],JanalainPos[0][2], 0);
                    //DoCast(me, SPELL_TELE_TO_CENTER, true);

                    FireWall();
                    SpawnBombs();
                    isBombing = true;
                    BombSequenceTimer = 100;

                    //Teleport every Player into the middle
                    Map* pMap = me->GetMap();
                    if (!pMap->IsDungeon()) return;
                    Map::PlayerList const &PlayerList = pMap->GetPlayers();
                    for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                        if (Player* i_pl = i->getSource())
                            if (i_pl->isAlive())
                                DoTeleportPlayer(i_pl, JanalainPos[0][0]-5+rand()%10, JanalainPos[0][1]-5+rand()%10, JanalainPos[0][2], 0);
                    //DoCast(Temp, SPELL_SUMMON_PLAYERS, true) // core bug, spell does not work if too far
                    return;
                } else BombTimer -= diff;

                if (!noeggs)
                {
                    if (HealthBelowPct(35))
                    {
                        DoScriptText(SAY_ALL_EGGS, me);

                        me->AttackStop();
                        me->GetMotionMaster()->Clear();
                        DoTeleportTo(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2]);
                        me->StopMoving();
                        DoCast(me, SPELL_HATCH_ALL, false);
                        HatchAllEggs(2);
                        noeggs = true;
                    }
                    else if (HatcherTimer <= diff)
                    {
                        if (HatchAllEggs(0))
                        {
                            DoScriptText(SAY_SUMMON_HATCHER, me);
                            me->SummonCreature(MOB_AMANI_HATCHER,hatcherway[0][0][0],hatcherway[0][0][1],hatcherway[0][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000);
                            me->SummonCreature(MOB_AMANI_HATCHER,hatcherway[1][0][0],hatcherway[1][0][1],hatcherway[1][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000);
                            HatcherTimer = 90000;
                        }
                        else
                            noeggs = true;
                    } else HatcherTimer -= diff;
                }

                EnterEvadeIfOutOfCombatArea(diff);

                DoMeleeAttackIfReady();

                if (FireBreathTimer <= diff)
                {
                    if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
                    {
                        me->AttackStop();
                        me->GetMotionMaster()->Clear();
                        DoCast(pTarget, SPELL_FLAME_BREATH, false);
                        me->StopMoving();
                        isFlameBreathing = true;
                    }
                    FireBreathTimer = 8000;
                } else FireBreathTimer -= diff;
            }
Пример #13
0
    void Update (uint32 diff)
    {
        //Lurker Fishing event
        if (LurkerSubEvent == LURKER_FISHING)
        {
            if (FishingTimer < diff)
            {
                LurkerSubEvent = LURKER_HOOKED;
                SetData(DATA_STRANGE_POOL, IN_PROGRESS);//just fished, signal Lurker script to emerge and start fight, we use IN_PROGRESS so it won't get saved and lurker will be alway invis at start if server restarted
            }
            else
                FishingTimer -= diff;
        }

        if (trashCheckTimer < diff)
        {
            if (Encounters[2] == NOT_STARTED)   // check and change water state only if lurker event is not started
            {
                uint64 tmpPriestessGuid = instance->GetCreatureGUID(TRASHMOB_COILFANG_PRIESTESS, GET_ALIVE_CREATURE_GUID);
                uint64 tmpShattererGuid = instance->GetCreatureGUID(TRASHMOB_COILFANG_SHATTERER, GET_ALIVE_CREATURE_GUID);
                if (!tmpPriestessGuid && !tmpShattererGuid)
                    Water = WATERSTATE_SCALDING;
                else
                    Water = WATERSTATE_FRENZY;
            }
            else if (Encounters[2] == DONE)
            {
                Water = WATERSTATE_NONE;
            }
            
            trashCheckTimer = 5000;
        }
        else
            trashCheckTimer -= diff;

        //Water checks
        if (WaterCheckTimer < diff)
        {
            Map::PlayerList const &PlayerList = instance->GetPlayers();
            if (PlayerList.isEmpty())
                return;

            bool PlayerInWater = false;
            for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
            {
                if(Player* pPlayer = i->getSource())
                {
                    if (pPlayer->isAlive() && pPlayer->IsInWater())
                    {
                        PlayerInWater = true;
                        if (Water == WATERSTATE_SCALDING)
                        {
                            if (!pPlayer->HasAura(SPELL_SCALDINGWATER))
                            {
                                pPlayer->CastSpell(pPlayer, SPELL_SCALDINGWATER, true);
                                break;
                            }
                        }
                        else if (Water == WATERSTATE_FRENZY)
                        {
                            //spawn frenzy
                            if (DoSpawnFrenzy && !pPlayer->isGameMaster())
                            {
                                if (Creature* frenzy = pPlayer->SummonCreature(MOB_COILFANG_FRENZY,pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ(),pPlayer->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000))
                                {
                                    frenzy->AddUnitMovementFlag(MOVEFLAG_SWIMMING);
                                    frenzy->SetLevitate(true);
                                    frenzy->AI()->AttackStart(pPlayer);
                                }
                                DoSpawnFrenzy = false;
                            }
                        }
                        else if (Water == WATERSTATE_NONE)
                        {
                            break;
                        }
                    }
                }
            }

            if (PlayerInWater)
                PlayerInWaterTimer = 5000;
            else
            {
                if (PlayerInWaterTimer <= diff)
                    PlayerInWaterTimer = 0;
                else
                    PlayerInWaterTimer -= diff;
            }

            if (PlayerInWaterTimer)
                WaterCheckTimer = 1;
            else
                WaterCheckTimer = 500; //remove stress from core
        }
        else
            WaterCheckTimer -= diff;

        if (FrenzySpawnTimer < diff)
        {
            DoSpawnFrenzy = true;
            FrenzySpawnTimer = 500;
        }
        else
            FrenzySpawnTimer -= diff;
    }
Пример #14
0
void instance_karazhan::DoPrepareChessEvent()
{
    // Allow all the chess pieces to init start position
    for (GuidList::const_iterator itr = m_lChessPiecesAlliance.begin(); itr != m_lChessPiecesAlliance.end(); ++itr)
    {
        if (Creature* pChessPiece = instance->GetCreature(*itr))
        {
            Creature* pSquare = GetClosestCreatureWithEntry(pChessPiece, NPC_SQUARE_BLACK, 2.0f);
            if (!pSquare)
                pSquare = GetClosestCreatureWithEntry(pChessPiece, NPC_SQUARE_WHITE, 2.0f);
            if (!pSquare)
            {
                script_error_log("Instance Karazhan: ERROR Failed to properly load the Chess square for %s.", pChessPiece->GetGuidStr().c_str());
                return;
            }

            // send event which will prepare the current square
            pChessPiece->AI()->SendAIEvent(AI_EVENT_CUSTOM_B, pSquare, pChessPiece);
        }
    }

    for (GuidList::const_iterator itr = m_lChessPiecesHorde.begin(); itr != m_lChessPiecesHorde.end(); ++itr)
    {
        if (Creature* pChessPiece = instance->GetCreature(*itr))
        {
            Creature* pSquare = GetClosestCreatureWithEntry(pChessPiece, NPC_SQUARE_BLACK, 2.0f);
            if (!pSquare)
                pSquare = GetClosestCreatureWithEntry(pChessPiece, NPC_SQUARE_WHITE, 2.0f);
            if (!pSquare)
            {
                script_error_log("Instance Karazhan: ERROR Failed to properly load the Chess square for %s.", pChessPiece->GetGuidStr().c_str());
                return;
            }

            // send event which will prepare the current square
            pChessPiece->AI()->SendAIEvent(AI_EVENT_CUSTOM_B, pSquare, pChessPiece);
        }
    }

    // add silence debuff
    Map::PlayerList const& players = instance->GetPlayers();
    for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
    {
        if (Player* pPlayer = itr->getSource())
            pPlayer->CastSpell(pPlayer, SPELL_GAME_IN_SESSION, true);
    }

    m_uiAllianceStalkerCount = 0;
    m_uiHordeStalkerCount = 0;
    m_vHordeStalkers.clear();
    m_vAllianceStalkers.clear();

    // sort stalkers depending on side
    std::list<Creature*> lStalkers;
    for (GuidList::const_iterator itr = m_lChessHordeStalkerList.begin(); itr != m_lChessHordeStalkerList.end(); ++itr)
    {
        if (Creature* pTemp = instance->GetCreature(*itr))
            lStalkers.push_back(pTemp);
    }

    if (lStalkers.empty())
    {
        script_error_log("Instance Karazhan: ERROR Failed to properly load the horde side stalkers for the Chess Event.");
        return;
    }

    // get the proper statusBar npc
    Creature* pStatusBar = instance->GetCreature(m_HordeStatusGuid);
    if (!pStatusBar)
        return;

    lStalkers.sort(ObjectDistanceOrder(pStatusBar));
    for (std::list<Creature*>::const_iterator itr = lStalkers.begin(); itr != lStalkers.end(); ++itr)
        m_vHordeStalkers.push_back((*itr)->GetObjectGuid());

    lStalkers.clear();
    for (GuidList::const_iterator itr = m_lChessAllianceStalkerList.begin(); itr != m_lChessAllianceStalkerList.end(); ++itr)
    {
        if (Creature* pTemp = instance->GetCreature(*itr))
            lStalkers.push_back(pTemp);
    }

    if (lStalkers.empty())
    {
        script_error_log("Instance Karazhan: ERROR Failed to properly load the alliance side stalkers for the Chess Event.");
        return;
    }

    // get the proper statusBar npc
    pStatusBar = instance->GetCreature(m_AllianceStatusGuid);
    if (!pStatusBar)
        return;

    lStalkers.sort(ObjectDistanceOrder(pStatusBar));
    for (std::list<Creature*>::const_iterator itr = lStalkers.begin(); itr != lStalkers.end(); ++itr)
        m_vAllianceStalkers.push_back((*itr)->GetObjectGuid());
}
Пример #15
0
    void JustDied(Unit* pKiller)
    {
        if (m_pInstance)
            m_pInstance->SetData(TYPE_DEATHWHISPER, DONE);

        DoScriptText(SAY_JUST_DIED_01, m_creature, pKiller);

        // Achiev Full House Checks
        bool bFullHouse = false;
        uint8 cnt = 0;
        std::list<Creature*> lCreatures;
        
        lCreatures.clear();
        GetCreatureListWithEntryInGrid(lCreatures, m_creature, NPC_FANATIC, 1000.0f);
        if(CreatureInListIsAlive(lCreatures))
            cnt++;

        lCreatures.clear();
        GetCreatureListWithEntryInGrid(lCreatures, m_creature, NPC_REANIMATED_FANATIC, 1000.0f);
        if(CreatureInListIsAlive(lCreatures))
            cnt++;

        lCreatures.clear();
        GetCreatureListWithEntryInGrid(lCreatures, m_creature, NPC_DEFORMED_FANATIC, 1000.0f);
        if(CreatureInListIsAlive(lCreatures))
            cnt++;

        lCreatures.clear();
        GetCreatureListWithEntryInGrid(lCreatures, m_creature, NPC_ADHERENT, 1000.0f);
        if(CreatureInListIsAlive(lCreatures))
            cnt++;

        lCreatures.clear();
        GetCreatureListWithEntryInGrid(lCreatures, m_creature, NPC_REANIMATED_ADHERENT, 1000.0f);
        if(CreatureInListIsAlive(lCreatures))
            cnt++;

        lCreatures.clear();
        GetCreatureListWithEntryInGrid(lCreatures, m_creature, NPC_EMPOWERED_ADHERENT, 1000.0f);
        if(CreatureInListIsAlive(lCreatures))
            cnt++;
        
        if (cnt >= 5)
            bFullHouse = true;

        Map *pMap = m_creature->GetMap();
        if(pMap && pMap->IsDungeon())
        {
            bool is25 = false;
            switch (m_uiMode)
            {
            case RAID_DIFFICULTY_10MAN_NORMAL:
            case RAID_DIFFICULTY_10MAN_HEROIC:
                is25 = false;
                break;
            case RAID_DIFFICULTY_25MAN_NORMAL:
            case RAID_DIFFICULTY_25MAN_HEROIC:
                is25 = true;
                break;
            default:
                break;
            }

            AchievementEntry const *AchievFullHouse = GetAchievementStore()->LookupEntry(is25 ? ACHIEV_FULL_HOUSE_25 : ACHIEV_FULL_HOUSE_10);
            Map::PlayerList const &lPlayers = pMap->GetPlayers();
            for (Map::PlayerList::const_iterator iter = lPlayers.begin(); iter != lPlayers.end(); ++iter)
            {
                iter->getSource()->RemoveAurasDueToSpell(SPELL_TOUCH_OF_INSIGNIFICANCE);
                
                if (AchievFullHouse && bFullHouse)
                {
                    iter->getSource()->CompletedAchievement(AchievFullHouse);
                }
            }
        }
    }
Пример #16
0
    void UpdateAI(const uint32 uiDiff)
    {
        //Return since we have no target
        if (!UpdateVictim())
            return;

        EncounterTime += uiDiff;

        if (m_bIsAura)
        {
            // workaround for PULSING_SHOCKWAVE
            if (m_uiPulsingShockwave_Timer < uiDiff)
            {
                Map* pMap = m_creature->GetMap();
                if (pMap->IsDungeon())
                {
                    Map::PlayerList const &PlayerList = pMap->GetPlayers();

                    if (PlayerList.isEmpty())
                        return;

                    for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                        if (i->getSource()->isAlive() && i->getSource()->isTargetableForAttack())
                        {
                            int32 dmg;
                            float m_fDist = m_creature->GetDistance(i->getSource());

                            if (m_fDist <= 1.0f) // Less than 1 yard
                                dmg = (m_bIsHeroic ? 850 : 800); // need to correct damage
                            else // Further from 1 yard
                                dmg = ((m_bIsHeroic ? 250 : 200) * m_fDist) + (m_bIsHeroic ? 850 : 800); // need to correct damage

                            m_creature->CastCustomSpell(i->getSource(), (m_bIsHeroic ? 59837 : 52942), &dmg, 0, 0, false);
                        }
                }
                m_uiPulsingShockwave_Timer = 2000;
            }else m_uiPulsingShockwave_Timer -= uiDiff;
        }
        else
        {
            if (m_uiResumePulsingShockwave_Timer < uiDiff)
            {
                //breaks at movement, can we assume when it's time, this spell is casted and also must stop movement?
                m_creature->CastSpell(m_creature, SPELL_PULSING_SHOCKWAVE_AURA, true);

                  DoCast(m_creature, m_bIsHeroic ? SPELL_PULSING_SHOCKWAVE_H : SPELL_PULSING_SHOCKWAVE_N); // need core support
                m_bIsAura = true;
                m_uiResumePulsingShockwave_Timer = 0;
            }
            else
                m_uiResumePulsingShockwave_Timer -= uiDiff;
        }

        if (m_uiArcLightning_Timer < uiDiff)
        {
            if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
                DoCast(pTarget, SPELL_ARC_LIGHTNING);

            m_uiArcLightning_Timer = 15000 + rand()%1000;
        }
        else
            m_uiArcLightning_Timer -= uiDiff;

        if (m_uiLightningNova_Timer < uiDiff)
        {
            switch(rand()%3)
            {
                case 0: DoScriptText(SAY_NOVA_1, m_creature);break;
                case 1: DoScriptText(SAY_NOVA_2, m_creature);break;
                case 2: DoScriptText(SAY_NOVA_3, m_creature);break;
            }

            DoCast(m_creature, m_bIsHeroic ? SPELL_LIGHTNING_NOVA_H : SPELL_LIGHTNING_NOVA_N);

            m_bIsAura = false;
            m_uiResumePulsingShockwave_Timer = (m_bIsHeroic ? 4000 : 5000); // Pause Pulsing Shockwave aura
            m_uiLightningNova_Timer = 20000 + rand()%1000;
        }
        else
            m_uiLightningNova_Timer -= uiDiff;

        // Health check
        if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < (100-(25*m_uiHealthAmountModifier)))
        {
            switch(m_uiHealthAmountModifier)
            {
                case 1: DoScriptText(SAY_75HEALTH, m_creature); break;
                case 2: DoScriptText(SAY_50HEALTH, m_creature); break;
                case 3: DoScriptText(SAY_25HEALTH, m_creature); break;
            }

            ++m_uiHealthAmountModifier;
        }

        DoMeleeAttackIfReady();
    }
Пример #17
0
    void DoControlObsessedPlayers()
    {
        Map::PlayerList const &lPlayers = m_creature->GetMap()->GetPlayers();
        for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr)
        {
            if(Unit *pObsessed = ((Unit*)itr->getSource()))
            {
                if(pObsessed->HasAura(SPELL_DOMINATE_MIND))
                {
                    if(!pObsessed->isAlive())
                        continue;

                    bool heal;
                    heal = roll_chance_i(20);

                    switch(pObsessed->getClass())
                    {
                    // classes witch healing spells
                    case CLASS_PRIEST:
                        if (heal)
                        {
                            pObsessed->CastSpell(m_creature, SPELL_FLASH_HEAL, false);
                        }
                        else
                        {
                            if(Unit* pTarget = SelectAttackingTargetForObsessed(pObsessed))
                            {
                                if (pObsessed->isAttackReady())
                                {
                                    pObsessed->AttackerStateUpdate(pTarget);
                                    pObsessed->resetAttackTimer();
                                }
                                else
                                    pObsessed->GetMotionMaster()->MoveChase(pTarget, 1.0f);
                            }
                        }
                        break;
                    case CLASS_DRUID:
                        if (heal)
                        {
                            pObsessed->CastSpell(m_creature, SPELL_REJUVENATION, false);
                        }
                        else
                        {
                            if(Unit* pTarget = SelectAttackingTargetForObsessed(pObsessed))
                            {
                                if (pObsessed->isAttackReady())
                                {
                                    pObsessed->AttackerStateUpdate(pTarget);
                                    pObsessed->resetAttackTimer();
                                }
                                else
                                    pObsessed->GetMotionMaster()->MoveChase(pTarget, 1.0f);
                            }
                        }
                        break;
                    case CLASS_PALADIN:
                        if (heal)
                        {
                            pObsessed->CastSpell(m_creature, SPELL_FLASH_OF_LIGHT, false);
                        }
                        else
                        {
                            if(Unit* pTarget = SelectAttackingTargetForObsessed(pObsessed))
                            {
                                if (pObsessed->isAttackReady())
                                {
                                    pObsessed->AttackerStateUpdate(pTarget);
                                    pObsessed->resetAttackTimer();
                                }
                                else
                                    pObsessed->GetMotionMaster()->MoveChase(pTarget, 1.0f);
                            }
                        }
                        break;
                    case CLASS_SHAMAN:
                        if (heal)
                        {
                            pObsessed->CastSpell(m_creature, SPELL_CHAIN_HEAL, false);
                        }
                        else
                        {
                            if(Unit* pTarget = SelectAttackingTargetForObsessed(pObsessed))
                            {
                                if (pObsessed->isAttackReady())
                                {
                                    pObsessed->AttackerStateUpdate(pTarget);
                                    pObsessed->resetAttackTimer();
                                }
                                else
                                    pObsessed->GetMotionMaster()->MoveChase(pTarget, 1.0f);
                            }
                        }
                        break;
                    case CLASS_MAGE:
                        if(Unit* pTarget = SelectAttackingTargetForObsessed(pObsessed))
                        {
                            pObsessed->CastSpell(pTarget, SPELL_ARCANE_MISSILES, false);
                            if (pObsessed->isAttackReady())
                            {
                                pObsessed->AttackerStateUpdate(pTarget);
                                pObsessed->resetAttackTimer();
                            }
                            else
                                pObsessed->GetMotionMaster()->MoveChase(pTarget, 1.0f);
                        }
                        break;
                    case CLASS_WARLOCK:
                        if(Unit* pTarget = SelectAttackingTargetForObsessed(pObsessed))
                        {
                            pObsessed->CastSpell(pTarget, SPELL_INCINERATE, false);
                            if (pObsessed->isAttackReady())
                            {
                                pObsessed->AttackerStateUpdate(pTarget);
                                pObsessed->resetAttackTimer();
                            }
                            else
                                pObsessed->GetMotionMaster()->MoveChase(pTarget, 1.0f);
                        }
                        break;
                    case CLASS_HUNTER:
                        if(Unit* pTarget = SelectAttackingTargetForObsessed(pObsessed))
                        {
                            if (pObsessed->isAttackReady())
                            {
                                pObsessed->AttackerStateUpdate(pTarget);
                                pObsessed->resetAttackTimer();
                            }
                            else
                                pObsessed->GetMotionMaster()->MoveChase(pTarget, 20.0f);
                        }
                        break;
                    default:
                        if(Unit* pTarget = SelectAttackingTargetForObsessed(pObsessed))
                        {
                            if (pObsessed->isAttackReady() && pObsessed->CanReachWithMeleeAttack(pTarget))
                            {
                                pObsessed->AttackerStateUpdate(pTarget);
                                pObsessed->resetAttackTimer();
                            }
                            else
                                pObsessed->GetMotionMaster()->MoveChase(pTarget, 1.0f);
                        }
                        break;
                    }
                }
            }
        }
    }
Пример #18
0
        void SetData(uint32 type, uint32 data)
        {
            switch (type)
            {
                case DATA_RAGEWINTERCHILLEVENT:
                    m_auiEncounter[0] = data;
                    break;
                case DATA_ANETHERONEVENT:
                    m_auiEncounter[1] = data;
                    break;
                case DATA_KAZROGALEVENT:
                    m_auiEncounter[2] = data;
                    break;
                case DATA_AZGALOREVENT:
                    {
                        m_auiEncounter[3] = data;
                        if (data == DONE)
                        {
                            if (ArchiYell)
                                break;

                            ArchiYell = true;

                            Creature* creature = instance->GetCreature(Azgalor);
                            if (creature)
                            {
                                Creature* unit = creature->SummonCreature(21987, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000);

                                Map* map = creature->GetMap();
                                if (map->IsDungeon() && unit)
                                {
                                    unit->SetVisible(false);
                                    Map::PlayerList const &PlayerList = map->GetPlayers();
                                    if (PlayerList.isEmpty())
                                         return;

                                    for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                                    {
                                         if (i->getSource())
                                         {
                                            WorldPacket packet(SMSG_MESSAGECHAT, 200);
                                            unit->BuildMonsterChat(&packet, CHAT_MSG_MONSTER_YELL, YELL_EFFORTS, 0, YELL_EFFORTS_NAME, i->getSource()->GetGUID());
                                            i->getSource()->GetSession()->SendPacket(&packet);

                                            WorldPacket data2(SMSG_PLAY_SOUND, 4);
                                            data2 << 10986;
                                            i->getSource()->GetSession()->SendPacket(&data2);
                                         }
                                    }
                                }
                            }
                        }
                    }
                    break;
                case DATA_ARCHIMONDEEVENT:
                    m_auiEncounter[4] = data;
                    break;
                case DATA_RESET_TRASH_COUNT:
                    Trash = 0;
                    break;
                case DATA_TRASH:
                    if (data)
                        Trash = data;
                    else
                        Trash--;
                    DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash);
                    break;
                case TYPE_RETREAT:
                    if (data == SPECIAL)
                    {
                        if (!m_uiAncientGemGUID.empty())
                        {
                            for (std::list<uint64>::const_iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr)
                            {
                                //don't know how long it expected
                                DoRespawnGameObject(*itr, DAY);
                            }
                        }
                    }
                    break;
                case DATA_ALLIANCE_RETREAT:
                    allianceRetreat = data;
                    HandleGameObject(HordeGate, true);
                    SaveToDB();
                    break;
                case DATA_HORDE_RETREAT:
                    hordeRetreat = data;
                    HandleGameObject(ElfGate, true);
                    SaveToDB();
                    break;
                case DATA_RAIDDAMAGE:
                    RaidDamage += data;
                    if (RaidDamage >= MINRAIDDAMAGE)
                        RaidDamage = MINRAIDDAMAGE;
                    break;
                case DATA_RESET_RAIDDAMAGE:
                    RaidDamage = 0;
                    break;
            }

             sLog->outDebug(LOG_FILTER_TSCR, "Instance Hyjal: Instance data updated for event %u (Data=%u)", type, data);

            if (data == DONE)
            {
                OUT_SAVE_INST_DATA;

                std::ostringstream saveStream;
                saveStream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' '
                    << m_auiEncounter[3] << ' ' << m_auiEncounter[4]
                    << ' ' << allianceRetreat << ' ' << hordeRetreat
                    << ' ' << RaidDamage;

                str_data = saveStream.str();

                SaveToDB();
                OUT_SAVE_INST_DATA_COMPLETE;
            }

        }
Пример #19
0
            bool SetBossState(uint32 type, EncounterState state)
            {
                if (!InstanceScript::SetBossState(type, state))
                    return false;

                switch (type)
                {
                    case BOSS_LEVIATHAN:
                    case BOSS_IGNIS:
                    case BOSS_RAZORSCALE:
                    case BOSS_XT002:
                    case BOSS_AURIAYA:
                    case BOSS_MIMIRON:
                    case BOSS_FREYA:
                        break;
                    case BOSS_ASSEMBLY_OF_IRON:
                        if (state == DONE)
                            HandleGameObject(ArchivumDoorGUID, true);
                        break;
                    case BOSS_VEZAX:
                        if (state == DONE)
                            HandleGameObject(VezaxDoorGUID, true);
                        break;
                    case BOSS_YOGGSARON:
                        break;
                    case BOSS_KOLOGARN:
                        if (state == DONE)
                        {
                            if (GameObject* gameObject = instance->GetGameObject(KologarnChestGUID))
                            {
                                gameObject->SetRespawnTime(gameObject->GetRespawnDelay());
                                gameObject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
                            }
                            HandleGameObject(KologarnBridgeGUID, false);
                        }
                        break;
                    case BOSS_HODIR:
                        if (state == DONE)
                        {
                            if (GameObject* HodirRareCache = instance->GetGameObject(HodirRareCacheGUID))
                                if (GetData(DATA_HODIR_RARE_CACHE))
                                    HodirRareCache->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
                            if (GameObject* HodirChest = instance->GetGameObject(HodirChestGUID))
                                HodirChest->SetRespawnTime(HodirChest->GetRespawnDelay());
                            HandleGameObject(HodirDoorGUID, true);
                            HandleGameObject(HodirIceDoorGUID, true);
                        }
                        break;
                    case BOSS_THORIM:
                        if (state == DONE)
                            if (GameObject* gameObject = instance->GetGameObject(ThorimChestGUID))
                                gameObject->SetRespawnTime(gameObject->GetRespawnDelay());
                        break;
                    case BOSS_ALGALON:
                        if (state == DONE)
                        {
                            _events.CancelEvent(EVENT_UPDATE_ALGALON_TIMER);
                            _events.CancelEvent(EVENT_DESPAWN_ALGALON);
                            DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 0);
                            _algalonTimer = 61;
                            if (GameObject* gameObject = instance->GetGameObject(GiftOfTheObserverGUID))
                                gameObject->SetRespawnTime(gameObject->GetRespawnDelay());
                            // get item level (recheck weapons)
                            Map::PlayerList const& players = instance->GetPlayers();
                            for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                                if (Player* player = itr->getSource())
                                    for (uint8 slot = EQUIPMENT_SLOT_MAINHAND; slot <= EQUIPMENT_SLOT_RANGED; ++slot)
                                        if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
                                            if (item->GetTemplate()->ItemLevel > _maxWeaponItemLevel)
                                                _maxWeaponItemLevel = item->GetTemplate()->ItemLevel;
                        }
                        else if (state == IN_PROGRESS)
                        {
                            // get item level (armor cannot be swapped in combat)
                            Map::PlayerList const& players = instance->GetPlayers();
                            for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                            {
                                if (Player* player = itr->getSource())
                                {
                                    for (uint8 slot = EQUIPMENT_SLOT_START; slot < EQUIPMENT_SLOT_END; ++slot)
                                    {
                                        if (slot == EQUIPMENT_SLOT_TABARD || slot == EQUIPMENT_SLOT_BODY)
                                            continue;

                                        if (Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
                                        {
                                            if (slot >= EQUIPMENT_SLOT_MAINHAND && slot <= EQUIPMENT_SLOT_RANGED)
                                            {
                                                if (item->GetTemplate()->ItemLevel > _maxWeaponItemLevel)
                                                    _maxWeaponItemLevel = item->GetTemplate()->ItemLevel;
                                            }
                                            else if (item->GetTemplate()->ItemLevel > _maxArmorItemLevel)
                                                _maxArmorItemLevel = item->GetTemplate()->ItemLevel;
                                        }
                                    }
                                }
                            }
                        }
                        break;
                }

                return true;
            }
    void UpdateAI(const uint32 uiDiff)
    {
        if(!UpdateVictim())
            return;

        if (!m_pInstance || m_pInstance->GetData(DATA_SAURFANG_EVENT) != IN_PROGRESS)
        {
            Map::PlayerList const &PlList = me->GetMap()->GetPlayers();

            for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
            {
                if (Player* pPlayer = i->getSource())
                {
                    pPlayer->RemoveAurasDueToSpell(72293);
                }
            }
        }

        if (m_uiBoilingBloodTimer < uiDiff)
        {
            if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1))
                DoCast(pTarget, SPELL_BOILING_BLOOD_10_NORMAL);
            m_uiBoilingBloodTimer = 20000;
        } else m_uiBoilingBloodTimer -= uiDiff;


        if (m_uiBloodNovaTimer < uiDiff)
        {
            uint32 count = RAID_MODE(1,3,1,3);
            for (uint8 i = 1; i <= count; i++)
            {
                Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1);
                DoCast(pTarget, RAID_MODE(SPELL_BLOOD_NOVA_10_NORMAL,SPELL_BLOOD_NOVA_25_NORMAL,SPELL_BLOOD_NOVA_10_HEROIC,SPELL_BLOOD_NOVA_25_HEROIC));
                m_uiBloodNovaTimer = 23000;
            }
        } else m_uiBloodNovaTimer -= uiDiff;

        if (m_uiSummonBloodBeastTimer <= uiDiff)
        {
            DoCast(me, SPELL_SUMMON_BLOOD_BEAST_1);
            DoCast(me, SPELL_SUMMON_BLOOD_BEAST_2);
            if (getDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || getDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC)
            {
                DoCast(me, SPELL_SUMMON_BLOOD_BEAST_3);
                DoCast(me, SPELL_SUMMON_BLOOD_BEAST_4);
                DoCast(me, SPELL_SUMMON_BLOOD_BEAST_5);
            }
            DoScriptText(SAY_BLOODBEASTS, me);
            m_uiSummonBloodBeastTimer = 48000;
        } else m_uiSummonBloodBeastTimer -= uiDiff;

        if (me->GetPower(POWER_ENERGY) == 100)
        {
            Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 1);
            DoCast(pTarget, SPELL_FALLEN_CHAMPION);
            DoScriptText(SAY_FALLENCHAMPION, me);
            me->SetPower(me->getPowerType(), 0);
        }

        if (m_uiRuneOfBloodTimer < uiDiff)
        {
            Unit* pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO, 0);
            DoCast(pTarget, RAID_MODE(SPELL_RUNE_OF_BLOOD_10_NORMAL,SPELL_RUNE_OF_BLOOD_25_NORMAL,SPELL_RUNE_OF_BLOOD_10_HEROIC,SPELL_RUNE_OF_BLOOD_25_HEROIC));
           // me->ModifyHealth(me->GetMaxHealth() * 0.05);
            m_uiRuneOfBloodTimer = 40000;
        } else m_uiRuneOfBloodTimer -= uiDiff;

        if(me->GetHealth()*100 / me->GetMaxHealth() < 30)
        {
            if (!me->HasAura(SPELL_FRENZY))
            {
                DoCast(me, SPELL_FRENZY);
            }
        }

        if (m_uiBerserkTimer < uiDiff)
        {
            DoCast(SPELL_BERSERK);
            DoScriptText(SAY_BERSERK, me);
            m_uiBerserkTimer = 480000;
        } else m_uiBerserkTimer -= uiDiff;

        DoMeleeAttackIfReady();
    }
Пример #21
0
            void JustDied(Unit* /*killer*/) override
            {
                me->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP_ACO);

                // remove twilight torment on Vesperon
                if (Creature* vesperon = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_VESPERON)))
                {
                    instance->SetBossState(DATA_PORTAL_OPEN, NOT_STARTED);

                    if (vesperon->IsAlive() && vesperon->HasAura(SPELL_TWILIGHT_TORMENT_VESP))
                        vesperon->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP);
                }

                Map* map = me->GetMap();
                if (map->IsDungeon())
                {
                    Map::PlayerList const &PlayerList = map->GetPlayers();

                    if (PlayerList.isEmpty())
                        return;

                    for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                    {
                        if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_SHIFT) && !i->GetSource()->GetVictim())
                        {
                            i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_SHIFT_REMOVAL_ALL, true);
                            i->GetSource()->CastSpell(i->GetSource(), SPELL_TWILIGHT_RESIDUE, true);
                            i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT);
                            i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_SHIFT_ENTER);
                        }
                        if (i->GetSource()->IsAlive() && i->GetSource()->HasAura(SPELL_TWILIGHT_TORMENT_VESP) && !i->GetSource()->GetVictim())
                            i->GetSource()->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP);
                    }
                }

                instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_TWILIGHT_TORMENT_VESP_ACO);
                instance->DoRemoveAurasDueToSpellOnPlayers(57935);
                instance->DoRemoveAurasDueToSpellOnPlayers(58835); // Components of spell Twilight Torment
            }
        void UpdateAI(const uint32 diff)
        {
            if (instance)
            {
                if (!leotherasGUID)
                    leotherasGUID = instance->GetData64(DATA_LEOTHERAS);

                if (!me->isInCombat() && instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER))
                {
                    Unit* victim = NULL;
                    victim = Unit::GetUnit(*me, instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER));
                    if (victim)
                        AttackStart(victim);
                }
            }

            if (!UpdateVictim())
            {
                CastChanneling();
                return;
            }

            if (instance && !instance->GetData64(DATA_LEOTHERAS_EVENT_STARTER))
            {
                EnterEvadeMode();
                return;
            }

            if (Mindblast_Timer <= diff)
            {
                Unit* target = NULL;
                target = SelectTarget(SELECT_TARGET_RANDOM, 0);

                if (target)DoCast(target, SPELL_MINDBLAST);

                Mindblast_Timer = urand(10000, 15000);
            } else Mindblast_Timer -= diff;

            if (Earthshock_Timer <= diff)
            {
                Map* map = me->GetMap();
                Map::PlayerList const &PlayerList = map->GetPlayers();
                for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
                {
                    if (Player* i_pl = itr->getSource())
                    {
                        bool isCasting = false;
                        for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
                            if (i_pl->GetCurrentSpell(i))
                                isCasting = true;

                        if (isCasting)
                        {
                            DoCast(i_pl, SPELL_EARTHSHOCK);
                            break;
                        }
                    }
                }
                Earthshock_Timer = urand(8000, 15000);
            } else Earthshock_Timer -= diff;
            DoMeleeAttackIfReady();
        }
Пример #23
0
    void SetData(uint32 type, uint32 data)
    {
        switch (type)
        {
            case DATA_RAGEWINTERCHILLEVENT: Encounters[0] = data; break;
            case DATA_ANETHERONEVENT:
                Encounters[1] = data;
                break;
            case DATA_KAZROGALEVENT:        Encounters[2] = data; break;
            case DATA_AZGALOREVENT:
                {
                    Encounters[3] = data;
                    if (data == DONE)
                    {
                        if (ArchiYell)break;
                        ArchiYell = true;

                        Creature* creature = instance->GetCreature(Azgalor);
                        if (creature)
                        {
                            Creature* pUnit = creature->SummonCreature(21987, creature->GetPositionX(),creature->GetPositionY(),creature->GetPositionZ(),0, TEMPSUMMON_TIMED_DESPAWN, 10000);

                            Map* pMap = creature->GetMap();
                            if (pMap->IsDungeon() && pUnit)
                            {
                                pUnit->SetVisibility(VISIBILITY_OFF);
                                Map::PlayerList const &PlayerList = pMap->GetPlayers();
                                if (PlayerList.isEmpty())
                                     return;

                                for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                                {
                                     if (i->getSource())
                                     {
                                        WorldPacket data(SMSG_MESSAGECHAT, 200);
                                        pUnit->BuildMonsterChat(&data, CHAT_MSG_MONSTER_YELL, YELL_EFFORTS, 0, YELL_EFFORTS_NAME, i->getSource()->GetGUID());
                                        i->getSource()->GetSession()->SendPacket(&data);

                                        WorldPacket data2(SMSG_PLAY_SOUND, 4);
                                        data2 << 10986;
                                        i->getSource()->GetSession()->SendPacket(&data2);
                                     }
                                }
                            }
                        }
                    }
                }
                break;
            case DATA_ARCHIMONDEEVENT:      Encounters[4] = data; break;
            case DATA_RESET_TRASH_COUNT:    Trash = 0;            break;

            case DATA_TRASH:
                if (data) Trash = data;
                else     Trash--;
                UpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash);
                break;
            case DATA_ALLIANCE_RETREAT:
                allianceRetreat = data;
                OpenDoor(HordeGate, true);
                SaveToDB();
                break;
            case DATA_HORDE_RETREAT:
                hordeRetreat = data;
                OpenDoor(ElfGate, true);
                SaveToDB();
                break;
            case DATA_RAIDDAMAGE:
                RaidDamage += data;
                if (RaidDamage >= MINRAIDDAMAGE)
                    RaidDamage = MINRAIDDAMAGE;
                break;
            case DATA_RESET_RAIDDAMAGE:
                RaidDamage = 0;
                break;
        }

         sLog->outDebug("TSCR: Instance Hyjal: Instance data updated for event %u (Data=%u)",type, data);

        if (data == DONE)
            SaveToDB();
    }
Пример #24
0
        void UpdateAI(const uint32 uiDiff)
        {
            if (!bDone && GrandChampionsOutVehicle(me))
            {
                bDone = true;

                if (instance && me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_1))
                    me->SetHomePosition(739.678f, 662.541f, 412.393f, 4.49f);
                else if (instance && me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_2))
                    me->SetHomePosition(746.71f, 661.02f, 411.69f, 4.6f);
                else if (instance && me->GetGUID() == instance->GetData64(DATA_GRAND_CHAMPION_3))
                    me->SetHomePosition(754.34f, 660.70f, 412.39f, 4.79f);

                EnterEvadeMode();
                bHome = true;
            }

            if (uiPhaseTimer <= uiDiff)
            {
                if (uiPhase == 1)
                {
                    AggroAllPlayers(me);
                    uiPhase = 0;
                }
            }else uiPhaseTimer -= uiDiff;

            if (!UpdateVictim() || me->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT))
                return;

            if (uiInterceptTimer <= uiDiff)
            {
                Map::PlayerList const& players = me->GetMap()->GetPlayers();
                if (me->GetMap()->IsDungeon() && !players.isEmpty())
                {
                    for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                    {
                        Player* player = itr->getSource();
                        if (player && !player->isGameMaster() && me->IsInRange(player, 8.0f, 25.0f, false))
                        {
                            DoResetThreat();
                            me->AddThreat(player, 5.0f);
                            DoCast(player, SPELL_INTERCEPT);
                            break;
                        }
                    }
                }
                uiInterceptTimer = 7000;
            } else uiInterceptTimer -= uiDiff;

            if (uiBladeStormTimer <= uiDiff)
            {
                DoCastVictim(SPELL_BLADESTORM);
                uiBladeStormTimer = urand(15000, 20000);
            } else uiBladeStormTimer -= uiDiff;

            if (uiMortalStrikeTimer <= uiDiff)
            {
                DoCastVictim(SPELL_MORTAL_STRIKE);
                uiMortalStrikeTimer = urand(8000, 12000);
            } else uiMortalStrikeTimer -= uiDiff;

            DoMeleeAttackIfReady();
        }
Пример #25
0
        void UpdateAI(const uint32 diff)
        {
            if (currentEvent != TYPE_NARALEX_PART3)
                npc_escortAI::UpdateAI(diff);

            if (!pInstance)
                return;
            if (eventTimer <= diff)
            {
                eventTimer = 0;
                if (pInstance->GetData(currentEvent) == IN_PROGRESS)
                {
                    switch (currentEvent)
                    {
                        case TYPE_NARALEX_PART1:
                            if (eventProgress == 1)
                            {
                                ++eventProgress;
                                DoScriptText(SAY_TEMPLE_OF_PROMISE, me);
                                me->SummonCreature(NPC_DEVIATE_RAVAGER, -82.1763f, 227.874f, -93.3233f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
                                me->SummonCreature(NPC_DEVIATE_RAVAGER, -72.9506f, 216.645f, -93.6756f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
                            }
                        break;
                        case TYPE_NARALEX_PART2:
                            if (eventProgress == 1)
                            {
                                ++eventProgress;
                                DoScriptText(SAY_BANISH_THE_SPIRITS, me);
                                DoCast(me, SPELL_SERPENTINE_CLEANSING);
                                //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false);
                                eventTimer = 30000;
                                me->SummonCreature(NPC_DEVIATE_VIPER, -61.5261f, 273.676f, -92.8442f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
                                me->SummonCreature(NPC_DEVIATE_VIPER, -58.4658f, 280.799f, -92.8393f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
                                me->SummonCreature(NPC_DEVIATE_VIPER, -50.002f,  278.578f, -92.8442f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
                            }
                            else
                            if (eventProgress == 2)
                            {
                                //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(true);
                                DoScriptText(SAY_CAVERNS_PURIFIED, me);
                                pInstance->SetData(TYPE_NARALEX_PART2, DONE);
                                if (me->HasAura(SPELL_SERPENTINE_CLEANSING))
                                    me->RemoveAura(SPELL_SERPENTINE_CLEANSING);
                            }
                        break;
                        case TYPE_NARALEX_PART3:
                            if (eventProgress == 1)
                            {
                                ++eventProgress;
                                eventTimer = 4000;
                                me->SetStandState(UNIT_STAND_STATE_KNEEL);
                                DoScriptText(SAY_EMERALD_DREAM, me);
                            }
                            else
                            if (eventProgress == 2)
                            {
                                ++eventProgress;
                                eventTimer = 15000;
                                //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false);
                                if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
                                    DoCast(naralex, SPELL_NARALEXS_AWAKENING, true);
                                DoScriptText(EMOTE_AWAKENING_RITUAL, me);
                            }
                            else
                            if (eventProgress == 3)
                            {
                                ++eventProgress;
                                eventTimer = 15000;
                                if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
                                    DoScriptText(EMOTE_TROUBLED_SLEEP, naralex);
                                me->SummonCreature(NPC_DEVIATE_MOCCASIN, 135.943f, 199.701f, -103.529f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
                                me->SummonCreature(NPC_DEVIATE_MOCCASIN, 151.08f,  221.13f,  -103.609f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
                                me->SummonCreature(NPC_DEVIATE_MOCCASIN, 128.007f, 227.428f, -97.421f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
                            }
                            else
                            if (eventProgress == 4)
                            {
                                ++eventProgress;
                                eventTimer = 30000;
                                if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
                                    DoScriptText(EMOTE_WRITHE_IN_AGONY, naralex);
                                me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413f, 207.188f, -102.469f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
                                me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857f, 218.645f, -102.905f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
                                me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 105.102f, 227.211f, -102.752f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
                                me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 153.372f, 235.149f, -102.826f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
                                me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 149.524f, 251.113f, -102.558f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
                                me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 136.208f, 266.466f, -102.977f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
                                me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 126.167f, 274.759f, -102.962f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
                            }
                            else
                            if (eventProgress == 5)
                            {
                                ++eventProgress;
                                if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
                                    DoScriptText(EMOTE_HORRENDOUS_VISION, naralex);
                                me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872f, 262.905f, -103.503f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
                                DoScriptText(SAY_MUTANUS_THE_DEVOURER, me);
                                pInstance->SetData(TYPE_MUTANUS_THE_DEVOURER, IN_PROGRESS);
                            }
                            else
                            if (eventProgress == 6 && pInstance->GetData(TYPE_MUTANUS_THE_DEVOURER) == DONE)
                            {
                                ++eventProgress;
                                eventTimer = 3000;
                                if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
                                {
                                    AchievementEntry const *AchievWC = GetAchievementStore()->LookupEntry(ACHIEVEMENT_WAILING_CAVERNS);
                                    if (AchievWC)
                                    {
                                        Map* map = me->GetMap();
                                        if (map && map->IsDungeon())
                                        {
                                            Map::PlayerList const &players = map->GetPlayers();
                                            for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                                                itr->getSource()->CompletedAchievement(AchievWC);
                                        }
                                    }
                                    if (me->HasAura(SPELL_NARALEXS_AWAKENING))
                                        me->RemoveAura(SPELL_NARALEXS_AWAKENING);
                                    naralex->SetStandState(UNIT_STAND_STATE_STAND);
                                    DoScriptText(SAY_I_AM_AWAKE, naralex);
                                }
                                DoScriptText(SAY_NARALEX_AWAKES, me);
                            }
                            else
                            if (eventProgress == 7)
                            {
                                ++eventProgress;
                                eventTimer = 6000;
                                if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
                                    DoScriptText(SAY_THANK_YOU, naralex);
                            }
                            else
                            if (eventProgress == 8)
                            {
                                ++eventProgress;
                                eventTimer = 8000;
                                if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
                                {
                                    DoScriptText(SAY_FAREWELL, naralex);
                                    naralex->AddAura(SPELL_FLIGHT_FORM, naralex);
                                }
                                SetRun();
                                me->SetStandState(UNIT_STAND_STATE_STAND);
                                me->AddAura(SPELL_FLIGHT_FORM, me);
                            }
                            else
                            if (eventProgress == 9)
                            {
                                ++eventProgress;
                                eventTimer = 1500;
                                if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
                                    naralex->GetMotionMaster()->MovePoint(25, naralex->GetPositionX(), naralex->GetPositionY(), naralex->GetPositionZ());
                            }
                            else
                            if (eventProgress == 10)
                            {
                                ++eventProgress;
                                eventTimer = 2500;
                                if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
                                {
                                    naralex->GetMotionMaster()->MovePoint(0, 117.095512f, 247.107971f, -96.167870f);
                                    naralex->GetMotionMaster()->MovePoint(1, 90.388809f, 276.135406f, -83.389801f);
                                }
                                me->GetMotionMaster()->MovePoint(26, 117.095512f, 247.107971f, -96.167870f);
                                me->GetMotionMaster()->MovePoint(27, 144.375443f, 281.045837f, -82.477135f);
                            }
                            else
                            if (eventProgress == 11)
                            {
                                if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
                                    naralex->SetVisible(false);
                                me->SetVisible(false);
                                pInstance->SetData(TYPE_NARALEX_PART3, DONE);
                            }
                        break;
                    }
                }
            } else eventTimer -= diff;
        }
Пример #26
0
    void UpdateAI(const uint32 diff)
    {
        if(isFlameBreathing)
        {
            if(!m_creature->IsNonMeleeSpellCasted(false))
            {
                isFlameBreathing = false;
            } else return;
        }

        if(isBombing)
        {
            if(BombSequenceTimer < diff)
            {
                HandleBombSequence();
            } else BombSequenceTimer -= diff;
            return;
        }

        if(!m_creature->SelectHostileTarget() && !m_creature->getVictim())
            return;

        //enrage if under 25% hp before 5 min.
        if(!enraged && m_creature->GetHealth() * 4 < m_creature->GetMaxHealth())
            EnrageTimer = 0;

        if(EnrageTimer < diff)
        {
            if(!enraged)
            {
                m_creature->CastSpell(m_creature, SPELL_ENRAGE, true);
                enraged = true;
                EnrageTimer = 300000;
            }
            else
            {
                DoScriptText(SAY_BERSERK, m_creature);

                m_creature->CastSpell(m_creature, SPELL_BERSERK, true);
                EnrageTimer = 300000;
            }
        } else EnrageTimer -= diff;

        if(BombTimer < diff)
        {
            DoScriptText(SAY_FIRE_BOMBS, m_creature);

            m_creature->AttackStop();
            m_creature->GetMotionMaster()->Clear();
            m_creature->Relocate(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2],0);
            m_creature->GetMotionMaster()->MovePoint(0, JanalainPos[0][0], JanalainPos[0][1], JanalainPos[0][2]);
            m_creature->StopMoving();
            m_creature->CastSpell(m_creature, SPELL_FIRE_BOMB_CHANNEL, false);
            DoTeleportPlayer(m_creature, JanalainPos[0][0], JanalainPos[0][1],JanalainPos[0][2], 0);
            m_creature->CastSpell(m_creature, SPELL_TELE_TO_CENTER, true);

            FireWall();
            SpawnBombs();
            isBombing = true;
            BombSequenceTimer = 100;

            //Teleport every Player into the middle
            Map *map = m_creature->GetMap();
            if(!map->IsDungeon()) return;
            Map::PlayerList const &PlayerList = map->GetPlayers();
            if (!PlayerList.isEmpty())
                return;
            for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
            {
                if(i->getSource()->isAlive())
                    DoTeleportPlayer(i->getSource(), JanalainPos[0][0]-5+rand()%10, JanalainPos[0][1]-5+rand()%10, JanalainPos[0][2], 0);
            }
            /*Test*/    m_creature->CastSpell(JanalainPos[0][0]-5+rand()%10, JanalainPos[0][1]-5+rand()%10, JanalainPos[0][2], SPELL_SUMMON_PLAYERS, true); // core bug, spell does not work if too far
            return;
        } else BombTimer -= diff;

        if (!noeggs)
        {
            if(100 * m_creature->GetHealth() < 35 * m_creature->GetMaxHealth())
            {
                m_creature->AttackStop();
                m_creature->GetMotionMaster()->Clear();
                m_creature->Relocate(JanalainPos[0][0],JanalainPos[0][1],JanalainPos[0][2],0);
                m_creature->GetMotionMaster()->MovePoint(0, JanalainPos[0][0], JanalainPos[0][1], JanalainPos[0][2]);
                m_creature->StopMoving();
                m_creature->CastSpell(m_creature, SPELL_HATCH_ALL, false);
                HatchAllEggs(2);
                noeggs = true;
            }
            else if(HatcherTimer < diff)
            {
                if(HatchAllEggs(0))
                {
                    DoScriptText(SAY_SUMMON_HATCHER, m_creature);

                    m_creature->SummonCreature(MOB_AMANI_HATCHER,hatcherway[0][0][0],hatcherway[0][0][1],hatcherway[0][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000);
                    m_creature->SummonCreature(MOB_AMANI_HATCHER,hatcherway[1][0][0],hatcherway[1][0][1],hatcherway[1][0][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,10000);
                    HatcherTimer = 90000;
                }
                else
                    noeggs = true;
            } else HatcherTimer -= diff;
        }

        if(ResetTimer < diff)
        {
            float x, y, z;
            m_creature->GetPosition(x, y, z);
            if(x < -70 || x > 0 || y > 1176 || y < 1121 || z < 18)
                EnterEvadeMode();
            ResetTimer = 5000;
        } else ResetTimer -= diff;

        DoMeleeAttackIfReady();

        if(FireBreathTimer < diff)
        {
            if(Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0))
            {
                m_creature->AttackStop();
                m_creature->GetMotionMaster()->Clear();
                m_creature->CastSpell(target, SPELL_FLAME_BREATH, false);
                m_creature->StopMoving();
                isFlameBreathing = true;
            }
            FireBreathTimer = 8000;
        } else FireBreathTimer -= diff;
    }
Пример #27
0
void instance_karazhan::SetData(uint32 uiType, uint32 uiData)
{
    switch (uiType)
    {
        case TYPE_ATTUMEN:
            m_auiEncounter[uiType] = uiData;
            if (uiData == FAIL)
            {
                // Respawn Midnight on Fail
                if (Creature* pMidnight = GetSingleCreatureFromStorage(NPC_MIDNIGHT))
                {
                    if (!pMidnight->isAlive())
                        pMidnight->Respawn();
                }
            }
            break;
        case TYPE_MOROES:
        case TYPE_MAIDEN:
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_OPERA:
            // Don't store the same data twice
            if (uiData == m_auiEncounter[uiType])
                break;
            m_auiEncounter[uiType] = uiData;
            if (uiData == IN_PROGRESS)
                m_uiOzDeathCount = 0;
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_STAGE_DOOR_LEFT);
                DoUseDoorOrButton(GO_STAGE_DOOR_RIGHT);
                DoToggleGameObjectFlags(GO_SIDE_ENTRANCE_DOOR, GO_FLAG_LOCKED, false);
            }
            // use curtain only for event start or fail
            else
                DoUseDoorOrButton(GO_STAGE_CURTAIN);
            break;
        case TYPE_CURATOR:
        case TYPE_TERESTIAN:
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_ARAN:
            if (uiData == FAIL || uiData == DONE)
                DoToggleGameObjectFlags(GO_PRIVATE_LIBRARY_DOOR, GO_FLAG_LOCKED, false);
            if (uiData == IN_PROGRESS)
                DoToggleGameObjectFlags(GO_PRIVATE_LIBRARY_DOOR, GO_FLAG_LOCKED, true);
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_NETHERSPITE:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_MASSIVE_DOOR);
            break;
        case TYPE_CHESS:
            if (uiData == DONE)
            {
                DoUseDoorOrButton(GO_GAMESMANS_HALL_EXIT_DOOR);
                DoRespawnGameObject(GO_DUST_COVERED_CHEST, DAY);
                DoToggleGameObjectFlags(GO_DUST_COVERED_CHEST, GO_FLAG_NO_INTERACT, false);

                // cast game end spells
                if (Creature* pMedivh = GetSingleCreatureFromStorage(NPC_ECHO_MEDIVH))
                {
                    pMedivh->CastSpell(pMedivh, SPELL_FORCE_KILL_BUNNY, true);
                    pMedivh->CastSpell(pMedivh, SPELL_GAME_OVER, true);
                }
                if (Creature* pController = GetSingleCreatureFromStorage(NPC_CHESS_VICTORY_CONTROLLER))
                    pController->CastSpell(pController, SPELL_VICTORY_VISUAL, true);

                // remove silence debuff
                Map::PlayerList const& players = instance->GetPlayers();
                for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                {
                    if (Player* pPlayer = itr->getSource())
                        pPlayer->RemoveAurasDueToSpell(SPELL_GAME_IN_SESSION);
                }

                // ToDo: reset board for friendly game!
            }
            else if (uiData == NOT_STARTED)
            {
                // clean the board for reset
                if (Creature* pMedivh = GetSingleCreatureFromStorage(NPC_ECHO_MEDIVH))
                {
                    pMedivh->CastSpell(pMedivh, SPELL_GAME_OVER, true);
                    pMedivh->CastSpell(pMedivh, SPELL_CLEAR_BOARD, true);
                }

                // remove silence debuff
                Map::PlayerList const& players = instance->GetPlayers();
                for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                {
                    if (Player* pPlayer = itr->getSource())
                        pPlayer->RemoveAurasDueToSpell(SPELL_GAME_IN_SESSION);
                }

                m_uiChessResetTimer = 35000;
            }
            else if (uiData == IN_PROGRESS)
                DoPrepareChessEvent();
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_MALCHEZZAR:
            DoUseDoorOrButton(GO_NETHERSPACE_DOOR);
            m_auiEncounter[uiType] = uiData;
            break;
        case TYPE_NIGHTBANE:
            m_auiEncounter[uiType] = uiData;
            DoUseDoorOrButton(GO_MASTERS_TERRACE_DOOR_1);
            DoUseDoorOrButton(GO_MASTERS_TERRACE_DOOR_2);
            break;
            // Store the event type for the Opera
        case TYPE_OPERA_PERFORMANCE:
            m_uiOperaEvent = uiData;
            break;
    }

    // Also save the opera performance, once it's set
    if (uiData == DONE || uiType == TYPE_OPERA_PERFORMANCE)
    {
        OUT_SAVE_INST_DATA;

        std::ostringstream saveStream;
        saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " "
                   << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " "
                   << m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8] << " "
                   << m_auiEncounter[9] << " " << m_auiEncounter[10] << " " << m_uiOperaEvent;

        m_strInstData = saveStream.str();

        SaveToDB();
        OUT_SAVE_INST_DATA_COMPLETE;
    }
}
Пример #28
0
void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToNearestTarget /* = 50.0f*/)
{
    if (!creature)
        creature = me;

    if (!creature->CanHaveThreatList())
        return;

    Map* map = creature->GetMap();
    if (!map->IsDungeon())                                  //use IsDungeon instead of Instanceable, in case battlegrounds will be instantiated
    {
        TC_LOG_ERROR("misc", "DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? creature->ToCreature()->GetEntry() : 0);
        return;
    }

    if (!creature->HasReactState(REACT_PASSIVE) && !creature->GetVictim())
    {
        if (Unit* nearTarget = creature->SelectNearestTarget(maxRangeToNearestTarget))
            creature->AI()->AttackStart(nearTarget);
        else if (creature->IsSummon())
        {
            if (Unit* summoner = creature->ToTempSummon()->GetSummoner())
            {
                Unit* target = summoner->getAttackerForHelper();
                if (!target && summoner->CanHaveThreatList() && !summoner->getThreatManager().isThreatListEmpty())
                    target = summoner->getThreatManager().getHostilTarget();
                if (target && (creature->IsFriendlyTo(summoner) || creature->IsHostileTo(target)))
                    creature->AI()->AttackStart(target);
            }
        }
    }

    // Intended duplicated check, the code above this should select a victim
    // If it can't find a suitable attack target then we should error out.
    if (!creature->HasReactState(REACT_PASSIVE) && !creature->GetVictim())
    {
        TC_LOG_ERROR("misc", "DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry());
        return;
    }

    Map::PlayerList const& playerList = map->GetPlayers();

    if (playerList.isEmpty())
        return;

    for (Map::PlayerList::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr)
    {
        if (Player* player = itr->GetSource())
        {
            if (player->IsGameMaster())
                continue;

            if (player->IsAlive())
            {
                creature->SetInCombatWith(player);
                player->SetInCombatWith(creature);
                creature->AddThreat(player, 0.0f);
            }

            /* Causes certain things to never leave the threat list (Priest Lightwell, etc):
            for (Unit::ControlList::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr)
            {
                creature->SetInCombatWith(*itr);
                (*itr)->SetInCombatWith(creature);
                creature->AddThreat(*itr, 0.0f);
            }*/
        }
    }
}
Пример #29
0
    void UpdateAI(const uint32 diff)
    {
        //Inhibitmagic_Timer
        if (Inhibitmagic_Timer < diff)
        {
            float dist;
            Map* pMap = m_creature->GetMap();
            Map::PlayerList const &PlayerList = pMap->GetPlayers();
            for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                if (Player* i_pl = i->getSource())
                    if (i_pl->isAlive() && (dist = i_pl->IsWithinDist(m_creature, 45)))
                    {
                        i_pl->RemoveAurasDueToSpell(SPELL_INHIBITMAGIC);
                        m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl);
                        if (dist < 35)
                            m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl);
                        if (dist < 25)
                            m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl);
                        if (dist < 15)
                            m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl);
                    }
            Inhibitmagic_Timer = 3000+(rand()%1000);
        }else Inhibitmagic_Timer -= diff;

        //Return since we have no target
        if (!UpdateVictim())
            return;

        //Attractmagic_Timer
        if (Attractmagic_Timer < diff)
        {
            DoCast(m_creature,SPELL_ATTRACTMAGIC);
            Attractmagic_Timer = 30000;
            Carnivorousbite_Timer = 1500;
        }else Attractmagic_Timer -= diff;

        //Carnivorousbite_Timer
        if (Carnivorousbite_Timer < diff)
        {
            DoCast(m_creature,SPELL_CARNIVOROUSBITE);
            Carnivorousbite_Timer = 10000;
        }else Carnivorousbite_Timer -= diff;

        //FocusFire_Timer
        if (FocusFire_Timer < diff)
        {
            // Summon Focus Fire & Emote
            Unit *target = SelectUnit(SELECT_TARGET_RANDOM,1);
            if (target && target->GetTypeId() == TYPEID_PLAYER && target->isAlive())
            {
                focusedTarget = target;
                m_creature->SummonCreature(ENTRY_FOCUS_FIRE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,5500);

                // TODO: Find better way to handle emote
                // Emote
                std::string *emote = new std::string(EMOTE_FOCUSES_ON);
                emote->append(target->GetName());
                emote->append("!");
                const char* text = emote->c_str();
                m_creature->MonsterTextEmote(text, 0, true);
                delete emote;
            }
            FocusFire_Timer = 15000+(rand()%5000);
        }else FocusFire_Timer -= diff;

        DoMeleeAttackIfReady();
    }
Пример #30
-1
        void WaypointReached(uint32 i)
        {
            if (!pInstance)
                return;

            switch(i)
            {
                case 8:
                    SetRun(false);
                    me->SummonCreature(18764, 2181.87f, 112.46f, 89.45f, 0.26f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    break;
                case 9:
                    DoScriptText(SAY_TH_ARMORY, me);
                    me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, THRALL_WEAPON_MODEL);
                    //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, THRALL_WEAPON_INFO);
                    //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+1, 781);
                    me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, THRALL_SHIELD_MODEL);
                    //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+2, THRALL_SHIELD_INFO);
                    //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+3, 1038);
                    break;
                case 10:
                    me->SetDisplayId(THRALL_MODEL_EQUIPPED);
                    break;
                case 11:
                    SetRun();
                    break;
                case 15:
                    me->SummonCreature(MOB_ENTRY_RIFLE, 2200.28f, 137.37f, 87.93f, 5.07f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_WARDEN, 2197.44f, 131.83f, 87.93f, 0.78f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_VETERAN, 2203.62f, 135.40f, 87.93f, 3.70f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_VETERAN, 2200.75f, 130.13f, 87.93f, 1.48f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    break;
                case 21:
                    me->SummonCreature(MOB_ENTRY_RIFLE, 2135.80f, 154.01f, 67.45f, 4.98f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_WARDEN, 2144.36f, 151.87f, 67.74f, 4.46f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_VETERAN, 2142.12f, 154.41f, 67.12f, 4.56f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_VETERAN, 2138.08f, 155.38f, 67.24f, 4.60f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    break;
                case 25:
                    me->SummonCreature(MOB_ENTRY_RIFLE, 2102.98f, 192.17f, 65.24f, 6.02f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_WARDEN, 2108.48f, 198.75f, 65.18f, 5.15f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_VETERAN, 2106.11f, 197.29f, 65.18f, 5.63f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_VETERAN, 2104.18f, 194.82f, 65.18f, 5.75f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    break;
                case 29:
                    DoScriptText(SAY_TH_SKARLOC_MEET, me);
                    me->SummonCreature(ENTRY_SCARLOC, 2036.48f, 271.22f, 63.43f, 5.27f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
                    //temporary, skarloc should rather be triggered to walk up to thrall
                    break;
                case 30:
                    SetEscortPaused(true);
                    me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                    SetRun(false);
                    break;
                case 31:
                    DoScriptText(SAY_TH_MOUNTS_UP, me);
                    DoMount();
                    SetRun();
                    break;
                case 37:
                    //possibly regular patrollers? If so, remove this and let database handle them
                    me->SummonCreature(MOB_ENTRY_WATCHMAN, 2124.26f, 522.16f, 56.87f, 3.99f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_WATCHMAN, 2121.69f, 525.37f, 57.11f, 4.01f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_SENTRY, 2124.65f, 524.55f, 56.63f, 3.98f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    break;
                case 59:
                    me->SummonCreature(SKARLOC_MOUNT, 2488.64f, 625.77f, 58.26f, 4.71f, TEMPSUMMON_TIMED_DESPAWN, 10000);
                    DoUnmount();
                    HadMount = false;
                    SetRun(false);
                    break;
                case 60:
                    me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION);
                    //make horsie run off
                    SetEscortPaused(true);
                    me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
                    pInstance->SetData(TYPE_THRALL_PART2, DONE);
                    SetRun();
                    break;
                case 64:
                    SetRun(false);
                    break;
                case 68:
                    me->SummonCreature(MOB_ENTRY_BARN_PROTECTOR, 2500.22f, 692.60f, 55.50f, 2.84f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_BARN_LOOKOUT, 2500.13f, 696.55f, 55.51f, 3.38f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_BARN_GUARDSMAN, 2500.55f, 693.64f, 55.50f, 3.14f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_BARN_GUARDSMAN, 2500.94f, 695.81f, 55.50f, 3.14f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    break;
                case 71:
                    SetRun();
                    break;
                case 81:
                    SetRun(false);
                    break;
                case 83:
                    me->SummonCreature(MOB_ENTRY_CHURCH_PROTECTOR, 2627.33f, 646.82f, 56.03f, 4.28f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000);
                    me->SummonCreature(MOB_ENTRY_CHURCH_LOOKOUT, 2624.14f, 648.03f, 56.03f, 4.50f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000);
                    me->SummonCreature(MOB_ENTRY_CHURCH_GUARDSMAN, 2625.32f, 649.60f, 56.03f, 4.38f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000);
                    me->SummonCreature(MOB_ENTRY_CHURCH_GUARDSMAN, 2627.22f, 649.00f, 56.03f, 4.34f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 5000);
                    break;
                case 84:
                    DoScriptText(SAY_TH_CHURCH_END, me);
                    SetRun();
                    break;
                case 91:
                    me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
                    SetRun(false);
                    break;
                case 93:
                    me->SummonCreature(MOB_ENTRY_INN_PROTECTOR, 2652.71f, 660.31f, 61.93f, 1.67f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_INN_LOOKOUT, 2648.96f, 662.59f, 61.93f, 0.79f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_INN_GUARDSMAN, 2657.36f, 662.34f, 61.93f, 2.68f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    me->SummonCreature(MOB_ENTRY_INN_GUARDSMAN, 2656.39f, 659.77f, 61.93f, 2.61f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
                    break;
                case 94:
                    if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA))
                    {
                        if (Unit* Taretha = Unit::GetUnit((*me), TarethaGUID))
                            DoScriptText(SAY_TA_ESCAPED, Taretha, me);
                    }
                    break;
                case 95:
                    DoScriptText(SAY_TH_MEET_TARETHA, me);
                    pInstance->SetData(TYPE_THRALL_PART3, DONE);
                    SetEscortPaused(true);
                    break;
                case 96:
                    DoScriptText(SAY_TH_EPOCH_WONDER, me);
                    break;
                case 97:
                    DoScriptText(SAY_TH_EPOCH_KILL_TARETHA, me);
                    SetRun();
                    break;
                case 98:
                    //trigger epoch Yell("Thrall! Come outside and face your fate! ....")
                    //from here, thrall should not never be allowed to move to point 106 which he currently does.
                    break;

                case 106:
                    {
                        //trigger taretha to run down outside
                        if (Creature* Taretha = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TARETHA)))
                        {
                            if (Player* pPlayer = GetPlayerForEscort())
                                CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, pPlayer->GetGUID());
                        }

                        //kill credit Creature for quest
                        Map* pMap = me->GetMap();
                        Map::PlayerList const& players = pMap->GetPlayers();
                        if (!players.isEmpty() && pMap->IsDungeon())
                        {
                            for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                            {
                                if (Player* pPlayer = itr->getSource())
                                    pPlayer->KilledMonsterCredit(20156, 0);
                            }
                        }

                        //alot will happen here, thrall and taretha talk, erozion appear at spot to explain
                        me->SummonCreature(EROZION_ENTRY, 2646.47f, 680.416f, 55.38f, 4.16f, TEMPSUMMON_TIMED_DESPAWN, 120000);
                    }
                    break;
                case 108:
                    //last waypoint, just set Thrall invisible, respawn is turned off
                    me->SetVisible(false);
                    break;
            }
        }