diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 55dcb21db4..4b2c5e29d3 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -7691,7 +7691,7 @@ void Player::DuelComplete(DuelCompleteType type) // Honor points after duel (the winner) - ImpConfig if (uint32 amount = sWorld->getIntConfig(CONFIG_HONOR_AFTER_DUEL)) duel->opponent->RewardHonor(NULL, 1, amount); - + break; default: break; @@ -9671,6 +9671,16 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) bf->FillInitialWorldStates(data); break; } + case 4820: + if (instance && mapid == 668) + instance->FillInitialWorldStates(data); + else + { + data << uint32(4884) << uint32(0); // 9 WORLD_STATE_HOR_WAVES_ENABLED + data << uint32(4882) << uint32(0); // 10 WORLD_STATE_HOR_WAVE_COUNT + } + break; + // No break here, intended. default: data << uint32(0x914) << uint32(0x0); // 7 diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a8b17fbf09..9adcbdd936 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -12454,7 +12454,7 @@ void Unit::setDeathState(DeathState s) SetPower(getPowerType(), 0); // players in instance don't have ZoneScript, but they have InstanceScript - if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : (ZoneScript*)GetInstanceScript()) + if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : GetInstanceScript()) zoneScript->OnUnitDeath(this); } else if (s == JUST_RESPAWNED) diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index c694508969..a64f2cf546 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -539,7 +539,6 @@ class npc_jaina_or_sylvanas_hor : public CreatureScript { instance->SetData(DATA_INTRO_EVENT, DONE); instance->ProcessEvent(0, EVENT_SPAWN_WAVES); - //instance->SetData(DATA_WAVE_COUNT, SPECIAL); // start first wave } // Loralen or Koreln disappearAndDie() if (Creature* lichking = me->GetCreature(*me, lichkingGUID)) @@ -655,7 +654,22 @@ enum TrashEvents struct npc_gauntlet_trash : public ScriptedAI { - npc_gauntlet_trash(Creature* creature) : ScriptedAI(creature) { } + npc_gauntlet_trash(Creature* creature) : ScriptedAI(creature), + instance(creature->GetInstanceScript()) + { + } + + void Reset() + { + me->CastSpell(me, SPELL_WELL_OF_SOULS, true); + events.Reset(); + } + + void EnterEvadeMode() + { + if (instance->GetData(DATA_WAVE_COUNT) != NOT_STARTED) + instance->SetData(DATA_WAVE_COUNT, NOT_STARTED); + } void SetData(uint32 type, uint32 value) { @@ -674,6 +688,8 @@ struct npc_gauntlet_trash : public ScriptedAI } protected: + EventMap events; + InstanceScript* instance; uint32 InternalWaveId; }; @@ -682,28 +698,10 @@ class npc_ghostly_priest : public CreatureScript public: npc_ghostly_priest() : CreatureScript("npc_ghostly_priest") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_ghostly_priestAI(creature); - } - struct npc_ghostly_priestAI : public npc_gauntlet_trash { npc_ghostly_priestAI(Creature* creature) : npc_gauntlet_trash(creature) { - instance = me->GetInstanceScript(); - me->CastSpell(me, SPELL_WELL_OF_SOULS, true); - } - - InstanceScript* instance; - - EventMap events; - - void Reset() - { - events.Reset(); - if (instance->GetData(DATA_WAVE_COUNT) != NOT_STARTED) - instance->SetData(DATA_WAVE_COUNT, NOT_STARTED); } void EnterCombat(Unit* /*who*/) @@ -760,6 +758,10 @@ public: } }; + CreatureAI* GetAI(Creature* creature) const + { + return new npc_ghostly_priestAI(creature); + } }; class npc_phantom_mage : public CreatureScript @@ -767,28 +769,10 @@ class npc_phantom_mage : public CreatureScript public: npc_phantom_mage() : CreatureScript("npc_phantom_mage") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_phantom_mageAI(creature); - } - struct npc_phantom_mageAI : public npc_gauntlet_trash { npc_phantom_mageAI(Creature* creature) : npc_gauntlet_trash(creature) { - instance = me->GetInstanceScript(); - me->CastSpell(me, SPELL_WELL_OF_SOULS, true); - } - - InstanceScript* instance; - - EventMap events; - - void Reset() - { - events.Reset(); - if (instance->GetData(DATA_WAVE_COUNT) != NOT_STARTED) - instance->SetData(DATA_WAVE_COUNT, NOT_STARTED); } void EnterCombat(Unit* /*who*/) @@ -840,6 +824,10 @@ public: } }; + CreatureAI* GetAI(Creature* creature) const + { + return new npc_phantom_mageAI(creature); + } }; class npc_phantom_hallucination : public CreatureScript @@ -847,11 +835,6 @@ class npc_phantom_hallucination : public CreatureScript public: npc_phantom_hallucination() : CreatureScript("npc_phantom_hallucination") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_phantom_hallucinationAI(creature); - } - struct npc_phantom_hallucinationAI : public npc_phantom_mage::npc_phantom_mageAI { npc_phantom_hallucinationAI(Creature* creature) : npc_phantom_mage::npc_phantom_mageAI(creature) {} @@ -862,6 +845,10 @@ public: } }; + CreatureAI* GetAI(Creature* creature) const + { + return new npc_phantom_hallucinationAI(creature); + } }; class npc_shadowy_mercenary : public CreatureScript @@ -869,28 +856,10 @@ class npc_shadowy_mercenary : public CreatureScript public: npc_shadowy_mercenary() : CreatureScript("npc_shadowy_mercenary") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_shadowy_mercenaryAI(creature); - } - struct npc_shadowy_mercenaryAI : public npc_gauntlet_trash { npc_shadowy_mercenaryAI(Creature* creature) : npc_gauntlet_trash(creature) { - instance = me->GetInstanceScript(); - me->CastSpell(me, SPELL_WELL_OF_SOULS, true); - } - - InstanceScript* instance; - - EventMap events; - - void Reset() - { - events.Reset(); - if (instance->GetData(DATA_WAVE_COUNT) != NOT_STARTED) - instance->SetData(DATA_WAVE_COUNT, NOT_STARTED); } void EnterCombat(Unit* /*who*/) @@ -936,6 +905,10 @@ public: } }; + CreatureAI* GetAI(Creature* creature) const + { + return new npc_shadowy_mercenaryAI(creature); + } }; class npc_spectral_footman : public CreatureScript @@ -943,28 +916,10 @@ class npc_spectral_footman : public CreatureScript public: npc_spectral_footman() : CreatureScript("npc_spectral_footman") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_spectral_footmanAI(creature); - } - struct npc_spectral_footmanAI : public npc_gauntlet_trash { npc_spectral_footmanAI(Creature* creature) : npc_gauntlet_trash(creature) { - instance = me->GetInstanceScript(); - me->CastSpell(me, SPELL_WELL_OF_SOULS, true); - } - - InstanceScript* instance; - - EventMap events; - - void Reset() - { - events.Reset(); - if (instance->GetData(DATA_WAVE_COUNT) != NOT_STARTED) - instance->SetData(DATA_WAVE_COUNT, NOT_STARTED); } void EnterCombat(Unit* /*who*/) @@ -1004,6 +959,10 @@ public: } }; + CreatureAI* GetAI(Creature* creature) const + { + return new npc_spectral_footmanAI(creature); + } }; class npc_tortured_rifleman : public CreatureScript @@ -1011,28 +970,10 @@ class npc_tortured_rifleman : public CreatureScript public: npc_tortured_rifleman() : CreatureScript("npc_tortured_rifleman") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_tortured_riflemanAI(creature); - } - struct npc_tortured_riflemanAI : public npc_gauntlet_trash { npc_tortured_riflemanAI(Creature* creature) : npc_gauntlet_trash(creature) { - instance = me->GetInstanceScript(); - me->CastSpell(me, SPELL_WELL_OF_SOULS, true); - } - - InstanceScript* instance; - - EventMap events; - - void Reset() - { - events.Reset(); - if (instance->GetData(DATA_WAVE_COUNT) != NOT_STARTED) - instance->SetData(DATA_WAVE_COUNT, NOT_STARTED); } void EnterCombat(Unit* /*who*/) @@ -1080,6 +1021,10 @@ public: } }; + CreatureAI* GetAI(Creature* creature) const + { + return new npc_tortured_riflemanAI(creature); + } }; @@ -1191,6 +1136,7 @@ public: } }; + CreatureAI* GetAI(Creature* creature) const { return new npc_frostworn_generalAI(creature); @@ -1247,6 +1193,7 @@ public: DoMeleeAttackIfReady(); } }; + CreatureAI* GetAI(Creature* creature) const { return new npc_spiritual_reflectionAI(creature); @@ -1255,58 +1202,57 @@ public: class at_hor_intro_start : public AreaTriggerScript { - public: - at_hor_intro_start() : AreaTriggerScript("at_hor_intro_start") {} +public: + at_hor_intro_start() : AreaTriggerScript("at_hor_intro_start") {} - bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) - { - InstanceScript* instance = player->GetInstanceScript(); - - if (player->isGameMaster()) - return true; - - if (instance->GetData(DATA_INTRO_EVENT) == NOT_STARTED) - { - instance->SetData(DATA_INTRO_EVENT, IN_PROGRESS); - } + bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) + { + InstanceScript* instance = player->GetInstanceScript(); + if (player->isGameMaster()) return true; + + if (instance->GetData(DATA_INTRO_EVENT) == NOT_STARTED) + { + instance->SetData(DATA_INTRO_EVENT, IN_PROGRESS); } + + return true; + } }; class at_hor_waves_restarter : public AreaTriggerScript { - public: - at_hor_waves_restarter() : AreaTriggerScript("at_hor_waves_restarter") {} +public: + at_hor_waves_restarter() : AreaTriggerScript("at_hor_waves_restarter") {} - bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) - { - InstanceScript* instance = player->GetInstanceScript(); + bool OnTrigger(Player* player, AreaTriggerEntry const* /*trigger*/) + { + InstanceScript* instance = player->GetInstanceScript(); - if (player->isGameMaster()) - return true; - - if (instance->GetData(DATA_WAVE_COUNT)) - return true; - - if (instance->GetData(DATA_INTRO_EVENT) == DONE && instance->GetBossState(DATA_MARWYN_EVENT) != DONE && instance->GetData(DATA_WAVE_COUNT) == NOT_STARTED) - { - instance->ProcessEvent(0, EVENT_SPAWN_WAVES); - //instance->SetData(DATA_WAVE_COUNT, SPECIAL); - - if (Creature* falric = player->GetCreature(*player, instance->GetData64(DATA_FALRIC_EVENT))) - { - falric->CastSpell(falric, SPELL_BOSS_SPAWN_AURA, true); - falric->SetVisible(true); - } - if (Creature* marwyn = player->GetCreature(*player, instance->GetData64(DATA_MARWYN_EVENT))) - { - marwyn->CastSpell(marwyn, SPELL_BOSS_SPAWN_AURA, true); - marwyn->SetVisible(true); - } - } + if (player->isGameMaster()) return true; + + if (instance->GetData(DATA_WAVE_COUNT)) + return true; + + if (instance->GetData(DATA_INTRO_EVENT) == DONE && instance->GetBossState(DATA_MARWYN_EVENT) != DONE) + { + instance->ProcessEvent(0, EVENT_SPAWN_WAVES); + + if (Creature* falric = player->GetCreature(*player, instance->GetData64(DATA_FALRIC_EVENT))) + { + falric->CastSpell(falric, SPELL_BOSS_SPAWN_AURA, true); + falric->SetVisible(true); + } + if (Creature* marwyn = player->GetCreature(*player, instance->GetData64(DATA_MARWYN_EVENT))) + { + marwyn->CastSpell(marwyn, SPELL_BOSS_SPAWN_AURA, true); + marwyn->SetVisible(true); + } } + return true; + } }; void AddSC_halls_of_reflection() diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h index 958ecc24aa..4787a6b9fd 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h @@ -94,7 +94,7 @@ enum GameObjects enum HorWorldStates { - WORLD_STATE_HOR = 4884, + WORLD_STATE_HOR_WAVES_ENABLED = 4884, WORLD_STATE_HOR_WAVE_COUNT = 4882, }; diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp index 88a3692651..43d065d5f7 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp @@ -98,7 +98,7 @@ public: void OnCreatureCreate(Creature* creature) { - Map::PlayerList const &players = instance->GetPlayers(); + Map::PlayerList const& players = instance->GetPlayers(); if (!players.isEmpty()) if (Player* player = players.begin()->getSource()) _teamInInstance = player->GetTeam(); @@ -176,6 +176,12 @@ public: } } + void FillInitialWorldStates(WorldPacket& data) + { + data << uint32(WORLD_STATE_HOR_WAVES_ENABLED) << uint32(0); + data << uint32(WORLD_STATE_HOR_WAVE_COUNT) << uint32(0); + } + bool SetBossState(uint32 type, EncounterState state) { if (!InstanceScript::SetBossState(type, state)) @@ -185,7 +191,10 @@ public: { case DATA_FALRIC_EVENT: if (state == DONE) + { + ++_waveCount; events.ScheduleEvent(EVENT_NEXT_WAVE, 60000); + } break; case DATA_MARWYN_EVENT: if (state == DONE) @@ -207,9 +216,6 @@ public: void SetData(uint32 type, uint32 data) { - if (_waveCount && data == NOT_STARTED) - ProcessEvent(NULL, EVENT_DO_WIPE); - switch (type) { case DATA_INTRO_EVENT: @@ -226,8 +232,8 @@ public: _introEvent = data; break; case DATA_WAVE_COUNT: - if (data == SPECIAL) - events.ScheduleEvent(EVENT_NEXT_WAVE, 10000); + if (_waveCount && data == NOT_STARTED) + ProcessEvent(NULL, EVENT_DO_WIPE); break; case DATA_FROSWORN_EVENT: if (data == DONE) @@ -243,6 +249,165 @@ public: SaveToDB(); } + + // wave scheduling,checked when wave npcs die + void OnUnitDeath(Unit* unit) + { + Creature* creature = unit->ToCreature(); + if (!creature) + return; + + switch (creature->GetEntry()) + { + case NPC_WAVE_MERCENARY: + case NPC_WAVE_FOOTMAN: + case NPC_WAVE_RIFLEMAN: + case NPC_WAVE_PRIEST: + case NPC_WAVE_MAGE: + { + uint32 deadNpcs = 0; + uint32 internalWaveId = _waveCount - ((_waveCount < 5) ? 1 : 2); + for (std::set::const_iterator itr = waveGuidList[internalWaveId].begin(); itr != waveGuidList[internalWaveId].end(); ++itr) + { + Creature* npc = instance->GetCreature(*itr); + if (!npc || !npc->isAlive()) + ++deadNpcs; + } + + // because the current npc returns isAlive when OnUnitDeath happens + // we check if the number of dead npcs is equal to the list-1 + if (deadNpcs == waveGuidList[internalWaveId].size() - 1) + { + ++_waveCount; + events.ScheduleEvent(EVENT_NEXT_WAVE, 10000); + } + break; + } + } + } + + void Update(uint32 diff) + { + if (!instance->HavePlayers()) + return; + + events.Update(diff); + + switch (events.ExecuteEvent()) + { + case EVENT_NEXT_WAVE: + ProcessEvent(NULL, EVENT_ADD_WAVE); + break; + } + } + + void ProcessEvent(WorldObject* /*go*/, uint32 eventId) + { + switch (eventId) + { + // spawning all wave npcs at once + case EVENT_SPAWN_WAVES: + _waveCount = 1; + DoUpdateWorldState(WORLD_STATE_HOR_WAVES_ENABLED, 1); + DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, _waveCount); + { + std::list possibilityList, tempList; + uint32 posIndex = 0; + + possibilityList.push_back(NPC_WAVE_MERCENARY); + possibilityList.push_back(NPC_WAVE_FOOTMAN); + possibilityList.push_back(NPC_WAVE_RIFLEMAN); + possibilityList.push_back(NPC_WAVE_PRIEST); + possibilityList.push_back(NPC_WAVE_MAGE); + + // iterate each wave + for (uint8 i = 0; i < 8; i++) + { + tempList = possibilityList; + + uint64 bossGuid = i <= 3 ? _falricGUID : _marwynGUID; + + if (!i) + Trinity::Containers::RandomResizeList(tempList, 3); + else if (i < 6 && i != 3) + Trinity::Containers::RandomResizeList(tempList, 4); + + for (std::list::const_iterator itr = tempList.begin(); itr != tempList.end(); ++itr) + { + if (Creature* boss = instance->GetCreature(bossGuid)) + { + if (Creature* temp = boss->SummonCreature(*itr, SpawnPos[posIndex], TEMPSUMMON_DEAD_DESPAWN)) + { + temp->AI()->SetData(0, i); + waveGuidList[i].insert(temp->GetGUID()); + } + } + + ++posIndex; + } + } + } + events.ScheduleEvent(EVENT_NEXT_WAVE, 10000); + break; + case EVENT_ADD_WAVE: + DoUpdateWorldState(WORLD_STATE_HOR_WAVES_ENABLED, 1); + DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, _waveCount); + HandleGameObject(_entranceDoorGUID, false); + + if (_waveCount % 5) + { + uint32 internalWaveId = _waveCount - ((_waveCount < 5) ? 1 : 2); + for (std::set::const_iterator itr = waveGuidList[internalWaveId].begin(); itr != waveGuidList[internalWaveId].end(); ++itr) + { + if (Creature* temp = instance->GetCreature(*itr)) + { + temp->CastSpell(temp, SPELL_SPIRIT_ACTIVATE, true); + temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_NOT_SELECTABLE); + temp->AI()->DoZoneInCombat(); + } + } + } + else + { + uint32 bossIndex = (_waveCount / 5) - 1; + if (GetBossState(DATA_FALRIC_EVENT + bossIndex) != DONE) + { + if (Creature* boss = instance->GetCreature(bossIndex ? _marwynGUID : _falricGUID)) + if (boss->AI()) + boss->AI()->DoAction(ACTION_ENTER_COMBAT); + } + else if (_waveCount != 10) + { + ++_waveCount; + events.ScheduleEvent(EVENT_NEXT_WAVE, 10000); + } + } + break; + case EVENT_DO_WIPE: + _waveCount = 0; + events.Reset(); + DoUpdateWorldState(WORLD_STATE_HOR_WAVES_ENABLED, 1); + DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, _waveCount); + HandleGameObject(_entranceDoorGUID, true); + + if (Creature* falric = instance->GetCreature(_falricGUID)) + falric->SetVisible(false); + if (Creature* marwyn = instance->GetCreature(_marwynGUID)) + marwyn->SetVisible(false); + + //despawn wave npcs + for (uint8 i = 0; i < 8; ++i) + { + for (std::set::const_iterator itr = waveGuidList[i].begin(); itr != waveGuidList[i].end(); ++itr) + if (Creature* creature = instance->GetCreature(*itr)) + creature->DespawnOrUnsummon(1); + + waveGuidList[i].clear(); + } + break; + } + } + uint32 GetData(uint32 type) const { switch (type) @@ -294,7 +459,7 @@ public: return saveStream.str(); } - void Load(const char* in) + void Load(char const* in) { if (!in) { @@ -340,159 +505,6 @@ public: OUT_LOAD_INST_DATA_COMPLETE; } - // wave scheduling,checked when wave npcs die - void OnUnitDeath(Unit* unit) - { - Creature* creature = unit->ToCreature(); - if (!creature) - return; - - switch (creature->GetEntry()) - { - case NPC_WAVE_MERCENARY: - case NPC_WAVE_FOOTMAN: - case NPC_WAVE_RIFLEMAN: - case NPC_WAVE_PRIEST: - case NPC_WAVE_MAGE: - { - uint32 deadNpcs = 0; - uint32 internalWaveId = _waveCount - ((_waveCount < 5) ? 1 : 2); - for (std::set::const_iterator itr = waveGuidList[internalWaveId].begin(); itr != waveGuidList[internalWaveId].end(); ++itr) - { - Creature* npc = instance->GetCreature(*itr); - if (!npc || !npc->isAlive()) - ++deadNpcs; - } - - // because the current npc returns isAlive when OnUnitDeath happens - // we check if the number of dead npcs is equal to the list-1 - if (deadNpcs == waveGuidList[internalWaveId].size() - 1) - events.ScheduleEvent(EVENT_NEXT_WAVE, 10000); - break; - } - } - } - - void Update(uint32 diff) - { - if (!instance->HavePlayers()) - return; - - events.Update(diff); - - switch (events.ExecuteEvent()) - { - case EVENT_NEXT_WAVE: - ++_waveCount; - ProcessEvent(NULL, EVENT_ADD_WAVE); - break; - } - } - - void ProcessEvent(WorldObject* /*go*/, uint32 eventId) - { - switch (eventId) - { - // spawning all wave npcs at once - case EVENT_SPAWN_WAVES: - DoUpdateWorldState(WORLD_STATE_HOR, 1); - DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, _waveCount); - { - std::list possibilityList, tempList; - uint32 posIndex = 0; - - possibilityList.push_back(NPC_WAVE_MERCENARY); - possibilityList.push_back(NPC_WAVE_FOOTMAN); - possibilityList.push_back(NPC_WAVE_RIFLEMAN); - possibilityList.push_back(NPC_WAVE_PRIEST); - possibilityList.push_back(NPC_WAVE_MAGE); - - // iterate each wave - for (uint8 i = 0; i < 8; i++) - { - tempList = possibilityList; - - uint64 bossGuid = i <= 3 ? _falricGUID : _marwynGUID; - - if (!i) - Trinity::Containers::RandomResizeList(tempList, 3); - else if (i < 6 && i != 3) - Trinity::Containers::RandomResizeList(tempList, 4); - - for (std::list::const_iterator itr = tempList.begin(); itr != tempList.end(); ++itr) - { - if (Creature* boss = instance->GetCreature(bossGuid)) - { - if (Creature* temp = boss->SummonCreature(*itr, SpawnPos[posIndex], TEMPSUMMON_DEAD_DESPAWN)) - { - temp->AI()->SetData(0, i); - waveGuidList[i].insert(temp->GetGUID()); - } - } - - ++posIndex; - } - } - } - SetData(DATA_WAVE_COUNT, SPECIAL); - break; - case EVENT_ADD_WAVE: - DoUpdateWorldState(WORLD_STATE_HOR, 1); - DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, _waveCount); - HandleGameObject(_entranceDoorGUID, false); - - if (_waveCount % 5) - { - uint32 internalWaveId = _waveCount - ((_waveCount < 5) ? 1 : 2); - for (std::set::const_iterator itr = waveGuidList[internalWaveId].begin(); itr != waveGuidList[internalWaveId].end(); ++itr) - { - if (Creature* temp = instance->GetCreature(*itr)) - { - temp->CastSpell(temp, SPELL_SPIRIT_ACTIVATE, true); - temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_NOT_SELECTABLE); - temp->AI()->DoZoneInCombat(); - } - } - } - else - { - uint32 bossIndex = (_waveCount / 5) - 1; - if (GetBossState(DATA_FALRIC_EVENT + bossIndex) != DONE) - { - if (Creature* boss = instance->GetCreature(bossIndex ? _marwynGUID :_falricGUID)) - if (boss->AI()) - boss->AI()->DoAction(ACTION_ENTER_COMBAT); - } - else if (_waveCount != 10) - events.ScheduleEvent(EVENT_NEXT_WAVE, 10000); - } - break; - case EVENT_DO_WIPE: - //SetData(DATA_WAVE_COUNT, NOT_STARTED); - _waveCount = 0; - events.Reset(); - DoUpdateWorldState(WORLD_STATE_HOR, 1); - DoUpdateWorldState(WORLD_STATE_HOR_WAVE_COUNT, _waveCount); - HandleGameObject(_entranceDoorGUID, true); - - if (Creature* falric = instance->GetCreature(_falricGUID)) - falric->SetVisible(false); - if (Creature* marwyn = instance->GetCreature(_marwynGUID)) - marwyn->SetVisible(false); - - //despawn wave npcs - for (uint8 i = 0; i < 8; i++) - { - for (std::set::const_iterator itr = waveGuidList[i].begin(); itr != waveGuidList[i].end(); ++itr) - if (Creature* creature = instance->GetCreature(*itr)) - creature->DespawnOrUnsummon(); - - waveGuidList[i].clear(); - } - break; - } - } - private: uint64 _falricGUID; uint64 _marwynGUID;