aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorccrs <ccrs@users.noreply.github.com>2019-01-17 11:52:38 +0100
committerccrs <ccrs@users.noreply.github.com>2019-01-17 11:52:38 +0100
commitd8819147b023f318c0ca2c42da4d05e4f9551cce (patch)
treecc5e868908f4ed77e0cd101388b264d610769799 /src
parentbcb0b03fac3cc1698b9764e377c727adf01aa659 (diff)
Core/Misc: update SMSG_UPDATE_WORLD_STATE uses
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp21
-rw-r--r--src/server/game/Battlegrounds/Battleground.h7
-rw-r--r--src/server/game/Battlegrounds/BattlegroundMgr.cpp7
-rw-r--r--src/server/game/Battlegrounds/BattlegroundMgr.h1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp10
-rw-r--r--src/server/game/Entities/Player/Player.cpp11
-rw-r--r--src/server/game/Entities/Player/Player.h2
-rw-r--r--src/server/game/Events/GameEventMgr.cpp9
-rw-r--r--src/server/game/Server/Packets/WorldStatePackets.cpp6
-rw-r--r--src/server/game/Server/WorldSession.h14
-rw-r--r--src/server/game/World/World.cpp6
-rw-r--r--src/server/game/World/World.h6
12 files changed, 44 insertions, 56 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 770168e35c4..caa8afe776e 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -38,6 +38,7 @@
#include "Transport.h"
#include "Util.h"
#include "WorldPacket.h"
+#include "WorldStatePackets.h"
#include <cstdarg>
void BattlegroundScore::AppendToPacket(WorldPacket& data)
@@ -564,14 +565,14 @@ Position const* Battleground::GetTeamStartPosition(TeamId teamId) const
return &StartPosition[teamId];
}
-void Battleground::SendPacketToAll(WorldPacket* packet)
+void Battleground::SendPacketToAll(WorldPacket const* packet)
{
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
if (Player* player = _GetPlayer(itr, "SendPacketToAll"))
player->SendDirectMessage(packet);
}
-void Battleground::SendPacketToTeam(uint32 TeamID, WorldPacket* packet, Player* sender, bool self)
+void Battleground::SendPacketToTeam(uint32 TeamID, WorldPacket const* packet, Player* sender, bool self)
{
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
@@ -659,18 +660,12 @@ void Battleground::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
}
}
-void Battleground::UpdateWorldState(uint32 Field, uint32 Value)
+void Battleground::UpdateWorldState(uint32 variable, uint32 value)
{
- WorldPacket data;
- sBattlegroundMgr->BuildUpdateWorldStatePacket(&data, Field, Value);
- SendPacketToAll(&data);
-}
-
-void Battleground::UpdateWorldStateForPlayer(uint32 field, uint32 value, Player* player)
-{
- WorldPacket data;
- sBattlegroundMgr->BuildUpdateWorldStatePacket(&data, field, value);
- player->SendDirectMessage(&data);
+ WorldPackets::WorldState::UpdateWorldState worldstate;
+ worldstate.VariableID = variable;
+ worldstate.Value = value;
+ SendPacketToAll(worldstate.Write());
}
void Battleground::EndBattleground(uint32 winner)
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index 05d9508e346..2100b0da546 100644
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -363,8 +363,8 @@ class TC_GAME_API Battleground
// Packet Transfer
// method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!)
virtual void FillInitialWorldStates(WorldPacket& /*data*/) { }
- void SendPacketToTeam(uint32 TeamID, WorldPacket* packet, Player* sender = nullptr, bool self = true);
- void SendPacketToAll(WorldPacket* packet);
+ void SendPacketToTeam(uint32 TeamID, WorldPacket const* packet, Player* sender = nullptr, bool self = true);
+ void SendPacketToAll(WorldPacket const* packet);
void SendChatMessage(Creature* source, uint8 textId, WorldObject* target = nullptr);
void SendBroadcastText(uint32 id, ChatMsg msgType, WorldObject const* target = nullptr);
@@ -378,8 +378,7 @@ class TC_GAME_API Battleground
void RemoveAuraOnTeam(uint32 SpellID, uint32 TeamID);
void RewardHonorToTeam(uint32 Honor, uint32 TeamID);
void RewardReputationToTeam(uint32 faction_id, uint32 Reputation, uint32 TeamID);
- void UpdateWorldState(uint32 Field, uint32 Value);
- void UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player* player);
+ void UpdateWorldState(uint32 variable, uint32 value);
virtual void EndBattleground(uint32 winner);
void BlockMovement(Player* player);
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index 0f66c575aa5..7e7b4b3e9f8 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -244,13 +244,6 @@ void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket* data, Grou
*data << uint64(0); // player guid
}
-void BattlegroundMgr::BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value)
-{
- data->Initialize(SMSG_UPDATE_WORLD_STATE, 4+4);
- *data << uint32(field);
- *data << uint32(value);
-}
-
void BattlegroundMgr::BuildPlaySoundPacket(WorldPacket* data, uint32 soundid)
{
data->Initialize(SMSG_PLAY_SOUND, 4);
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h
index ccd8b5a0c7d..162c7a25bc9 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.h
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.h
@@ -78,7 +78,6 @@ class TC_GAME_API BattlegroundMgr
void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, ObjectGuid guid);
void BuildBattlegroundListPacket(WorldPacket* data, ObjectGuid guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere);
void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result);
- void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value);
void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 queueSlot, uint8 statusId, uint32 time1, uint32 time2, uint8 arenaType, uint32 arenaFaction);
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundId);
void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, ObjectGuid guid);
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
index c6e00a9c8a1..6398b5529c3 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
@@ -184,9 +184,9 @@ void BattlegroundEY::CheckSomeoneJoinedPoint()
{
//player joined point!
//show progress bar
- UpdateWorldStateForPlayer(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY, player);
- UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[i], player);
- UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, player);
+ player->SendUpdateWorldState(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY);
+ player->SendUpdateWorldState(PROGRESS_BAR_STATUS, m_PointBarStatus[i]);
+ player->SendUpdateWorldState(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW);
//add player to point
m_PlayersNearPoint[i].push_back(m_PlayersNearPoint[EY_POINTS_MAX][j]);
//remove player from "free space"
@@ -228,7 +228,7 @@ void BattlegroundEY::CheckSomeoneLeftPoint()
{
m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]);
m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j);
- UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, player);
+ player->SendUpdateWorldState(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW);
}
else
{
@@ -271,7 +271,7 @@ void BattlegroundEY::UpdatePointStatuses()
Player* player = ObjectAccessor::FindPlayer(m_PlayersNearPoint[point][i]);
if (player)
{
- UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], player);
+ player->SendUpdateWorldState(PROGRESS_BAR_STATUS, m_PointBarStatus[point]);
//if point owner changed we must evoke event!
if (pointOwnerTeamId != m_PointOwnedByTeam[point])
{
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 9535961b376..21d9b0d5623 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -96,6 +96,7 @@
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
+#include "WorldStatePackets.h"
#define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS)
@@ -8773,12 +8774,12 @@ void Player::SendNotifyLootItemRemoved(uint8 lootSlot) const
SendDirectMessage(&data);
}
-void Player::SendUpdateWorldState(uint32 Field, uint32 Value) const
+void Player::SendUpdateWorldState(uint32 variable, uint32 value) const
{
- WorldPacket data(SMSG_UPDATE_WORLD_STATE, 8);
- data << Field;
- data << Value;
- SendDirectMessage(&data);
+ WorldPackets::WorldState::UpdateWorldState worldstate;
+ worldstate.VariableID = variable;
+ worldstate.Value = value;
+ SendDirectMessage(worldstate.Write());
}
void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 71e3ff8519d..e31f9f7d3b4 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1853,7 +1853,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void DeleteEquipmentSet(uint64 setGuid);
void SendInitWorldStates(uint32 zone, uint32 area);
- void SendUpdateWorldState(uint32 Field, uint32 Value) const;
+ void SendUpdateWorldState(uint32 variable, uint32 value) const;
void SendDirectMessage(WorldPacket const* data) const;
void SendBGWeekendWorldStates() const;
void SendBattlefieldWorldStates() const;
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index 3c1bc3a140f..a496a7940da 100644
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -30,7 +30,7 @@
#include "PoolMgr.h"
#include "Player.h"
#include "World.h"
-#include "WorldPacket.h"
+#include "WorldStatePackets.h"
GameEventMgr* GameEventMgr::instance()
{
@@ -1569,9 +1569,10 @@ void GameEventMgr::UpdateWorldStates(uint16 event_id, bool Activate)
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
if (bl && bl->HolidayWorldStateId)
{
- WorldPacket data;
- sBattlegroundMgr->BuildUpdateWorldStatePacket(&data, bl->HolidayWorldStateId, Activate ? 1 : 0);
- sWorld->SendGlobalMessage(&data);
+ WorldPackets::WorldState::UpdateWorldState worldstate;
+ worldstate.VariableID = bl->HolidayWorldStateId;
+ worldstate.Value = Activate ? 1 : 0;
+ sWorld->SendGlobalMessage(worldstate.Write());
}
}
}
diff --git a/src/server/game/Server/Packets/WorldStatePackets.cpp b/src/server/game/Server/Packets/WorldStatePackets.cpp
index 1c8442ac955..5d9b2b350c7 100644
--- a/src/server/game/Server/Packets/WorldStatePackets.cpp
+++ b/src/server/game/Server/Packets/WorldStatePackets.cpp
@@ -17,17 +17,17 @@
#include "WorldStatePackets.h"
-WorldPackets::WorldState::InitWorldStates::InitWorldStates() : ServerPacket(SMSG_INIT_WORLD_STATES, 4 + 4 + 4 + 4) { }
+WorldPackets::WorldState::InitWorldStates::InitWorldStates() : ServerPacket(SMSG_INIT_WORLD_STATES, 4 + 4 + 4 + 2) { }
WorldPacket const* WorldPackets::WorldState::InitWorldStates::Write()
{
- _worldPacket.reserve(4 + 4 + 4 + 4 + Worldstates.size() * 8);
+ _worldPacket.reserve(4 + 4 + 4 + 2 + Worldstates.size() * 8);
_worldPacket << int32(MapID);
_worldPacket << int32(ZoneID);
_worldPacket << int32(AreaID);
- _worldPacket << uint32(Worldstates.size());
+ _worldPacket << uint16(Worldstates.size());
for (WorldStateInfo const& wsi : Worldstates)
{
_worldPacket << int32(wsi.VariableID);
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 3e7344794e8..7dc9a1d11c7 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -58,13 +58,13 @@ struct TradeStatusInfo;
namespace lfg
{
-struct LfgJoinResultData;
-struct LfgPlayerBoot;
-struct LfgProposal;
-struct LfgQueueStatusData;
-struct LfgPlayerRewardData;
-struct LfgRoleCheck;
-struct LfgUpdateData;
+ struct LfgJoinResultData;
+ struct LfgPlayerBoot;
+ struct LfgProposal;
+ struct LfgQueueStatusData;
+ struct LfgPlayerRewardData;
+ struct LfgRoleCheck;
+ struct LfgUpdateData;
}
namespace rbac
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 72df52fbcce..c9bacd4057a 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -2470,7 +2470,7 @@ void World::ForceGameEventUpdate()
}
/// Send a packet to all players (except self if mentioned)
-void World::SendGlobalMessage(WorldPacket* packet, WorldSession* self, uint32 team)
+void World::SendGlobalMessage(WorldPacket const* packet, WorldSession* self, uint32 team)
{
SessionMap::const_iterator itr;
for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
@@ -2487,7 +2487,7 @@ void World::SendGlobalMessage(WorldPacket* packet, WorldSession* self, uint32 te
}
/// Send a packet to all GMs (except self if mentioned)
-void World::SendGlobalGMMessage(WorldPacket* packet, WorldSession* self, uint32 team)
+void World::SendGlobalGMMessage(WorldPacket const* packet, WorldSession* self, uint32 team)
{
for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
{
@@ -2615,7 +2615,7 @@ void World::SendGlobalText(char const* text, WorldSession* self)
}
/// Send a packet to all players (or players selected team) in the zone (except self if mentioned)
-bool World::SendZoneMessage(uint32 zone, WorldPacket* packet, WorldSession* self, uint32 team)
+bool World::SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession* self, uint32 team)
{
bool foundPlayerToSend = false;
SessionMap::const_iterator itr;
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index 030c928ab25..e2fd8478f11 100644
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -656,9 +656,9 @@ class TC_GAME_API World
void SendGlobalText(char const* text, WorldSession* self);
void SendGMText(uint32 string_id, ...);
void SendServerMessage(ServerMessageType type, const char *text = "", Player* player = nullptr);
- void SendGlobalMessage(WorldPacket* packet, WorldSession* self = nullptr, uint32 team = 0);
- void SendGlobalGMMessage(WorldPacket* packet, WorldSession* self = nullptr, uint32 team = 0);
- bool SendZoneMessage(uint32 zone, WorldPacket* packet, WorldSession* self = nullptr, uint32 team = 0);
+ void SendGlobalMessage(WorldPacket const* packet, WorldSession* self = nullptr, uint32 team = 0);
+ void SendGlobalGMMessage(WorldPacket const* packet, WorldSession* self = nullptr, uint32 team = 0);
+ bool SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession* self = nullptr, uint32 team = 0);
void SendZoneText(uint32 zone, const char *text, WorldSession* self = nullptr, uint32 team = 0);
/// Are we in the middle of a shutdown?