void WaypointReached(uint32 uiPointId) override { switch (uiPointId) { case 24: DoScriptText(SAY_PREPARE, m_creature); break; case 25: DoScriptText(SAY_CAMP_ENTER, m_creature); SetRun(false); break; case 46: // despawn the Ark if (GameObject* pArk = GetClosestGameObjectWithEntry(m_creature, GO_ARK_OF_SSSLITH, 10.0f)) pArk->SetLootState(GO_JUST_DEACTIVATED); // spawn npcs m_creature->SummonCreature(NPC_ENCHANTRESS, 526.12f, 8136.96f, 21.64f, 0.57f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000); m_creature->SummonCreature(NPC_SLAVEDRIVER, 524.09f, 8138.67f, 21.49f, 0.58f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000); m_creature->SummonCreature(NPC_SLAVEDRIVER, 526.93f, 8133.88f, 21.56f, 0.58f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000); break; case 70: DoScriptText(SAY_AMBUSH, m_creature); // spawn npcs m_bIsAmbush = true; m_creature->SummonCreature(NPC_SSSLITH, 162.91f, 8192.08f, 22.55f, 5.98f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000); m_creature->SummonCreature(NPC_ENCHANTRESS, 162.34f, 8193.99f, 22.85f, 5.98f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000); m_creature->SummonCreature(NPC_SLAVEDRIVER, 163.07f, 8187.04f, 22.71f, 0.10f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000); SetEscortPaused(true); break; case 71: DoScriptText(SAY_AMBUSH_CLEARED, m_creature); SetRun(); break; case 92: SetRun(false); break; case 93: DoScriptText(SAY_ESCORT_COMPLETE, m_creature); if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_ID_FHWOOR_SMASH, m_creature); break; } }
void WaypointStart(uint32 uiPointId) { switch (uiPointId) { case 0: { GameObject* pCage = NULL; if (m_uiGalensCageGUID) pCage = me->GetMap()->GetGameObject(m_uiGalensCageGUID); else pCage = GetClosestGameObjectWithEntry(me, GO_GALENS_CAGE, INTERACTION_DISTANCE); if (pCage) { pCage->UseDoorOrButton(); m_uiGalensCageGUID = pCage->GetGUID(); } break; } case 21: DoScriptText(EMOTE_DISAPPEAR, me); break; } }
bool EffectDummy(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Object* pTarget, ObjectGuid /*originalCasterGuid*/) override { if (uiEffIndex == EFFECT_INDEX_0) { Creature *pCreatureTarget = pTarget->ToCreature(); if (!pCreatureTarget || pCreatureTarget->GetEntry() != NPC_SMOLDERING_SCRAP_BUNNY) return true; if (GameObject* pScrap = GetClosestGameObjectWithEntry(pCreatureTarget, GO_SMOLDERING_SCRAP, 5.0f)) { if (pScrap->GetRespawnTime() != 0) return true; pCreatureTarget->CastSpell(pCreatureTarget, SPELL_FROZEN_IRON_SCRAP, true); pScrap->SetLootState(GO_JUST_DEACTIVATED); pCreatureTarget->ForcedDespawn(1000); } } return true; }
void MovementInform(uint32 uiType, uint32 uiPointId) override { if (uiType != POINT_MOTION_TYPE || !uiPointId) return; if (GameObject* pTrap = m_creature->GetMap()->GetGameObject(m_trapGuid)) { // respawn the Quality Fur if (GameObject* pGoFur = GetClosestGameObjectWithEntry(pTrap, GO_QUALITY_FUR, INTERACTION_DISTANCE)) { if (!pGoFur->isSpawned()) { pGoFur->SetRespawnTime(10); pGoFur->Refresh(); } } } m_uiPhaseTimer = 2000; }
bool EffectAuraDummy_spell_aura_dummy_crystal_spike_visual(const Aura* pAura, bool bApply) { if (pAura->GetId() == SPELL_CRYSTAL_SPIKE_PRE && pAura->GetEffIndex() == EFFECT_INDEX_0 && !bApply) { if (Creature* pTarget = (Creature*)pAura->GetTarget()) { if (pTarget->GetEntry() != NPC_CRYSTAL_SPIKE_TRIGGER) return true; // Use the Spike gameobject so we can summon the npc which actual does the damage if (GameObject* pSpike = GetClosestGameObjectWithEntry(pTarget, GO_CRYSTAL_SPIKE, 10.0f)) { pSpike->Use(pTarget); // Note: the following command should be handled in core by the trap GO code pSpike->SetLootState(GO_JUST_DEACTIVATED); } } } return true; }
void MoveInLineOfSight(Unit* who) { if (!who) return; if (Phase == IDLE && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 40)) { Phase = INTRO; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (GameObject* mirror = GetClosestGameObjectWithEntry(me, OBJECT_UTGARDE_MIRROR, 100.0f)) mirror->SetGoState(GO_STATE_READY); if (Creature* arthas = me->SummonCreature(CREATURE_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN)) { arthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); arthasGUID = arthas->GetGUID(); } } }
void WaypointReached(uint32 uiPointId) override { switch (uiPointId) { case 5: DoScriptText(SAY_STINKY_FIRST_STOP, m_creature); break; case 10: DoScriptText(SAY_STINKY_SECOND_STOP, m_creature); break; case 24: DoScriptText(SAY_STINKY_THIRD_STOP_1, m_creature); break; case 25: DoScriptText(SAY_STINKY_THIRD_STOP_2, m_creature); if (GameObject* pBogbeanPlant = GetClosestGameObjectWithEntry(m_creature, GO_BOGBEAN_PLANT, DEFAULT_VISIBILITY_DISTANCE)) { m_bogbeanPlantGuid = pBogbeanPlant->GetObjectGuid(); m_creature->SetFacingToObject(pBogbeanPlant); } break; case 26: if (Player* pPlayer = GetPlayerForEscort()) DoScriptText(SAY_STINKY_THIRD_STOP_3, m_creature, pPlayer); break; case 29: m_creature->HandleEmote(EMOTE_STATE_USESTANDING); break; case 30: DoScriptText(SAY_STINKY_PLANT_GATHERED, m_creature); break; case 39: if (Player* pPlayer = GetPlayerForEscort()) { pPlayer->GroupEventHappens(pPlayer->GetTeam() == ALLIANCE ? QUEST_ID_STINKYS_ESCAPE_ALLIANCE : QUEST_ID_STINKYS_ESCAPE_HORDE, m_creature); DoScriptText(SAY_STINKY_END, m_creature, pPlayer); } break; } }
void UpdateAI(const uint32 uiDiff) { npc_escortAI::UpdateAI(uiDiff); if (bTake) { if (uiTakeTimer < uiDiff) { me->HandleEmoteCommand(EMOTE_STATE_NONE); if (GameObject* pGO = GetClosestGameObjectWithEntry(me, GO_DRAENEI_MACHINE, INTERACTION_DISTANCE)) { SetEscortPaused(false); bTake=false; uiTakeTimer = 3000; pGO->Delete(); } } else uiTakeTimer -= uiDiff; } DoMeleeAttackIfReady(); }
void Reset() { m_uiFieryCombustionTimer = 15000; m_uiMeteorStrikeTimer = 30000; m_uiFlameBreathTimer = 15000; m_uiBerserkTimer = 6000000; m_uiTailLashTimer = 10000; if (pInstance->instance->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) isMode25 = false; else isMode25 = true; bIntro = false; if (pInstance) pInstance->SetData(DATA_HALION_EVENT, NOT_STARTED); GameObject *pGOTemp = GetClosestGameObjectWithEntry(me, 7999000, 100.0f); if(pGOTemp) pGOTemp->RemoveFromWorld(); }
bool EffectDummy(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Object* pTarget, ObjectGuid /*originalCasterGuid*/) override { if (uiSpellId == SPELL_EXPOSE_RAZORTHORN_ROOT && uiEffIndex == EFFECT_INDEX_0) { if (pTarget->GetEntry() != NPC_RAZORTHORN_RAVAGER) { return true; } if (GameObject* pMound = GetClosestGameObjectWithEntry(pTarget->ToCreature(), GO_RAZORTHORN_DIRT_MOUND, 20.0f)) { if (pMound->GetRespawnTime() != 0) { return true; } pTarget->ToCreature()->CastSpell(pTarget->ToCreature(), SPELL_SUMMON_RAZORTHORN_ROOT, true); pMound->SetLootState(GO_JUST_DEACTIVATED); } } return true; }
void WaypointStart(uint32 uiPointId) { switch (uiPointId) { case 0: { GameObject* cage = NULL; if (galensCageGUID) cage = me->GetMap()->GetGameObject(galensCageGUID); else cage = GetClosestGameObjectWithEntry(me, GO_GALENS_CAGE, INTERACTION_DISTANCE); if (cage) { cage->UseDoorOrButton(); galensCageGUID = cage->GetGUID(); } break; } case 21: Talk(EMOTE_DISAPPEAR); break; } }
bool KnotQuestRewarded(Player*, Creature* cr, Quest const* quest) { if((quest->GetQuestId() != 5525 && quest->GetQuestId() != 7429) || cr->GetEntry() != 14338) { return false; } if(cr->GetInstanceData() == nullptr) return false; bool spawned = ((ScriptedInstance*)cr->GetInstanceData())->GetData(TYPE_KNOT_CHEST) == DONE; if(spawned) return false; auto existing = GetClosestGameObjectWithEntry(cr, GO_KNOTS_CACHE, 100.0f); if(existing) { return false; } cr->SummonObject(cr->GetMap(), GO_KNOTS_CACHE, 583.688f, 523.646f, -25.401f, 1.545f); return true; }
void WaypointStarted(uint32 uiPointId, uint32 /*pathId*/) override { switch (uiPointId) { case 0: { GameObject* cage = nullptr; if (galensCageGUID) cage = ObjectAccessor::GetGameObject(*me, galensCageGUID); else cage = GetClosestGameObjectWithEntry(me, GO_GALENS_CAGE, INTERACTION_DISTANCE); if (cage) { cage->UseDoorOrButton(); galensCageGUID = cage->GetGUID(); } break; } case 21: Talk(EMOTE_DISAPPEAR); break; } }
//"opens" the portal and does the "opening" whisper void DoOpenPortal() { // there are 4 portal spawn locations, each are expected to be spawned with negative spawntimesecs in database // using a grid search here seem to be more efficient than caching all four guids // in instance script and calculate range to each. GameObject* pPortal = GetClosestGameObjectWithEntry(m_creature, GO_TWILIGHT_PORTAL, 50.0f); DoScriptText(EMOTE_OPEN_PORTAL, m_creature); // By using SetRespawnTime() we will actually "spawn" the object with our defined time. // Once time is up, portal will disappear again. if (pPortal && !pPortal->isSpawned()) { pPortal->SetRespawnTime(HOUR * IN_MILLISECONDS); pPortal->Refresh(); } // set portal status as active when Sartharion is in progress if (m_pInstance && m_pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS) m_pInstance->SetPortalStatus(m_uiPortalId, true); // Unclear what are expected to happen if one drake has a portal open already // Refresh respawnTime so time again are set to 30secs? }
bool GOUse_go_caribou_trap(Player* pPlayer, GameObject* pGo) { float fX, fY, fZ; pGo->GetClosePoint(fX, fY, fZ, pGo->GetObjectBoundingRadius(), 2*INTERACTION_DISTANCE, frand(0, M_PI_F*2)); if (Creature* pCreature = pGo->SummonCreature(NPC_NESINGWARY_TRAPPER, fX, fY, fZ, pGo->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10000)) { if (npc_nesingwary_trapperAI* pTrapperAI = dynamic_cast<npc_nesingwary_trapperAI*>(pCreature->AI())) pTrapperAI->StartAction(pPlayer, pGo); pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); if (GameObject* pGoFur = GetClosestGameObjectWithEntry(pGo, GO_QUALITY_FUR, INTERACTION_DISTANCE)) { if (!pGoFur->isSpawned()) { pGoFur->SetRespawnTime(10); pGoFur->Refresh(); } } } return true; }
void UpdateEscortAI(const uint32 uiDiff) override { if (HasEscortState(STATE_ESCORT_PAUSED)) { if (m_uiRitualTimer < uiDiff) { switch (m_uiRitualPhase) { case 0: DoCastSpellIfCan(m_creature, SPELL_IDOL_SHUTDOWN); m_uiRitualTimer = 1000; break; case 1: DoSummonSpawner(irand(1, 3)); m_uiRitualTimer = 39000; break; case 2: DoSummonSpawner(irand(1, 3)); m_uiRitualTimer = 20000; break; case 3: DoScriptText(SAY_BELNISTRASZ_3_MIN, m_creature, m_creature); m_uiRitualTimer = 20000; break; case 4: DoSummonSpawner(irand(1, 3)); m_uiRitualTimer = 40000; break; case 5: DoSummonSpawner(irand(1, 3)); DoScriptText(SAY_BELNISTRASZ_2_MIN, m_creature, m_creature); m_uiRitualTimer = 40000; break; case 6: DoSummonSpawner(irand(1, 3)); m_uiRitualTimer = 20000; break; case 7: DoScriptText(SAY_BELNISTRASZ_1_MIN, m_creature, m_creature); m_uiRitualTimer = 40000; break; case 8: DoSummonSpawner(irand(1, 3)); m_uiRitualTimer = 20000; break; case 9: DoScriptText(SAY_BELNISTRASZ_FINISH, m_creature, m_creature); m_uiRitualTimer = 3000; break; case 10: { if (Player* pPlayer = GetPlayerForEscort()) { pPlayer->GroupEventHappens(QUEST_EXTINGUISHING_THE_IDOL, m_creature); if (GameObject* pGo = GetClosestGameObjectWithEntry(m_creature, GO_BELNISTRASZ_BRAZIER, 10.0f)) { if (!pGo->isSpawned()) { pGo->SetRespawnTime(HOUR * IN_MILLISECONDS); pGo->Refresh(); } } } m_creature->RemoveAurasDueToSpell(SPELL_IDOL_SHUTDOWN); SetEscortPaused(false); break; } } ++m_uiRitualPhase; } else { m_uiRitualTimer -= uiDiff; } return; } if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) { return; } if (m_uiFireballTimer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_FIREBALL); m_uiFireballTimer = urand(2000, 3000); } else { m_uiFireballTimer -= uiDiff; } if (m_uiFrostNovaTimer < uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_FROST_NOVA); m_uiFrostNovaTimer = urand(10000, 15000); } else { m_uiFrostNovaTimer -= uiDiff; } DoMeleeAttackIfReady(); }
bool EffectDummyCreature_spell_dummy_npc(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Creature* pCreatureTarget, ObjectGuid /*originalCasterGuid*/) { switch (uiSpellId) { case SPELL_ADMINISTER_ANTIDOTE: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCreatureTarget->GetEntry() != NPC_HELBOAR) return true; // possible needs check for quest state, to not have any effect when quest really complete pCreatureTarget->UpdateEntry(NPC_DREADTUSK); return true; } return true; } case SPELL_APPLY_SALVE: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCaster->GetTypeId() != TYPEID_PLAYER) return true; if (pCreatureTarget->GetEntry() != NPC_SICKLY_DEER && pCreatureTarget->GetEntry() != NPC_SICKLY_GAZELLE) return true; // Update entry, remove aura, set the kill credit and despawn uint32 uiUpdateEntry = pCreatureTarget->GetEntry() == NPC_SICKLY_DEER ? NPC_CURED_DEER : NPC_CURED_GAZELLE; pCreatureTarget->RemoveAurasDueToSpell(SPELL_SICKLY_AURA); pCreatureTarget->UpdateEntry(uiUpdateEntry); ((Player*)pCaster)->KilledMonsterCredit(uiUpdateEntry); pCreatureTarget->ForcedDespawn(20000); return true; } return true; } case SPELL_INOCULATE_OWLKIN: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCreatureTarget->GetEntry() != NPC_OWLKIN) return true; pCreatureTarget->UpdateEntry(NPC_OWLKIN_INOC); ((Player*)pCaster)->KilledMonsterCredit(NPC_OWLKIN_INOC); // set despawn timer, since we want to remove creature after a short time pCreatureTarget->ForcedDespawn(15000); return true; } return true; } case SPELL_FEL_SIPHON_DUMMY: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCreatureTarget->GetEntry() != NPC_FELBLOOD_INITIATE) return true; pCreatureTarget->UpdateEntry(NPC_EMACIATED_FELBLOOD); return true; } return true; } case SPELL_SACRED_CLEANSING: { if (uiEffIndex == EFFECT_INDEX_1) { if (pCreatureTarget->GetEntry() != NPC_MORBENT) return true; pCreatureTarget->UpdateEntry(NPC_WEAKENED_MORBENT); return true; } return true; } case SPELL_TAG_MURLOC_PROC: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCreatureTarget->GetEntry() == NPC_BLACKSILT_MURLOC) pCreatureTarget->UpdateEntry(NPC_TAGGED_MURLOC); } return true; } case SPELL_ORB_OF_MURLOC_CONTROL: { pCreatureTarget->CastSpell(pCaster, SPELL_GREENGILL_SLAVE_FREED, true); // Freed Greengill Slave pCreatureTarget->UpdateEntry(NPC_FREED_GREENGILL_SLAVE); pCreatureTarget->CastSpell(pCreatureTarget, SPELL_ENRAGE, true); return true; } case SPELL_FUMPING: { if (uiEffIndex == EFFECT_INDEX_2) { switch (urand(0, 2)) { case 0: { pCaster->CastSpell(pCreatureTarget, SPELL_SUMMON_HAISHULUD, true); break; } case 1: { for (int i = 0; i < 2; ++i) { if (Creature* pSandGnome = pCaster->SummonCreature(NPC_SAND_GNOME, pCreatureTarget->GetPositionX(), pCreatureTarget->GetPositionY(), pCreatureTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 30000)) pSandGnome->AI()->AttackStart(pCaster); } break; } case 2: { for (int i = 0; i < 2; ++i) { if (Creature* pMatureBoneSifter = pCaster->SummonCreature(NPC_MATURE_BONE_SIFTER, pCreatureTarget->GetPositionX(), pCreatureTarget->GetPositionY(), pCreatureTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 30000)) pMatureBoneSifter->AI()->AttackStart(pCaster); } break; } } pCreatureTarget->ForcedDespawn(); } return true; } case SPELL_THROW_GORDAWG_BOULDER: { if (uiEffIndex == EFFECT_INDEX_0) { for (int i = 0; i < 3; ++i) { if (irand(i, 2)) // 2-3 summons pCreatureTarget->SummonCreature(NPC_MINION_OF_GUROK, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 5000); } if (pCreatureTarget->getVictim()) { pCaster->DealDamage(pCreatureTarget, pCreatureTarget->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); return true; } // If not in combat, no xp or loot pCreatureTarget->SetDeathState(JUST_DIED); pCreatureTarget->SetHealth(0); return true; } return true; } case SPELL_EXPOSE_RAZORTHORN_ROOT: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCreatureTarget->GetEntry() != NPC_RAZORTHORN_RAVAGER) return true; if (GameObject* pMound = GetClosestGameObjectWithEntry(pCreatureTarget, GO_RAZORTHORN_DIRT_MOUND, 20.0f)) { if (pMound->GetRespawnTime() != 0) return true; pCreatureTarget->CastSpell(pCreatureTarget, SPELL_SUMMON_RAZORTHORN_ROOT, true); pMound->SetLootState(GO_JUST_DEACTIVATED); } } return true; } case SPELL_MELODIOUS_RAPTURE: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCaster->GetTypeId() != TYPEID_PLAYER && pCreatureTarget->GetEntry() != NPC_DEEPRUN_RAT) return true; pCreatureTarget->UpdateEntry(NPC_ENTHRALLED_DEEPRUN_RAT); pCreatureTarget->CastSpell(pCreatureTarget, SPELL_MELODIOUS_RAPTURE_VISUAL, false); pCreatureTarget->GetMotionMaster()->MoveFollow(pCaster, frand(0.5f, 3.0f), frand(M_PI_F * 0.8f, M_PI_F * 1.2f)); ((Player*)pCaster)->KilledMonsterCredit(NPC_ENTHRALLED_DEEPRUN_RAT); } return true; } } return false; }
bool EffectDummyCreature_spell_dummy_npc(Unit* pCaster, uint32 uiSpellId, SpellEffectIndex uiEffIndex, Creature* pCreatureTarget) { switch (uiSpellId) { case SPELL_ADMINISTER_ANTIDOTE: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCreatureTarget->GetEntry() != NPC_HELBOAR) return true; // possible needs check for quest state, to not have any effect when quest really complete pCreatureTarget->UpdateEntry(NPC_DREADTUSK); return true; } return true; } case SPELL_APPLY_SALVE: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCaster->GetTypeId() != TYPEID_PLAYER) return true; if (pCreatureTarget->GetEntry() != NPC_SICKLY_DEER && pCreatureTarget->GetEntry() != NPC_SICKLY_GAZELLE) return true; // Update entry, remove aura, set the kill credit and despawn uint32 uiUpdateEntry = pCreatureTarget->GetEntry() == NPC_SICKLY_DEER ? NPC_CURED_DEER : NPC_CURED_GAZELLE; pCreatureTarget->RemoveAurasDueToSpell(SPELL_SICKLY_AURA); pCreatureTarget->UpdateEntry(uiUpdateEntry); ((Player*)pCaster)->KilledMonsterCredit(uiUpdateEntry); pCreatureTarget->ForcedDespawn(20000); return true; } return true; } case SPELL_DARKMENDER_TINCTURE: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCaster->GetTypeId() != TYPEID_PLAYER) return true; // TODO: find/fix visual for effect, no related spells found doing this pCreatureTarget->CastSpell(pCreatureTarget, SPELL_SUMMON_CORRUPTED_SCARLET, true); ((Player*)pCaster)->KilledMonsterCredit(NPC_CORPSES_RISE_CREDIT_BUNNY); pCreatureTarget->ForcedDespawn(); return true; } return true; } case SPELL_DISCIPLINING_ROD: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCreatureTarget->getStandState() == UNIT_STAND_STATE_STAND) return true; switch (urand(1, 2)) { case 1: { switch (urand(1, 3)) { case 1: DoScriptText(SAY_RAND_ATTACK1, pCreatureTarget); break; case 2: DoScriptText(SAY_RAND_ATTACK2, pCreatureTarget); break; case 3: DoScriptText(SAY_RAND_ATTACK3, pCreatureTarget); break; } pCreatureTarget->SetStandState(UNIT_STAND_STATE_STAND); pCreatureTarget->AI()->AttackStart(pCaster); break; } case 2: { switch (urand(1, 3)) { case 1: DoScriptText(SAY_RAND_WORK1, pCreatureTarget); break; case 2: DoScriptText(SAY_RAND_WORK2, pCreatureTarget); break; case 3: DoScriptText(SAY_RAND_WORK3, pCreatureTarget); break; } pCreatureTarget->SetStandState(UNIT_STAND_STATE_STAND); pCreatureTarget->HandleEmote(EMOTE_STATE_WORK); break; } } return true; } return true; } case SPELL_INOCULATE_OWLKIN: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCreatureTarget->GetEntry() != NPC_OWLKIN) return true; pCreatureTarget->UpdateEntry(NPC_OWLKIN_INOC); ((Player*)pCaster)->KilledMonsterCredit(NPC_OWLKIN_INOC); // set despawn timer, since we want to remove creature after a short time pCreatureTarget->ForcedDespawn(15000); return true; } return true; } case SPELL_LIQUID_FIRE: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCaster->GetTypeId() == TYPEID_PLAYER) { if (pCreatureTarget->HasAura(SPELL_LIQUID_FIRE_AURA)) return true; if (pCreatureTarget->GetEntry() == NPC_ELK) { pCreatureTarget->CastSpell(pCreatureTarget, SPELL_LIQUID_FIRE_AURA, true); ((Player*)pCaster)->KilledMonsterCredit(NPC_ELK_BUNNY); } else if (pCreatureTarget->GetEntry() == NPC_GRIZZLY) { pCreatureTarget->CastSpell(pCreatureTarget, SPELL_LIQUID_FIRE_AURA, true); ((Player*)pCaster)->KilledMonsterCredit(NPC_GRIZZLY_BUNNY); } } return true; } return true; } case SPELL_MODIFIED_MOJO: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCreatureTarget->GetEntry() != NPC_PROPHET_OF_SSERATUS) return true; // Apparently done before updateEntry, so need to make a way to handle that // "Mmm, more mojo" // "%s drinks the Mojo" // "NOOOOOOOOOOOOooooooo...............!" pCreatureTarget->UpdateEntry(NPC_WEAK_PROPHET_OF_SSERATUS); return true; } return true; } case SPELL_FEL_SIPHON_DUMMY: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCreatureTarget->GetEntry() != NPC_FELBLOOD_INITIATE) return true; pCreatureTarget->UpdateEntry(NPC_EMACIATED_FELBLOOD); return true; } return true; } case SPELL_SACRED_CLEANSING: { if (uiEffIndex == EFFECT_INDEX_1) { if (pCreatureTarget->GetEntry() != NPC_MORBENT) return true; pCreatureTarget->UpdateEntry(NPC_WEAKENED_MORBENT); return true; } return true; } case SPELL_SEEDS_OF_NATURES_WRATH: { if (uiEffIndex == EFFECT_INDEX_0) { uint32 uiNewEntry = 0; switch (pCreatureTarget->GetEntry()) { case NPC_REANIMATED_FROSTWYRM: uiNewEntry = NPC_WEAK_REANIMATED_FROSTWYRM; break; case NPC_TURGID: uiNewEntry = NPC_WEAK_TURGID; break; case NPC_DEATHGAZE: uiNewEntry = NPC_WEAK_DEATHGAZE; break; } if (uiNewEntry) pCreatureTarget->UpdateEntry(uiNewEntry); return true; } return true; } case SPELL_STRENGTH_ANCIENTS: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCaster->GetTypeId() == TYPEID_PLAYER) { if (urand(0, 1)) { DoScriptText(EMOTE_AGGRO, pCreatureTarget); pCreatureTarget->setFaction(FACTION_HOSTILE); pCreatureTarget->AI()->AttackStart(pCaster); } else { DoScriptText(EMOTE_CREATE, pCreatureTarget); pCaster->CastSpell(pCaster, SPELL_CREATE_BARK_WALKERS, true); pCreatureTarget->ForcedDespawn(5000); } } return true; } return true; } case SPELL_TAG_MURLOC_PROC: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCreatureTarget->GetEntry() == NPC_BLACKSILT_MURLOC) pCreatureTarget->UpdateEntry(NPC_TAGGED_MURLOC); } return true; } case SPELL_THROW_BOULDER: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCaster->GetTypeId() != TYPEID_PLAYER) return true; if (pCreatureTarget->GetEntry() != NPC_IRON_RUNESHAPER && pCreatureTarget->GetEntry() != NPC_RUNE_REAVER) return true; pCreatureTarget->CastSpell(pCreatureTarget, SPELL_BOULBER_IMPACT, true); pCaster->CastSpell(pCaster, SPELL_BOULDER_TOSS_CREDIT, true); return true; } return true; } case SPELL_ULTRASONIC_SCREWDRIVER: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCreatureTarget->IsCorpse()) { uint32 newSpellId = 0; switch (pCreatureTarget->GetEntry()) { case NPC_COLLECT_A_TRON: newSpellId = SPELL_SUMMON_COLLECT_A_TRON; break; case NPC_DEFENDO_TANK: newSpellId = SPELL_SUMMON_DEFENDO_TANK; break; case NPC_SCAVENGE_A8: newSpellId = SPELL_SUMMON_SCAVENGE_A8; break; case NPC_SCAVENGE_B6: newSpellId = SPELL_SUMMON_SCAVENGE_B6; break; case NPC_SENTRY_BOT: newSpellId = SPELL_SUMMON_SENTRY_BOT; break; } if (const SpellEntry* pSpell = GetSpellStore()->LookupEntry(newSpellId)) { pCaster->CastSpell(pCreatureTarget, pSpell->Id, true); if (Pet* pPet = pCaster->FindGuardianWithEntry(pSpell->GetEffectMiscValue(SpellEffectIndex(uiEffIndex)))) pPet->CastSpell(pCaster, SPELL_REPROGRAM_KILL_CREDIT, true); pCreatureTarget->ForcedDespawn(); } } return true; } return true; } case SPELL_ORB_OF_MURLOC_CONTROL: { pCreatureTarget->CastSpell(pCaster, SPELL_GREENGILL_SLAVE_FREED, true); // Freed Greengill Slave pCreatureTarget->UpdateEntry(NPC_FREED_GREENGILL_SLAVE); pCreatureTarget->CastSpell(pCreatureTarget, SPELL_ENRAGE, true); return true; } case SPELL_FUMPING: { if (uiEffIndex == EFFECT_INDEX_2) { switch (urand(0, 2)) { case 0: { pCaster->CastSpell(pCreatureTarget, SPELL_SUMMON_HAISHULUD, true); break; } case 1: { for (int i = 0; i < 2; ++i) { if (Creature* pSandGnome = pCaster->SummonCreature(NPC_SAND_GNOME, pCreatureTarget->GetPositionX(), pCreatureTarget->GetPositionY(), pCreatureTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 30000)) pSandGnome->AI()->AttackStart(pCaster); } break; } case 2: { for (int i = 0; i < 2; ++i) { if (Creature* pMatureBoneSifter = pCaster->SummonCreature(NPC_MATURE_BONE_SIFTER, pCreatureTarget->GetPositionX(), pCreatureTarget->GetPositionY(), pCreatureTarget->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 30000)) pMatureBoneSifter->AI()->AttackStart(pCaster); } break; } } pCreatureTarget->ForcedDespawn(); } return true; } case SPELL_AHUNAES_KNIFE: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCaster->GetTypeId() != TYPEID_PLAYER) return true; ((Player*)pCaster)->KilledMonsterCredit(NPC_SCALPS_KILL_CREDIT_BUNNY); pCreatureTarget->ForcedDespawn(); return true; } return true; } case SPELL_TAILS_UP_GENDER_MASTER: { if (uiEffIndex == EFFECT_INDEX_0) { bool isMale = urand(0, 1); Player* pPlayer = pCreatureTarget->GetLootRecipient(); if (isMale) DoScriptText(SAY_ITS_MALE, pCreatureTarget, pPlayer); else DoScriptText(SAY_ITS_FEMALE, pCreatureTarget, pPlayer); switch (pCreatureTarget->GetEntry()) { case NPC_FROST_LEOPARD: { if (isMale) pCreatureTarget->CastSpell(pCreatureTarget, SPELL_TAILS_UP_AURA, true); else { pPlayer->KilledMonsterCredit(NPC_LEOPARD_KILL_CREDIT, pCreatureTarget->GetObjectGuid()); pCreatureTarget->CastSpell(pPlayer, SPELL_FORCE_LEOPARD_SUMMON, true); pCreatureTarget->ForcedDespawn(); } break; } case NPC_ICEPAW_BEAR: { if (isMale) pCreatureTarget->CastSpell(pCreatureTarget, SPELL_TAILS_UP_AURA, true); else { pPlayer->KilledMonsterCredit(NPC_BEAR_KILL_CREDIT, pCreatureTarget->GetObjectGuid()); pCreatureTarget->CastSpell(pPlayer, SPELL_FORCE_BEAR_SUMMON, true); pCreatureTarget->ForcedDespawn(); } break; } } return true; } return true; } case SPELL_THROW_GORDAWG_BOULDER: { if (uiEffIndex == EFFECT_INDEX_0) { for (int i = 0; i < 3; ++i) { if (irand(i, 2)) // 2-3 summons pCreatureTarget->SummonCreature(NPC_MINION_OF_GUROK, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 5000); } if (pCreatureTarget->getVictim()) { pCaster->DealDamage(pCreatureTarget, pCreatureTarget->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); return true; } // If not in combat, no xp or loot pCreatureTarget->SetDeathState(JUST_DIED); pCreatureTarget->SetHealth(0); return true; } return true; } case SPELL_HIT_APPLE: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCaster->GetTypeId() == TYPEID_PLAYER) ((Player*)pCaster)->KilledMonsterCredit(pCreatureTarget->GetEntry(), pCreatureTarget->GetObjectGuid()); pCreatureTarget->CastSpell(pCreatureTarget, SPELL_APPLE_FALLS_TO_GROUND, false); if (Creature* pLuckyWilhelm = GetClosestCreatureWithEntry(pCreatureTarget, NPC_LUCKY_WILHELM, 2 * INTERACTION_DISTANCE)) DoScriptText(SAY_LUCKY_HIT_APPLE, pLuckyWilhelm); } return true; } case SPELL_MISS_APPLE: { if (uiEffIndex == EFFECT_INDEX_0) { switch (urand(1, 3)) { case 1: DoScriptText(SAY_LUCKY_HIT_1, pCreatureTarget); break; case 2: DoScriptText(SAY_LUCKY_HIT_2, pCreatureTarget); break; case 3: DoScriptText(SAY_LUCKY_HIT_3, pCreatureTarget); break; } if (Creature* pDrostan = GetClosestCreatureWithEntry(pCreatureTarget, NPC_DROSTAN, 4 * INTERACTION_DISTANCE)) DoScriptText(urand(0, 1) ? SAY_DROSTAN_GOT_LUCKY_1 : SAY_DROSTAN_GOT_LUCKY_2, pDrostan); } return true; } case SPELL_MISS_APPLE_HIT_BIRD: { if (uiEffIndex == EFFECT_INDEX_0) { if (Creature* pDrostan = GetClosestCreatureWithEntry(pCreatureTarget, NPC_DROSTAN, 5 * INTERACTION_DISTANCE)) DoScriptText(urand(0, 1) ? SAY_DROSTAN_HIT_BIRD_1 : SAY_DROSTAN_HIT_BIRD_2, pDrostan); pCreatureTarget->DealDamage(pCreatureTarget, pCreatureTarget->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } return true; } case SPELL_LURIELLES_PENDANT: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCreatureTarget->GetEntry() != NPC_CHILL_NYMPH || pCaster->GetTypeId() != TYPEID_PLAYER) return true; switch (urand(0, 2)) { case 0: DoScriptText(SAY_FREE_1, pCreatureTarget); break; case 1: DoScriptText(SAY_FREE_2, pCreatureTarget); break; case 2: DoScriptText(SAY_FREE_3, pCreatureTarget); break; } ((Player*)pCaster)->KilledMonsterCredit(NPC_LURIELLE); pCreatureTarget->SetFactionTemporary(FACTION_FRIENDLY, TEMPFACTION_RESTORE_RESPAWN); pCreatureTarget->DeleteThreatList(); pCreatureTarget->AttackStop(true); pCreatureTarget->GetMotionMaster()->MoveFleeing(pCaster, 7); pCreatureTarget->ForcedDespawn(7 * IN_MILLISECONDS); } return true; } case SPELL_SAMPLING_ENERGY: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCaster->GetTypeId() != TYPEID_PLAYER) return true; ((Player*)pCaster)->KilledMonsterCredit(pCreatureTarget->GetEntry()); } return true; } case SPELL_EXPOSE_RAZORTHORN_ROOT: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCreatureTarget->GetEntry() != NPC_RAZORTHORN_RAVAGER) return true; if (GameObject* pMound = GetClosestGameObjectWithEntry(pCreatureTarget, GO_RAZORTHORN_DIRT_MOUND, 20.0f)) { if (pMound->GetRespawnTime() != 0) return true; pCreatureTarget->CastSpell(pCreatureTarget, SPELL_SUMMON_RAZORTHORN_ROOT, true); pMound->SetLootState(GO_JUST_DEACTIVATED); } } return true; } case SPELL_MELODIOUS_RAPTURE: { if (uiEffIndex == EFFECT_INDEX_0) { if (pCaster->GetTypeId() != TYPEID_PLAYER && pCreatureTarget->GetEntry() != NPC_DEEPRUN_RAT) return true; pCreatureTarget->UpdateEntry(NPC_ENTHRALLED_DEEPRUN_RAT); pCreatureTarget->CastSpell(pCreatureTarget, SPELL_MELODIOUS_RAPTURE_VISUAL, false); pCreatureTarget->GetMotionMaster()->MoveFollow(pCaster, frand(0.5f, 3.0f), frand(M_PI_F * 0.8f, M_PI_F * 1.2f)); ((Player*)pCaster)->KilledMonsterCredit(NPC_ENTHRALLED_DEEPRUN_RAT); } return true; } } return false; }
void WaypointReached(uint32 uiPointId) override { switch (uiPointId) { case 0: if (Player* pPlayer = GetPlayerForEscort()) DoScriptText(SAY_ESCORT_START, m_creature, pPlayer); break; case 14: DoScriptText(SAY_FIRST_STOP, m_creature); break; case 34: DoScriptText(SAY_SECOND_STOP, m_creature); SetRun(); break; case 38: if (GameObject* pChest = GetClosestGameObjectWithEntry(m_creature, GO_ARKONARIN_CHEST, 5.0f)) pChest->Use(m_creature); m_creature->HandleEmote(EMOTE_ONESHOT_KNEEL); break; case 39: DoCastSpellIfCan(m_creature, SPELL_STRENGTH_ARKONARIN); break; case 40: m_creature->UpdateEntry(NPC_ARKONARIN); if (Player* pPlayer = GetPlayerForEscort()) m_creature->SetFacingToObject(pPlayer); m_bCanAttack = true; DoScriptText(SAY_FOUND_EQUIPMENT, m_creature); break; case 41: DoScriptText(SAY_ESCAPE_DEMONS, m_creature); m_creature->SummonCreature(NPC_JAEDENAR_LEGIONNAIRE, 5082.068f, -490.084f, 296.856f, 5.15f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000); m_creature->SummonCreature(NPC_JAEDENAR_LEGIONNAIRE, 5084.135f, -489.187f, 296.832f, 5.15f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000); m_creature->SummonCreature(NPC_JAEDENAR_LEGIONNAIRE, 5085.676f, -488.518f, 296.824f, 5.15f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000); break; case 43: SetRun(false); break; case 104: DoScriptText(SAY_FRESH_AIR, m_creature); break; case 105: m_creature->SummonCreature(NPC_SPIRT_TREY, 4844.839f, -395.763f, 350.603f, 6.25f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, 60000); break; case 106: DoScriptText(SAY_TREY, m_creature); break; case 107: if (Creature* pTrey = m_creature->GetMap()->GetCreature(m_treyGuid)) AttackStart(pTrey); break; case 108: if (Player* pPlayer = GetPlayerForEscort()) m_creature->SetFacingToObject(pPlayer); DoScriptText(SAY_ESCORT_COMPLETE, m_creature); break; case 109: if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_ID_RESCUE_JAEDENAR, m_creature); SetRun(); break; } }
void UpdateAI(const uint32 uiDiff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; // If we are < 30% cast enrage if (HealthBelowPct(30)) DoCastSpellIfCan(m_creature, SPELL_ENRAGE, CAST_AURA_NOT_PRESENT); // Mortal Wound if (m_uiMortalWoundTimer <= uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_MORTAL_WOUND); m_uiMortalWoundTimer = urand(8000,12000); } else m_uiMortalWoundTimer -= uiDiff; // Sand Trap if (m_uiSandTrapTimer <= uiDiff) { if(!m_bIsSandTrap) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { pTarget->CastSpell(pTarget, SPELL_SAND_TRAP, true, 0, 0, m_creature->GetObjectGuid()); m_bIsSandTrap = true; } m_uiSandTrapTimer = 5000;//3000; } else { if (GameObject* pTrap = GetClosestGameObjectWithEntry(m_creature, GO_SAND_TRAP, DEFAULT_VISIBILITY_INSTANCE)) { float fX, fY, fZ; pTrap->GetPosition(fX, fY, fZ); if (Creature* pTrigger = m_creature->SummonCreature(NPC_AHNQIRAJ_TRIGGER, fX, fY, fZ, 0, TEMPSUMMON_TIMED_DESPAWN, 2000)) pTrigger->CastSpell(pTrigger, SPELL_SAND_TRAP_EFFECT, false, 0, 0, m_creature->GetObjectGuid()); m_creature->SendObjectDeSpawnAnim(pTrap->GetObjectGuid()); pTrap->Delete(); } m_uiSandTrapTimer = 5000; m_bIsSandTrap = false; } } else m_uiSandTrapTimer -= uiDiff; // Summon Player if (m_uiSummonPlayerTimer <= uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 1)) { float x, y, z; m_creature->GetPosition(x, y, z); float o = m_creature->GetOrientation(); pTarget->NearTeleportTo(x + 9.f * cosf(o), y + 9.f * sinf(o), z + 2.f, 0); } m_uiSummonPlayerTimer = urand(8000,10000); } else m_uiSummonPlayerTimer -= uiDiff; // Trash if (m_uiTrashTimer <= uiDiff) { DoCastSpellIfCan(m_creature, SPELL_TRASH); m_uiTrashTimer = urand(4000,6000); } else m_uiTrashTimer -= uiDiff; // Wide Slash if (m_uiWideSlashTimer <= uiDiff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_WIDE_SLASH); m_uiWideSlashTimer = urand(5000,10000); } else m_uiWideSlashTimer -= uiDiff; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 uiDiff) override { if (m_uiTaskTimer) { if (m_uiTaskTimer <= uiDiff) { switch (m_uiTaskIndex) { // fruit tasks case 0: case 1: case 3: case 6: case 7: { uint8 uiIndex = urand(0, 2); DoScriptText(aStillAtItFruits[uiIndex].iText, m_creature); m_uiTaskOwnerEntry = aStillAtItFruits[uiIndex].uiOwnerEntry; m_uiTaskTimer = 0; m_uiActionTimer = 5000; break; } // valve or fire task case 2: case 4: case 5: case 8: { uint8 uiIndex = urand(0, 1); DoScriptText(aStillAtItMachines[uiIndex].iText, m_creature); m_uiTaskOwnerEntry = aStillAtItMachines[uiIndex].uiOwnerEntry; m_uiTaskTimer = 0; m_uiActionTimer = 5000; break; } // complete event case 9: DoScriptText(SAY_DISTILLATION_COMPLETE, m_creature); if (GameObject* pPunch = GetClosestGameObjectWithEntry(m_creature, GO_THUNDERBREW_JUNGLE_PUNCH, 10.0f)) { pPunch->SetRespawnTime(30); pPunch->Refresh(); } m_uiTaskTimer = 20000; break; case 10: EnterEvadeMode(); m_uiTaskTimer = 0; break; } ++m_uiTaskIndex; } else m_uiTaskTimer -= uiDiff; } // timer delay to allow player to complete the task if (m_uiActionTimer) { if (m_uiActionTimer <= uiDiff) { DoScriptText(SAY_DISTILLATION_FAIL, m_creature); EnterEvadeMode(); m_uiActionTimer = 0; } else m_uiActionTimer -= uiDiff; } if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 diff) { if (bCanEat || bIsEating) { if (EatTimer < diff) { if (bCanEat && !bIsEating) { if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_playerGuid)) { GameObject* pGo = pPlayer->GetGameObject(SPELL_PLACE_CARCASS); // Workaround for broken function GetGameObject if (!pGo) { if (SpellEntry const* pSpell = GetSpellStore()->LookupEntry(SPELL_PLACE_CARCASS)) { if (SpellEffectEntry const * effect = pSpell->GetSpellEffect(EFFECT_INDEX_0)) { uint32 uiGameobjectEntry = effect->EffectMiscValue; pGo = GetClosestGameObjectWithEntry(pPlayer, uiGameobjectEntry, 2*INTERACTION_DISTANCE); } } } if (pGo) { if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) m_creature->GetMotionMaster()->MovementExpired(); m_creature->GetMotionMaster()->MoveIdle(); m_creature->StopMoving(); float fX, fY, fZ; pGo->GetContactPoint(m_creature, fX, fY, fZ, CONTACT_DISTANCE); m_creature->GetMotionMaster()->MovePoint(POINT_ID, fX, fY, fZ); } } bCanEat = false; } else if (bIsEating) { DoCastSpellIfCan(m_creature, SPELL_JUST_EATEN); DoScriptText(SAY_JUST_EATEN, m_creature); if (Player* pPlayer = m_creature->GetMap()->GetPlayer(m_playerGuid)) pPlayer->KilledMonsterCredit(NPC_EVENT_PINGER, m_creature->GetObjectGuid()); Reset(); m_creature->GetMotionMaster()->Clear(); } } else EatTimer -= diff; return; } if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; if (CastTimer < diff) { DoCastSpellIfCan(m_creature->getVictim(), SPELL_NETHER_BREATH); CastTimer = 5000; }else CastTimer -= diff; DoMeleeAttackIfReady(); }
void JustDidDialogueStep(int32 iEntry) { switch(iEntry) { case NPC_RANSHALLA: // Start the altar channeling DoChannelTorchSpell(true); break; case SAY_RANSHALLA_ALTAR_6: SetEscortPaused(false); break; case SAY_PRIESTESS_ALTAR_8: // make the gem respawn if (GameObject* pGem = GetClosestGameObjectWithEntry(m_creature, GO_ELUNE_GEM, 10.0f)) { if (pGem->isSpawned()) break; pGem->SetRespawnTime(90); pGem->Refresh(); } break; case SAY_PRIESTESS_ALTAR_9: // move near the escort npc if (Creature* pPriestess = m_creature->GetMap()->GetCreature(m_firstPriestessGuid)) pPriestess->GetMotionMaster()->MovePoint(0, aWingThicketLocations[6].m_fX, aWingThicketLocations[6].m_fY, aWingThicketLocations[6].m_fZ); break; case SAY_PRIESTESS_ALTAR_13: // summon the Guardian of Elune if (Creature* pGuard = m_creature->SummonCreature(NPC_GUARDIAN_ELUNE, aWingThicketLocations[2].m_fX, aWingThicketLocations[2].m_fY, aWingThicketLocations[2].m_fZ, aWingThicketLocations[2].m_fO, TEMPSUMMON_CORPSE_DESPAWN, 0)) { pGuard->GetMotionMaster()->MovePoint(0, aWingThicketLocations[5].m_fX, aWingThicketLocations[5].m_fY, aWingThicketLocations[5].m_fZ); m_guardEluneGuid = pGuard->GetObjectGuid(); } // summon the Voice of Elune if (GameObject* pAltar = m_creature->GetMap()->GetGameObject(m_altarGuid)) { if (Creature* pVoice = m_creature->SummonCreature(NPC_VOICE_ELUNE, pAltar->GetPositionX(), pAltar->GetPositionY(), pAltar->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000)) m_voiceEluneGuid = pVoice->GetObjectGuid(); } break; case SAY_VOICE_ALTAR_15: // move near the escort npc and continue dialogue if (Creature* pPriestess = m_creature->GetMap()->GetCreature(m_secondPriestessGuid)) { DoScriptText(SAY_PRIESTESS_ALTAR_14, pPriestess); pPriestess->GetMotionMaster()->MovePoint(0, aWingThicketLocations[7].m_fX, aWingThicketLocations[7].m_fY, aWingThicketLocations[7].m_fZ); } break; case SAY_PRIESTESS_ALTAR_19: // make the voice of elune leave if (Creature* pGuard = m_creature->GetMap()->GetCreature(m_guardEluneGuid)) { pGuard->GetMotionMaster()->MovePoint(0, aWingThicketLocations[2].m_fX, aWingThicketLocations[2].m_fY, aWingThicketLocations[2].m_fZ); pGuard->ForcedDespawn(4000); } break; case SAY_PRIESTESS_ALTAR_20: // make the first priestess leave if (Creature* pPriestess = m_creature->GetMap()->GetCreature(m_firstPriestessGuid)) { pPriestess->GetMotionMaster()->MovePoint(0, aWingThicketLocations[0].m_fX, aWingThicketLocations[0].m_fY, aWingThicketLocations[0].m_fZ); pPriestess->ForcedDespawn(4000); } break; case SAY_PRIESTESS_ALTAR_21: // make the second priestess leave if (Creature* pPriestess = m_creature->GetMap()->GetCreature(m_secondPriestessGuid)) { pPriestess->GetMotionMaster()->MovePoint(0, aWingThicketLocations[1].m_fX, aWingThicketLocations[1].m_fY, aWingThicketLocations[1].m_fZ); pPriestess->ForcedDespawn(4000); } break; case DATA_EVENT_END: // Turn towards the player if (Player* pPlayer = GetPlayerForEscort()) { m_creature->SetFacingToObject(pPlayer); DoScriptText(SAY_QUEST_END_1, m_creature, pPlayer); } break; case SAY_QUEST_END_2: // Turn towards the altar and kneel - quest complete if (GameObject* pAltar = m_creature->GetMap()->GetGameObject(m_altarGuid)) m_creature->SetFacingToObject(pAltar); m_creature->SetStandState(UNIT_STAND_STATE_KNEEL); if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_GUARDIANS_ALTAR, m_creature); break; } }
void JustDidDialogueStep(int32 entry) { switch (entry) { case NPC_RANSHALLA: // Start the altar channeling DoChannelTorchSpell(true); break; case SAY_RANSHALLA_ALTAR_6: SetEscortPaused(false); break; case SAY_PRIESTESS_ALTAR_8: // make the gem respawn if (GameObject* gem = GetClosestGameObjectWithEntry(me, GO_ELUNE_GEM, 10.0f)) { if (gem->isSpawned()) break; gem->SetRespawnTime(90); gem->Refresh(); } break; case SAY_PRIESTESS_ALTAR_9: // move near the escort npc if (Creature* priestess = me->GetMap()->GetCreature(_firstPriestessGUID)) priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[6].m_positionX, wingThicketLocations[6].m_positionY, wingThicketLocations[6].m_positionZ); break; case SAY_PRIESTESS_ALTAR_13: // summon the Guardian of Elune if (Creature* guard = me->SummonCreature(NPC_GUARDIAN_ELUNE, wingThicketLocations[2].m_positionX, wingThicketLocations[2].m_positionY, wingThicketLocations[2].m_positionZ, wingThicketLocations[2].m_orientation, TEMPSUMMON_CORPSE_DESPAWN, 0)) { guard->GetMotionMaster()->MovePoint(0, wingThicketLocations[5].m_positionX, wingThicketLocations[5].m_positionY, wingThicketLocations[5].m_positionZ); _guardEluneGUID = guard->GetGUID(); } // summon the Voice of Elune if (GameObject* altar = me->GetMap()->GetGameObject(_altarGUID)) { if (Creature* voice = me->SummonCreature(NPC_VOICE_ELUNE, altar->GetPositionX(), altar->GetPositionY(), altar->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 30000)) _voiceEluneGUID = voice->GetGUID(); } break; case SAY_VOICE_ALTAR_15: // move near the escort npc and continue dialogue if (Creature* priestess = me->GetMap()->GetCreature(_secondPriestessGUID)) { priestess->AI()->Talk(SAY_PRIESTESS_ALTAR_14); priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[7].m_positionX, wingThicketLocations[7].m_positionY, wingThicketLocations[7].m_positionZ); } break; case SAY_PRIESTESS_ALTAR_19: // make the voice of elune leave if (Creature* guard = me->GetMap()->GetCreature(_guardEluneGUID)) { guard->GetMotionMaster()->MovePoint(0, wingThicketLocations[2].m_positionX, wingThicketLocations[2].m_positionY, wingThicketLocations[2].m_positionZ); guard->DespawnOrUnsummon(4000); } break; case SAY_PRIESTESS_ALTAR_20: // make the first priestess leave if (Creature* priestess = me->GetMap()->GetCreature(_firstPriestessGUID)) { priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[0].m_positionX, wingThicketLocations[0].m_positionY, wingThicketLocations[0].m_positionZ); priestess->DespawnOrUnsummon(4000); } break; case SAY_PRIESTESS_ALTAR_21: // make the second priestess leave if (Creature* priestess = me->GetMap()->GetCreature(_secondPriestessGUID)) { priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[1].m_positionX, wingThicketLocations[1].m_positionY, wingThicketLocations[1].m_positionZ); priestess->DespawnOrUnsummon(4000); } break; case DATA_EVENT_END: // Turn towards the player if (Player* player = GetPlayerForEscort()) { me->SetFacingToObject(player); Talk(SAY_RANSHALLA_END_1, player->GetGUID()); } break; case SAY_RANSHALLA_END_2: // Turn towards the altar and kneel - quest complete if (GameObject* altar = me->GetMap()->GetGameObject(_altarGUID)) { me->SetFacingToObject(altar); altar->ResetDoorOrButton(); } me->SetStandState(UNIT_STAND_STATE_KNEEL); if (Player* player = GetPlayerForEscort()) { player->GroupEventHappens(QUEST_GUARDIANS_ALTAR, me); Talk(SAY_RANSHALLA_END_2, player->GetGUID()); } me->DespawnOrUnsummon(4000); break; } }
void JustStartedEscort() override { if (GameObject* pCage = GetClosestGameObjectWithEntry(m_creature, GO_MELIZZAS_CAGE, INTERACTION_DISTANCE)) pCage->UseDoorOrButton(); }
void UpdateAI(const uint32 uiDiff) { if (m_uiPhase == PHASE_NOSTART) return; else if (m_uiPhase == PHASE_PREACHING) { if (m_uiCheckTimer <= uiDiff) { if (Creature *pTemp = GetClosestCreatureWithEntry(m_creature, NPC_TWILIGHT_INITIATE, 150.0f)) m_uiCheckTimer = 2000; else { m_uiPhase = PHASE_DESCEND; m_uiSubPhase = SUBPHASE_FLY_DESCEND; return; } }else m_uiCheckTimer -= uiDiff; if (m_uiPreachingTimer > uiDiff) { m_uiPreachingTimer -= uiDiff; return; } if (m_pInstance) if (m_pInstance->GetData(TYPE_TALDARAM) != DONE) return; switch (m_uiPreachingText) { case 0: DoScriptText(SAY_PREACHING_1, m_creature); m_uiPreachingText++; m_uiPreachingTimer = 9500; break; case 1: DoScriptText(SAY_PREACHING_2, m_creature); m_uiPreachingText++; m_uiPreachingTimer = 6500; break; case 2: DoScriptText(SAY_PREACHING_3, m_creature); m_uiPreachingText++; m_uiPreachingTimer = 8500; break; case 3: DoScriptText(SAY_PREACHING_4, m_creature); m_uiPreachingText++; m_uiPreachingTimer = 7500; break; case 4: DoScriptText(SAY_PREACHING_5, m_creature); m_uiPreachingText = 0; m_uiPreachingTimer = 12000; break; } return; } else if (m_uiPhase == PHASE_DESCEND) { if (m_uiSubPhase == SUBPHASE_FLY_DESCEND) { if (GetClosestCreatureWithEntry(m_creature, NPC_TWILIGHT_VOLUNTEER, 150.0f)) return; SetCombatMovement(true); m_creature->GetMap()->CreatureRelocation(m_creature, CENTER_X, CENTER_Y, GROUND_Z, JEDOGA_O); m_creature->SendMonsterMove(CENTER_X, CENTER_Y, GROUND_Z, SPLINETYPE_NORMAL, SPLINEFLAG_NONE, 0); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL); m_creature->SetInCombatWithZone(); //Spawn Volunteers for (int i = 0; i <= 28; ++i) { if (Creature *pTemp = m_creature->SummonCreature(NPC_TWILIGHT_VOLUNTEER, VolunteerLoc[i].x, VolunteerLoc[i].y, VolunteerLoc[i].z, VolunteerLoc[i].o, TEMPSUMMON_CORPSE_DESPAWN, 0)) pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } m_uiSubPhase = 0; m_uiPhase = PHASE_FIGHT; return; } } else if (m_uiPhase == PHASE_FIGHT) { //Evade if no target in this phase if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; //Spells //Cyclone Strike if (m_uiCycloneStrikeTimer <= uiDiff) { DoCast(m_creature, m_bIsRegularMode ? SPELL_CYCLONE_STRIKE : SPELL_CYCLONE_STRIKE_H); m_uiCycloneStrikeTimer = 10000 + rand()%10000; }else m_uiCycloneStrikeTimer -= uiDiff; //Lightning Bolt if (m_uiLightningBoltTimer <= uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) DoCast(pTarget, m_bIsRegularMode ? SPELL_LIGHTNING_BOLT : SPELL_LIGHTNING_BOLT_H); m_uiLightningBoltTimer = 3000 + rand()%2000; }else m_uiLightningBoltTimer -= uiDiff; //Thundershock if (m_uiThundershockTimer <= uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) DoCast(pTarget, m_bIsRegularMode ? SPELL_THUNDERSHOCK : SPELL_THUNDERSHOCK_H); m_uiThundershockTimer = 20000 + rand()%10000; }else m_uiThundershockTimer -= uiDiff; //Health check if (m_uiCheckTimer <= uiDiff) { uint8 health = m_creature->GetHealth()*100 / m_creature->GetMaxHealth(); if (m_uiLastSacrifaceHP == 0 && health <= 75) { m_uiLastSacrifaceHP = 75; m_uiPhase = PHASE_SACRIFACE; m_uiSubPhase = SUBPHASE_FLY_UP; return; } else if (m_uiLastSacrifaceHP == 75 && health <= 50) { m_uiLastSacrifaceHP = 50; m_uiPhase = PHASE_SACRIFACE; m_uiSubPhase = SUBPHASE_FLY_UP; return; } else if (m_uiLastSacrifaceHP == 50 && health <= 25) { m_uiLastSacrifaceHP = 25; m_uiPhase = PHASE_SACRIFACE; m_uiSubPhase = SUBPHASE_FLY_UP; return; } m_uiCheckTimer = 1000; }else m_uiCheckTimer -= uiDiff; DoMeleeAttackIfReady(); } else if (m_uiPhase == PHASE_SACRIFACE) { if (m_uiSubPhase == SUBPHASE_FLY_UP) { SetCombatMovement(false); m_creature->GetMotionMaster()->MovementExpired(); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->InterruptNonMeleeSpells(true); DoCast(m_creature, SPELL_SPHERE_VISUAL); m_creature->GetMap()->CreatureRelocation(m_creature, JEDOGA_X, JEDOGA_Y, JEDOGA_Z, JEDOGA_O); m_creature->SendMonsterMove(JEDOGA_X, JEDOGA_Y, JEDOGA_Z, SPLINETYPE_NORMAL, SPLINEFLAG_NONE, 0); m_uiSubPhase = SUBPHASE_CALL_VOLUNTEER; GameObject* pCircle = GetClosestGameObjectWithEntry(m_creature,GO_CIRCLE,50.0f); if (pCircle && !pCircle->isSpawned()) pCircle->SetRespawnTime(10000); } else if (m_uiSubPhase == SUBPHASE_CALL_VOLUNTEER) { pVolunteer = SelectRandomVolunteer(150.0f); if (pVolunteer) { switch (urand(0, 1)) { case 0: DoScriptText(SAY_CALL_SACRIFICE_1, m_creature); break; case 1: DoScriptText(SAY_CALL_SACRIFICE_2, m_creature); break; } ((npc_twilight_volunteerAI*)pVolunteer->AI())->Sacriface(SACRIFACE_CHOOSEN); m_uiSubPhase = SUBPHASE_WAIT_FOR_VOLUNTEER; } } else if (m_uiSubPhase == SUBPHASE_WAIT_FOR_VOLUNTEER) { if (m_uiCheckTimer <= uiDiff) { if (pVolunteer && pVolunteer->isAlive()){ if (pVolunteer->GetVisibility() == VISIBILITY_OFF) { if (((npc_twilight_volunteerAI*)pVolunteer->AI())->m_bIsVulunteerNear) m_bVolunteerDied = false; else m_bVolunteerDied = true; m_uiSubPhase = SUBPHASE_SACRIFACE; } }else{ m_bIsVulunteerNear = true; m_bVolunteerDied = true; m_uiSubPhase = SUBPHASE_SACRIFACE; } m_uiCheckTimer = 1000; }else m_uiCheckTimer -= uiDiff; } else if (m_uiSubPhase == SUBPHASE_SACRIFACE) { switch (urand(0, 1)) { case 0: DoScriptText(SAY_SACRIFICE_1, m_creature); break; case 1: DoScriptText(SAY_SACRIFICE_2, m_creature); break; } if (!m_bVolunteerDied) DoCast(m_creature, SPELL_GIFT_OF_THE_HERALD); m_creature->GetMap()->CreatureRelocation(m_creature, CENTER_X, CENTER_Y, GROUND_Z, JEDOGA_O); m_creature->SendMonsterMove(CENTER_X, CENTER_Y, GROUND_Z, SPLINETYPE_NORMAL, SPLINEFLAG_NONE, 0); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->RemoveAurasDueToSpell(SPELL_SPHERE_VISUAL); SetCombatMovement(true); m_uiPhase = PHASE_FIGHT; if (m_creature->getVictim()) m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim()); } } }
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 JustRespawned() { if (GameObject* cage = GetClosestGameObjectWithEntry(me, GO_DRYWOOD_CAGE, 10.f)) cage->SetGoState(GO_STATE_READY); }
void UpdateAI(const uint32 diff) { if (Phase == IDLE) return; if (Phase == INTRO) { if (introTimer <= diff) { Creature* arthas = Unit::GetCreature(*me, arthasGUID); if (!arthas) return; switch (introPhase) { case 0: Talk(SAY_SVALA_INTRO_0); ++introPhase; introTimer = 8100; break; case 1: arthas->AI()->Talk(SAY_DIALOG_OF_ARTHAS_1); ++introPhase; introTimer = 10000; break; case 2: arthas->CastSpell(me, SPELL_TRANSFORMING_CHANNEL, false); pos.Relocate(me); pos.m_positionZ += 8.0f; me->GetMotionMaster()->MoveTakeoff(0, pos); // spectators flee event if (instance) { std::list<Creature*> lspectatorList; GetCreatureListWithEntryInGrid(lspectatorList, me, CREATURE_SPECTATOR, 100.0f); for (std::list<Creature*>::iterator itr = lspectatorList.begin(); itr != lspectatorList.end(); ++itr) { if ((*itr)->isAlive()) { (*itr)->SetStandState(UNIT_STAND_STATE_STAND); (*itr)->SetWalk(false); (*itr)->GetMotionMaster()->MovePoint(1, spectatorWP[0][0], spectatorWP[0][1], spectatorWP[0][2]); } } } ++introPhase; introTimer = 4200; break; case 3: me->CastSpell(me, SPELL_SVALA_TRANSFORMING1, false); ++introPhase; introTimer = 6200; break; case 4: me->CastSpell(me, SPELL_SVALA_TRANSFORMING2, false); arthas->InterruptNonMeleeSpells(true); me->RemoveAllAuras(); me->UpdateEntry(CREATURE_SVALA_SORROWGRAVE); me->SetFacingToObject(arthas); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); ++introPhase; introTimer = 3200; break; case 5: Talk(SAY_SVALA_INTRO_1); ++introPhase; introTimer = 10000; break; case 6: arthas->AI()->Talk(SAY_DIALOG_OF_ARTHAS_2); ++introPhase; introTimer = 7200; break; case 7: Talk(SAY_SVALA_INTRO_2); me->SetOrientation(1.58f); me->SendMovementFlagUpdate(); arthas->SetVisible(false); ++introPhase; introTimer = 13800; break; case 8: pos.Relocate(me); pos.m_positionX = me->GetHomePosition().GetPositionX(); pos.m_positionY = me->GetHomePosition().GetPositionY(); pos.m_positionZ = 90.6065f; me->GetMotionMaster()->MoveLand(0, pos); me->SetDisableGravity(false, true); me->SetHover(true); ++introPhase; introTimer = 3000; break; case 9: if (GameObject* mirror = GetClosestGameObjectWithEntry(me, OBJECT_UTGARDE_MIRROR, 100.0f)) mirror->SetGoState(GO_STATE_ACTIVE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); arthas->DespawnOrUnsummon(); arthasGUID = 0; Phase = NORMAL; break; } } else introTimer -= diff; return; } if (Phase == NORMAL) { //Return since we have no target if (!UpdateVictim()) return; if (sinsterStrikeTimer <= diff) { DoCast(me->getVictim(), SPELL_SINSTER_STRIKE); sinsterStrikeTimer = urand(5 * IN_MILLISECONDS, 9 * IN_MILLISECONDS); } else sinsterStrikeTimer -= diff; if (callFlamesTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) { DoCast(target, SPELL_CALL_FLAMES); callFlamesTimer = urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); } } else callFlamesTimer -= diff; if (!sacrificed) { if (HealthBelowPct(50)) { if (Unit* sacrificeTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 80.0f, true)) { if (instance) instance->SetData64(DATA_SACRIFICED_PLAYER, sacrificeTarget->GetGUID()); Talk(SAY_SACRIFICE_PLAYER); DoCast(sacrificeTarget, SPELL_RITUAL_PREPARATION); SetCombatMovement(false); Phase = SACRIFICING; sacrePhase = 0; sacrificeTimer = 1 * IN_MILLISECONDS; DoCast(me, SPELL_RITUAL_OF_THE_SWORD); sacrificed = true; } } } DoMeleeAttackIfReady(); } else //SACRIFICING { if (sacrificeTimer <= diff) { switch (sacrePhase) { case 0: // spawn ritual channelers if (instance) { DoCast(me, SPELL_RITUAL_CHANNELER_1, true); DoCast(me, SPELL_RITUAL_CHANNELER_2, true); DoCast(me, SPELL_RITUAL_CHANNELER_3, true); } ++sacrePhase; sacrificeTimer = 2 * IN_MILLISECONDS; break; case 1: me->StopMoving(); me->GetMotionMaster()->MoveIdle(); me->InterruptNonMeleeSpells(true); DoCast(me, SPELL_RITUAL_STRIKE_TRIGGER, true); ++sacrePhase; sacrificeTimer = 200; break; case 2: DoCast(me, SPELL_RITUAL_DISARM); ++sacrePhase; break; case 3: break; } } else sacrificeTimer -= diff; } }
void UpdateAI(const uint32 uiDiff) override { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; // Troll phase if (!m_bIsInPhaseTwo) { if (m_uiPoisonVolleyTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_POISON_VOLLEY) == CAST_OK) m_uiPoisonVolleyTimer = urand(10000, 20000); } else m_uiPoisonVolleyTimer -= uiDiff; if (m_uiDrainLifeTimer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { if (DoCastSpellIfCan(pTarget, SPELL_DRAIN_LIFE) == CAST_OK) m_uiDrainLifeTimer = urand(20000, 50000); } } else m_uiDrainLifeTimer -= uiDiff; if (m_uiSpawnSpiderTimer < uiDiff) { // Workaround for missing spell 24082 - creature always selects the closest egg for hatch if (m_pInstance) { if (GameObject* pEgg = GetClosestGameObjectWithEntry(m_creature, GO_SPIDER_EGG, 30.0f)) { if (urand(0, 1)) DoScriptText(SAY_SPIDER_SPAWN, m_creature); pEgg->Use(m_creature); m_uiSpawnSpiderTimer = 60000; } } } else m_uiSpawnSpiderTimer -= uiDiff; } // Spider phase else { if (m_uiWebsTimer < uiDiff) { if (DoCastSpellIfCan(m_creature, SPELL_ENVELOPING_WEBS) == CAST_OK) { m_uiWebsTimer = urand(15000, 20000); m_uiChargeTimer = 1000; } } else m_uiWebsTimer -= uiDiff; if (m_uiChargeTimer) { if (m_uiChargeTimer < uiDiff) { // ToDo: research if the selected target shouldn't have the enveloping webs aura if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, SPELL_CHARGE, SELECT_FLAG_NOT_IN_MELEE_RANGE)) { if (DoCastSpellIfCan(pTarget, SPELL_CHARGE) == CAST_OK) { DoResetThreat(); m_uiChargeTimer = 0; } } } else m_uiChargeTimer -= uiDiff; } if (m_uiCorrosivePoisonTimer < uiDiff) { if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0)) { if (DoCastSpellIfCan(pTarget, SPELL_CORROSIVE_POISON) == CAST_OK) m_uiCorrosivePoisonTimer = urand(25000, 35000); } } else m_uiCorrosivePoisonTimer -= uiDiff; } // Transform from Troll to Spider and back if (m_uiTransformTimer < uiDiff) { if (!m_bIsInPhaseTwo) { if (DoCastSpellIfCan(m_creature, SPELL_SPIDER_FORM) == CAST_OK) { DoScriptText(SAY_TRANSFORM, m_creature); DoResetThreat(); m_uiTransformTimer = 60000; m_uiWebsTimer = 5000; m_bIsInPhaseTwo = true; } } else { if (DoCastSpellIfCan(m_creature, SPELL_TRANSFORM_BACK) == CAST_OK) { DoScriptText(SAY_TRANSFORM_BACK, m_creature); m_creature->RemoveAurasDueToSpell(SPELL_SPIDER_FORM); m_bIsInPhaseTwo = false; m_uiTransformTimer = 60000; } } } else m_uiTransformTimer -= uiDiff; if (m_uiTrashTimer < uiDiff) { if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_TRASH) == CAST_OK) m_uiTrashTimer = urand(10000, 20000); } else m_uiTrashTimer -= uiDiff; DoMeleeAttackIfReady(); }