Created
May 26, 2016 01:36
-
-
Save Demonid/6b8e065b18f362f2f42e4279e325b1ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h | |
index 5f13461..8f745d7 100644 | |
--- a/src/server/game/Maps/Map.h | |
+++ b/src/server/game/Maps/Map.h | |
@@ -419,6 +419,7 @@ class TC_GAME_API Map : public GridRefManager<NGridType> | |
bool HavePlayers() const { return !m_mapRefManager.isEmpty(); } | |
uint32 GetPlayersCountExceptGMs() const; | |
+ uint32 GetAlivePlayersCountExceptGMs() const; | |
bool ActiveObjectsNearGrid(NGridType const& ngrid) const; | |
void AddWorldObject(WorldObject* obj) { i_worldObjects.insert(obj); } | |
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp | |
index 794be12..e0070f4 100644 | |
--- a/src/server/game/Maps/Map.cpp | |
+++ b/src/server/game/Maps/Map.cpp | |
@@ -2895,6 +2895,18 @@ uint32 Map::GetPlayersCountExceptGMs() const | |
return count; | |
} | |
+uint32 Map::GetAlivePlayersCountExceptGMs() const | |
+{ | |
+ uint32 count = 0; | |
+ for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr) | |
+ { | |
+ if (itr->GetSource()->IsGameMaster() || !itr->GetSource()->IsAlive()) | |
+ continue; | |
+ ++count; | |
+ } | |
+ return count; | |
+} | |
+ | |
void Map::SendToPlayers(WorldPacket* data) const | |
{ | |
for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr) | |
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp | |
index ef6005d..302e42b 100644 | |
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp | |
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp | |
@@ -138,7 +138,8 @@ enum Events | |
EVENT_SHADOW_PULSARS_SHOOT = 14, | |
EVENT_TRIGGER_BERSERK = 15, | |
EVENT_TWILIGHT_MENDING = 16, | |
- EVENT_ACTIVATE_EMBERS = 17 | |
+ EVENT_ACTIVATE_EMBERS = 17, | |
+ EVENT_EVADE_CHECK = 18 | |
}; | |
enum Actions | |
@@ -596,6 +597,7 @@ class npc_halion_controller : public CreatureScript | |
_materialDamageTaken = 0; | |
_events.ScheduleEvent(EVENT_TRIGGER_BERSERK, Minutes(8)); | |
+ _events.ScheduleEvent(EVENT_EVADE_CHECK, Seconds(5)); | |
} | |
void EnterEvadeMode(EvadeReason /*why*/) override | |
@@ -740,6 +742,11 @@ class npc_halion_controller : public CreatureScript | |
UpdateCorporeality(); | |
_events.ScheduleEvent(EVENT_CHECK_CORPOREALITY, Seconds(5)); | |
break; | |
+ case EVENT_EVADE_CHECK: | |
+ if (!me->GetMap()->GetAlivePlayersCountExceptGMs()) | |
+ EnterEvadeMode(EVADE_REASON_NO_HOSTILES); | |
+ _events.Repeat(Seconds(5)); | |
+ break; | |
case EVENT_ACTIVATE_EMBERS: | |
_summons.DoZoneInCombat(NPC_LIVING_EMBER); | |
break; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment