void OnPlayerEnter(Player* /*player*/) override { if (!GetGuidData(DATA_HALION_CONTROLLER) && GetBossState(DATA_HALION) != DONE && GetBossState(DATA_GENERAL_ZARITHRIAN) == DONE) { instance->LoadGrid(HalionControllerSpawnPos.GetPositionX(), HalionControllerSpawnPos.GetPositionY()); if (Creature* halionController = instance->SummonCreature(NPC_HALION_CONTROLLER, HalionControllerSpawnPos)) halionController->AI()->DoAction(ACTION_INTRO_HALION); } }
void MoveNPCIfAlive(uint32 entry, float x, float y, float z, float o) { if (Creature* npc = instance->GetCreature(GetGuidData(entry))) { if (npc->IsAlive()) { npc->SetWalk(true); npc->GetMotionMaster()->MovePoint(1, x, y, z); npc->SetHomePosition(x, y, z, o); } } }
void ResetBossEncounter(uint8 bossId) { if (bossId < DATA_CYANIGOSA || bossId > DATA_ZURAMAT) return; Creature* boss = GetCreature(bossId); if (!boss) return; switch (bossId) { case DATA_CYANIGOSA: boss->DespawnOrUnsummon(); break; case DATA_EREKEM: for (uint32 i = DATA_EREKEM_GUARD_1; i <= DATA_EREKEM_GUARD_2; ++i) { if (Creature* guard = instance->GetCreature(GetGuidData(i))) { if (guard->isDead()) guard->Respawn(); if (GetBossState(bossId) == DONE) UpdateKilledBoss(guard); guard->GetMotionMaster()->MoveTargetedHome(); guard->SetImmuneToAll(true); } } /* fallthrough */ default: if (boss->isDead()) { // respawn and update to a placeholder npc to avoid be looted again boss->Respawn(); UpdateKilledBoss(boss); } boss->GetMotionMaster()->MoveTargetedHome(); boss->SetImmuneToAll(true); break; } }
void StartBossEncounter(uint8 bossId) { switch (bossId) { case DATA_MORAGG: Scheduler.Schedule(Seconds(2), [this](TaskContext task) { if (Creature* moragg = GetCreature(DATA_MORAGG)) { moragg->PlayDirectSound(SOUND_MORAGG_SPAWN); moragg->CastSpell(moragg, SPELL_MORAGG_EMOTE_ROAR); } task.Schedule(Seconds(3), [this](TaskContext task) { if (Creature* moragg = GetCreature(DATA_MORAGG)) moragg->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, MoraggPath, MoraggPathSize, true); task.Schedule(Seconds(8), [this](TaskContext /*task*/) { if (Creature* moragg = GetCreature(DATA_MORAGG)) { moragg->SetImmuneToAll(false); moragg->AI()->DoZoneInCombat(moragg); } }); }); }); break; case DATA_EREKEM: Scheduler.Schedule(Seconds(3), [this](TaskContext task) { if (Creature* erekem = GetCreature(DATA_EREKEM)) erekem->AI()->Talk(SAY_EREKEM_SPAWN); task.Schedule(Seconds(5), [this](TaskContext task) { if (Creature* erekem = GetCreature(DATA_EREKEM)) erekem->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, ErekemPath, ErekemPathSize, true); if (Creature* guard = instance->GetCreature(GetGuidData(DATA_EREKEM_GUARD_1))) guard->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, ErekemGuardLeftPath, ErekemGuardLeftPathSize, true); if (Creature* guard = instance->GetCreature(GetGuidData(DATA_EREKEM_GUARD_2))) guard->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, ErekemGuardRightPath, ErekemGuardRightPathSize, true); task.Schedule(Seconds(6), [this](TaskContext task) { if (Creature* erekem = GetCreature(DATA_EREKEM)) erekem->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); task.Schedule(Seconds(1), [this](TaskContext /*task*/) { for (uint32 i = DATA_EREKEM_GUARD_1; i <= DATA_EREKEM_GUARD_2; ++i) { if (Creature* guard = instance->GetCreature(GetGuidData(i))) guard->SetImmuneToAll(false); } if (Creature* erekem = GetCreature(DATA_EREKEM)) { erekem->SetImmuneToAll(false); erekem->AI()->DoZoneInCombat(erekem); } }); }); }); }); break; case DATA_ICHORON: Scheduler.Schedule(Seconds(2), [this](TaskContext task) { if (Creature* ichoron = GetCreature(DATA_ICHORON)) ichoron->AI()->Talk(SAY_ICHORON_SPAWN); task.Schedule(Seconds(3), [this](TaskContext task) { if (Creature* ichoron = GetCreature(DATA_ICHORON)) ichoron->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, IchoronPath, IchoronPathSize, true); task.Schedule(Seconds(14), [this](TaskContext /*task*/) { if (Creature* ichoron = GetCreature(DATA_ICHORON)) { ichoron->SetImmuneToAll(false); ichoron->AI()->DoZoneInCombat(ichoron); } }); }); }); break; case DATA_LAVANTHOR: Scheduler.Schedule(Seconds(1), [this](TaskContext task) { if (Creature* lavanthor = GetCreature(DATA_LAVANTHOR)) lavanthor->CastSpell(lavanthor, SPELL_LAVANTHOR_SPECIAL_UNARMED); task.Schedule(Seconds(3), [this](TaskContext task) { if (Creature* lavanthor = GetCreature(DATA_LAVANTHOR)) lavanthor->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, LavanthorPath, LavanthorPathSize, true); task.Schedule(Seconds(8), [this](TaskContext /*task*/) { if (Creature* lavanthor = GetCreature(DATA_LAVANTHOR)) { lavanthor->SetImmuneToAll(false); lavanthor->AI()->DoZoneInCombat(lavanthor); } }); }); }); break; case DATA_XEVOZZ: Scheduler.Schedule(Seconds(2), [this](TaskContext task) { if (Creature* xevozz = GetCreature(DATA_XEVOZZ)) xevozz->AI()->Talk(SAY_XEVOZZ_SPAWN); task.Schedule(Seconds(3), [this](TaskContext task) { if (Creature* xevozz = GetCreature(DATA_XEVOZZ)) xevozz->HandleEmoteCommand(EMOTE_ONESHOT_TALK_NO_SHEATHE); task.Schedule(Seconds(4), [this](TaskContext task) { if (Creature* xevozz = GetCreature(DATA_XEVOZZ)) xevozz->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, XevozzPath, XevozzPathSize, true); task.Schedule(Seconds(4), [this](TaskContext /*task*/) { if (Creature* xevozz = GetCreature(DATA_XEVOZZ)) { xevozz->SetImmuneToAll(false); xevozz->AI()->DoZoneInCombat(xevozz); } }); }); }); }); break; case DATA_ZURAMAT: Scheduler.Schedule(Seconds(2), [this](TaskContext task) { if (Creature* zuramat = GetCreature(DATA_ZURAMAT)) { zuramat->CastSpell(zuramat, SPELL_ZURAMAT_COSMETIC_CHANNEL_OMNI); zuramat->AI()->Talk(SAY_ZURAMAT_SPAWN); } task.Schedule(Seconds(6), [this](TaskContext task) { if (Creature* zuramat = GetCreature(DATA_ZURAMAT)) zuramat->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, ZuramatPath, ZuramatPathSize, true); task.Schedule(Seconds(4), [this](TaskContext /*task*/) { if (Creature* zuramat = GetCreature(DATA_ZURAMAT)) { zuramat->SetImmuneToAll(false); zuramat->AI()->DoZoneInCombat(zuramat); } }); }); }); break; default: return; } HandleCells(bossId); }