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(); }
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(); }
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; } }
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(); }
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 UpdateAI(const uint32 diff) { //Check if we have a target if (!UpdateVictim()) { //No target so we'll use this section to do our random wispers instance wide //WisperTimer if (WisperTimer < diff) { Map *map = m_creature->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()) { //Play random sound to the zone i_pl->SendPlaySound(RANDOM_SOUND_WHISPER, true); } } //One random wisper every 90 - 300 seconds WisperTimer = 90000 + (rand()% 210000); }else WisperTimer -= diff; return; } m_creature->SetSelection(0); //No instance if (!pInstance) return; switch (pInstance->GetData(DATA_CTHUN_PHASE)) { //Transition phase case 2: { //PhaseTimer if (PhaseTimer < diff) { //Switch pInstance->SetData(DATA_CTHUN_PHASE, 3); //Switch to c'thun model m_creature->InterruptNonMeleeSpells(false); DoCast(m_creature, SPELL_TRANSFORM, false); m_creature->SetHealth(m_creature->GetMaxHealth()); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); //Emerging phase //AttackStart(Unit::GetUnit(*m_creature, HoldPlayer)); DoZoneInCombat(); //Place all units in threat list on outside of stomach Stomach_Map.clear(); std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin(); for (; i != m_creature->getThreatManager().getThreatList().end(); ++i) { //Outside stomach Stomach_Map[(*i)->getUnitGuid()] = false; } //Spawn 2 flesh tentacles FleshTentaclesKilled = 0; Creature* Spawned; //Spawn flesh tentacle Spawned = (Creature*)m_creature->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS1_X, TENTACLE_POS1_Y, TENTACLE_POS1_Z, TENTACLE_POS1_O, TEMPSUMMON_CORPSE_DESPAWN, 0); if (!Spawned) FleshTentaclesKilled++; else ((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID()); //Spawn flesh tentacle Spawned = (Creature*)m_creature->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS2_X, TENTACLE_POS2_Y, TENTACLE_POS2_Z, TENTACLE_POS2_O, TEMPSUMMON_CORPSE_DESPAWN, 0); if (!Spawned) FleshTentaclesKilled++; else ((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID()); PhaseTimer = 0; }else PhaseTimer -= diff; }break; //Body Phase case 3: { //Remove Target field m_creature->SetSelection(0); //Weaken if (FleshTentaclesKilled > 1) { pInstance->SetData(DATA_CTHUN_PHASE, 4); DoScriptText(EMOTE_WEAKENED, m_creature); PhaseTimer = 45000; DoCast(m_creature, SPELL_RED_COLORATION, true); UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin(); //Kick all players out of stomach while (i != Stomach_Map.end()) { //Check for valid player Unit* pUnit = Unit::GetUnit(*m_creature, i->first); //Only move units in stomach if (pUnit && i->second == true) { //Teleport each player out DoTeleportPlayer(pUnit, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ()+10, rand()%6); //Cast knockback on them DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true); //Remove the acid debuff pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); i->second = false; } ++i; } return; } //Stomach acid if (StomachAcidTimer < diff) { //Apply aura to all players in stomach UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin(); while (i != Stomach_Map.end()) { //Check for valid player Unit* pUnit = Unit::GetUnit(*m_creature, i->first); //Only apply to units in stomach if (pUnit && i->second == true) { //Cast digestive acid on them DoCast(pUnit, SPELL_DIGESTIVE_ACID, true); //Check if player should be kicked from stomach if (pUnit->GetDistance(KICK_X, KICK_Y, KICK_Z) < 15) { //Teleport each player out DoTeleportPlayer(pUnit, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ()+10, rand()%6); //Cast knockback on them DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true); //Remove the acid debuff pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); i->second = false; } } ++i; } StomachAcidTimer = 4000; }else StomachAcidTimer -= diff; //Stomach Enter Timer if (StomachEnterTimer < diff) { Unit* target = NULL; target = SelectRandomNotStomach(); if (target) { //Set target in stomach Stomach_Map[target->GetGUID()] = true; target->InterruptNonMeleeSpells(false); target->CastSpell(target, SPELL_MOUTH_TENTACLE, true, NULL, NULL, m_creature->GetGUID()); StomachEnterTarget = target->GetGUID(); StomachEnterVisTimer = 3800; } StomachEnterTimer = 13800; }else StomachEnterTimer -= diff; if (StomachEnterVisTimer && StomachEnterTarget) if (StomachEnterVisTimer <= diff) { //Check for valid player Unit* pUnit = Unit::GetUnit(*m_creature, StomachEnterTarget); if (pUnit) { DoTeleportPlayer(pUnit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O); } StomachEnterTarget = 0; StomachEnterVisTimer = 0; }else StomachEnterVisTimer -= diff; //GientClawTentacleTimer if (GiantClawTentacleTimer < diff) { Unit* target = NULL; target = SelectRandomNotStomach(); if (target) { Creature* Spawned = NULL; //Spawn claw tentacle on the random target Spawned = (Creature*)m_creature->SummonCreature(MOB_GIANT_CLAW_TENTACLE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500); if (Spawned) Spawned->AI()->AttackStart(target); } //One giant claw tentacle every minute GiantClawTentacleTimer = 60000; }else GiantClawTentacleTimer -= diff; //GiantEyeTentacleTimer if (GiantEyeTentacleTimer < diff) { Unit* target = NULL; target = SelectRandomNotStomach(); if (target) { Creature* Spawned = NULL; //Spawn claw tentacle on the random target Spawned = (Creature*)m_creature->SummonCreature(MOB_GIANT_EYE_TENTACLE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,500); if (Spawned) Spawned->AI()->AttackStart(target); } //One giant eye tentacle every minute GiantEyeTentacleTimer = 60000; }else GiantEyeTentacleTimer -= diff; //EyeTentacleTimer if (EyeTentacleTimer < diff) { //Spawn the 8 Eye Tentacles in the corret spots SpawnEyeTentacle(0, 25); //south SpawnEyeTentacle(12, 12); //south west SpawnEyeTentacle(25, 0); //west SpawnEyeTentacle(12, -12); //north west SpawnEyeTentacle(0, -25); //north SpawnEyeTentacle(-12, -12); //north east SpawnEyeTentacle(-25, 0); // east SpawnEyeTentacle(-12, 12); // south east //These spawn at every 30 seconds EyeTentacleTimer = 30000; }else EyeTentacleTimer -= diff; }break; //Weakened state case 4: { //PhaseTimer if (PhaseTimer < diff) { //Switch pInstance->SetData(DATA_CTHUN_PHASE, 3); //Remove red coloration m_creature->RemoveAurasDueToSpell(SPELL_RED_COLORATION); //Spawn 2 flesh tentacles FleshTentaclesKilled = 0; Creature* Spawned; //Spawn flesh tentacle Spawned = (Creature*)m_creature->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS1_X, TENTACLE_POS1_Y, TENTACLE_POS1_Z, TENTACLE_POS1_O, TEMPSUMMON_CORPSE_DESPAWN, 0); if (!Spawned) FleshTentaclesKilled++; else ((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID()); //Spawn flesh tentacle Spawned = (Creature*)m_creature->SummonCreature(MOB_FLESH_TENTACLE, TENTACLE_POS2_X, TENTACLE_POS2_Y, TENTACLE_POS2_Z, TENTACLE_POS2_O, TEMPSUMMON_CORPSE_DESPAWN, 0); if (!Spawned) FleshTentaclesKilled++; else ((flesh_tentacleAI*)(Spawned->AI()))->SpawnedByCthun(m_creature->GetGUID()); PhaseTimer = 0; }else PhaseTimer -= diff; } } }
void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; switch (m_uiStage) { case 0: if (m_uiFerociousButtTimer <= uiDiff) { DoCastVictim(SPELL_FEROCIOUS_BUTT); m_uiFerociousButtTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); } else m_uiFerociousButtTimer -= uiDiff; if (m_uiArticBreathTimer <= uiDiff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_ARCTIC_BREATH); m_uiArticBreathTimer = urand(25*IN_MILLISECONDS, 40*IN_MILLISECONDS); } else m_uiArticBreathTimer -= uiDiff; if (m_uiWhirlTimer <= uiDiff) { DoCastAOE(SPELL_WHIRL); m_uiWhirlTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); } else m_uiWhirlTimer -= uiDiff; if (m_uiMassiveCrashTimer <= uiDiff) { me->GetMotionMaster()->MoveJump(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 10.0f, 20.0f); // 1: Middle of the room m_uiStage = 7; //Invalid (Do nothing more than move) m_uiMassiveCrashTimer = 30*IN_MILLISECONDS; } else m_uiMassiveCrashTimer -= uiDiff; DoMeleeAttackIfReady(); break; case 1: DoCastAOE(SPELL_MASSIVE_CRASH); m_uiStage = 2; break; case 2: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) { m_uiTrampleTargetGUID = target->GetGUID(); me->SetTarget(m_uiTrampleTargetGUID); DoScriptText(SAY_TRAMPLE_STARE, me, target); m_bTrampleCasted = false; SetCombatMovement(false); me->GetMotionMaster()->MoveIdle(); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_uiTrampleTimer = 4*IN_MILLISECONDS; m_uiStage = 3; } else m_uiStage = 6; break; case 3: if (m_uiTrampleTimer <= uiDiff) { if (Unit* target = Unit::GetPlayer(*me, m_uiTrampleTargetGUID)) { m_bTrampleCasted = false; m_bMovementStarted = true; m_fTrampleTargetX = target->GetPositionX(); m_fTrampleTargetY = target->GetPositionY(); m_fTrampleTargetZ = target->GetPositionZ(); me->GetMotionMaster()->MoveJump(2*me->GetPositionX()-m_fTrampleTargetX, 2*me->GetPositionY()-m_fTrampleTargetY, me->GetPositionZ(), 10.0f, 20.0f); // 2: Hop Backwards m_uiStage = 7; //Invalid (Do nothing more than move) } else m_uiStage = 6; } else m_uiTrampleTimer -= uiDiff; break; case 4: DoScriptText(SAY_TRAMPLE_START, me); me->GetMotionMaster()->MoveCharge(m_fTrampleTargetX, m_fTrampleTargetY, m_fTrampleTargetZ+2, 42, 1); me->SetTarget(0); m_uiStage = 5; break; case 5: if (m_bMovementFinish) { if (m_uiTrampleTimer <= uiDiff) DoCastAOE(SPELL_TRAMPLE); m_bMovementFinish = false; m_uiStage = 6; return; } if (m_uiTrampleTimer <= uiDiff) { Map::PlayerList const &lPlayers = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr) { if (Unit* player = itr->getSource()) if (player->isAlive() && player->IsWithinDistInMap(me, 6.0f)) { DoCastAOE(SPELL_TRAMPLE); m_uiTrampleTimer = IN_MILLISECONDS; break; } } } else m_uiTrampleTimer -= uiDiff; break; case 6: if (!m_bTrampleCasted) { DoCast(me, SPELL_STAGGERED_DAZE); DoScriptText(SAY_TRAMPLE_FAIL, me); } m_bMovementStarted = false; me->GetMotionMaster()->MovementExpired(); me->GetMotionMaster()->MoveChase(me->getVictim()); SetCombatMovement(true); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_uiStage = 0; break; } }
void Aggro(Unit* pWho) { for (uint8 i = 0; i < 4; ++i) m_PlagueFissureGUID[i].clear(); for (uint32 i = 10; i <= 52; ++i) if (GameObject* pPlagueFissure = GetClosestGameObjectWithEntry(m_creature, 181500+i, 100.0f)) { if (i != 10 && i != 17 && i != 18 && i != 19 && i != 20 && i != 21 && i != 22 && i != 23 && i != 24 && i != 26) m_PlagueFissureGUID[0].push_back(pPlagueFissure->GetGUID()); if (i != 11 && i != 12 && i != 13 && i != 14 && i != 15 && i != 16 && i != 25 && i != 27 && i != 28 && i != 29 && i != 30 && i != 31) m_PlagueFissureGUID[1].push_back(pPlagueFissure->GetGUID()); if (i != 32 && i != 33 && i != 34 && i != 35 && i != 36 && i != 40 && i != 41 && i != 42 && i != 43 && i != 44 && i != 45) m_PlagueFissureGUID[2].push_back(pPlagueFissure->GetGUID()); if (i != 37 && i != 48 && i != 39 && i != 46 && i != 47 && i != 48 && i != 49 && i != 50 && i != 51 && i != 52) m_PlagueFissureGUID[3].push_back(pPlagueFissure->GetGUID()); } std::list<GameObject*> lList; GetGameObjectListWithEntryInGrid(lList, m_creature, 181678, 100.0f); if (!lList.empty()) for (std::list<GameObject*>::iterator itr = lList.begin(); itr != lList.end(); ++itr) { m_PlagueFissureGUID[1].push_back((*itr)->GetGUID()); m_PlagueFissureGUID[2].push_back((*itr)->GetGUID()); m_PlagueFissureGUID[3].push_back((*itr)->GetGUID()); } lList.clear(); GetGameObjectListWithEntryInGrid(lList, m_creature, 181676, 100.0f); if (!lList.empty()) for (std::list<GameObject*>::iterator itr = lList.begin(); itr != lList.end(); ++itr) { m_PlagueFissureGUID[0].push_back((*itr)->GetGUID()); m_PlagueFissureGUID[2].push_back((*itr)->GetGUID()); m_PlagueFissureGUID[3].push_back((*itr)->GetGUID()); } lList.clear(); GetGameObjectListWithEntryInGrid(lList, m_creature, 181677, 100.0f); if (!lList.empty()) for (std::list<GameObject*>::iterator itr = lList.begin(); itr != lList.end(); ++itr) { m_PlagueFissureGUID[0].push_back((*itr)->GetGUID()); m_PlagueFissureGUID[1].push_back((*itr)->GetGUID()); m_PlagueFissureGUID[3].push_back((*itr)->GetGUID()); } lList.clear(); GetGameObjectListWithEntryInGrid(lList, m_creature, 181695, 100.0f); if (!lList.empty()) for (std::list<GameObject*>::iterator itr = lList.begin(); itr != lList.end(); ++itr) { m_PlagueFissureGUID[0].push_back((*itr)->GetGUID()); m_PlagueFissureGUID[1].push_back((*itr)->GetGUID()); m_PlagueFissureGUID[2].push_back((*itr)->GetGUID()); } switch (rand()%3) { case 0: DoScriptText(SAY_AGGRO1, m_creature); break; case 1: DoScriptText(SAY_AGGRO2, m_creature); break; case 2: DoScriptText(SAY_AGGRO3, m_creature); break; } // Teleport "cheaters" to center of room Map* map = m_creature->GetMap(); if (map->IsDungeon()) { Map::PlayerList const &PlayerList = map->GetPlayers(); if (!PlayerList.isEmpty()) for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) i->getSource()->TeleportTo(NAXXRAMAS, 2804.946f, -3678.315f, 273.666f, 4.385f); } if(m_pInstance) m_pInstance->SetData(TYPE_HEIGAN, IN_PROGRESS); }
void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (m_uiDeathCheckTimer < diff) { Map* pMap = m_creature->GetMap(); if(pMap) { Map::PlayerList const &lPlayers = pMap->GetPlayers(); for (Map::PlayerList::const_iterator iter = lPlayers.begin(); iter != lPlayers.end(); ++iter) { Player* pPlayer = iter->getSource(); if(!pPlayer->isAlive()) m_bIsPlayerDeath = true; } } m_uiDeathCheckTimer = 1000; }else m_uiDeathCheckTimer -= diff; if (m_uiEvadeCheckCooldown < diff) { if (m_creature->GetDistance2d(2769.68f, -3684.61f) > 48.0f) EnterEvadeMode(); m_uiEvadeCheckCooldown = 2000; }else m_uiEvadeCheckCooldown -= diff; if (m_bDelay) { m_bDelay = false; DoCast(m_creature, SPELL_PLAGUED_CLOUD); } if (Phase_Timer < diff) { if (m_bCombatPhase) { m_creature->InterruptNonMeleeSpells(true); m_creature->StopMoving(); m_creature->GetMotionMaster()->Clear(false); m_creature->GetMotionMaster()->MoveIdle(); m_creature->GetMap()->CreatureRelocation(m_creature, PLATFORM_X, PLATFORM_Y, PLATFORM_Z, PLATFORM_O); m_creature->SendMonsterMove(PLATFORM_X, PLATFORM_Y, PLATFORM_Z, SPLINETYPE_NORMAL, SPLINEFLAG_DONE, 0); SetCombatMovement(false); m_bDelay = true; Phase_Timer = 45000; } else { SetCombatMovement(true); DoStartMovement(m_creature->getVictim()); Phase_Timer = 90000; Disruption_Timer = 0; } m_bCombatPhase = !m_bCombatPhase; m_uiSafeSection = 0; Erupt_Timer = 10000; m_bEruptDirection = false; } else Phase_Timer -= diff; if (Erupt_Timer < diff) { for (std::list<uint64>::iterator itr = m_PlagueFissureGUID[m_uiSafeSection].begin(); itr != m_PlagueFissureGUID[m_uiSafeSection].end(); ++itr) { if (GameObject* pGo = m_creature->GetMap()->GetGameObject(*itr)) if (pGo) { WorldPacket data(SMSG_GAMEOBJECT_CUSTOM_ANIM,8+4); data << pGo->GetGUID(); data << 0; pGo->SendMessageToSet(&data,true); if (Creature* pTemp = m_creature->SummonCreature(14667, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 100)) { pTemp->SetLevel(80); pTemp->CastSpell(pTemp, SPELL_ERUPTION, true); } } } if (m_uiSafeSection == 0 || m_uiSafeSection == 3) m_bEruptDirection = !m_bEruptDirection; m_bEruptDirection ? ++m_uiSafeSection : --m_uiSafeSection; m_bCombatPhase ? Erupt_Timer = 10000 : Erupt_Timer = 3000; // Teleport "cheaters" to center of room (until LOS with GOs will be implemented) Map* map = m_creature->GetMap(); if (map->IsDungeon()) { Map::PlayerList const &PlayerList = map->GetPlayers(); if (!PlayerList.isEmpty()) for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) if ((i->getSource()->GetDistance2d(2769.68f, -3684.61f) > 48.0f) && (i->getSource()->GetDistance2d(2769.68f, -3684.61f) < 100.0f)) i->getSource()->TeleportTo(533, 2769.68f, -3684.61f, 273.66f, 5.5f); } } else Erupt_Timer -= diff; if (m_bCombatPhase) { if (Disruption_Timer < diff) { DoCast(m_creature, SPELL_DISRUPTION); Disruption_Timer = 10000; } else Disruption_Timer -= diff; if (Feaver_Timer < diff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) DoCast(pTarget, m_bIsRegularMode ? SPELL_FEAVER : H_SPELL_FEAVER); Feaver_Timer = 20000; } else Feaver_Timer -= diff; DoMeleeAttackIfReady(); } }
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; }
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* pMap = me->GetMap(); if (pMap && pMap->IsDungeon()) { Map::PlayerList const &players = pMap->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; }
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, "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; } }
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* pPlayer = itr->getSource()) { if (pPlayer->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE) pPlayer->AreaExploredOrEventHappens(QUEST_OPENING_PORTAL); if (pPlayer->GetQuestStatus(QUEST_MASTER_TOUCH) == QUEST_STATUS_INCOMPLETE) pPlayer->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 UpdateAI(const uint32 diff) { //Inhibitmagic_Timer if (Inhibitmagic_Timer <= diff) { float dist; Map* map = me->GetMap(); 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() && (dist = i_pl->IsWithinDist(me, 45))) { i_pl->RemoveAurasDueToSpell(SPELL_INHIBITMAGIC); me->AddAura(SPELL_INHIBITMAGIC, i_pl); if (dist < 35) me->AddAura(SPELL_INHIBITMAGIC, i_pl); if (dist < 25) me->AddAura(SPELL_INHIBITMAGIC, i_pl); if (dist < 15) me->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(me, SPELL_ATTRACTMAGIC); Attractmagic_Timer = 30000; Carnivorousbite_Timer = 1500; } else Attractmagic_Timer -= diff; //Carnivorousbite_Timer if (Carnivorousbite_Timer <= diff) { DoCast(me, SPELL_CARNIVOROUSBITE); Carnivorousbite_Timer = 10000; } else Carnivorousbite_Timer -= diff; //FocusFire_Timer if (FocusFire_Timer <= diff) { // Summon Focus Fire & Emote Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1); if (target && target->GetTypeId() == TYPEID_PLAYER && target->isAlive()) { FocusedTargetGUID = target->GetGUID(); me->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(EMOTE_FOCUSES_ON); emote.append(target->GetName()); emote.push_back('!'); me->MonsterTextEmote(emote.c_str(), 0, true); } FocusFire_Timer = 15000+(rand()%5000); } else FocusFire_Timer -= diff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { // If WG is disabled, don't do anything. if (!sWorld->getBoolConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) return; if (OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197)) { // Get playerlist if there is. if (pvpWG->isWarTime() && Check == true) { Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (!PlayerList.isEmpty()) { if (i->getSource()->GetDistance2d(me) <= 75) { Player = true; Check = false; } else { Player = false; Check = false; Check2 = true; } } else { Player = false; Check = false; Check2 = true; } } } if (pvpWG->m_changeHorde != true) // If wg is switching (.wg switch) { if (pvpWG->isWarTime()) { if (Player == true) //(false) If there isn't any player, then, don't cast the portal spell. Just summon gameobject. { if (uiPortalTimer <= diff) { switch (uiPortalPhase) { case 0: me->SetOrientation(4.356160f); me->SendMovementFlagUpdate(); ++uiPortalPhase; uiPortalTimer = 100; break; case 1: me->AI()->DoCast(SPELL_PORTAL_VISUAL); ++uiPortalPhase; uiPortalTimer = 900; break; case 2: WintergraspPortal = me->SummonGameObject(GO_WINTERGRASP_PORTAL, 5924.042969f, 570.354492f, 661.087280f, 5.930885f, 0, 0, 0.324484f, -0.945891f, 0); me->SetOrientation(6.003930f); me->SendMovementFlagUpdate(); ++uiPortalPhase; uiPortalTimer = 1000; break; } }else uiPortalTimer -= diff; } else { if (Check2 == true) // If the portal isn't exist { WintergraspPortal = me->SummonGameObject(GO_WINTERGRASP_PORTAL, 5686.974609f, 773.303711f, 647.753235f, 5.572729f, 0, 0, 0.324484f, -0.945891f, 0); Check2 = false; } } } else { if (pvpWG->getDefenderTeam() == TEAM_HORDE) { if (pvpWG->m_timer <= 3600000) // An hour before battle begin, the portal will disappear. { uiPortalTimer = 0; uiPortalPhase = 0; Check = true; Check2 = false; if (GameObject* WintergraspPortal = me->FindNearestGameObject(GO_WINTERGRASP_PORTAL, 5.0f)) // If the portal is exist WintergraspPortal->RemoveFromWorld(); } } else { uiPortalTimer = 0; uiPortalPhase = 0; Check = true; Check2 = false; if (GameObject* WintergraspPortal = me->FindNearestGameObject(GO_WINTERGRASP_PORTAL, 5.0f)) // If the portal is exist WintergraspPortal->RemoveFromWorld(); } } } } }
CanCastResult BossSpellWorker::_BSWSpellSelector(uint8 m_uiSpellIdx, Unit* pTarget) { if (_bossSpellCount == 0) return CAST_FAIL_OTHER; SpellEntry const *spell; SpellTable* pSpell = &m_BossSpell[m_uiSpellIdx]; Unit* pSummon = NULL; debug_log("BSW: Casting spell number %u type %u",pSpell->m_uiSpellEntry[currentDifficulty], pSpell->m_CastTarget); switch (pSpell->m_CastTarget) { case DO_NOTHING: return CAST_OK; case CAST_ON_SELF: if (!pSpell->m_IsBugged) return _DoCastSpellIfCan(boss, pSpell->m_uiSpellEntry[currentDifficulty]); else return _BSWDoCast(m_uiSpellIdx, boss); break; case CAST_ON_SUMMONS: if (!pTarget) return CAST_FAIL_OTHER; else return _DoCastSpellIfCan(pTarget, pSpell->m_uiSpellEntry[currentDifficulty]); break; case CAST_ON_VICTIM: pTarget = boss->getVictim(); return _BSWCastOnTarget(pTarget, m_uiSpellIdx); break; case CAST_ON_RANDOM: pTarget = SelectUnit(SELECT_TARGET_RANDOM); return _BSWCastOnTarget(pTarget, m_uiSpellIdx); break; case CAST_ON_BOTTOMAGGRO: pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); return _BSWCastOnTarget(pTarget, m_uiSpellIdx); break; case CAST_ON_TARGET: return _BSWCastOnTarget(pTarget, m_uiSpellIdx); break; case APPLY_AURA_SELF: if (spell = (SpellEntry *)GetSpellStore()->LookupEntry(pSpell->m_uiSpellEntry[currentDifficulty])) if(boss->AddAura(new BossAura(spell, EFFECT_INDEX_0, &pSpell->varData, boss, boss))) return CAST_OK; else return CAST_FAIL_OTHER; break; case APPLY_AURA_TARGET: if (!pTarget) return CAST_FAIL_OTHER; if (spell = (SpellEntry *)GetSpellStore()->LookupEntry(pSpell->m_uiSpellEntry[currentDifficulty])) if (pTarget->AddAura(new BossAura(spell, EFFECT_INDEX_0, &pSpell->varData, pTarget, pTarget))) return CAST_OK; else return CAST_FAIL_OTHER; break; case SUMMON_NORMAL: pSummon = _doSummon(m_uiSpellIdx, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); if(pSummon) return CAST_OK; else return CAST_FAIL_OTHER; break; case SUMMON_TEMP: pSummon = _doSummon(m_uiSpellIdx, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, urand(pSpell->m_uiSpellTimerMin[currentDifficulty],pSpell->m_uiSpellTimerMax[currentDifficulty])); if(pSummon) return CAST_OK; else return CAST_FAIL_OTHER; break; case SUMMON_INSTANT: pSummon = _doSummon(m_uiSpellIdx, TEMPSUMMON_MANUAL_DESPAWN,0); if(pSummon) return CAST_OK; else return CAST_FAIL_OTHER; break; case CAST_ON_ALLPLAYERS: { CanCastResult res1 = CAST_FAIL_OTHER; Map::PlayerList const& pPlayers = pMap->GetPlayers(); for (Map::PlayerList::const_iterator itr = pPlayers.begin(); itr != pPlayers.end(); ++itr) { pTarget = itr->getSource(); if (pTarget && pTarget->isAlive() && pTarget->IsWithinDistInMap(boss, pSpell->LocData.x)) if (!pSpell->m_IsBugged) { res1 = _DoCastSpellIfCan(pTarget, pSpell->m_uiSpellEntry[currentDifficulty]); } else { _BSWDoCast(m_uiSpellIdx, pTarget); res1 = CAST_OK; }; return res1; } break; } case CAST_ON_FRENDLY: pTarget = SelectLowHPFriendly(); return _BSWCastOnTarget(pTarget, m_uiSpellIdx); break; case CAST_ON_FRENDLY_LOWHP: pTarget = SelectLowHPFriendly(); return _BSWCastOnTarget(pTarget, m_uiSpellIdx); break; default: return CAST_FAIL_OTHER; break; }; return CAST_FAIL_OTHER; };
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() && i->getSource()->isAlive() && i->getSource()->isTargetableForAttack()) { int32 dmg; float m_fDist = m_creature->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 *= m_fDist; m_creature->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(m_creature, SPELL_PULSING_SHOCKWAVE_AURA, true); DoCast(m_creature, DUNGEON_MODE(SPELL_PULSING_SHOCKWAVE_N, SPELL_PULSING_SHOCKWAVE_H)); // 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) { DoScriptText(RAND(SAY_NOVA_1,SAY_NOVA_2,SAY_NOVA_3), m_creature); DoScriptText(EMOTE_NOVA, m_creature); DoCast(m_creature, DUNGEON_MODE(SPELL_LIGHTNING_NOVA_N, SPELL_LIGHTNING_NOVA_H)); 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 ((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(); }
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(); }
void UpdateAI(uint32 const diff) { if (!intro) { me->SummonCreature(NPC_SLIPPERY_FLOOR, SummonPositions[0]); // floor ambient me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); me->SetReactState(REACT_AGGRESSIVE); intro = true; } if (!UpdateVictim()) return; events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_SWITCH_PHASE: if (events.GetPhaseMask() & PHASE_MASK_ONE) { // Emote: Ahune retreats. His defenses diminish. // me->MonsterTextEmote(EMOTE_SUBMERGE, 0, true); events.SetPhase(PHASE_TWO); events.ScheduleEvent(EVENT_SWITCH_PHASE, 30000); DoCast(me, SPELL_MAKE_BONFIRE); // Handle Submerge. This is essentially a copy of how Ragnaros submerges... :) minus the threatwipe me->AttackStop(); me->SetReactState(REACT_PASSIVE); me->setFaction(35); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED); me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE); // spawn core me->SummonCreature(NPC_FROZEN_CORE, SummonPositions[0], TEMPSUMMON_CORPSE_DESPAWN); } else { events.SetPhase(PHASE_ONE); events.ScheduleEvent(EVENT_SWITCH_PHASE, 90000); events.ScheduleEvent(EVENT_COLD_SLAP, 500, 0, PHASE_ONE); events.ScheduleEvent(EVENT_SUMMON_HAILSTONE, 1000, 0, PHASE_ONE); events.ScheduleEvent(EVENT_SUMMON_COLDWEAVE, 8000, 0, PHASE_ONE); events.ScheduleEvent(EVENT_SUMMON_FROSTWIND, 9000, 0, PHASE_ONE); events.ScheduleEvent(EVENT_ICE_SPEAR, 9500, 0, PHASE_ONE); events.ScheduleEvent(EVENT_EARTHEN_RING_ATTACK, 10000, 0, PHASE_ONE); me->SetReactState(REACT_AGGRESSIVE); me->setFaction(14); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); me->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); DoCastVictim(SPELL_RESURFACE); // despawn core summons.DespawnEntry(NPC_FROZEN_CORE); } break; case EVENT_COLD_SLAP: if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0, 8.0f, true)) { DoCast(target, SPELL_COLD_SLAP); Position targetPos; target->GetNearPosition(targetPos, float(rand_norm()) * 5.0f + 35.0f, me->GetAngle(target)); target->GetMotionMaster()->MoveJump(targetPos.GetPositionX(), targetPos.GetPositionY(), targetPos.GetPositionZ(), target->GetExactDist2d(targetPos.GetPositionX(), targetPos.GetPositionY()), 10.0f); } events.ScheduleEvent(EVENT_COLD_SLAP, 500, 0, PHASE_ONE); break; case EVENT_ICE_SPEAR: // FIXME: should make use of all the proper spells... if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 120.0f, true)) { target->CastSpell(target, SPELL_ICESPEAR_SUMMON_BUNNY); target->CastSpell(target, SPELL_ICESPEAR_SUMMON_GO); events.ScheduleEvent(EVENT_ICE_SPEAR_KNOCKBACK, 2000); } events.ScheduleEvent(EVENT_ICE_SPEAR, 7000, 0, PHASE_ONE); break; case EVENT_ICE_SPEAR_KNOCKBACK: if (GameObject* go = me->FindNearestGameObject(GO_ICE_SPEAR, 120.0f)) { go->UseDoorOrButton(); Map::PlayerList const& playerList = me->GetMap()->GetPlayers(); if (!playerList.isEmpty()) for (Map::PlayerList::const_iterator i = playerList.begin(); i != playerList.end(); ++i) if (i->getSource() && go->GetDistance(i->getSource()) <= 2.0f) i->getSource()->CastSpell(i->getSource(), SPELL_ICESPEAR_KNOCKBACK); go->Delete(); } break; case EVENT_SUMMON_HAILSTONE: me->SummonCreature(NPC_AHUNITE_HAILSTONE, SummonPositions[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); break; case EVENT_SUMMON_COLDWEAVE: // they always come in pairs of two me->SummonCreature(NPC_AHUNITE_COLDWEAVE, SummonPositions[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); me->SummonCreature(NPC_AHUNITE_COLDWEAVE, SummonPositions[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); events.ScheduleEvent(EVENT_SUMMON_COLDWEAVE, 5000, 0, PHASE_ONE); break; case EVENT_SUMMON_FROSTWIND: // not in first phase 1 me->SummonCreature(NPC_AHUNITE_FROSTWIND, SummonPositions[urand(2,3)], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 3000); events.ScheduleEvent(EVENT_SUMMON_FROSTWIND, 7000, 0, PHASE_ONE); break; case EVENT_EARTHEN_RING_ATTACK: if (Creature* totem = me->FindNearestCreature(NPC_EARTHEN_RING_TOTEM, 200.0f)) { totem->CastSpell(me, SPELL_BEAM_ATTACK, false); totem->CastSpell(me, SPELL_BEAM_ATTACK_BEAM, false); } events.ScheduleEvent(EVENT_EARTHEN_RING_ATTACK, 10000, 0, PHASE_ONE); break; } } DoMeleeAttackIfReady(); }
void SetData(uint32 uiType, uint32 uiData) { switch(uiType) { case TYPE_BARON_RUN: switch(uiData) { case IN_PROGRESS: if (m_auiEncounter[0] == IN_PROGRESS || m_auiEncounter[0] == FAIL) break; m_uiBaronRun_Timer = 2700000; debug_log("SD2: Instance Stratholme: Baron run in progress."); break; case FAIL: //may add code to remove aura from players, but in theory the time should be up already and removed. break; case DONE: if (Creature* pYsidaT = instance->GetCreature(m_uiYsidaTriggerGUID)) pYsidaT->SummonCreature(NPC_YSIDA, pYsidaT->GetPositionX(),pYsidaT->GetPositionY(),pYsidaT->GetPositionZ(),pYsidaT->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN,1800000); m_uiBaronRun_Timer = 0; break; } m_auiEncounter[0] = uiData; break; case TYPE_BARONESS: m_auiEncounter[1] = uiData; if (uiData == IN_PROGRESS) UpdateGoState(m_uiZiggurat1GUID,GO_STATE_ACTIVE,false); if (uiData == IN_PROGRESS) //change to DONE when crystals implemented StartSlaugtherSquare(); break; case TYPE_NERUB: m_auiEncounter[2] = uiData; if (uiData == IN_PROGRESS) UpdateGoState(m_uiZiggurat2GUID,GO_STATE_ACTIVE,false); if (uiData == IN_PROGRESS) //change to DONE when crystals implemented StartSlaugtherSquare(); break; case TYPE_PALLID: m_auiEncounter[3] = uiData; if (uiData == IN_PROGRESS) UpdateGoState(m_uiZiggurat3GUID,GO_STATE_ACTIVE,false); if (uiData == IN_PROGRESS) //change to DONE when crystals implemented StartSlaugtherSquare(); break; case TYPE_RAMSTEIN: if (uiData == IN_PROGRESS) { if (m_auiEncounter[4] != IN_PROGRESS) UpdateGoState(m_uiPortGauntletGUID,GO_STATE_READY,false); uint32 uiCount = abomnationGUID.size(); for(std::set<uint64>::iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i) { if (Creature* pAbom = instance->GetCreature(*i)) { if (!pAbom->isAlive()) --uiCount; } } if (!uiCount) { //a bit itchy, it should close the door after 10 secs, but it doesn't. skipping it for now. //UpdateGoState(ziggurat4GUID,0,true); if (Creature* pBaron = instance->GetCreature(m_uiBaronGUID)) pBaron->SummonCreature(NPC_RAMSTEIN, 4032.84f, -3390.24f, 119.73f, 4.71f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000); debug_log("SD2: Instance Stratholme: Ramstein spawned."); } else debug_log("SD2: Instance Stratholme: %u Abomnation left to kill.", uiCount); } if (uiData == DONE) { m_uiSlaugtherSquare_Timer = 30000; debug_log("SD2: Instance Stratholme: Slaugther event will continue in 5 minutes."); } m_auiEncounter[4] = uiData; break; case TYPE_BARON: if (uiData == IN_PROGRESS) { if (GetData(TYPE_BARON_RUN) == IN_PROGRESS) { 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()) { if (pPlayer->HasAura(SPELL_BARON_ULTIMATUM)) pPlayer->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM); if (pPlayer->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE) pPlayer->AreaExploredOrEventHappens(QUEST_DEAD_MAN_PLEA); } } } SetData(TYPE_BARON_RUN,DONE); } } if (uiData == DONE) { UpdateGoState(m_uiSlaughterGate1GUID,GO_STATE_ACTIVE,false); UpdateGoState(m_uiSlaughterGate2GUID,GO_STATE_ACTIVE,false); } m_auiEncounter[5] = uiData; break; case TYPE_SH_AELMAR: IsSilverHandDead[0] = (uiData) ? true : false; break; case TYPE_SH_CATHELA: IsSilverHandDead[1] = (uiData) ? true : false; break; case TYPE_SH_GREGOR: IsSilverHandDead[2] = (uiData) ? true : false; break; case TYPE_SH_NEMAS: IsSilverHandDead[3] = (uiData) ? true : false; break; case TYPE_SH_VICAR: IsSilverHandDead[4] = (uiData) ? true : false; break; } }
void UpdateAI(uint32 const diff) { if (!UpdateVictim()) return; _events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) { switch (eventId) { case EVENT_RESONATING: DoCast(me, SPELL_RESONATING_CRYSTAL_AURA); _events.ScheduleEvent(EVENT_RESONATING, 100); break; case EVENT_EXPLODE: { count = 0; Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (i->getSource()->isAlive()) { if (me->GetExactDist(i->getSource()) < 3.0f) { count++; } } } } if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (i->getSource()->isAlive()) { if (count == 0) { DoCast(i->getSource(), SPELL_DANGER); i->getSource()->RemoveAurasDueToSpell(SPELL_WARNING); i->getSource()->RemoveAurasDueToSpell(SPELL_SAFE); } else if (count == 1) { DoCast(i->getSource(), SPELL_DANGER); i->getSource()->RemoveAurasDueToSpell(SPELL_WARNING); i->getSource()->RemoveAurasDueToSpell(SPELL_SAFE); } else if (count == 2) { DoCast(i->getSource(), SPELL_WARNING); i->getSource()->RemoveAurasDueToSpell(SPELL_DANGER); i->getSource()->RemoveAurasDueToSpell(SPELL_SAFE); } else { DoCast(i->getSource(), SPELL_SAFE); i->getSource()->RemoveAurasDueToSpell(SPELL_WARNING); i->getSource()->RemoveAurasDueToSpell(SPELL_DANGER); _events.ScheduleEvent(EVENT_DESPAWN, 2000); } } } } _events.ScheduleEvent(EVENT_EXPLODE, 500); break; } case EVENT_ANTI_EXPLODE: { Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (i->getSource()->isAlive()) { i->getSource()->RemoveAurasDueToSpell(SPELL_SAFE); i->getSource()->RemoveAurasDueToSpell(SPELL_WARNING); i->getSource()->RemoveAurasDueToSpell(SPELL_DANGER); } } } DoCast(me, SPELL_RESONATING_CRYSTAL_EX); _events.ScheduleEvent(EVENT_ANTI_EXPLODE, 11900); break; } case EVENT_DESPAWN: { Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers(); if (!PlayerList.isEmpty()) { for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { if (i->getSource()->isAlive()) { i->getSource()->RemoveAurasDueToSpell(SPELL_SAFE); i->getSource()->RemoveAurasDueToSpell(SPELL_WARNING); i->getSource()->RemoveAurasDueToSpell(SPELL_DANGER); } } } me->DespawnOrUnsummon(); _events.ScheduleEvent(EVENT_DESPAWN, 12000); break; } default: break; } } DoMeleeAttackIfReady(); }
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(); }
void CreatureTextMgr::SendChatPacket(WorldPacket *data, WorldObject* source, ChatType msgtype, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const { if (!source) return; float dist = sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY); switch (msgtype) { case CHAT_TYPE_YELL: dist = sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL); break; case CHAT_TYPE_BOSS_EMOTE: case CHAT_TYPE_TEXT_EMOTE: dist = sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE); break; case CHAT_TYPE_WHISPER: case CHAT_TYPE_BOSS_WHISPER: { if (range == TEXT_RANGE_NORMAL)//ignores team and gmOnly { Player *player = sObjectMgr->GetPlayer(whisperGuid); if (!player || !player->GetSession()) return; player->GetSession()->SendPacket(data); return; } } break; case CHAT_TYPE_SAY://default dist default: break; } switch (range) { case TEXT_RANGE_AREA: { uint32 areaId = source->GetAreaId(); Map::PlayerList const& pList = source->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) if (itr->getSource()->GetAreaId() == areaId && (!team || Team(itr->getSource()->GetTeam()) == team) && (!gmOnly || itr->getSource()->isGameMaster())) { if (data->GetOpcode() == SMSG_MESSAGECHAT)//override whisperguid with actual player's guid data->put<uint64>(1+4+8+4+4+(int32)(strlen(source->GetName())+1), uint64(itr->getSource()->GetGUID())); (itr->getSource())->GetSession()->SendPacket(data); } } return; case TEXT_RANGE_ZONE: { uint32 zoneId = source->GetZoneId(); Map::PlayerList const& pList = source->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) if (itr->getSource()->GetZoneId() == zoneId && (!team || Team(itr->getSource()->GetTeam()) == team) && (!gmOnly || itr->getSource()->isGameMaster())) { if (data->GetOpcode() == SMSG_MESSAGECHAT)//override whisperguid with actual player's guid data->put<uint64>(1+4+8+4+4+(int32)(strlen(source->GetName())+1), uint64(itr->getSource()->GetGUID())); (itr->getSource())->GetSession()->SendPacket(data); } } return; case TEXT_RANGE_MAP: { Map::PlayerList const& pList = source->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) { if (data->GetOpcode() == SMSG_MESSAGECHAT)//override whisperguid with actual player's guid data->put<uint64>(1+4+8+4+4+(int32)(strlen(source->GetName())+1), uint64(itr->getSource()->GetGUID())); if ((!team || Team(itr->getSource()->GetTeam()) == team) && (!gmOnly || itr->getSource()->isGameMaster())) (itr->getSource())->GetSession()->SendPacket(data); } } return; case TEXT_RANGE_WORLD: { const SessionMap smap = sWorld->GetAllSessions(); for (SessionMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter) { if (Player* plr = (*iter).second->GetPlayer()) { if (data->GetOpcode() == SMSG_MESSAGECHAT)//override whisperguid with actual player's guid data->put<uint64>(1+4+8+4+4+(int32)(strlen(source->GetName())+1), uint64(plr->GetGUID())); if (plr->GetSession() && (!team || Team(plr->GetTeam()) == team) && (!gmOnly || plr->isGameMaster())) plr->GetSession()->SendPacket(data); } } } return; case TEXT_RANGE_NORMAL: default: break; } source->SendMessageToSetInRange(data, dist, true); }
void instance_naxxramas::SetData(uint32 uiType, uint32 uiData) { switch(uiType) { case TYPE_ANUB_REKHAN: m_auiEncounter[0] = uiData; DoUseDoorOrButton(m_uiAnubDoorGUID); if (uiData == DONE) DoUseDoorOrButton(m_uiAnubGateGUID); break; case TYPE_FAERLINA: m_auiEncounter[1] = uiData; DoUseDoorOrButton(m_uiFaerWebGUID); if (uiData == DONE) { DoUseDoorOrButton(m_uiFaerDoorGUID); DoUseDoorOrButton(m_uiMaexOuterGUID); } break; case TYPE_MAEXXNA: m_auiEncounter[2] = uiData; DoUseDoorOrButton(m_uiMaexInnerGUID, uiData); if (uiData == DONE) { DoUseDoorOrButton(m_uiAracEyeRampGUID); DoRespawnGameObject(m_uiAracPortalGUID, 30*MINUTE); } break; case TYPE_NOTH: m_auiEncounter[3] = uiData; DoUseDoorOrButton(m_uiNothEntryDoorGUID); if (uiData == DONE) { DoUseDoorOrButton(m_uiNothExitDoorGUID); DoUseDoorOrButton(m_uiHeigEntryDoorGUID); } break; case TYPE_HEIGAN: m_auiEncounter[4] = uiData; DoUseDoorOrButton(m_uiHeigEntryDoorGUID); if (uiData == DONE) DoUseDoorOrButton(m_uiHeigExitDoorGUID); break; case TYPE_LOATHEB: m_auiEncounter[5] = uiData; DoUseDoorOrButton(m_uiLoathebDoorGUID); if (uiData == DONE) { DoUseDoorOrButton(m_uiPlagEyeRampGUID); DoRespawnGameObject(m_uiPlagPortalGUID, 30*MINUTE); } break; case TYPE_RAZUVIOUS: m_auiEncounter[6] = uiData; if (uiData == DONE) DoUseDoorOrButton(m_uiGothikEntryDoorGUID); break; case TYPE_GOTHIK: switch(uiData) { case IN_PROGRESS: DoUseDoorOrButton(m_uiGothikEntryDoorGUID); DoUseDoorOrButton(m_uiGothCombatGateGUID); break; case SPECIAL: DoUseDoorOrButton(m_uiGothCombatGateGUID); break; case FAIL: if (m_auiEncounter[7] == IN_PROGRESS) DoUseDoorOrButton(m_uiGothCombatGateGUID); DoUseDoorOrButton(m_uiGothikEntryDoorGUID); break; case DONE: DoUseDoorOrButton(m_uiGothikEntryDoorGUID); DoUseDoorOrButton(m_uiGothikExitDoorGUID); DoUseDoorOrButton(m_uiHorsemenDoorGUID); break; } m_auiEncounter[7] = uiData; break; case TYPE_FOUR_HORSEMEN: m_auiEncounter[8] = uiData; DoUseDoorOrButton(m_uiHorsemenDoorGUID); if (uiData == DONE) { DoUseDoorOrButton(m_uiMiliEyeRampGUID); DoRespawnGameObject(m_uiMiliPortalGUID, 30*MINUTE); DoRespawnGameObject(m_uiHorsemenChestGUID, 30*MINUTE); } break; case TYPE_PATCHWERK: m_auiEncounter[9] = uiData; if (uiData == DONE) DoUseDoorOrButton(m_uiPathExitDoorGUID); break; case TYPE_GROBBULUS: m_auiEncounter[10] = uiData; break; case TYPE_GLUTH: m_auiEncounter[11] = uiData; if (uiData == DONE) { DoUseDoorOrButton(m_uiGlutExitDoorGUID); DoUseDoorOrButton(m_uiThadDoorGUID); } break; case TYPE_THADDIUS: m_auiEncounter[12] = uiData; DoUseDoorOrButton(m_uiThadDoorGUID, uiData); if (uiData == DONE) { DoUseDoorOrButton(m_uiConsEyeRampGUID); DoRespawnGameObject(m_uiConsPortalGUID, 30*MINUTE); } break; case TYPE_SAPPHIRON: m_auiEncounter[13] = uiData; if (uiData == DONE) DoUseDoorOrButton(m_uiKelthuzadDoorGUID); break; case TYPE_KELTHUZAD: switch(uiData) { case SPECIAL: { Map::PlayerList const& lPlayers = instance->GetPlayers(); if (lPlayers.isEmpty()) return; bool bCanBegin = true; for(Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr) { if (Player* pPlayer = itr->getSource()) { if (!pPlayer->IsWithinDist2d(m_fChamberCenterX, m_fChamberCenterY, 15.0f)) bCanBegin = false; } } if (bCanBegin) m_auiEncounter[14] = IN_PROGRESS; break; } case FAIL: m_auiEncounter[14] = NOT_STARTED; break; default: m_auiEncounter[14] = uiData; break; } 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]; strInstData = saveStream.str(); SaveToDB(); OUT_SAVE_INST_DATA_COMPLETE; } }
void UpdateAI(const uint32 uiDiff) { //Return since we have no target if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (m_bIsAchievInTime && (m_uiAchievTimer < uiDiff)) { m_bIsAchievInTime = false; m_uiAchievTimer = 120000; }else m_uiAchievTimer -= uiDiff; if (m_bIsAura) { // workaround for PULSING_SHOCKWAVE if (m_uiPulsingShockwave_Timer < uiDiff) { Map *map = m_creature->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()->isTargetableForAttack()) { int32 dmg; float m_fDist = m_creature->GetDistance(i->getSource()); if (m_fDist <= 1.0f) // Less than 1 yard dmg = (m_bIsRegularMode ? 800 : 850); // need to correct damage else // Further from 1 yard dmg = round((m_bIsRegularMode ? 200 : 250) * m_fDist) + (m_bIsRegularMode ? 800 : 850); // need to correct damage m_creature->CastCustomSpell(i->getSource(), (m_bIsRegularMode ? 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? //m_creature->CastSpell(m_creature, SPELL_PULSING_SHOCKWAVE_AURA, true); //DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_PULSING_SHOCKWAVE_N : SPELL_PULSING_SHOCKWAVE_H); // need core support m_bIsAura = true; m_uiResumePulsingShockwave_Timer = 0; } else m_uiResumePulsingShockwave_Timer -= uiDiff; } if (m_uiArcLightning_Timer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) DoCastSpellIfCan(pTarget, SPELL_ARC_LIGHTNING); m_uiArcLightning_Timer = urand(15000, 16000); } else m_uiArcLightning_Timer -= uiDiff; if (m_uiLightningNova_Timer < uiDiff) { switch(urand(0, 2)) { 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; } DoCastSpellIfCan(m_creature, m_bIsRegularMode ? SPELL_LIGHTNING_NOVA_N : SPELL_LIGHTNING_NOVA_H); m_bIsAura = false; m_uiResumePulsingShockwave_Timer = (m_bIsRegularMode ? 5000 : 4000); // Pause Pulsing Shockwave aura m_uiLightningNova_Timer = urand(20000, 21000); } else m_uiLightningNova_Timer -= uiDiff; // Health check if (m_creature->GetHealthPercent() < float(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(); }
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); go->SetPhaseMask(1, true); } 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); timerVisible = true; 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, (uint32)pow(2.0f, index)); } } break; case DATA_CRATE_COUNT: _crateCount = data; DoUpdateWorldState(WORLDSTATE_CRATES_REVEALED, _crateCount); if (_crateCount == 5) { if (Creature* bunny = instance->GetCreature(_genericBunnyGUID)) bunny->CastSpell(bunny, SPELL_CRATES_CREDIT, true); // Summon Chromie and global whisper if (Creature* chromie = instance->SummonCreature(NPC_CHROMIE_2, ChromieSummonPos)) 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_ZONE); DoUpdateWorldState(WORLDSTATE_SHOW_CRATES, 0); if(Creature* crier = instance->GetCreature(_lordaeronCrierGUID)) crier->YellToZone(-1595053, LANG_UNIVERSAL, 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()); risenZombie->SetRespawnTime(60); risenZombie->GetMotionMaster()->MoveRandom(10.0f); } citizen->SetPhaseMask(2, true); } break; } break; case DATA_ZOMBIEFEST: if(!instance->IsHeroic() || GetData(DATA_ZOMBIEFEST) == DONE) break; switch(data) { case DONE: //DoCompleteAchievement(ACHIEVEMENT_ZOMBIEFEST); _zombieFest = data; break; case IN_PROGRESS: _zombieFest = data; break; case FAIL: _killedZombieCount = 0; _zombieTimer = 60000; _zombieFest = data; DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_CREATURE, ACHIEVEMENT_ZOMBIEFEST); break; case SPECIAL: _killedZombieCount++; DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, 27737, 1); if(_killedZombieCount == 1) { SetData(DATA_ZOMBIEFEST, IN_PROGRESS); DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_CREATURE, ACHIEVEMENT_ZOMBIEFEST); } else if(_killedZombieCount >= 100 && GetData(DATA_ZOMBIEFEST) == IN_PROGRESS) SetData(DATA_ZOMBIEFEST, DONE); //else //{ //if(_killedZombieCount%10 == 0); //} break; } break; case DATA_ARTHAS_STEP: _artasStepUi = data; return; case DATA_SKIP: _skipUi = data; } if (data == DONE) SaveToDB(); }
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 && me->GetHealth() * 4 < me->GetMaxHealth()) 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 (100 * me->GetHealth() < 35 * me->GetMaxHealth()) { 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; } if (ResetTimer <= diff) { float x, y, z, o; me->GetHomePosition(x, y, z, o); if (me->GetPositionZ() <= z-7) { EnterEvadeMode(); return; } ResetTimer = 5000; } else ResetTimer -= diff; DoMeleeAttackIfReady(); if (FireBreathTimer <= diff) { if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) { me->AttackStop(); me->GetMotionMaster()->Clear(); me->SetInFront(pTarget); DoCast(pTarget, SPELL_FLAME_BREATH, false); me->StopMoving(); isFlameBreathing = true; } FireBreathTimer = 8000; } else FireBreathTimer -= diff; }
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->ToCreature()->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 = 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); } } } 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); }*/ } } }
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; } }
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; } }