aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKudlaty <none@none>2009-08-14 20:56:01 +0200
committerKudlaty <none@none>2009-08-14 20:56:01 +0200
commitce21d65aa29e96da160998750da96cba69eefb57 (patch)
tree7206cab665f999287eba4c76f4fb3be9a465e473 /src
parent686cd6eeffdad89e24407bbb816f48997cf3bb53 (diff)
Merge [SD2]
r1276 Add function DoUpdateWorldState() to ScriptedInstance class for sending update to all players in instance. --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/InstanceData.cpp17
-rw-r--r--src/game/InstanceData.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/src/game/InstanceData.cpp b/src/game/InstanceData.cpp
index 551db4eb2cb..567c06ac5ec 100644
--- a/src/game/InstanceData.cpp
+++ b/src/game/InstanceData.cpp
@@ -21,6 +21,7 @@
#include "InstanceData.h"
#include "Database/DatabaseEnv.h"
#include "Map.h"
+#include "Player.h"
#include "GameObject.h"
#include "Creature.h"
#include "CreatureAI.h"
@@ -279,3 +280,19 @@ void InstanceData::DoRespawnGameObject(uint64 uiGuid, uint32 uiTimeToDespawn)
pGo->SetRespawnTime(uiTimeToDespawn);
}
}
+
+void InstanceData::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData)
+{
+ Map::PlayerList const& lPlayers = instance->GetPlayers();
+
+ if (!lPlayers.isEmpty())
+ {
+ for(Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr)
+ {
+ if (Player* pPlayer = itr->getSource())
+ pPlayer->SendUpdateWorldState(uiStateId, uiStateData);
+ }
+ }
+ else
+ debug_log("TSCR: DoUpdateWorldState attempt send data but no players in map.");
+}
diff --git a/src/game/InstanceData.h b/src/game/InstanceData.h
index d06043ff07d..90be75fa5da 100644
--- a/src/game/InstanceData.h
+++ b/src/game/InstanceData.h
@@ -149,6 +149,9 @@ class TRINITY_DLL_SPEC InstanceData : public ZoneScript
//Respawns a GO having negative spawntimesecs in gameobject-table
void DoRespawnGameObject(uint64 uiGuid, uint32 uiTimeToDespawn = MINUTE);
+ //sends world state update to all players in instance
+ void DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData);
+
virtual bool SetBossState(uint32 id, EncounterState state);
EncounterState GetBossState(uint32 id) const { return id < bosses.size() ? bosses[id].state : TO_BE_DECIDED; }
const BossBoundaryMap * GetBossBoundary(uint32 id) const { return id < bosses.size() ? &bosses[id].boundary : NULL; }