aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorclick <none@none>2010-04-21 23:14:37 +0200
committerclick <none@none>2010-04-21 23:14:37 +0200
commit12950d1c165204e46b735c0f1a58bb97834be647 (patch)
tree04623cc52c98017155e45f52b6d266f097f023ae /src
parent3a826ecfeea9222fdd4f5528a4e5e09eb7a4a2ba (diff)
Update trigger visibility when doing gm on/off
Fix by liberate --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Level1.cpp2
-rw-r--r--src/game/Player.cpp22
-rw-r--r--src/game/Player.h1
3 files changed, 25 insertions, 0 deletions
diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp
index ba82b7aff7b..b06e3628a27 100644
--- a/src/game/Level1.cpp
+++ b/src/game/Level1.cpp
@@ -228,6 +228,7 @@ bool ChatHandler::HandleGMCommand(const char* args)
{
m_session->GetPlayer()->SetGameMaster(true);
m_session->SendNotification(LANG_GM_ON);
+ m_session->GetPlayer()->UpdateTriggerVisibility();
#ifdef _DEBUG_VMAPS
VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
vMapManager->processCommand("stoplog");
@@ -239,6 +240,7 @@ bool ChatHandler::HandleGMCommand(const char* args)
{
m_session->GetPlayer()->SetGameMaster(false);
m_session->SendNotification(LANG_GM_OFF);
+ m_session->GetPlayer()->UpdateTriggerVisibility();
#ifdef _DEBUG_VMAPS
VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
vMapManager->processCommand("startlog");
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index e0acc99fcb0..45bf0867cbb 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -20325,6 +20325,28 @@ void Player::UpdateVisibilityOf(WorldObject* target)
}
}
+void Player::UpdateTriggerVisibility()
+{
+ if (m_clientGUIDs.empty())
+ return;
+
+ UpdateData udata;
+ WorldPacket packet;
+ for (ClientGUIDs::iterator itr=m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
+ {
+ if (IS_CREATURE_GUID(*itr))
+ {
+ Creature *obj = IsInWorld() ? GetMap()->GetCreature(*itr) : NULL;
+ if (!obj || !obj->isTrigger())
+ continue;
+
+ obj->BuildCreateUpdateBlockForPlayer(&udata,this);
+ }
+ }
+ udata.BuildPacket(&packet);
+ GetSession()->SendPacket(&packet);
+}
+
void Player::SendInitialVisiblePackets(Unit* target)
{
SendAurasForTarget(target);
diff --git a/src/game/Player.h b/src/game/Player.h
index 27d152fbd95..b6175b6bd8d 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -2215,6 +2215,7 @@ class Player : public Unit, public GridObject<Player>
void UpdateObjectVisibility(bool forced = true);
void UpdateVisibilityForPlayer();
void UpdateVisibilityOf(WorldObject* target);
+ void UpdateTriggerVisibility();
template<class T>
void UpdateVisibilityOf(T* target, UpdateData& data, std::set<Unit*>& visibleNow);