From 4c4b04f07b48f9d9370a8153f9b8a0e611e5fdb0 Mon Sep 17 00:00:00 2001 From: Jelle Meeus Date: Wed, 19 Feb 2025 11:55:09 +0100 Subject: [PATCH] refactor(Core/Packet): use WorldPackets::WorldState::InitWorldStates definition (#20475) Co-authored-by: ccrs --- src/server/game/Battlefield/Battlefield.h | 4 +- .../game/Battlefield/Zones/BattlefieldWG.cpp | 61 +- .../game/Battlefield/Zones/BattlefieldWG.h | 5 +- src/server/game/Battlegrounds/Arena.cpp | 9 +- src/server/game/Battlegrounds/Arena.h | 2 +- src/server/game/Battlegrounds/Battleground.h | 3 +- .../Battlegrounds/Zones/BattlegroundAB.cpp | 23 +- .../game/Battlegrounds/Zones/BattlegroundAB.h | 2 +- .../Battlegrounds/Zones/BattlegroundAV.cpp | 30 +- .../game/Battlegrounds/Zones/BattlegroundAV.h | 2 +- .../Battlegrounds/Zones/BattlegroundBE.cpp | 7 +- .../game/Battlegrounds/Zones/BattlegroundBE.h | 2 +- .../Battlegrounds/Zones/BattlegroundDS.cpp | 7 +- .../game/Battlegrounds/Zones/BattlegroundDS.h | 2 +- .../Battlegrounds/Zones/BattlegroundEY.cpp | 52 +- .../game/Battlegrounds/Zones/BattlegroundEY.h | 8 +- .../Battlegrounds/Zones/BattlegroundIC.cpp | 18 +- .../game/Battlegrounds/Zones/BattlegroundIC.h | 2 +- .../Battlegrounds/Zones/BattlegroundNA.cpp | 6 +- .../game/Battlegrounds/Zones/BattlegroundNA.h | 3 +- .../Battlegrounds/Zones/BattlegroundRL.cpp | 6 +- .../game/Battlegrounds/Zones/BattlegroundRL.h | 2 +- .../Battlegrounds/Zones/BattlegroundRV.cpp | 6 +- .../game/Battlegrounds/Zones/BattlegroundRV.h | 2 +- .../Battlegrounds/Zones/BattlegroundSA.cpp | 58 +- .../game/Battlegrounds/Zones/BattlegroundSA.h | 2 +- .../Battlegrounds/Zones/BattlegroundWS.cpp | 17 +- .../game/Battlegrounds/Zones/BattlegroundWS.h | 2 +- src/server/game/Entities/Player/Player.cpp | 1075 +++++++++-------- src/server/game/Entities/Player/Player.h | 4 +- src/server/game/Instances/InstanceScript.h | 3 +- src/server/game/OutdoorPvP/OutdoorPvP.h | 5 +- src/server/game/Server/WorldSession.cpp | 2 +- src/server/game/World/WorldState.cpp | 24 +- src/server/game/World/WorldState.h | 2 +- .../instance_culling_of_stratholme.cpp | 14 +- .../RubySanctum/instance_ruby_sanctum.cpp | 12 +- .../instance_halls_of_reflection.cpp | 4 +- .../instance_icecrown_citadel.cpp | 16 +- .../Nexus/Oculus/instance_oculus.cpp | 1 + .../Ulduar/Ulduar/instance_ulduar.cpp | 8 +- .../scripts/OutdoorPvP/OutdoorPvPEP.cpp | 105 +- src/server/scripts/OutdoorPvP/OutdoorPvPEP.h | 14 +- .../scripts/OutdoorPvP/OutdoorPvPGH.cpp | 9 +- src/server/scripts/OutdoorPvP/OutdoorPvPGH.h | 2 +- .../scripts/OutdoorPvP/OutdoorPvPHP.cpp | 44 +- src/server/scripts/OutdoorPvP/OutdoorPvPHP.h | 4 +- .../scripts/OutdoorPvP/OutdoorPvPNA.cpp | 75 +- src/server/scripts/OutdoorPvP/OutdoorPvPNA.h | 4 +- .../scripts/OutdoorPvP/OutdoorPvPSI.cpp | 10 +- src/server/scripts/OutdoorPvP/OutdoorPvPSI.h | 3 +- .../scripts/OutdoorPvP/OutdoorPvPTF.cpp | 41 +- src/server/scripts/OutdoorPvP/OutdoorPvPTF.h | 5 +- .../scripts/OutdoorPvP/OutdoorPvPZM.cpp | 106 +- src/server/scripts/OutdoorPvP/OutdoorPvPZM.h | 18 +- 55 files changed, 1006 insertions(+), 947 deletions(-) diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index e04b180ba..966c5fc98 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -81,7 +81,7 @@ public: virtual ~BfCapturePoint() { } - virtual void FillInitialWorldStates(WorldPacket& /*data*/) {} + virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& /*packet*/) { } // Send world state update to all players present void SendUpdateWorldState(uint32 field, uint32 value); @@ -334,7 +334,7 @@ public: /// Send all worldstate data to all player in zone. virtual void SendInitWorldStatesToAll() = 0; - virtual void FillInitialWorldStates(WorldPacket& /*data*/) = 0; + virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& /*packet*/) = 0; /// Return if we can use mount in battlefield bool CanFlyIn() { return !m_isActive; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 7052f3275..91d75a385 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -29,6 +29,7 @@ #include "TemporarySummon.h" #include "Vehicle.h" #include "WorldSession.h" +#include "WorldStatePackets.h" BattlefieldWG::~BattlefieldWG() { @@ -74,7 +75,7 @@ bool BattlefieldWG::SetupBattlefield() m_saveTimer = 60000; - // Init GraveYards + // Init Graveyards SetGraveyardNumber(BATTLEFIELD_WG_GRAVEYARD_MAX); // Load from db @@ -102,12 +103,12 @@ bool BattlefieldWG::SetupBattlefield() BfGraveyardWG* graveyard = new BfGraveyardWG(this); // When between games, the graveyard is controlled by the defending team - if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL) - graveyard->Initialize(WGGraveYard[i].gyid == BATTLEFIELD_WG_GY_WORKSHOP_SE || WGGraveYard[i].gyid == BATTLEFIELD_WG_GY_WORKSHOP_SW ? GetAttackerTeam() : m_DefenderTeam, WGGraveYard[i].gyid); + if (WGGraveyard[i].startcontrol == TEAM_NEUTRAL) + graveyard->Initialize(WGGraveyard[i].gyid == BATTLEFIELD_WG_GY_WORKSHOP_SE || WGGraveyard[i].gyid == BATTLEFIELD_WG_GY_WORKSHOP_SW ? GetAttackerTeam() : m_DefenderTeam, WGGraveyard[i].gyid); else - graveyard->Initialize(WGGraveYard[i].startcontrol, WGGraveYard[i].gyid); + graveyard->Initialize(WGGraveyard[i].startcontrol, WGGraveyard[i].gyid); - graveyard->SetTextId(WGGraveYard[i].textid); + graveyard->SetTextId(WGGraveyard[i].textid); m_GraveyardList[i] = graveyard; } @@ -933,46 +934,46 @@ uint32 BattlefieldWG::GetData(uint32 data) const return Battlefield::GetData(data); } -void BattlefieldWG::FillInitialWorldStates(WorldPacket& data) +void BattlefieldWG::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(BATTLEFIELD_WG_WORLD_STATE_ATTACKER) << uint32(GetAttackerTeam()); - data << uint32(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) << uint32(GetDefenderTeam()); - data << uint32(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) << uint32(IsWarTime() ? 0 : 1); // Note: cleanup these two, their names look awkward - data << uint32(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE) << uint32(IsWarTime() ? 1 : 0); + packet.Worldstates.reserve(4+2+WG_MAX_OBJ+WG_MAX_WORKSHOP); + packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_ATTACKER, GetAttackerTeam()); + packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, GetDefenderTeam()); + + // Note: cleanup these two, their names look awkward + packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, IsWarTime() ? 0 : 1); + packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE, IsWarTime() ? 1 : 0); for (uint32 i = 0; i < 2; ++i) - data << ClockWorldState[i] << uint32(GameTime::GetGameTime().count() + (m_Timer / 1000)); + packet.Worldstates.emplace_back(ClockWorldState[i], GameTime::GetGameTime().count() + (m_Timer / 1000)); - data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); - data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H); - data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); - data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A); + packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)); + packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)); + packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A)); + packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A)); - data << uint32(WORLDSTATE_HORDE_KEEP_CAPTURED) << uint32(sWorld->getWorldState(WORLDSTATE_HORDE_KEEP_CAPTURED)); - data << uint32(WORLDSTATE_HORDE_KEEP_DEFENDED) << uint32(sWorld->getWorldState(WORLDSTATE_HORDE_KEEP_DEFENDED)); - data << uint32(WORLDSTATE_ALLIANCE_KEEP_CAPTURED) << uint32(sWorld->getWorldState(WORLDSTATE_ALLIANCE_KEEP_CAPTURED)); - data << uint32(WORLDSTATE_ALLIANCE_KEEP_DEFENDED) << uint32(sWorld->getWorldState(WORLDSTATE_ALLIANCE_KEEP_DEFENDED)); + packet.Worldstates.emplace_back(WORLDSTATE_ALLIANCE_KEEP_DEFENDED, uint32(sWorld->getWorldState(WORLDSTATE_ALLIANCE_KEEP_DEFENDED))); + packet.Worldstates.emplace_back(WORLDSTATE_HORDE_KEEP_CAPTURED, uint32(sWorld->getWorldState(WORLDSTATE_HORDE_KEEP_CAPTURED))); + packet.Worldstates.emplace_back(WORLDSTATE_HORDE_KEEP_DEFENDED, uint32(sWorld->getWorldState(WORLDSTATE_HORDE_KEEP_DEFENDED))); + packet.Worldstates.emplace_back(WORLDSTATE_ALLIANCE_KEEP_CAPTURED, uint32(sWorld->getWorldState(WORLDSTATE_ALLIANCE_KEEP_CAPTURED))); for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr) - data << (*itr)->m_WorldState << (*itr)->m_State; + packet.Worldstates.emplace_back((*itr)->m_WorldState, (*itr)->m_State); for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) if (*itr) - data << WorkshopsData[(*itr)->workshopId].worldstate << (*itr)->state; + packet.Worldstates.emplace_back(WorkshopsData[(*itr)->workshopId].worldstate, (*itr)->state); } void BattlefieldWG::SendInitWorldStatesTo(Player* player) { - WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (BuildingsInZone.size() * 8) + (WorkshopsList.size() * 8))); + WorldPackets::WorldState::InitWorldStates packet; + packet.MapID = m_MapId; + packet.ZoneID = m_ZoneId; + packet.AreaID = player->GetAreaId(); + FillInitialWorldStates(packet); - data << uint32(m_MapId); - data << uint32(m_ZoneId); - data << uint32(0); - data << uint16(14 + BuildingsInZone.size() + WorkshopsList.size()); // Number of fields - - FillInitialWorldStates(data); - - player->GetSession()->SendPacket(&data); + player->SendDirectMessage(packet.Write()); } void BattlefieldWG::SendInitWorldStatesToAll() diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 5a53c796e..66ad47147 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -21,6 +21,7 @@ #include "Battlefield.h" #include "Log.h" #include "World.h" +#include "WorldStatePackets.h" class Group; class BattlefieldWG; @@ -238,7 +239,7 @@ const uint32 WGQuest[2][6] = { 13185, 13183, 13223, 13539, 13178, 13180 }, }; // 7 in sql, 7 in header -const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] = +const BfWGCoordGY WGGraveyard[BATTLEFIELD_WG_GRAVEYARD_MAX] = { { 5104.750f, 2300.940f, 368.579f, 0.733038f, 1329, BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GOSSIPTEXT_GY_NE, TEAM_NEUTRAL }, { 5099.120f, 3466.036f, 368.484f, 5.317802f, 1330, BATTLEFIELD_WG_GY_WORKSHOP_NW, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW, TEAM_NEUTRAL }, @@ -403,7 +404,7 @@ public: void SendInitWorldStatesTo(Player* player); void SendInitWorldStatesToAll() override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void HandleKill(Player* killer, Unit* victim) override; void OnUnitDeath(Unit* unit) override; diff --git a/src/server/game/Battlegrounds/Arena.cpp b/src/server/game/Battlegrounds/Arena.cpp index dc200abda..2fd0f863d 100644 --- a/src/server/game/Battlegrounds/Arena.cpp +++ b/src/server/game/Battlegrounds/Arena.cpp @@ -26,7 +26,7 @@ #include "World.h" #include "WorldSession.h" #include "WorldSessionMgr.h" -//#include "WorldStatePackets.h" +#include "WorldStatePackets.h" void ArenaScore::AppendToPacket(WorldPacket& data) { @@ -147,10 +147,11 @@ void Arena::RemovePlayer(Player* /*player*/) CheckWinConditions(); } -void Arena::FillInitialWorldStates(WorldPacket& data) +void Arena::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN) << uint32(GetAlivePlayersCountByTeam(TEAM_HORDE)); - data << uint32(ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD) << uint32(GetAlivePlayersCountByTeam(TEAM_ALLIANCE)); + packet.Worldstates.reserve(2); + packet.Worldstates.emplace_back(ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN, GetAlivePlayersCountByTeam(TEAM_HORDE)); + packet.Worldstates.emplace_back(ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD, GetAlivePlayersCountByTeam(TEAM_ALLIANCE)); } void Arena::UpdateArenaWorldState() diff --git a/src/server/game/Battlegrounds/Arena.h b/src/server/game/Battlegrounds/Arena.h index fd7460080..346d30e7a 100644 --- a/src/server/game/Battlegrounds/Arena.h +++ b/src/server/game/Battlegrounds/Arena.h @@ -52,7 +52,7 @@ protected: void AddPlayer(Player* player) override; void RemovePlayer(Player* /*player*/) override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void UpdateArenaWorldState(); void HandleKillPlayer(Player* player, Player* killer) override; diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 2a9e85e0f..5e1d00f9a 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -24,6 +24,7 @@ #include "GameObject.h" #include "SharedDefines.h" #include "World.h" +#include "WorldStatePackets.h" class Creature; class GameObject; @@ -457,7 +458,7 @@ public: // Packet Transfer // method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!) - virtual void FillInitialWorldStates(WorldPacket& /*data*/) { } + virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& /*packet*/) { } void SendPacketToTeam(TeamId teamId, WorldPacket const* packet, Player* sender = nullptr, bool self = true); void SendPacketToAll(WorldPacket const* packet); void YellToAll(Creature* creature, const char* text, uint32 language); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 4cc94a60d..b9064de35 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -23,6 +23,7 @@ #include "Util.h" #include "WorldPacket.h" #include "WorldSession.h" +#include "WorldStatePackets.h" void BattlegroundABScore::BuildObjectivesBlock(WorldPacket& data) { @@ -234,24 +235,26 @@ void BattlegroundAB::DeleteBanner(uint8 node) SpawnBGObject(node * BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_ONE_DAY); } -void BattlegroundAB::FillInitialWorldStates(WorldPacket& data) +void BattlegroundAB::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { + packet.Worldstates.reserve(BG_AB_DYNAMIC_NODES_COUNT+7); for (auto& node : _capturePointInfo) { if (node._state == BG_AB_NODE_STATE_NEUTRAL) - data << uint32(node._iconNone) << uint32(1); + packet.Worldstates.emplace_back(node._iconNone, 1); for (uint8 i = BG_AB_NODE_STATE_ALLY_OCCUPIED; i <= BG_AB_NODE_STATE_HORDE_CONTESTED; ++i) - data << uint32(node._iconCapture + i - 1) << uint32(node._state == i); + packet.Worldstates.emplace_back(node._iconCapture + i - 1, node._state == i ? 1 : 0); + } - data << uint32(BG_AB_OP_OCCUPIED_BASES_ALLY) << uint32(_controlledPoints[TEAM_ALLIANCE]); - data << uint32(BG_AB_OP_OCCUPIED_BASES_HORDE) << uint32(_controlledPoints[TEAM_HORDE]); - data << uint32(BG_AB_OP_RESOURCES_MAX) << uint32(BG_AB_MAX_TEAM_SCORE); - data << uint32(BG_AB_OP_RESOURCES_WARNING) << uint32(BG_AB_WARNING_NEAR_VICTORY_SCORE); - data << uint32(BG_AB_OP_RESOURCES_ALLY) << uint32(m_TeamScores[TEAM_ALLIANCE]); - data << uint32(BG_AB_OP_RESOURCES_HORDE) << uint32(m_TeamScores[TEAM_HORDE]); - data << uint32(0x745) << uint32(0x2); // 37 1861 unk + packet.Worldstates.emplace_back(BG_AB_OP_OCCUPIED_BASES_ALLY, _controlledPoints[TEAM_ALLIANCE]); + packet.Worldstates.emplace_back(BG_AB_OP_OCCUPIED_BASES_HORDE, _controlledPoints[TEAM_HORDE]); + packet.Worldstates.emplace_back(BG_AB_OP_RESOURCES_MAX, BG_AB_MAX_TEAM_SCORE); + packet.Worldstates.emplace_back(BG_AB_OP_RESOURCES_WARNING, BG_AB_WARNING_NEAR_VICTORY_SCORE); + packet.Worldstates.emplace_back(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[TEAM_ALLIANCE]); + packet.Worldstates.emplace_back(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[TEAM_HORDE]); + packet.Worldstates.emplace_back(0x745, 2); } void BattlegroundAB::SendNodeUpdate(uint8 node) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index 403664faf..b63b9fae9 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -304,7 +304,7 @@ public: GraveyardStruct const* GetClosestGraveyard(Player* player) override; bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void EventPlayerClickedOnFlag(Player* source, GameObject* gameObject) override; bool AllNodesConrolledByTeam(TeamId teamId) const override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index a5e246dae..f4c601fa8 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -25,6 +25,7 @@ #include "Player.h" #include "SpellAuras.h" #include "WorldPacket.h" +#include "WorldStatePackets.h" void BattlegroundAVScore::BuildObjectivesBlock(WorldPacket& data) { @@ -1084,9 +1085,10 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) player->KilledMonsterCredit((IsTower(node)) ? BG_AV_QUEST_CREDIT_TOWER : BG_AV_QUEST_CREDIT_GRAVEYARD); } -void BattlegroundAV::FillInitialWorldStates(WorldPacket& data) +void BattlegroundAV::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { bool stateok; + packet.Worldstates.reserve(7*2*2 + 8*2*2 + 5); //graveyards for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; i++) { @@ -1094,8 +1096,8 @@ void BattlegroundAV::FillInitialWorldStates(WorldPacket& data) { //j=1=assaulted j=3=controled stateok = (m_Nodes[i].State == j); - data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_ALLIANCE)]) << uint32((m_Nodes[i].OwnerId == TEAM_ALLIANCE && stateok) ? 1 : 0); - data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_HORDE)]) << uint32((m_Nodes[i].OwnerId == TEAM_HORDE && stateok) ? 1 : 0); + packet.Worldstates.emplace_back(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_ALLIANCE)], (m_Nodes[i].OwnerId == TEAM_ALLIANCE && stateok) ? 1 : 0); + packet.Worldstates.emplace_back(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_HORDE)], (m_Nodes[i].OwnerId == TEAM_HORDE && stateok) ? 1 : 0); } } @@ -1105,23 +1107,19 @@ void BattlegroundAV::FillInitialWorldStates(WorldPacket& data) { //j=1=assaulted j=3=controled //i dont have j=2=destroyed cause destroyed is the same like enemy-team controll stateok = (m_Nodes[i].State == j || (m_Nodes[i].State == POINT_DESTROYED && j == 3)); - data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_ALLIANCE)]) << uint32((m_Nodes[i].OwnerId == TEAM_ALLIANCE && stateok) ? 1 : 0); - data << uint32(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_HORDE)]) << uint32((m_Nodes[i].OwnerId == TEAM_HORDE && stateok) ? 1 : 0); + packet.Worldstates.emplace_back(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_ALLIANCE)], (m_Nodes[i].OwnerId == TEAM_ALLIANCE && stateok) ? 1 : 0); + packet.Worldstates.emplace_back(BG_AV_NodeWorldStates[i][GetWorldStateType(j, TEAM_HORDE)], (m_Nodes[i].OwnerId == TEAM_HORDE && stateok) ? 1 : 0); } if (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].OwnerId == TEAM_NEUTRAL) //cause neutral teams aren't handled generic - data << uint32(AV_SNOWFALL_N) << uint32(1); - data << uint32(AV_Alliance_Score) << uint32(m_Team_Scores[0]); - data << uint32(AV_Horde_Score) << uint32(m_Team_Scores[1]); - if (GetStatus() == STATUS_IN_PROGRESS) //only if game started the teamscores are displayed { - data << uint32(AV_SHOW_A_SCORE) << uint32(1); - data << uint32(AV_SHOW_H_SCORE) << uint32(1); - } - else - { - data << uint32(AV_SHOW_A_SCORE) << uint32(0); - data << uint32(AV_SHOW_H_SCORE) << uint32(0); + packet.Worldstates.emplace_back(AV_SNOWFALL_N, 1); } + packet.Worldstates.emplace_back(AV_Alliance_Score, m_Team_Scores[0]); + packet.Worldstates.emplace_back(AV_Horde_Score, m_Team_Scores[1]); + + packet.Worldstates.emplace_back(AV_SHOW_A_SCORE, GetStatus() == STATUS_IN_PROGRESS ? 1 : 0); + packet.Worldstates.emplace_back(AV_SHOW_H_SCORE, GetStatus() == STATUS_IN_PROGRESS ? 1 : 0); + SendMineWorldStates(AV_NORTH_MINE); SendMineWorldStates(AV_SOUTH_MINE); } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index 2af1c50b6..e0195206a 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -1936,7 +1936,7 @@ private: void ChangeMineOwner(uint8 mine, TeamId teamId, bool initial = false); /*worldstates*/ - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; uint8 GetWorldStateType(uint8 state, TeamId teamId); void SendMineWorldStates(uint32 mine); void UpdateNodeWorldState(BG_AV_Nodes node); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp index 4acc4fafe..ce210aa60 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp @@ -19,6 +19,7 @@ #include "Log.h" #include "Player.h" #include "WorldPacket.h" +#include "WorldStatePackets.h" BattlegroundBE::BattlegroundBE() { @@ -87,10 +88,10 @@ void BattlegroundBE::HandleAreaTrigger(Player* player, uint32 trigger) } } -void BattlegroundBE::FillInitialWorldStates(WorldPacket& data) +void BattlegroundBE::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(0x9f3) << uint32(1); // 9 - Arena::FillInitialWorldStates(data); + packet.Worldstates.emplace_back(0x9f3, 1); // BATTLEGROUND_BLADES_EDGE_ARENA_SHOW + Arena::FillInitialWorldStates(packet); } bool BattlegroundBE::SetupBattleground() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h index 9d7790d9b..77d5c3423 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h @@ -54,7 +54,7 @@ public: void HandleAreaTrigger(Player* player, uint32 trigger) override; bool SetupBattleground() override; - void FillInitialWorldStates(WorldPacket& d) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; bool HandlePlayerUnderMap(Player* player) override; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index 53d4b3314..5a91f57ac 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -22,6 +22,7 @@ #include "ObjectAccessor.h" #include "Player.h" #include "WorldPacket.h" +#include "WorldStatePackets.h" BattlegroundDS::BattlegroundDS() { @@ -173,10 +174,10 @@ bool BattlegroundDS::HandlePlayerUnderMap(Player* player) return true; } -void BattlegroundDS::FillInitialWorldStates(WorldPacket& data) +void BattlegroundDS::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(3610) << uint32(1); // 9 show - Arena::FillInitialWorldStates(data); + packet.Worldstates.emplace_back(0xe1a, 1); // ARENA_WORLD_STATE_ALIVE_PLAYERS_SHOW + Arena::FillInitialWorldStates(packet); } bool BattlegroundDS::SetupBattleground() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index 3ff673154..2c8340f70 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -101,7 +101,7 @@ public: void HandleAreaTrigger(Player* player, uint32 trigger) override; bool SetupBattleground() override; - void FillInitialWorldStates(WorldPacket& d) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; bool HandlePlayerUnderMap(Player* player) override; private: diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index 226bcf709..8cf1f7813 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -26,6 +26,7 @@ #include "World.h" #include "WorldPacket.h" #include "WorldSession.h" +#include "WorldStatePackets.h" void BattlegroundEYScore::BuildObjectivesBlock(WorldPacket& data) { @@ -506,7 +507,7 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* player, TeamId teamId, uint3 _capturePointInfo[point]._ownerTeamId = teamId; - GraveyardStruct const* sg = sGraveyard->GetGraveyard(m_CapturingPointTypes[point].GraveYardId); + GraveyardStruct const* sg = sGraveyard->GetGraveyard(m_CapturingPointTypes[point].GraveyardId); AddSpiritGuide(point, sg->x, sg->y, sg->z, 3.124139f, teamId); UpdatePointsIcons(point); @@ -568,30 +569,31 @@ bool BattlegroundEY::UpdatePlayerScore(Player* player, uint32 type, uint32 value return true; } -void BattlegroundEY::FillInitialWorldStates(WorldPacket& data) +void BattlegroundEY::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(EY_HORDE_BASE) << uint32(_ownedPointsCount[TEAM_HORDE]); - data << uint32(EY_ALLIANCE_BASE) << uint32(_ownedPointsCount[TEAM_ALLIANCE]); - data << uint32(DRAENEI_RUINS_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_HORDE)); - data << uint32(DRAENEI_RUINS_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_ALLIANCE)); - data << uint32(DRAENEI_RUINS_UNCONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUncontrolled()); - data << uint32(MAGE_TOWER_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_HORDE)); - data << uint32(MAGE_TOWER_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_ALLIANCE)); - data << uint32(MAGE_TOWER_UNCONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUncontrolled()); - data << uint32(FEL_REAVER_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_HORDE)); - data << uint32(FEL_REAVER_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_ALLIANCE)); - data << uint32(FEL_REAVER_UNCONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUncontrolled()); - data << uint32(BLOOD_ELF_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_HORDE)); - data << uint32(BLOOD_ELF_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_ALLIANCE)); - data << uint32(BLOOD_ELF_UNCONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUncontrolled()); - data << uint32(NETHERSTORM_FLAG) << uint32(_flagState == BG_EY_FLAG_STATE_ON_BASE); - data << uint32(NETHERSTORM_FLAG_STATE_HORDE) << uint32(1); - data << uint32(NETHERSTORM_FLAG_STATE_ALLIANCE) << uint32(1); - data << uint32(EY_HORDE_RESOURCES) << uint32(GetTeamScore(TEAM_HORDE)); - data << uint32(EY_ALLIANCE_RESOURCES) << uint32(GetTeamScore(TEAM_ALLIANCE)); - data << uint32(PROGRESS_BAR_SHOW) << uint32(0); - data << uint32(PROGRESS_BAR_PERCENT_GREY) << uint32(0); - data << uint32(PROGRESS_BAR_STATUS) << uint32(0); + packet.Worldstates.reserve(22); + packet.Worldstates.emplace_back(EY_HORDE_BASE, _ownedPointsCount[TEAM_HORDE]); + packet.Worldstates.emplace_back(EY_ALLIANCE_BASE, _ownedPointsCount[TEAM_ALLIANCE]); + packet.Worldstates.emplace_back(DRAENEI_RUINS_HORDE_CONTROL, _capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_HORDE)); + packet.Worldstates.emplace_back(DRAENEI_RUINS_ALLIANCE_CONTROL, _capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_ALLIANCE)); + packet.Worldstates.emplace_back(DRAENEI_RUINS_UNCONTROL, _capturePointInfo[POINT_DRAENEI_RUINS].IsUncontrolled()); + packet.Worldstates.emplace_back(MAGE_TOWER_ALLIANCE_CONTROL, _capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_HORDE)); + packet.Worldstates.emplace_back(MAGE_TOWER_HORDE_CONTROL, _capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_ALLIANCE)); + packet.Worldstates.emplace_back(MAGE_TOWER_UNCONTROL, _capturePointInfo[POINT_MAGE_TOWER].IsUncontrolled()); + packet.Worldstates.emplace_back(FEL_REAVER_HORDE_CONTROL, _capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_HORDE)); + packet.Worldstates.emplace_back(FEL_REAVER_ALLIANCE_CONTROL, _capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_ALLIANCE)); + packet.Worldstates.emplace_back(FEL_REAVER_UNCONTROL, _capturePointInfo[POINT_FEL_REAVER].IsUncontrolled()); + packet.Worldstates.emplace_back(BLOOD_ELF_HORDE_CONTROL, _capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_HORDE)); + packet.Worldstates.emplace_back(BLOOD_ELF_ALLIANCE_CONTROL, _capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_ALLIANCE)); + packet.Worldstates.emplace_back(BLOOD_ELF_UNCONTROL, _capturePointInfo[POINT_BLOOD_ELF].IsUncontrolled()); + packet.Worldstates.emplace_back(NETHERSTORM_FLAG, _flagState == BG_EY_FLAG_STATE_ON_BASE); + packet.Worldstates.emplace_back(NETHERSTORM_FLAG_STATE_HORDE, 1); + packet.Worldstates.emplace_back(NETHERSTORM_FLAG_STATE_ALLIANCE, 1); + packet.Worldstates.emplace_back(EY_HORDE_RESOURCES, GetTeamScore(TEAM_HORDE)); + packet.Worldstates.emplace_back(EY_ALLIANCE_RESOURCES, GetTeamScore(TEAM_ALLIANCE)); + packet.Worldstates.emplace_back(PROGRESS_BAR_SHOW, 0); + packet.Worldstates.emplace_back(PROGRESS_BAR_PERCENT_GREY, 0); + packet.Worldstates.emplace_back(PROGRESS_BAR_STATUS, 0); } GraveyardStruct const* BattlegroundEY::GetClosestGraveyard(Player* player) @@ -608,7 +610,7 @@ GraveyardStruct const* BattlegroundEY::GetClosestGraveyard(Player* player) for (uint8 i = 0; i < EY_POINTS_MAX; ++i) if (_capturePointInfo[i].IsUnderControl(player->GetTeamId())) { - entry = sGraveyard->GetGraveyard(m_CapturingPointTypes[i].GraveYardId); + entry = sGraveyard->GetGraveyard(m_CapturingPointTypes[i].GraveyardId); dist = (entry->x - pX) * (entry->x - pX) + (entry->y - pY) * (entry->y - pY) + (entry->z - pZ) * (entry->z - pZ); if (dist < minDist) { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index 936e9e9b5..acd51fddc 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -305,11 +305,11 @@ struct BattlegroundEYLosingPointStruct struct BattlegroundEYCapturingPointStruct { - BattlegroundEYCapturingPointStruct(uint32 _DespawnNeutralObjectType, uint32 _SpawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _SpawnObjectTypeHorde, uint32 _MessageIdHorde, uint32 _GraveYardId) + BattlegroundEYCapturingPointStruct(uint32 _DespawnNeutralObjectType, uint32 _SpawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _SpawnObjectTypeHorde, uint32 _MessageIdHorde, uint32 _GraveyardId) : DespawnNeutralObjectType(_DespawnNeutralObjectType), SpawnObjectTypeAlliance(_SpawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance), SpawnObjectTypeHorde(_SpawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde), - GraveYardId(_GraveYardId) + GraveyardId(_GraveyardId) {} uint32 DespawnNeutralObjectType; @@ -317,7 +317,7 @@ struct BattlegroundEYCapturingPointStruct uint32 MessageIdAlliance; uint32 SpawnObjectTypeHorde; uint32 MessageIdHorde; - uint32 GraveYardId; + uint32 GraveyardId; }; const uint32 BG_EY_TickPoints[EY_POINTS_MAX] = {1, 2, 5, 10}; @@ -402,7 +402,7 @@ public: void Init() override; void EndBattleground(TeamId winnerTeamId) override; bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void SetDroppedFlagGUID(ObjectGuid guid, TeamId /*teamId*/ = TEAM_NEUTRAL) override { _droppedFlagGUID = guid; } ObjectGuid GetDroppedFlagGUID() const { return _droppedFlagGUID; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 205323289..e9957a17f 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -26,6 +26,7 @@ #include "Transport.h" #include "Vehicle.h" #include "WorldPacket.h" +#include "WorldStatePackets.h" void BattlegroundICScore::BuildObjectivesBlock(WorldPacket& data) { @@ -381,21 +382,24 @@ bool BattlegroundIC::UpdatePlayerScore(Player* player, uint32 type, uint32 value return true; } -void BattlegroundIC::FillInitialWorldStates(WorldPacket& data) +void BattlegroundIC::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(BG_IC_ALLIANCE_RENFORT_SET) << uint32(1); - data << uint32(BG_IC_HORDE_RENFORT_SET) << uint32(1); - data << uint32(BG_IC_ALLIANCE_RENFORT) << uint32(factionReinforcements[TEAM_ALLIANCE]); - data << uint32(BG_IC_HORDE_RENFORT) << uint32(factionReinforcements[TEAM_HORDE]); + packet.Worldstates.reserve(4+MAX_FORTRESS_GATES_SPAWNS+MAX_NODE_TYPES+1); + packet.Worldstates.emplace_back(BG_IC_ALLIANCE_RENFORT_SET, 1); + packet.Worldstates.emplace_back(BG_IC_HORDE_RENFORT_SET, 1); + packet.Worldstates.emplace_back(BG_IC_ALLIANCE_RENFORT, factionReinforcements[TEAM_ALLIANCE]); + packet.Worldstates.emplace_back(BG_IC_HORDE_RENFORT, factionReinforcements[TEAM_HORDE]); for (uint8 i = 0; i < MAX_FORTRESS_GATES_SPAWNS; ++i) { uint32 uws = GetWorldStateFromGateEntry(BG_IC_ObjSpawnlocs[i].entry, (GateStatus[GetGateIDFromEntry(BG_IC_ObjSpawnlocs[i].entry)] == BG_IC_GATE_DESTROYED)); - data << uint32(uws) << uint32(1); + packet.Worldstates.emplace_back(uws, 1); } for (uint8 i = 0; i < MAX_NODE_TYPES; ++i) - data << uint32(nodePoint[i].worldStates[nodePoint[i].nodeState]) << uint32(1); + packet.Worldstates.emplace_back(nodePoint[i].worldStates[nodePoint[i].nodeState], 1); + + packet.Worldstates.emplace_back(BG_IC_HORDE_RENFORT_SET, 1); } bool BattlegroundIC::SetupBattleground() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h index 6a6b40188..a067b794a 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h @@ -974,7 +974,7 @@ public: /* Scorekeeping */ bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void HandlePlayerResurrect(Player* player) override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp index 36a55b71c..f2585d387 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp @@ -64,10 +64,10 @@ void BattlegroundNA::HandleAreaTrigger(Player* player, uint32 trigger) } } -void BattlegroundNA::FillInitialWorldStates(WorldPacket& data) +void BattlegroundNA::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(0xa11) << uint32(1); // 9 - Arena::FillInitialWorldStates(data); + packet.Worldstates.emplace_back(0xa11, 1); // BATTLEGROUND_NAGRAND_ARENA_SHOW + Arena::FillInitialWorldStates(packet); } bool BattlegroundNA::SetupBattleground() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h index c13eb9d6d..e75b30d22 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h @@ -54,7 +54,8 @@ public: void HandleAreaTrigger(Player* player, uint32 trigger) override; bool SetupBattleground() override; - void FillInitialWorldStates(WorldPacket& d) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; + bool HandlePlayerUnderMap(Player* player) override; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp index 483d5a9c3..a8447a953 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp @@ -91,10 +91,10 @@ void BattlegroundRL::HandleAreaTrigger(Player* player, uint32 trigger) } } -void BattlegroundRL::FillInitialWorldStates(WorldPacket& data) +void BattlegroundRL::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(0xbba) << uint32(1); // 9 - Arena::FillInitialWorldStates(data); + packet.Worldstates.emplace_back(0xbba, 1); // BATTELGROUND_RUINS_OF_LORDAERNON_SHOW + Arena::FillInitialWorldStates(packet); } bool BattlegroundRL::SetupBattleground() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h index 81174f9db..bfcf6f5ff 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h @@ -45,7 +45,7 @@ public: BattlegroundRL(); /* inherited from BattlegroundClass */ - void FillInitialWorldStates(WorldPacket& d) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void StartingEventCloseDoors() override; void StartingEventOpenDoors() override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 4eccb3cf0..faae3a2ed 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -204,10 +204,10 @@ void BattlegroundRV::HandleAreaTrigger(Player* player, uint32 trigger) } } -void BattlegroundRV::FillInitialWorldStates(WorldPacket& data) +void BattlegroundRV::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(BG_RV_WORLD_STATE) << uint32(1); - Arena::FillInitialWorldStates(data); + packet.Worldstates.emplace_back(BG_RV_WORLD_STATE, 1); + Arena::FillInitialWorldStates(packet); } void BattlegroundRV::Init() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h index 5845b52dd..5596723ff 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h @@ -90,7 +90,7 @@ public: /* inherited from BattlegroundClass */ void StartingEventOpenDoors() override; void Init() override; - void FillInitialWorldStates(WorldPacket& d) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void HandleAreaTrigger(Player* player, uint32 trigger) override; bool SetupBattleground() override; bool HandlePlayerUnderMap(Player* player) override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 443a8a46c..0d6e80804 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -467,44 +467,46 @@ void BattlegroundSA::StartingEventOpenDoors() { } -void BattlegroundSA::FillInitialWorldStates(WorldPacket& data) +void BattlegroundSA::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - uint32 ally_attacks = uint32(Attackers == TEAM_ALLIANCE ? 1 : 0); - uint32 horde_attacks = uint32(Attackers == TEAM_HORDE ? 1 : 0); + bool const ally_attacks = Attackers == TEAM_ALLIANCE; + bool const horde_attacks = Attackers == TEAM_HORDE; - data << uint32(BG_SA_ANCIENT_GATEWS) << uint32(GateStatus[BG_SA_ANCIENT_GATE]); - data << uint32(BG_SA_YELLOW_GATEWS) << uint32(GateStatus[BG_SA_YELLOW_GATE]); - data << uint32(BG_SA_GREEN_GATEWS) << uint32(GateStatus[BG_SA_GREEN_GATE]); - data << uint32(BG_SA_BLUE_GATEWS) << uint32(GateStatus[BG_SA_BLUE_GATE]); - data << uint32(BG_SA_RED_GATEWS) << uint32(GateStatus[BG_SA_RED_GATE]); - data << uint32(BG_SA_PURPLE_GATEWS) << uint32(GateStatus[BG_SA_PURPLE_GATE]); + packet.Worldstates.reserve(25); + packet.Worldstates.emplace_back(BG_SA_ANCIENT_GATEWS, GateStatus[BG_SA_ANCIENT_GATE]); + packet.Worldstates.emplace_back(BG_SA_YELLOW_GATEWS, GateStatus[BG_SA_YELLOW_GATE]); + packet.Worldstates.emplace_back(BG_SA_GREEN_GATEWS, GateStatus[BG_SA_GREEN_GATE]); + packet.Worldstates.emplace_back(BG_SA_BLUE_GATEWS, GateStatus[BG_SA_BLUE_GATE]); + packet.Worldstates.emplace_back(BG_SA_RED_GATEWS, GateStatus[BG_SA_RED_GATE]); + packet.Worldstates.emplace_back(BG_SA_PURPLE_GATEWS, GateStatus[BG_SA_PURPLE_GATE]); - data << uint32(BG_SA_BONUS_TIMER) << uint32(0); + packet.Worldstates.emplace_back(BG_SA_BONUS_TIMER, 0); - data << uint32(BG_SA_HORDE_ATTACKS) << horde_attacks; - data << uint32(BG_SA_ALLY_ATTACKS) << ally_attacks; + packet.Worldstates.emplace_back(BG_SA_HORDE_ATTACKS, horde_attacks); + packet.Worldstates.emplace_back(BG_SA_ALLY_ATTACKS, ally_attacks); //Time will be sent on first update... - data << uint32(BG_SA_ENABLE_TIMER) << ((TimerEnabled) ? uint32(1) : uint32(0)); - data << uint32(BG_SA_TIMER_MINS) << uint32(0); - data << uint32(BG_SA_TIMER_SEC_TENS) << uint32(0); - data << uint32(BG_SA_TIMER_SEC_DECS) << uint32(0); + packet.Worldstates.emplace_back(BG_SA_ENABLE_TIMER, TimerEnabled ? 1 : 0); - data << uint32(BG_SA_RIGHT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0); - data << uint32(BG_SA_LEFT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0); - data << uint32(BG_SA_CENTER_GY_HORDE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0); + packet.Worldstates.emplace_back(BG_SA_TIMER_MINS, 0); + packet.Worldstates.emplace_back(BG_SA_TIMER_SEC_TENS, 0); + packet.Worldstates.emplace_back(BG_SA_TIMER_SEC_DECS, 0); - data << uint32(BG_SA_RIGHT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0); - data << uint32(BG_SA_LEFT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0); - data << uint32(BG_SA_CENTER_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0); + packet.Worldstates.emplace_back(BG_SA_RIGHT_GY_HORDE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0); + packet.Worldstates.emplace_back(BG_SA_LEFT_GY_HORDE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0); + packet.Worldstates.emplace_back(BG_SA_CENTER_GY_HORDE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE ? 1 : 0); - data << uint32(BG_SA_HORDE_DEFENCE_TOKEN) << ally_attacks; - data << uint32(BG_SA_ALLIANCE_DEFENCE_TOKEN) << horde_attacks; + packet.Worldstates.emplace_back(BG_SA_RIGHT_GY_ALLIANCE, GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0); + packet.Worldstates.emplace_back(BG_SA_LEFT_GY_ALLIANCE, GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0); + packet.Worldstates.emplace_back(BG_SA_CENTER_GY_ALLIANCE, GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE ? 1 : 0); - data << uint32(BG_SA_LEFT_ATT_TOKEN_HRD) << horde_attacks; - data << uint32(BG_SA_RIGHT_ATT_TOKEN_HRD) << horde_attacks; - data << uint32(BG_SA_RIGHT_ATT_TOKEN_ALL) << ally_attacks; - data << uint32(BG_SA_LEFT_ATT_TOKEN_ALL) << ally_attacks; + packet.Worldstates.emplace_back(BG_SA_HORDE_DEFENCE_TOKEN, ally_attacks); + packet.Worldstates.emplace_back(BG_SA_ALLIANCE_DEFENCE_TOKEN, horde_attacks); + + packet.Worldstates.emplace_back(BG_SA_LEFT_ATT_TOKEN_HRD, horde_attacks); + packet.Worldstates.emplace_back(BG_SA_RIGHT_ATT_TOKEN_HRD, horde_attacks); + packet.Worldstates.emplace_back(BG_SA_RIGHT_ATT_TOKEN_ALL, ally_attacks); + packet.Worldstates.emplace_back(BG_SA_LEFT_ATT_TOKEN_ALL, ally_attacks); } void BattlegroundSA::AddPlayer(Player* player) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 4e0832a23..e816ad1cb 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -475,7 +475,7 @@ public: bool SetupBattleground() override; void Init() override; /// Called for generate packet contain worldstate data - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; /// Called when a player deal damage to building (door) void EventPlayerDamagedGO(Player* player, GameObject* go, uint32 eventType) override; /// Called when a player kill a unit in bg diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 1f84f6f6f..64f30a7a0 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -546,17 +546,18 @@ GraveyardStruct const* BattlegroundWS::GetClosestGraveyard(Player* player) return sGraveyard->GetGraveyard(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_FLAGROOM_ALLIANCE : WS_GRAVEYARD_FLAGROOM_HORDE); } -void BattlegroundWS::FillInitialWorldStates(WorldPacket& data) +void BattlegroundWS::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(TEAM_ALLIANCE)); - data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(TEAM_HORDE)); - data << uint32(BG_WS_FLAG_CAPTURES_MAX) << uint32(BG_WS_MAX_TEAM_SCORE); + packet.Worldstates.reserve(7); + packet.Worldstates.emplace_back(BG_WS_FLAG_CAPTURES_ALLIANCE, GetTeamScore(TEAM_ALLIANCE)); + packet.Worldstates.emplace_back(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(TEAM_HORDE)); + packet.Worldstates.emplace_back(BG_WS_FLAG_CAPTURES_MAX, BG_WS_MAX_TEAM_SCORE); - data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(GetStatus() == STATUS_IN_PROGRESS); - data << uint32(BG_WS_STATE_TIMER) << uint32(GetMatchTime()); + packet.Worldstates.emplace_back(BG_WS_STATE_TIMER_ACTIVE, GetStatus() == STATUS_IN_PROGRESS ? 1 : 0); + packet.Worldstates.emplace_back(BG_WS_STATE_TIMER, GetMatchTime()); - data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(GetFlagState(TEAM_HORDE)); - data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(GetFlagState(TEAM_ALLIANCE)); + packet.Worldstates.emplace_back(BG_WS_FLAG_STATE_HORDE, GetFlagState(TEAM_HORDE)); + packet.Worldstates.emplace_back(BG_WS_FLAG_STATE_ALLIANCE, GetFlagState(TEAM_ALLIANCE)); } TeamId BattlegroundWS::GetPrematureWinner() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index 1620ca1fd..5b97d5d39 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h @@ -252,7 +252,7 @@ public: bool UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true) override; void SetDroppedFlagGUID(ObjectGuid guid, TeamId teamId) override { _droppedFlagGUID[teamId] = guid; } ObjectGuid GetDroppedFlagGUID(TeamId teamId) const { return _droppedFlagGUID[teamId];} - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; /* Scorekeeping */ void AddPoints(TeamId teamId, uint32 points) { m_TeamScores[teamId] += points; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index b875c363d..9aeda887c 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -86,6 +86,7 @@ #include "WorldSession.h" #include "WorldSessionMgr.h" #include "WorldState.h" +#include "WorldStatePackets.h" #include /// @todo: this import is not necessary for compilation and marked as unused by the IDE @@ -8221,643 +8222,667 @@ void Player::SendNotifyLootItemRemoved(uint8 lootSlot) GetSession()->SendPacket(&data); } -void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) +// TODO - InitWorldStates should NOT always send the same states +// Some should keep the same value between different zoneIds and areaIds on the same map +void Player::SendInitWorldStates(uint32 zoneId, uint32 areaId) { // data depends on zoneid/mapid... - Battleground* bg = GetBattleground(); - uint32 mapid = GetMapId(); - OutdoorPvP* pvp = sOutdoorPvPMgr->GetOutdoorPvPToZoneId(zoneid); + uint32 mapId = GetMapId(); + Battleground* battleground = GetBattleground(); + OutdoorPvP* outdoorPvP = sOutdoorPvPMgr->GetOutdoorPvPToZoneId(zoneId); InstanceScript* instance = GetInstanceScript(); - Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(zoneid); + Battlefield* battlefield = sBattlefieldMgr->GetBattlefieldToZoneId(zoneId); - LOG_DEBUG("network", "Sending SMSG_INIT_WORLD_STATES to Map: {}, Zone: {}", mapid, zoneid); + LOG_DEBUG("network", "Sending SMSG_INIT_WORLD_STATES to Map: {}, Zone: {}", mapId, zoneId); + + WorldPackets::WorldState::InitWorldStates packet; + packet.MapID = mapId; + packet.ZoneID = zoneId; + packet.AreaID = areaId; + + packet.Worldstates.reserve(8); + packet.Worldstates.emplace_back(0x8d8, 0); // SCOURGE_EVENT_WORLDSTATE_EASTERN_PLAGUELANDS + packet.Worldstates.emplace_back(0x8d7, 0); // SCOURGE_EVENT_WORLDSTATE_TANARIS + packet.Worldstates.emplace_back(0x8d6, 0); // SCOURGE_EVENT_WORLDSTATE_BURNING_STEPPES + packet.Worldstates.emplace_back(0x8d5, 0); // SCOURGE_EVENT_WORLDSTATE_BLASTED_LANDS + packet.Worldstates.emplace_back(0x8d4, 0); // SCOURGE_EVENT_WORLDSTATE_AZSHARA + packet.Worldstates.emplace_back(0x8d3, 0); // SCOURGE_EVENT_WORLDSTATE_WINTERSPRING - WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (12 * 8))); - data << uint32(mapid); // mapid - data << uint32(zoneid); // zone id - data << uint32(areaid); // area id, new 2.1.0 - std::size_t countPos = data.wpos(); - data << uint16(0); // count of uint64 blocks - data << uint32(0x8d8) << uint32(0x0); // 1 - data << uint32(0x8d7) << uint32(0x0); // 2 - data << uint32(0x8d6) << uint32(0x0); // 3 - data << uint32(0x8d5) << uint32(0x0); // 4 - data << uint32(0x8d4) << uint32(0x0); // 5 - data << uint32(0x8d3) << uint32(0x0); // 6 // 7 1 - Arena season in progress, 0 - end of season - data << uint32(0xC77) << uint32(sArenaSeasonMgr->GetSeasonState() == ARENA_SEASON_STATE_IN_PROGRESS); + packet.Worldstates.emplace_back(0xc77, sArenaSeasonMgr->GetSeasonState() == ARENA_SEASON_STATE_IN_PROGRESS); // 8 Arena season id - data << uint32(0xF3D) << uint32(sArenaSeasonMgr->GetCurrentSeason()); + packet.Worldstates.emplace_back(0xf3d, sArenaSeasonMgr->GetCurrentSeason()); - if (mapid == 530) // Outland + if (mapId == 530) // Outland { - data << uint32(0x9bf) << uint32(0x0); // 7 - data << uint32(0x9bd) << uint32(0xF); // 8 - data << uint32(0x9bb) << uint32(0xF); // 9 + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(0x9bf, 0); // NA_UI_OUTLAND_01 "Progress: %2494w" + packet.Worldstates.emplace_back(0x9bd, 15); // NA_UI_GUARDS_MAX + packet.Worldstates.emplace_back(0x9bb, 15); // NA_UI_GUARDS_LEFT } - if (Player::bgZoneIdToFillWorldStates.find(zoneid) != Player::bgZoneIdToFillWorldStates.end()) + if (Player::bgZoneIdToFillWorldStates.find(zoneId) != Player::bgZoneIdToFillWorldStates.end()) { - Player::bgZoneIdToFillWorldStates[zoneid](bg, data); + Player::bgZoneIdToFillWorldStates[zoneId](battleground, packet); } else { // insert - switch (zoneid) + switch (zoneId) { - case 1: // Dun Morogh - case 11: // Wetlands - case 12: // Elwynn Forest - case 38: // Loch Modan - case 40: // Westfall - case 51: // Searing Gorge - case 1519: // Stormwind City - case 1537: // Ironforge - case 2257: // Deeprun Tram - case 3703: // Shattrath City + case 1: // Dun Morogh + case 11: // Wetlands + case 12: // Elwynn Forest + case 38: // Loch Modan + case 40: // Westfall + case 51: // Searing Gorge + case 1519: // Stormwind City + case 1537: // Ironforge + case 2257: // Deeprun Tram + case 3703: // Shattrath City break; - case 139: // Eastern Plaguelands - if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_EP) - pvp->FillInitialWorldStates(data); + case 139: // Eastern Plaguelands + if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_EP) + outdoorPvP->FillInitialWorldStates(packet); else { - data << uint32(0x97a) << uint32(0x0); // 10 2426 - data << uint32(0x917) << uint32(0x0); // 11 2327 - data << uint32(0x918) << uint32(0x0); // 12 2328 - data << uint32(0x97b) << uint32(0x32); // 13 2427 - data << uint32(0x97c) << uint32(0x32); // 14 2428 - data << uint32(0x933) << uint32(0x1); // 15 2355 - data << uint32(0x946) << uint32(0x0); // 16 2374 - data << uint32(0x947) << uint32(0x0); // 17 2375 - data << uint32(0x948) << uint32(0x0); // 18 2376 - data << uint32(0x949) << uint32(0x0); // 19 2377 - data << uint32(0x94a) << uint32(0x0); // 20 2378 - data << uint32(0x94b) << uint32(0x0); // 21 2379 - data << uint32(0x932) << uint32(0x0); // 22 2354 - data << uint32(0x934) << uint32(0x0); // 23 2356 - data << uint32(0x935) << uint32(0x0); // 24 2357 - data << uint32(0x936) << uint32(0x0); // 25 2358 - data << uint32(0x937) << uint32(0x0); // 26 2359 - data << uint32(0x938) << uint32(0x0); // 27 2360 - data << uint32(0x939) << uint32(0x1); // 28 2361 - data << uint32(0x930) << uint32(0x1); // 29 2352 - data << uint32(0x93a) << uint32(0x0); // 30 2362 - data << uint32(0x93b) << uint32(0x0); // 31 2363 - data << uint32(0x93c) << uint32(0x0); // 32 2364 - data << uint32(0x93d) << uint32(0x0); // 33 2365 - data << uint32(0x944) << uint32(0x0); // 34 2372 - data << uint32(0x945) << uint32(0x0); // 35 2373 - data << uint32(0x931) << uint32(0x1); // 36 2353 - data << uint32(0x93e) << uint32(0x0); // 37 2366 - data << uint32(0x931) << uint32(0x1); // 38 2367 ?? grey horde not in dbc! send for consistency's sake, and to match field count - data << uint32(0x940) << uint32(0x0); // 39 2368 - data << uint32(0x941) << uint32(0x0); // 7 2369 - data << uint32(0x942) << uint32(0x0); // 8 2370 - data << uint32(0x943) << uint32(0x0); // 9 2371 + packet.Worldstates.reserve(32); + packet.Worldstates.emplace_back(0x97a, 0); // GENERAL_WORLDSTATES_01 "Progress: %2427w" + packet.Worldstates.emplace_back(0x917, 0); // EP_UI_TOWER_COUNT_A + packet.Worldstates.emplace_back(0x918, 0); // EP_UI_TOWER_COUNT_H + packet.Worldstates.emplace_back(0x97b, 50); // GENERAL_WORLDSTATES_02 + packet.Worldstates.emplace_back(0x97c, 50); // GENERAL_WORLDSTATES_03 + packet.Worldstates.emplace_back(0x933, 1); // EP_CGT_N + packet.Worldstates.emplace_back(0x946, 0); // EP_CGT_N_A + packet.Worldstates.emplace_back(0x947, 0); // EP_CGT_N_H + packet.Worldstates.emplace_back(0x948, 0); // GENERAL_WORLDSTATES_04 + packet.Worldstates.emplace_back(0x949, 0); // GENERAL_WORLDSTATES_05 + packet.Worldstates.emplace_back(0x94a, 0); // EP_CGT_A + packet.Worldstates.emplace_back(0x94b, 0); // EP_CGT_H + packet.Worldstates.emplace_back(0x932, 0); // EP_EWT_A + packet.Worldstates.emplace_back(0x934, 0); // EP_EWT_H + packet.Worldstates.emplace_back(0x935, 0); // GENERAL_WORLDSTATES_06 + packet.Worldstates.emplace_back(0x936, 0); // GENERAL_WORLDSTATES_07 + packet.Worldstates.emplace_back(0x937, 0); // EP_EWT_N_A + packet.Worldstates.emplace_back(0x938, 0); // EP_EWT_N_H + packet.Worldstates.emplace_back(0x939, 1); // EP_EWT_N + packet.Worldstates.emplace_back(0x930, 1); // EP_NPT_N + packet.Worldstates.emplace_back(0x93a, 0); // EP_NPT_N_A + packet.Worldstates.emplace_back(0x93b, 0); // GENERAL_WORLDSTATES_08 + packet.Worldstates.emplace_back(0x93c, 0); // GENERAL_WORLDSTATES_09 + packet.Worldstates.emplace_back(0x93d, 0); // GENERAL_WORLDSTATES_10 + packet.Worldstates.emplace_back(0x944, 0); // EP_NPT_A + packet.Worldstates.emplace_back(0x945, 0); // EP_NPT_H + packet.Worldstates.emplace_back(0x931, 1); // EP_PWT_N + packet.Worldstates.emplace_back(0x93e, 0); // EP_PWT_N_A + //packet.Worldstates.emplace_back(0x93f, 1); // GENERAL_WORLDSTATES_13 grey horde not in dbc! + packet.Worldstates.emplace_back(0x940, 0); // GENERAL_WORLDSTATES_11 + packet.Worldstates.emplace_back(0x941, 0); // GENERAL_WORLDSTATES_12 + packet.Worldstates.emplace_back(0x942, 0); // EP_PWT_A + packet.Worldstates.emplace_back(0x943, 0); // EP_PWT_H + + break; + case 1377: // Silithus + if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_SI) + outdoorPvP->FillInitialWorldStates(packet); + else + { + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(0x909, 0); // SI_GATHERED_A + packet.Worldstates.emplace_back(0x90a, 0); // SI_GATHERED_H + packet.Worldstates.emplace_back(0x90d, 0); // SI_SILITHYST_MAX + } + // unknown, aq opening? + packet.Worldstates.reserve(4); + packet.Worldstates.emplace_back(0x912, 0); // AQ_SANDWORM_N + packet.Worldstates.emplace_back(0x913, 0); // AQ_SANDWORM_S + packet.Worldstates.emplace_back(0x914, 0); // AQ_SANDWORM_SW + packet.Worldstates.emplace_back(0x915, 0); // AQ_SANDWORM_E + break; + case 2597: // Alterac Valley + if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_AV) + battleground->FillInitialWorldStates(packet); + else + { + packet.Worldstates.reserve(75); + packet.Worldstates.emplace_back(0x7ae, 1); // AV_SNOWFALL_N + packet.Worldstates.emplace_back(0x532, 1); // AV_FROSTWOLFHUT_H_C + packet.Worldstates.emplace_back(0x531, 0); // AV_FROSTWOLFHUT_A_C + packet.Worldstates.emplace_back(0x52e, 0); // AV_AID_A_A + packet.Worldstates.emplace_back(0x571, 0); // East Frostwolf Tower Horde Assaulted - UNUSED + packet.Worldstates.emplace_back(0x570, 0); // West Frostwolf Tower Horde Assaulted - UNUSED + packet.Worldstates.emplace_back(0x567, 1); // AV_FROSTWOLFE_CONTROLLED + packet.Worldstates.emplace_back(0x566, 1); // AV_FROSTWOLFW_CONTROLLED + packet.Worldstates.emplace_back(0x550, 1); // AV_N_MINE_N + packet.Worldstates.emplace_back(0x544, 0); // AV_ICEBLOOD_A_A + packet.Worldstates.emplace_back(0x536, 0); // AV_PIKEGRAVE_H_C + packet.Worldstates.emplace_back(0x535, 1); // AV_PIKEGRAVE_A_C + packet.Worldstates.emplace_back(0x518, 0); // AV_STONEHEART_A_A + packet.Worldstates.emplace_back(0x517, 0); // AV_STONEHEART_H_A + packet.Worldstates.emplace_back(0x574, 0); // unk + packet.Worldstates.emplace_back(0x573, 0); // Iceblood Tower Horde Assaulted - UNUSED + packet.Worldstates.emplace_back(0x572, 0); // Towerpoint Horde Assaulted - UNUSED + packet.Worldstates.emplace_back(0x56f, 0); // unk + packet.Worldstates.emplace_back(0x56e, 0); // AV_ICEBLOOD_ASSAULTED + packet.Worldstates.emplace_back(0x56d, 0); // AV_TOWERPOINT_ASSAULTED + packet.Worldstates.emplace_back(0x56c, 0); // AV_FROSTWOLFE_ASSAULTED + packet.Worldstates.emplace_back(0x56b, 0); // AV_FROSTWOLFW_ASSAULTED + packet.Worldstates.emplace_back(0x56a, 1); // unk + packet.Worldstates.emplace_back(0x569, 1); // AV_ICEBLOOD_CONTROLLED + packet.Worldstates.emplace_back(0x568, 1); // AV_TOWERPOINT_CONTROLLED + packet.Worldstates.emplace_back(0x565, 0); // AV_STONEH_ASSAULTED + packet.Worldstates.emplace_back(0x564, 0); // AV_ICEWING_ASSAULTED + packet.Worldstates.emplace_back(0x563, 0); // AV_DUNN_ASSAULTED + packet.Worldstates.emplace_back(0x562, 0); // AV_DUNS_ASSAULTED + packet.Worldstates.emplace_back(0x561, 0); // Stoneheart Bunker Alliance Assaulted - UNUSED + packet.Worldstates.emplace_back(0x560, 0); // Icewing Bunker Alliance Assaulted - UNUSED + packet.Worldstates.emplace_back(0x55f, 0); // Dunbaldar South Alliance Assaulted - UNUSED + packet.Worldstates.emplace_back(0x55e, 0); // Dunbaldar North Alliance Assaulted - UNUSED + packet.Worldstates.emplace_back(0x55d, 0); // AV_STONEH_DESTROYED + packet.Worldstates.emplace_back(0x3c6, 0); // AV_UNK_02 + packet.Worldstates.emplace_back(0x3c4, 0); // AV_UNK_01 + packet.Worldstates.emplace_back(0x3c2, 0); // AV_STORMPIKE_COMMANDERS + packet.Worldstates.emplace_back(0x516, 1); // AV_STONEHEART_A_C + packet.Worldstates.emplace_back(0x515, 0); // AV_STONEHEART_H_C + packet.Worldstates.emplace_back(0x3b6, 0); // AV_STORMPIKE_LIEUTENANTS + packet.Worldstates.emplace_back(0x55c, 0); // AV_ICEWING_DESTROYED + packet.Worldstates.emplace_back(0x55b, 0); // AV_DUNN_DESTROYED + packet.Worldstates.emplace_back(0x55a, 0); // AV_DUNS_DESTROYED + packet.Worldstates.emplace_back(0x559, 0); // unk + packet.Worldstates.emplace_back(0x558, 0); // AV_ICEBLOOD_DESTROYED + packet.Worldstates.emplace_back(0x557, 0); // AV_TOWERPOINT_DESTROYED + packet.Worldstates.emplace_back(0x556, 0); // AV_FROSTWOLFE_DESTROYED + packet.Worldstates.emplace_back(0x555, 0); // AV_FROSTWOLFW_DESTROYED + packet.Worldstates.emplace_back(0x554, 1); // AV_STONEH_CONTROLLED + packet.Worldstates.emplace_back(0x553, 1); // AV_ICEWING_CONTROLLED + packet.Worldstates.emplace_back(0x552, 1); // AV_DUNN_CONTROLLED + packet.Worldstates.emplace_back(0x551, 1); // AV_DUNS_CONTROLLED + packet.Worldstates.emplace_back(0x54f, 0); // AV_N_MINE_H + packet.Worldstates.emplace_back(0x54e, 0); // AV_N_MINE_A + packet.Worldstates.emplace_back(0x54d, 1); // AV_S_MINE_N + packet.Worldstates.emplace_back(0x54c, 0); // AV_S_MINE_H + packet.Worldstates.emplace_back(0x54b, 0); // AV_S_MINE_A + packet.Worldstates.emplace_back(0x545, 0); // AV_ICEBLOOD_H_A + packet.Worldstates.emplace_back(0x543, 1); // AV_ICEBLOOD_H_C + packet.Worldstates.emplace_back(0x542, 0); // AV_ICEBLOOD_A_C + packet.Worldstates.emplace_back(0x540, 0); // AV_SNOWFALL_H_A + packet.Worldstates.emplace_back(0x53f, 0); // AV_SNOWFALL_A_A + packet.Worldstates.emplace_back(0x53e, 0); // AV_SNOWFALL_H_C + packet.Worldstates.emplace_back(0x53d, 0); // AV_SNOWFALL_A_C + packet.Worldstates.emplace_back(0x53c, 0); // AV_FROSTWOLF_H_A + packet.Worldstates.emplace_back(0x53b, 0); // AV_FROSTWOLF_A_A + packet.Worldstates.emplace_back(0x53a, 1); // AV_FROSTWOLF_H_C + packet.Worldstates.emplace_back(0x539, 0); // AV_FROSTWOLF_A_C + packet.Worldstates.emplace_back(0x538, 0); // AV_PIKEGRAVE_H_A + packet.Worldstates.emplace_back(0x537, 0); // AV_PIKEGRAVE_A_A + packet.Worldstates.emplace_back(0x534, 0); // AV_FROSTWOLFHUT_H_A + packet.Worldstates.emplace_back(0x533, 0); // AV_FROSTWOLFHUT_A_A + packet.Worldstates.emplace_back(0x530, 0); // AV_AID_H_A + packet.Worldstates.emplace_back(0x52f, 0); // AV_AID_H_C + packet.Worldstates.emplace_back(0x52d, 1); // AV_AID_A_C } break; - case 1377: // Silithus - if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_SI) - pvp->FillInitialWorldStates(data); + case 3277: // Warsong Gulch + if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_WS) + battleground->FillInitialWorldStates(packet); else { - // states are always shown - data << uint32(2313) << uint32(0x0); // 7 ally silityst gathered - data << uint32(2314) << uint32(0x0); // 8 horde silityst gathered - data << uint32(2317) << uint32(0x0); // 9 max silithyst - } - // dunno about these... aq opening event maybe? - data << uint32(2322) << uint32(0x0); // 10 sandworm N - data << uint32(2323) << uint32(0x0); // 11 sandworm S - data << uint32(2324) << uint32(0x0); // 12 sandworm SW - data << uint32(2325) << uint32(0x0); // 13 sandworm E - break; - case 2597: // Alterac Valley - if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_AV) - bg->FillInitialWorldStates(data); - else - { - data << uint32(0x7ae) << uint32(0x1); // 7 snowfall n - data << uint32(0x532) << uint32(0x1); // 8 frostwolfhut hc - data << uint32(0x531) << uint32(0x0); // 9 frostwolfhut ac - data << uint32(0x52e) << uint32(0x0); // 10 stormpike firstaid a_a - data << uint32(0x571) << uint32(0x0); // 11 east frostwolf tower horde assaulted -unused - data << uint32(0x570) << uint32(0x0); // 12 west frostwolf tower horde assaulted - unused - data << uint32(0x567) << uint32(0x1); // 13 frostwolfe c - data << uint32(0x566) << uint32(0x1); // 14 frostwolfw c - data << uint32(0x550) << uint32(0x1); // 15 irondeep (N) ally - data << uint32(0x544) << uint32(0x0); // 16 ice grave a_a - data << uint32(0x536) << uint32(0x0); // 17 stormpike grave h_c - data << uint32(0x535) << uint32(0x1); // 18 stormpike grave a_c - data << uint32(0x518) << uint32(0x0); // 19 stoneheart grave a_a - data << uint32(0x517) << uint32(0x0); // 20 stoneheart grave h_a - data << uint32(0x574) << uint32(0x0); // 21 1396 unk - data << uint32(0x573) << uint32(0x0); // 22 iceblood tower horde assaulted -unused - data << uint32(0x572) << uint32(0x0); // 23 towerpoint horde assaulted - unused - data << uint32(0x56f) << uint32(0x0); // 24 1391 unk - data << uint32(0x56e) << uint32(0x0); // 25 iceblood a - data << uint32(0x56d) << uint32(0x0); // 26 towerp a - data << uint32(0x56c) << uint32(0x0); // 27 frostwolfe a - data << uint32(0x56b) << uint32(0x0); // 28 froswolfw a - data << uint32(0x56a) << uint32(0x1); // 29 1386 unk - data << uint32(0x569) << uint32(0x1); // 30 iceblood c - data << uint32(0x568) << uint32(0x1); // 31 towerp c - data << uint32(0x565) << uint32(0x0); // 32 stoneh tower a - data << uint32(0x564) << uint32(0x0); // 33 icewing tower a - data << uint32(0x563) << uint32(0x0); // 34 dunn a - data << uint32(0x562) << uint32(0x0); // 35 duns a - data << uint32(0x561) << uint32(0x0); // 36 stoneheart bunker alliance assaulted - unused - data << uint32(0x560) << uint32(0x0); // 37 icewing bunker alliance assaulted - unused - data << uint32(0x55f) << uint32(0x0); // 38 dunbaldar south alliance assaulted - unused - data << uint32(0x55e) << uint32(0x0); // 39 dunbaldar north alliance assaulted - unused - data << uint32(0x55d) << uint32(0x0); // 40 stone tower d - data << uint32(0x3c6) << uint32(0x0); // 41 966 unk - data << uint32(0x3c4) << uint32(0x0); // 42 964 unk - data << uint32(0x3c2) << uint32(0x0); // 43 962 unk - data << uint32(0x516) << uint32(0x1); // 44 stoneheart grave a_c - data << uint32(0x515) << uint32(0x0); // 45 stonheart grave h_c - data << uint32(0x3b6) << uint32(0x0); // 46 950 unk - data << uint32(0x55c) << uint32(0x0); // 47 icewing tower d - data << uint32(0x55b) << uint32(0x0); // 48 dunn d - data << uint32(0x55a) << uint32(0x0); // 49 duns d - data << uint32(0x559) << uint32(0x0); // 50 1369 unk - data << uint32(0x558) << uint32(0x0); // 51 iceblood d - data << uint32(0x557) << uint32(0x0); // 52 towerp d - data << uint32(0x556) << uint32(0x0); // 53 frostwolfe d - data << uint32(0x555) << uint32(0x0); // 54 frostwolfw d - data << uint32(0x554) << uint32(0x1); // 55 stoneh tower c - data << uint32(0x553) << uint32(0x1); // 56 icewing tower c - data << uint32(0x552) << uint32(0x1); // 57 dunn c - data << uint32(0x551) << uint32(0x1); // 58 duns c - data << uint32(0x54f) << uint32(0x0); // 59 irondeep (N) horde - data << uint32(0x54e) << uint32(0x0); // 60 irondeep (N) ally - data << uint32(0x54d) << uint32(0x1); // 61 mine (S) neutral - data << uint32(0x54c) << uint32(0x0); // 62 mine (S) horde - data << uint32(0x54b) << uint32(0x0); // 63 mine (S) ally - data << uint32(0x545) << uint32(0x0); // 64 iceblood h_a - data << uint32(0x543) << uint32(0x1); // 65 iceblod h_c - data << uint32(0x542) << uint32(0x0); // 66 iceblood a_c - data << uint32(0x540) << uint32(0x0); // 67 snowfall h_a - data << uint32(0x53f) << uint32(0x0); // 68 snowfall a_a - data << uint32(0x53e) << uint32(0x0); // 69 snowfall h_c - data << uint32(0x53d) << uint32(0x0); // 70 snowfall a_c - data << uint32(0x53c) << uint32(0x0); // 71 frostwolf g h_a - data << uint32(0x53b) << uint32(0x0); // 72 frostwolf g a_a - data << uint32(0x53a) << uint32(0x1); // 73 frostwolf g h_c - data << uint32(0x539) << uint32(0x0); // 74 frostwolf g a_c - data << uint32(0x538) << uint32(0x0); // 75 stormpike grave h_a - data << uint32(0x537) << uint32(0x0); // 76 stormpike grave a_a - data << uint32(0x534) << uint32(0x0); // 77 frostwolf hut h_a - data << uint32(0x533) << uint32(0x0); // 78 frostwolf hut a_a - data << uint32(0x530) << uint32(0x0); // 79 stormpike first aid h_a - data << uint32(0x52f) << uint32(0x0); // 80 stormpike first aid h_c - data << uint32(0x52d) << uint32(0x1); // 81 stormpike first aid a_c + packet.Worldstates.reserve(8); + packet.Worldstates.emplace_back(0x62d, 0); // alliance flag captures + packet.Worldstates.emplace_back(0x62e, 0); // horde flag captures + packet.Worldstates.emplace_back(0x609, 0); // unk, set to 1 on alliance flag pickup... + packet.Worldstates.emplace_back(0x60a, 0); // unk, set to 1 on horde flag pickup, after drop it's -1 + packet.Worldstates.emplace_back(0x60b, 2); // unk + packet.Worldstates.emplace_back(0x641, 3); // unk (max flag captures?) + packet.Worldstates.emplace_back(0x922, 1); // horde (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) + packet.Worldstates.emplace_back(0x923, 1); // alliance (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) } break; - case 3277: // Warsong Gulch - if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_WS) - bg->FillInitialWorldStates(data); + case 3358: // Arathi Basin + if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_AB) + battleground->FillInitialWorldStates(packet); else { - data << uint32(0x62d) << uint32(0x0); // 7 1581 alliance flag captures - data << uint32(0x62e) << uint32(0x0); // 8 1582 horde flag captures - data << uint32(0x609) << uint32(0x0); // 9 1545 unk, set to 1 on alliance flag pickup... - data << uint32(0x60a) << uint32(0x0); // 10 1546 unk, set to 1 on horde flag pickup, after drop it's -1 - data << uint32(0x60b) << uint32(0x2); // 11 1547 unk - data << uint32(0x641) << uint32(0x3); // 12 1601 unk (max flag captures?) - data << uint32(0x922) << uint32(0x1); // 13 2338 horde (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) - data << uint32(0x923) << uint32(0x1); // 14 2339 alliance (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) + packet.Worldstates.reserve(32); + packet.Worldstates.emplace_back(0x6e7, 0); // stables alliance + packet.Worldstates.emplace_back(0x6e8, 0); // stables horde + packet.Worldstates.emplace_back(0x6e9, 0); // stables alliance controlled + packet.Worldstates.emplace_back(0x6ea, 0); // stables horde controlled + packet.Worldstates.emplace_back(0x6ec, 0); // farm alliance + packet.Worldstates.emplace_back(0x6ed, 0); // farm horde + packet.Worldstates.emplace_back(0x6ee, 0); // farm alliance controlled + packet.Worldstates.emplace_back(0x6ef, 0); // farm horde controlled + packet.Worldstates.emplace_back(0x6f0, 0); // alliance resources + packet.Worldstates.emplace_back(0x6f1, 0); // horde resources + packet.Worldstates.emplace_back(0x6f2, 0); // horde bases + packet.Worldstates.emplace_back(0x6f3, 0); // alliance bases + packet.Worldstates.emplace_back(0x6f4, 1600); // max resources (1600) + packet.Worldstates.emplace_back(0x6f6, 0); // blacksmith alliance + packet.Worldstates.emplace_back(0x6f7, 0); // blacksmith horde + packet.Worldstates.emplace_back(0x6f8, 0); // blacksmith alliance controlled + packet.Worldstates.emplace_back(0x6f9, 0); // blacksmith horde controlled + packet.Worldstates.emplace_back(0x6fb, 0); // gold mine alliance + packet.Worldstates.emplace_back(0x6fc, 0); // gold mine horde + packet.Worldstates.emplace_back(0x6fd, 0); // gold mine alliance controlled + packet.Worldstates.emplace_back(0x6fe, 0); // gold mine horde controlled + packet.Worldstates.emplace_back(0x700, 0); // lumber mill alliance + packet.Worldstates.emplace_back(0x701, 0); // lumber mill horde + packet.Worldstates.emplace_back(0x702, 0); // lumber mill alliance controlled + packet.Worldstates.emplace_back(0x703, 0); // lumber mill horde controlled + packet.Worldstates.emplace_back(0x732, 1); // stables (1 - uncontrolled) + packet.Worldstates.emplace_back(0x733, 1); // gold mine (1 - uncontrolled) + packet.Worldstates.emplace_back(0x734, 1); // lumber mill (1 - uncontrolled) + packet.Worldstates.emplace_back(0x735, 1); // farm (1 - uncontrolled) + packet.Worldstates.emplace_back(0x736, 1); // blacksmith (1 - uncontrolled) + packet.Worldstates.emplace_back(0x745, 2); // unk + packet.Worldstates.emplace_back(0x7a3, 1400); // warning limit (1400) } break; - case 3358: // Arathi Basin - if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_AB) - bg->FillInitialWorldStates(data); + case 3820: // Eye of the Storm + if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_EY) + battleground->FillInitialWorldStates(packet); else { - data << uint32(0x6e7) << uint32(0x0); // 7 1767 stables alliance - data << uint32(0x6e8) << uint32(0x0); // 8 1768 stables horde - data << uint32(0x6e9) << uint32(0x0); // 9 1769 unk, ST? - data << uint32(0x6ea) << uint32(0x0); // 10 1770 stables (show/hide) - data << uint32(0x6ec) << uint32(0x0); // 11 1772 farm (0 - horde controlled, 1 - alliance controlled) - data << uint32(0x6ed) << uint32(0x0); // 12 1773 farm (show/hide) - data << uint32(0x6ee) << uint32(0x0); // 13 1774 farm color - data << uint32(0x6ef) << uint32(0x0); // 14 1775 gold mine color, may be FM? - data << uint32(0x6f0) << uint32(0x0); // 15 1776 alliance resources - data << uint32(0x6f1) << uint32(0x0); // 16 1777 horde resources - data << uint32(0x6f2) << uint32(0x0); // 17 1778 horde bases - data << uint32(0x6f3) << uint32(0x0); // 18 1779 alliance bases - data << uint32(0x6f4) << uint32(0x640); // 19 1780 max resources (1600) - data << uint32(0x6f6) << uint32(0x0); // 20 1782 blacksmith color - data << uint32(0x6f7) << uint32(0x0); // 21 1783 blacksmith (show/hide) - data << uint32(0x6f8) << uint32(0x0); // 22 1784 unk, bs? - data << uint32(0x6f9) << uint32(0x0); // 23 1785 unk, bs? - data << uint32(0x6fb) << uint32(0x0); // 24 1787 gold mine (0 - horde contr, 1 - alliance contr) - data << uint32(0x6fc) << uint32(0x0); // 25 1788 gold mine (0 - conflict, 1 - horde) - data << uint32(0x6fd) << uint32(0x0); // 26 1789 gold mine (1 - show/0 - hide) - data << uint32(0x6fe) << uint32(0x0); // 27 1790 gold mine color - data << uint32(0x700) << uint32(0x0); // 28 1792 gold mine color, may be LM? - data << uint32(0x701) << uint32(0x0); // 29 1793 lumber mill color (0 - conflict, 1 - horde contr) - data << uint32(0x702) << uint32(0x0); // 30 1794 lumber mill (show/hide) - data << uint32(0x703) << uint32(0x0); // 31 1795 lumber mill color color - data << uint32(0x732) << uint32(0x1); // 32 1842 stables (1 - uncontrolled) - data << uint32(0x733) << uint32(0x1); // 33 1843 gold mine (1 - uncontrolled) - data << uint32(0x734) << uint32(0x1); // 34 1844 lumber mill (1 - uncontrolled) - data << uint32(0x735) << uint32(0x1); // 35 1845 farm (1 - uncontrolled) - data << uint32(0x736) << uint32(0x1); // 36 1846 blacksmith (1 - uncontrolled) - data << uint32(0x745) << uint32(0x2); // 37 1861 unk - data << uint32(0x7a3) << uint32(0x578); // 38 1955 warning limit (1400) - } - break; - case 3820: // Eye of the Storm - if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_EY) - bg->FillInitialWorldStates(data); - else - { - data << uint32(0xac1) << uint32(0x0); // 7 2753 Horde Bases - data << uint32(0xac0) << uint32(0x0); // 8 2752 Alliance Bases - data << uint32(0xab6) << uint32(0x0); // 9 2742 Mage Tower - Horde conflict - data << uint32(0xab5) << uint32(0x0); // 10 2741 Mage Tower - Alliance conflict - data << uint32(0xab4) << uint32(0x0); // 11 2740 Fel Reaver - Horde conflict - data << uint32(0xab3) << uint32(0x0); // 12 2739 Fel Reaver - Alliance conflict - data << uint32(0xab2) << uint32(0x0); // 13 2738 Draenei - Alliance conflict - data << uint32(0xab1) << uint32(0x0); // 14 2737 Draenei - Horde conflict - data << uint32(0xab0) << uint32(0x0); // 15 2736 unk // 0 at start - data << uint32(0xaaf) << uint32(0x0); // 16 2735 unk // 0 at start - data << uint32(0xaad) << uint32(0x0); // 17 2733 Draenei - Horde control - data << uint32(0xaac) << uint32(0x0); // 18 2732 Draenei - Alliance control - data << uint32(0xaab) << uint32(0x1); // 19 2731 Draenei uncontrolled (1 - yes, 0 - no) - data << uint32(0xaaa) << uint32(0x0); // 20 2730 Mage Tower - Alliance control - data << uint32(0xaa9) << uint32(0x0); // 21 2729 Mage Tower - Horde control - data << uint32(0xaa8) << uint32(0x1); // 22 2728 Mage Tower uncontrolled (1 - yes, 0 - no) - data << uint32(0xaa7) << uint32(0x0); // 23 2727 Fel Reaver - Horde control - data << uint32(0xaa6) << uint32(0x0); // 24 2726 Fel Reaver - Alliance control - data << uint32(0xaa5) << uint32(0x1); // 25 2725 Fel Reaver uncontrolled (1 - yes, 0 - no) - data << uint32(0xaa4) << uint32(0x0); // 26 2724 Boold Elf - Horde control - data << uint32(0xaa3) << uint32(0x0); // 27 2723 Boold Elf - Alliance control - data << uint32(0xaa2) << uint32(0x1); // 28 2722 Boold Elf uncontrolled (1 - yes, 0 - no) - data << uint32(0xac5) << uint32(0x1); // 29 2757 Flag (1 - show, 0 - hide) - doesn't work exactly this way! - data << uint32(0xad2) << uint32(0x1); // 30 2770 Horde top-stats (1 - show, 0 - hide) // 02 -> horde picked up the flag - data << uint32(0xad1) << uint32(0x1); // 31 2769 Alliance top-stats (1 - show, 0 - hide) // 02 -> alliance picked up the flag - data << uint32(0xabe) << uint32(0x0); // 32 2750 Horde resources - data << uint32(0xabd) << uint32(0x0); // 33 2749 Alliance resources - data << uint32(0xa05) << uint32(0x8e); // 34 2565 unk, constant? - data << uint32(0xaa0) << uint32(0x0); // 35 2720 Capturing progress-bar (100 -> empty (only grey), 0 -> blue|red (no grey), default 0) - data << uint32(0xa9f) << uint32(0x0); // 36 2719 Capturing progress-bar (0 - left, 100 - right) - data << uint32(0xa9e) << uint32(0x0); // 37 2718 Capturing progress-bar (1 - show, 0 - hide) - data << uint32(0xc0d) << uint32(0x17b); // 38 3085 unk - // and some more ... unknown + packet.Worldstates.reserve(32); + packet.Worldstates.emplace_back(0xac1, 0); // Horde Bases + packet.Worldstates.emplace_back(0xac0, 0); // Alliance Bases + packet.Worldstates.emplace_back(0xab6, 0); // Mage Tower - Horde conflict + packet.Worldstates.emplace_back(0xab5, 0); // Mage Tower - Alliance conflict + packet.Worldstates.emplace_back(0xab4, 0); // Fel Reaver - Horde conflict + packet.Worldstates.emplace_back(0xab3, 0); // Fel Reaver - Alliance conflict + packet.Worldstates.emplace_back(0xab2, 0); // Draenei - Alliance conflict + packet.Worldstates.emplace_back(0xab1, 0); // Draenei - Horde conflict + packet.Worldstates.emplace_back(0xab0, 0); // unk (0 at start) + packet.Worldstates.emplace_back(0xaaf, 0); // unk (0 at start) + packet.Worldstates.emplace_back(0xaad, 0); // Draenei - Horde control + packet.Worldstates.emplace_back(0xaac, 0); // Draenei - Alliance control + packet.Worldstates.emplace_back(0xaab, 1); // Draenei uncontrolled (1 - yes, 0 - no) + packet.Worldstates.emplace_back(0xaaa, 0); // Mage Tower - Alliance control + packet.Worldstates.emplace_back(0xaa9, 0); // Mage Tower - Horde control + packet.Worldstates.emplace_back(0xaa8, 1); // Mage Tower uncontrolled (1 - yes, 0 - no) + packet.Worldstates.emplace_back(0xaa7, 0); // Fel Reaver - Horde control + packet.Worldstates.emplace_back(0xaa6, 0); // Fel Reaver - Alliance control + packet.Worldstates.emplace_back(0xaa5, 1); // Fel Reaver uncontrolled (1 - yes, 0 - no) + packet.Worldstates.emplace_back(0xaa4, 0); // Boold Elf - Horde control + packet.Worldstates.emplace_back(0xaa3, 0); // Boold Elf - Alliance control + packet.Worldstates.emplace_back(0xaa2, 1); // Boold Elf uncontrolled (1 - yes, 0 - no) + packet.Worldstates.emplace_back(0xac5, 1); // Flag (1 - show, 0 - hide) - doesn't work exactly this way! + packet.Worldstates.emplace_back(0xad2, 1); // Horde top-stats (1 - show, 0 - hide) // 02 -> horde picked up the flag + packet.Worldstates.emplace_back(0xad1, 1); // Alliance top-stats (1 - show, 0 - hide) // 02 -> alliance picked up the flag + packet.Worldstates.emplace_back(0xabe, 0); // Horde resources + packet.Worldstates.emplace_back(0xabd, 0); // Alliance resources + packet.Worldstates.emplace_back(0xa05, 142); // unk, constant? + packet.Worldstates.emplace_back(0xaa0, 0); // Capturing progress-bar (100 -> empty (only grey), 0 -> blue|red (no grey), default 0) + packet.Worldstates.emplace_back(0xa9f, 0); // Capturing progress-bar (0 - left, 100 - right) + packet.Worldstates.emplace_back(0xa9e, 0); // Capturing progress-bar (1 - show, 0 - hide) + packet.Worldstates.emplace_back(0xc0d, 379); // unk, constant? + // missing unknowns } break; // any of these needs change! the client remembers the prev setting! // ON EVERY ZONE LEAVE, RESET THE OLD ZONE'S WORLD STATE, BUT AT LEAST THE UI STUFF! - case 3483: // Hellfire Peninsula - if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_HP) - pvp->FillInitialWorldStates(data); + case 3483: // Hellfire Peninsula + if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_HP) + outdoorPvP->FillInitialWorldStates(packet); else { - data << uint32(0x9ba) << uint32(0x1); // 10 // add ally tower main gui icon // maybe should be sent only on login? - data << uint32(0x9b9) << uint32(0x1); // 11 // add horde tower main gui icon // maybe should be sent only on login? - data << uint32(0x9b5) << uint32(0x0); // 12 // show neutral broken hill icon // 2485 - data << uint32(0x9b4) << uint32(0x1); // 13 // show icon above broken hill // 2484 - data << uint32(0x9b3) << uint32(0x0); // 14 // show ally broken hill icon // 2483 - data << uint32(0x9b2) << uint32(0x0); // 15 // show neutral overlook icon // 2482 - data << uint32(0x9b1) << uint32(0x1); // 16 // show the overlook arrow // 2481 - data << uint32(0x9b0) << uint32(0x0); // 17 // show ally overlook icon // 2480 - data << uint32(0x9ae) << uint32(0x0); // 18 // horde pvp objectives captured // 2478 - data << uint32(0x9ac) << uint32(0x0); // 19 // ally pvp objectives captured // 2476 - data << uint32(2475) << uint32(100); //: ally / horde slider grey area // show only in direct vicinity! - data << uint32(2474) << uint32(50); //: ally / horde slider percentage, 100 for ally, 0 for horde // show only in direct vicinity! - data << uint32(2473) << uint32(0); //: ally / horde slider display // show only in direct vicinity! - data << uint32(0x9a8) << uint32(0x0); // 20 // show the neutral stadium icon // 2472 - data << uint32(0x9a7) << uint32(0x0); // 21 // show the ally stadium icon // 2471 - data << uint32(0x9a6) << uint32(0x1); // 22 // show the horde stadium icon // 2470 + packet.Worldstates.reserve(16); + packet.Worldstates.emplace_back(0x9ba, 1); // add ally tower main gui icon // maybe should be sent only on login? + packet.Worldstates.emplace_back(0x9b9, 1); // add horde tower main gui icon // maybe should be sent only on login? + packet.Worldstates.emplace_back(0x9b5, 0); // show neutral broken hill icon + packet.Worldstates.emplace_back(0x9b4, 1); // show icon above broken hill + packet.Worldstates.emplace_back(0x9b3, 0); // show ally broken hill icon + packet.Worldstates.emplace_back(0x9b2, 0); // show neutral overlook icon + packet.Worldstates.emplace_back(0x9b1, 1); // show the overlook arrow + packet.Worldstates.emplace_back(0x9b0, 0); // show ally overlook icon + packet.Worldstates.emplace_back(0x9ae, 0); // horde pvp objectives captured + packet.Worldstates.emplace_back(0x9ac, 0); // ally pvp objectives captured + packet.Worldstates.emplace_back(0x9ab, 100); //: ally / horde slider grey area // show only in direct vicinity! + packet.Worldstates.emplace_back(0x9aa, 50); //: ally / horde slider percentage, 100 for ally, 0 for horde // show only in direct vicinity! + packet.Worldstates.emplace_back(0x9a9, 0); //: ally / horde slider display // show only in direct vicinity! + packet.Worldstates.emplace_back(0x9a8, 0); // show the neutral stadium icon + packet.Worldstates.emplace_back(0x9a7, 0); // show the ally stadium icon + packet.Worldstates.emplace_back(0x9a6, 1); // show the horde stadium icon } break; - case 3518: // Nagrand - if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_NA) - pvp->FillInitialWorldStates(data); + case 3518: // Nagrand + if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_NA) + outdoorPvP->FillInitialWorldStates(packet); + else + { + packet.Worldstates.reserve(28); + packet.Worldstates.emplace_back(0x9c7, 0); // NA_UI_HORDE_GUARDS_SHOW + packet.Worldstates.emplace_back(0x9c6, 0); // NA_UI_ALLIANCE_GUARDS_SHOW + packet.Worldstates.emplace_back(0x9bd, 0); // NA_UI_GUARDS_MAX + packet.Worldstates.emplace_back(0x9bb, 0); // NA_UI_GUARDS_LEFT + packet.Worldstates.emplace_back(0x9bf, 0); // NA_UI_OUTLAND_01 + packet.Worldstates.emplace_back(0x9be, 0); // NA_UI_UNK_1 + packet.Worldstates.emplace_back(0x9c1, 0); // NA_UI_UNK_2 + packet.Worldstates.emplace_back(0xaca, 0); // NA_MAP_WYVERN_NORTH_NEU_H + packet.Worldstates.emplace_back(0xa66, 0); // NA_MAP_WYVERN_NORTH_NEU_A + packet.Worldstates.emplace_back(0xa67, 0); // NA_MAP_WYVERN_NORTH_H + packet.Worldstates.emplace_back(0xa68, 0); // NA_MAP_WYVERN_NORTH_A + packet.Worldstates.emplace_back(0xac8, 0); // NA_MAP_WYVERN_SOUTH_NEU_H + packet.Worldstates.emplace_back(0xa6e, 0); // NA_MAP_WYVERN_SOUTH_NEU_A + packet.Worldstates.emplace_back(0xa6c, 0); // NA_MAP_WYVERN_SOUTH_H + packet.Worldstates.emplace_back(0xa6d, 0); // NA_MAP_WYVERN_SOUTH_A + packet.Worldstates.emplace_back(0xac9, 0); // NA_MAP_WYVERN_WEST_NEU_H + packet.Worldstates.emplace_back(0xa6b, 0); // NA_MAP_WYVERN_WEST_NEU_A + packet.Worldstates.emplace_back(0xa69, 0); // NA_MAP_WYVERN_WEST_H + packet.Worldstates.emplace_back(0xa6a, 0); // NA_MAP_WYVERN_WEST_A + packet.Worldstates.emplace_back(0xacb, 0); // NA_MAP_WYVERN_EAST_NEU_H + packet.Worldstates.emplace_back(0xa63, 0); // NA_MAP_WYVERN_EAST_NEU_A + packet.Worldstates.emplace_back(0xa64, 0); // NA_MAP_WYVERN_EAST_H + packet.Worldstates.emplace_back(0xa65, 0); // NA_MAP_WYVERN_EAST_A + packet.Worldstates.emplace_back(0xa6f, 0); // NA_MAP_HALAA_NEUTRAL + packet.Worldstates.emplace_back(0xa74, 0); // NA_MAP_HALAA_NEU_A + packet.Worldstates.emplace_back(0xa75, 0); // NA_MAP_HALAA_NEU_H + packet.Worldstates.emplace_back(0xa70, 0); // NA_MAP_HALAA_HORDE + packet.Worldstates.emplace_back(0xa71, 0); // NA_MAP_HALAA_ALLIANCE + } + break; + case 3519: // Terokkar Forest + if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_TF) + outdoorPvP->FillInitialWorldStates(packet); else { - data << uint32(2503) << uint32(0x0); // 10 - data << uint32(2502) << uint32(0x0); // 11 - data << uint32(2493) << uint32(0x0); // 12 - data << uint32(2491) << uint32(0x0); // 13 - - data << uint32(2495) << uint32(0x0); // 14 - data << uint32(2494) << uint32(0x0); // 15 - data << uint32(2497) << uint32(0x0); // 16 - - data << uint32(2762) << uint32(0x0); // 17 - data << uint32(2662) << uint32(0x0); // 18 - data << uint32(2663) << uint32(0x0); // 19 - data << uint32(2664) << uint32(0x0); // 20 - - data << uint32(2760) << uint32(0x0); // 21 - data << uint32(2670) << uint32(0x0); // 22 - data << uint32(2668) << uint32(0x0); // 23 - data << uint32(2669) << uint32(0x0); // 24 - - data << uint32(2761) << uint32(0x0); // 25 - data << uint32(2667) << uint32(0x0); // 26 - data << uint32(2665) << uint32(0x0); // 27 - data << uint32(2666) << uint32(0x0); // 28 - - data << uint32(2763) << uint32(0x0); // 29 - data << uint32(2659) << uint32(0x0); // 30 - data << uint32(2660) << uint32(0x0); // 31 - data << uint32(2661) << uint32(0x0); // 32 - - data << uint32(2671) << uint32(0x0); // 33 - data << uint32(2676) << uint32(0x0); // 34 - data << uint32(2677) << uint32(0x0); // 35 - data << uint32(2672) << uint32(0x0); // 36 - data << uint32(2673) << uint32(0x0); // 37 + packet.Worldstates.reserve(28); + packet.Worldstates.emplace_back(0xa41, 0); // TF_UI_CAPTURE_BAR_POS + packet.Worldstates.emplace_back(0xa40, 20); // TF_UI_CAPTURE_BAR_NEUTRAL + packet.Worldstates.emplace_back(0xa3f, 0); // TF_UI_SHOW CAPTURE BAR + packet.Worldstates.emplace_back(0xa3e, 0); // TF_UI_TOWER_COUNT_H + packet.Worldstates.emplace_back(0xa3d, 5); // TF_UI_TOWER_COUNT_A + packet.Worldstates.emplace_back(0xa3c, 0); // TF_UI_TOWERS_CONTROLLED_DISPLAY + packet.Worldstates.emplace_back(0xa88, 0); // TF_TOWER_NUM_15 - SE Neutral + packet.Worldstates.emplace_back(0xa87, 0); // TF_TOWER_NUM_14 - SE Horde + packet.Worldstates.emplace_back(0xa86, 0); // TF_TOWER_NUM_13 - SE Alliance + packet.Worldstates.emplace_back(0xa85, 0); // TF_TOWER_NUM_12 - S Neutral + packet.Worldstates.emplace_back(0xa84, 0); // TF_TOWER_NUM_11 - S Horde + packet.Worldstates.emplace_back(0xa83, 0); // TF_TOWER_NUM_10 - S Alliance + packet.Worldstates.emplace_back(0xa82, 0); // TF_TOWER_NUM_09 - NE Neutral + packet.Worldstates.emplace_back(0xa81, 0); // TF_TOWER_NUM_08 - NE Horde + packet.Worldstates.emplace_back(0xa80, 0); // TF_TOWER_NUM_07 - NE Alliance + packet.Worldstates.emplace_back(0xa7f, 0); // TF_TOWER_NUM_16 - unk + packet.Worldstates.emplace_back(0xa7e, 0); // TF_TOWER_NUM_06 - N Neutral + packet.Worldstates.emplace_back(0xa7d, 0); // TF_TOWER_NUM_05 - N Horde + packet.Worldstates.emplace_back(0xa7c, 0); // TF_TOWER_NUM_04 - N Alliance + packet.Worldstates.emplace_back(0xa7b, 0); // TF_TOWER_NUM_03 - NW Alliance + packet.Worldstates.emplace_back(0xa7a, 0); // TF_TOWER_NUM_02 - NW Horde + packet.Worldstates.emplace_back(0xa79, 0); // TF_TOWER_NUM_01 - NW Neutral + packet.Worldstates.emplace_back(0x9d0, 5); // TF_UI_LOCKED_TIME_MINUTES_FIRST_DIGIT + packet.Worldstates.emplace_back(0x9ce, 0); // TF_UI_LOCKED_TIME_MINUTES_SECOND_DIGIT + packet.Worldstates.emplace_back(0x9cd, 0); // TF_UI_LOCKED_TIME_HOURS + packet.Worldstates.emplace_back(0x9cc, 0); // TF_UI_LOCKED_DISPLAY_NEUTRAL + packet.Worldstates.emplace_back(0xad0, 0); // TF_UI_LOCKED_DISPLAY_HORDE + packet.Worldstates.emplace_back(0xacf, 1); // TF_UI_LOCKED_DISPLAY_ALLIANCE } break; - case 3519: // Terokkar Forest - if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_TF) - pvp->FillInitialWorldStates(data); + case 3521: // Zangarmarsh + if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_ZM) + outdoorPvP->FillInitialWorldStates(packet); else { - data << uint32(0xa41) << uint32(0x0); // 10 // 2625 capture bar pos - data << uint32(0xa40) << uint32(0x14); // 11 // 2624 capture bar neutral - data << uint32(0xa3f) << uint32(0x0); // 12 // 2623 show capture bar - data << uint32(0xa3e) << uint32(0x0); // 13 // 2622 horde towers controlled - data << uint32(0xa3d) << uint32(0x5); // 14 // 2621 ally towers controlled - data << uint32(0xa3c) << uint32(0x0); // 15 // 2620 show towers controlled - data << uint32(0xa88) << uint32(0x0); // 16 // 2696 SE Neu - data << uint32(0xa87) << uint32(0x0); // 17 // SE Horde - data << uint32(0xa86) << uint32(0x0); // 18 // SE Ally - data << uint32(0xa85) << uint32(0x0); // 19 //S Neu - data << uint32(0xa84) << uint32(0x0); // 20 S Horde - data << uint32(0xa83) << uint32(0x0); // 21 S Ally - data << uint32(0xa82) << uint32(0x0); // 22 NE Neu - data << uint32(0xa81) << uint32(0x0); // 23 NE Horde - data << uint32(0xa80) << uint32(0x0); // 24 NE Ally - data << uint32(0xa7e) << uint32(0x0); // 25 // 2686 N Neu - data << uint32(0xa7d) << uint32(0x0); // 26 N Horde - data << uint32(0xa7c) << uint32(0x0); // 27 N Ally - data << uint32(0xa7b) << uint32(0x0); // 28 NW Ally - data << uint32(0xa7a) << uint32(0x0); // 29 NW Horde - data << uint32(0xa79) << uint32(0x0); // 30 NW Neutral - data << uint32(0x9d0) << uint32(0x5); // 31 // 2512 locked time remaining seconds first digit - data << uint32(0x9ce) << uint32(0x0); // 32 // 2510 locked time remaining seconds second digit - data << uint32(0x9cd) << uint32(0x0); // 33 // 2509 locked time remaining minutes - data << uint32(0x9cc) << uint32(0x0); // 34 // 2508 neutral locked time show - data << uint32(0xad0) << uint32(0x0); // 35 // 2768 horde locked time show - data << uint32(0xacf) << uint32(0x1); // 36 // 2767 ally locked time show + packet.Worldstates.reserve(26); + packet.Worldstates.emplace_back(0x9e1, 0); // ZM_UNK_1 + packet.Worldstates.emplace_back(0x9e0, 0); // ZM_UNK_2 + packet.Worldstates.emplace_back(0x9df, 0); // ZM_UNK_3 + packet.Worldstates.emplace_back(0xa5d, 1); // ZM_WORLDSTATE_UNK_1 + packet.Worldstates.emplace_back(0xa5c, 0); // ZM_MAP_TOWER_EAST_N + packet.Worldstates.emplace_back(0xa5b, 1); // ZM_MAP_TOWER_EAST_H + packet.Worldstates.emplace_back(0xa5a, 0); // ZM_MAP_TOWER_EAST_A + packet.Worldstates.emplace_back(0xa59, 1); // ZM_MAP_GRAVEYARD_H - Twin spire graveyard horde + packet.Worldstates.emplace_back(0xa58, 0); // ZM_MAP_GRAVEYARD_A + packet.Worldstates.emplace_back(0xa57, 0); // ZM_MAP_GRAVEYARD_N + packet.Worldstates.emplace_back(0xa56, 0); // ZM_MAP_TOWER_WEST_N + packet.Worldstates.emplace_back(0xa55, 1); // ZM_MAP_TOWER_WEST_H + packet.Worldstates.emplace_back(0xa54, 0); // ZM_MAP_TOWER_WEST_A + packet.Worldstates.emplace_back(0x9e7, 0); // ZM_UNK_4 + packet.Worldstates.emplace_back(0x9e6, 0); // ZM_UNK_5 + packet.Worldstates.emplace_back(0x9e5, 0); // ZM_UNK_6 + packet.Worldstates.emplace_back(0xa00, 0); // ZM_UI_TOWER_EAST_N + packet.Worldstates.emplace_back(0x9ff, 1); // ZM_UI_TOWER_EAST_H + packet.Worldstates.emplace_back(0x9fe, 0); // ZM_UI_TOWER_EAST_A + packet.Worldstates.emplace_back(0x9fd, 0); // ZM_UI_TOWER_WEST_N + packet.Worldstates.emplace_back(0x9fc, 1); // ZM_UI_TOWER_WEST_H + packet.Worldstates.emplace_back(0x9fb, 0); // ZM_UI_TOWER_WEST_A + packet.Worldstates.emplace_back(0xa62, 0); // ZM_MAP_HORDE_FLAG_READY + packet.Worldstates.emplace_back(0xa61, 1); // ZM_MAP_HORDE_FLAG_NOT_READY + packet.Worldstates.emplace_back(0xa60, 1); // ZM_MAP_ALLIANCE_FLAG_NOT_READY + packet.Worldstates.emplace_back(0xa5f, 0); // ZM_MAP_ALLIANCE_FLAG_READY } break; - case 3521: // Zangarmarsh - if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_ZM) - pvp->FillInitialWorldStates(data); + case 3698: // Nagrand Arena + if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_NA) + battleground->FillInitialWorldStates(packet); else { - data << uint32(0x9e1) << uint32(0x0); // 10 //2529 - data << uint32(0x9e0) << uint32(0x0); // 11 - data << uint32(0x9df) << uint32(0x0); // 12 - data << uint32(0xa5d) << uint32(0x1); // 13 //2653 - data << uint32(0xa5c) << uint32(0x0); // 14 //2652 east beacon neutral - data << uint32(0xa5b) << uint32(0x1); // 15 horde - data << uint32(0xa5a) << uint32(0x0); // 16 ally - data << uint32(0xa59) << uint32(0x1); // 17 // 2649 Twin spire graveyard horde 12??? - data << uint32(0xa58) << uint32(0x0); // 18 ally 14 ??? - data << uint32(0xa57) << uint32(0x0); // 19 neutral 7??? - data << uint32(0xa56) << uint32(0x0); // 20 // 2646 west beacon neutral - data << uint32(0xa55) << uint32(0x1); // 21 horde - data << uint32(0xa54) << uint32(0x0); // 22 ally - data << uint32(0x9e7) << uint32(0x0); // 23 // 2535 - data << uint32(0x9e6) << uint32(0x0); // 24 - data << uint32(0x9e5) << uint32(0x0); // 25 - data << uint32(0xa00) << uint32(0x0); // 26 // 2560 - data << uint32(0x9ff) << uint32(0x1); // 27 - data << uint32(0x9fe) << uint32(0x0); // 28 - data << uint32(0x9fd) << uint32(0x0); // 29 - data << uint32(0x9fc) << uint32(0x1); // 30 - data << uint32(0x9fb) << uint32(0x0); // 31 - data << uint32(0xa62) << uint32(0x0); // 32 // 2658 - data << uint32(0xa61) << uint32(0x1); // 33 - data << uint32(0xa60) << uint32(0x1); // 34 - data << uint32(0xa5f) << uint32(0x0); // 35 + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(0xa0f, 0); // BATTLEGROUND_NAGRAND_ARENA_GOLD + packet.Worldstates.emplace_back(0xa10, 0); // BATTLEGROUND_NAGRAND_ARENA_GREEN + packet.Worldstates.emplace_back(0xa11, 0); // BATTLEGROUND_NAGRAND_ARENA_SHOW } break; - case 3698: // Nagrand Arena - if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_NA) - bg->FillInitialWorldStates(data); + case 3702: // Blade's Edge Arena + if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_BE) + battleground->FillInitialWorldStates(packet); else { - data << uint32(0xa0f) << uint32(0x0); // 7 - data << uint32(0xa10) << uint32(0x0); // 8 - data << uint32(0xa11) << uint32(0x0); // 9 show + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(0x9f0, 0); // BATTLEGROUND_BLADES_EDGE_ARENA_GOLD + packet.Worldstates.emplace_back(0x9f1, 0); // BATTLEGROUND_BLADES_EDGE_ARENA_GREEN + packet.Worldstates.emplace_back(0x9f3, 0); // BATTLEGROUND_BLADES_EDGE_ARENA_SHOW } break; - case 3702: // Blade's Edge Arena - if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_BE) - bg->FillInitialWorldStates(data); + case 3968: // Ruins of Lordaeron + if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_RL) + battleground->FillInitialWorldStates(packet); else { - data << uint32(0x9f0) << uint32(0x0); // 7 gold - data << uint32(0x9f1) << uint32(0x0); // 8 green - data << uint32(0x9f3) << uint32(0x0); // 9 show + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(0xbb8, 0); // BATTELGROUND_RUINS_OF_LORDAERNON_GOLD + packet.Worldstates.emplace_back(0xbb9, 0); // BATTELGROUND_RUINS_OF_LORDAERNON_GREEN + packet.Worldstates.emplace_back(0xbba, 0); // BATTELGROUND_RUINS_OF_LORDAERNON_SHOW } break; - case 3968: // Ruins of Lordaeron - if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_RL) - bg->FillInitialWorldStates(data); + case 4378: // Dalaran Sewers + if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_DS) + battleground->FillInitialWorldStates(packet); else { - data << uint32(0xbb8) << uint32(0x0); // 7 gold - data << uint32(0xbb9) << uint32(0x0); // 8 green - data << uint32(0xbba) << uint32(0x0); // 9 show + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(0xe11, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD + packet.Worldstates.emplace_back(0xe10, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN + packet.Worldstates.emplace_back(0xe1a, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_SHOW } break; - case 4378: // Dalaran Sewers - if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_DS) - bg->FillInitialWorldStates(data); - else - { - data << uint32(3601) << uint32(0x0); // 7 gold - data << uint32(3600) << uint32(0x0); // 8 green - data << uint32(3610) << uint32(0x0); // 9 show - } - break; - case 4384: // Strand of the Ancients - if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_SA) - bg->FillInitialWorldStates(data); + case 4384: // Strand of the Ancients + if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_SA) + battleground->FillInitialWorldStates(packet); else { + packet.Worldstates.reserve(24); // 1-3 A defend, 4-6 H defend, 7-9 unk defend, 1 - ok, 2 - half destroyed, 3 - destroyed - data << uint32(0xf09) << uint32(0x0); // 7 3849 Gate of Temple - data << uint32(0xe36) << uint32(0x0); // 8 3638 Gate of Yellow Moon - data << uint32(0xe27) << uint32(0x0); // 9 3623 Gate of Green Emerald - data << uint32(0xe24) << uint32(0x0); // 10 3620 Gate of Blue Sapphire - data << uint32(0xe21) << uint32(0x0); // 11 3617 Gate of Red Sun - data << uint32(0xe1e) << uint32(0x0); // 12 3614 Gate of Purple Ametyst + packet.Worldstates.emplace_back(0xf09, 0); // Gate of Temple + packet.Worldstates.emplace_back(0xe36, 0); // Gate of Yellow Moon + packet.Worldstates.emplace_back(0xe27, 0); // Gate of Green Emerald + packet.Worldstates.emplace_back(0xe24, 0); // Gate of Blue Sapphire + packet.Worldstates.emplace_back(0xe21, 0); // Gate of Red Sun + packet.Worldstates.emplace_back(0xe1e, 0); // Gate of Purple Ametyst + packet.Worldstates.emplace_back(0xdf3, 0); // bonus timer (1 - on, 0 - off) + packet.Worldstates.emplace_back(0xded, 0); // Horde Attacker + packet.Worldstates.emplace_back(0xdec, 0); // Alliance Attacker - data << uint32(0xdf3) << uint32(0x0); // 13 3571 bonus timer (1 - on, 0 - off) - data << uint32(0xded) << uint32(0x0); // 14 3565 Horde Attacker - data << uint32(0xdec) << uint32(0x0); // 15 3564 Alliance Attacker - // End Round (timer), better explain this by example, eg. ends in 19:59 -> A:BC - data << uint32(0xde9) << uint32(0x0); // 16 3561 C - data << uint32(0xde8) << uint32(0x0); // 17 3560 B - data << uint32(0xde7) << uint32(0x0); // 18 3559 A - data << uint32(0xe35) << uint32(0x0); // 19 3637 East g - Horde control - data << uint32(0xe34) << uint32(0x0); // 20 3636 West g - Horde control - data << uint32(0xe33) << uint32(0x0); // 21 3635 South g - Horde control - data << uint32(0xe32) << uint32(0x0); // 22 3634 East g - Alliance control - data << uint32(0xe31) << uint32(0x0); // 23 3633 West g - Alliance control - data << uint32(0xe30) << uint32(0x0); // 24 3632 South g - Alliance control - data << uint32(0xe2f) << uint32(0x0); // 25 3631 Chamber of Ancients - Horde control - data << uint32(0xe2e) << uint32(0x0); // 26 3630 Chamber of Ancients - Alliance control - data << uint32(0xe2d) << uint32(0x0); // 27 3629 Beach1 - Horde control - data << uint32(0xe2c) << uint32(0x0); // 28 3628 Beach2 - Horde control - data << uint32(0xe2b) << uint32(0x0); // 29 3627 Beach1 - Alliance control - data << uint32(0xe2a) << uint32(0x0); // 30 3626 Beach2 - Alliance control - // and many unks... - } - break; - case 4406: // Ring of Valor - if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_RV) - bg->FillInitialWorldStates(data); - else - { - data << uint32(0xe10) << uint32(0x0); // 7 gold - data << uint32(0xe11) << uint32(0x0); // 8 green - data << uint32(0xe1a) << uint32(0x0); // 9 show - } - break; - case 4710: // Isle of Conquest - if (bg && bg->GetBgTypeID(true) == BATTLEGROUND_IC) - bg->FillInitialWorldStates(data); - else - { - data << uint32(4221) << uint32(1); // 7 BG_IC_ALLIANCE_RENFORT_SET - data << uint32(4222) << uint32(1); // 8 BG_IC_HORDE_RENFORT_SET - data << uint32(4226) << uint32(300); // 9 BG_IC_ALLIANCE_RENFORT - data << uint32(4227) << uint32(300); // 10 BG_IC_HORDE_RENFORT - data << uint32(4322) << uint32(1); // 11 BG_IC_GATE_FRONT_H_WS_OPEN - data << uint32(4321) << uint32(1); // 12 BG_IC_GATE_WEST_H_WS_OPEN - data << uint32(4320) << uint32(1); // 13 BG_IC_GATE_EAST_H_WS_OPEN - data << uint32(4323) << uint32(1); // 14 BG_IC_GATE_FRONT_A_WS_OPEN - data << uint32(4324) << uint32(1); // 15 BG_IC_GATE_WEST_A_WS_OPEN - data << uint32(4325) << uint32(1); // 16 BG_IC_GATE_EAST_A_WS_OPEN - data << uint32(4317) << uint32(1); // 17 unknown + // End Round timer, example: 19:59 -> A:BC + packet.Worldstates.emplace_back(0xde9, 0); // C + packet.Worldstates.emplace_back(0xde8, 0); // B + packet.Worldstates.emplace_back(0xde7, 0); // A - data << uint32(4301) << uint32(1); // 18 BG_IC_DOCKS_UNCONTROLLED - data << uint32(4296) << uint32(1); // 19 BG_IC_HANGAR_UNCONTROLLED - data << uint32(4306) << uint32(1); // 20 BG_IC_QUARRY_UNCONTROLLED - data << uint32(4311) << uint32(1); // 21 BG_IC_REFINERY_UNCONTROLLED - data << uint32(4294) << uint32(1); // 22 BG_IC_WORKSHOP_UNCONTROLLED - data << uint32(4243) << uint32(1); // 23 unknown - data << uint32(4345) << uint32(1); // 24 unknown + packet.Worldstates.emplace_back(0xe35, 0); // BG_SA_CENTER_GY_ALLIANCE + packet.Worldstates.emplace_back(0xe34, 0); // BG_SA_RIGHT_GY_ALLIANCE + packet.Worldstates.emplace_back(0xe33, 0); // BG_SA_LEFT_GY_ALLIANCE + packet.Worldstates.emplace_back(0xe32, 0); // BG_SA_CENTER_GY_HORDE + packet.Worldstates.emplace_back(0xe31, 0); // BG_SA_LEFT_GY_HORDE + packet.Worldstates.emplace_back(0xe30, 0); // BG_SA_RIGHT_GY_HORDE + packet.Worldstates.emplace_back(0xe2f, 0); // BG_SA_HORDE_DEFENCE_TOKEN + packet.Worldstates.emplace_back(0xe2e, 0); // BG_SA_ALLIANCE_DEFENCE_TOKEN + packet.Worldstates.emplace_back(0xe2d, 0); // BG_SA_LEFT_ATT_TOKEN_HRD + packet.Worldstates.emplace_back(0xe2c, 0); // BG_SA_RIGHT_ATT_TOKEN_HRD + packet.Worldstates.emplace_back(0xe2b, 0); // BG_SA_RIGHT_ATT_TOKEN_ALL + packet.Worldstates.emplace_back(0xe2a, 0); // BG_SA_LEFT_ATT_TOKEN_ALL + // missing unknowns } break; - // The Ruby Sanctum - case 4987: - if (instance && mapid == 724) - instance->FillInitialWorldStates(data); + case 4406: // Ring of Valor + if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_RV) + battleground->FillInitialWorldStates(packet); else { - data << uint32(5049) << uint32(50); // 9 WORLDSTATE_CORPOREALITY_MATERIAL - data << uint32(5050) << uint32(50); // 10 WORLDSTATE_CORPOREALITY_TWILIGHT - data << uint32(5051) << uint32(0); // 11 WORLDSTATE_CORPOREALITY_TOGGLE + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(0xe10, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN + packet.Worldstates.emplace_back(0xe11, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD + packet.Worldstates.emplace_back(0xe1a, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_SHOW } break; - // Icecrown Citadel - case 4812: - if (instance && mapid == 631) - instance->FillInitialWorldStates(data); + case 4710: // Isle of Conquest + if (battleground && battleground->GetBgTypeID(true) == BATTLEGROUND_IC) + battleground->FillInitialWorldStates(packet); else { - data << uint32(4903) << uint32(0); // 9 WORLDSTATE_SHOW_TIMER (Blood Quickening weekly) - data << uint32(4904) << uint32(30); // 10 WORLDSTATE_EXECUTION_TIME - data << uint32(4940) << uint32(0); // 11 WORLDSTATE_SHOW_ATTEMPTS - data << uint32(4941) << uint32(50); // 12 WORLDSTATE_ATTEMPTS_REMAINING - data << uint32(4942) << uint32(50); // 13 WORLDSTATE_ATTEMPTS_MAX + packet.Worldstates.reserve(18); + packet.Worldstates.emplace_back(0x107d, 1); // BG_IC_ALLIANCE_RENFORT_SET + packet.Worldstates.emplace_back(0x107e, 1); // BG_IC_HORDE_RENFORT_SET + packet.Worldstates.emplace_back(0x1082, 300); // BG_IC_ALLIANCE_RENFORT + packet.Worldstates.emplace_back(0x1083, 300); // BG_IC_HORDE_RENFORT + packet.Worldstates.emplace_back(0x10e2, 1); // BG_IC_GATE_FRONT_H_WS_OPEN + packet.Worldstates.emplace_back(0x10e1, 1); // BG_IC_GATE_WEST_H_WS_OPEN + packet.Worldstates.emplace_back(0x10e0, 1); // BG_IC_GATE_EAST_H_WS_OPEN + packet.Worldstates.emplace_back(0x10e3, 1); // BG_IC_GATE_FRONT_A_WS_OPEN + packet.Worldstates.emplace_back(0x10e4, 1); // BG_IC_GATE_WEST_A_WS_OPEN + packet.Worldstates.emplace_back(0x10e5, 1); // BG_IC_GATE_EAST_A_WS_OPEN + packet.Worldstates.emplace_back(0x10dd, 1); // unk + packet.Worldstates.emplace_back(0x10cd, 1); // BG_IC_DOCKS_UNCONTROLLED + packet.Worldstates.emplace_back(0x10c8, 1); // BG_IC_HANGAR_UNCONTROLLED + packet.Worldstates.emplace_back(0x10d2, 1); // BG_IC_QUARRY_UNCONTROLLED + packet.Worldstates.emplace_back(0x10d7, 1); // BG_IC_REFINERY_UNCONTROLLED + packet.Worldstates.emplace_back(0x10c6, 1); // BG_IC_WORKSHOP_UNCONTROLLED + packet.Worldstates.emplace_back(0x1093, 1); // unk + packet.Worldstates.emplace_back(0x10f9, 1); // unk } break; - // The Culling of Stratholme - case 4100: - if (instance && mapid == 595) - instance->FillInitialWorldStates(data); + case 4987: // The Ruby Sanctum + if (instance) + instance->FillInitialWorldStates(packet); else { - data << uint32(3479) << uint32(0); // 9 WORLDSTATE_SHOW_CRATES - data << uint32(3480) << uint32(0); // 10 WORLDSTATE_CRATES_REVEALED - data << uint32(3504) << uint32(0); // 11 WORLDSTATE_WAVE_COUNT - data << uint32(3931) << uint32(25); // 12 WORLDSTATE_TIME_GUARDIAN - data << uint32(3932) << uint32(0); // 13 WORLDSTATE_TIME_GUARDIAN_SHOW + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(0x13b9, 50); // WORLDSTATE_CORPOREALITY_MATERIAL + packet.Worldstates.emplace_back(0x13ba, 50); // WORLDSTATE_CORPOREALITY_TWILIGHT + packet.Worldstates.emplace_back(0x13bb, 0); // WORLDSTATE_CORPOREALITY_TOGGLE } break; - // The Oculus - case 4228: - if (instance && mapid == 578) - instance->FillInitialWorldStates(data); + case 4812: // Icecrown Citadel + if (instance && mapId == 631) + instance->FillInitialWorldStates(packet); else { - data << uint32(3524) << uint32(0); // 9 WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW - data << uint32(3486) << uint32(0); // 10 WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT + packet.Worldstates.reserve(5); + packet.Worldstates.emplace_back(0x1327, 0); // WORLDSTATE_SHOW_TIMER (Blood Quickening weekly) + packet.Worldstates.emplace_back(0x1328, 30); // WORLDSTATE_EXECUTION_TIME + packet.Worldstates.emplace_back(0x134c, 0); // WORLDSTATE_SHOW_ATTEMPTS + packet.Worldstates.emplace_back(0x134d, 50); // WORLDSTATE_ATTEMPTS_REMAINING + packet.Worldstates.emplace_back(0x134e, 50); // WORLDSTATE_ATTEMPTS_MAX } break; - // Ulduar - case 4273: - if (instance && mapid == 603) - instance->FillInitialWorldStates(data); + case 4100: // The Culling of Stratholme + if (instance && mapId == 595) + instance->FillInitialWorldStates(packet); else { - data << uint32(4132) << uint32(0); // 9 WORLDSTATE_ALGALON_TIMER_ENABLED - data << uint32(4131) << uint32(0); // 10 WORLDSTATE_ALGALON_DESPAWN_TIMER + packet.Worldstates.reserve(5); + packet.Worldstates.emplace_back(0xd97, 0); // WORLDSTATE_SHOW_CRATES + packet.Worldstates.emplace_back(0xd98, 0); // WORLDSTATE_CRATES_REVEALED + packet.Worldstates.emplace_back(0xdb0, 0); // WORLDSTATE_WAVE_COUNT + packet.Worldstates.emplace_back(0xf5b, 25); // WORLDSTATE_TIME_GUARDIAN + packet.Worldstates.emplace_back(0xf5c, 0); // WORLDSTATE_TIME_GUARDIAN_SHOW } break; - // Halls of Refection - case 4820: - if (instance && mapid == 668) - instance->FillInitialWorldStates(data); + case 4228: // The Oculus + if (instance && mapId == 578) + instance->FillInitialWorldStates(packet); else { - data << uint32(4884) << uint32(0); // 9 WORLD_STATE_HOR_WAVES_ENABLED - data << uint32(4882) << uint32(0); // 10 WORLD_STATE_HOR_WAVE_COUNT + packet.Worldstates.reserve(2); + packet.Worldstates.emplace_back(0xdc4, 0); // WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW + packet.Worldstates.emplace_back(0xd9e, 0); // WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT } break; - // Scarlet Enclave (DK starting zone) - case 4298: + case 4273: // Ulduar + if (instance && mapId == 603) + instance->FillInitialWorldStates(packet); + else + { + packet.Worldstates.reserve(2); + packet.Worldstates.emplace_back(0x1024, 0); // WORLDSTATE_ALGALON_TIMER_ENABLED + packet.Worldstates.emplace_back(0x1023, 0); // WORLDSTATE_ALGALON_DESPAWN_TIMER + } + break; + case 4415: // Violet Hold + if (instance) + instance->FillInitialWorldStates(packet); + else + { + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(0xee8, 0); // WORLD_STATE_VH_SHOW + packet.Worldstates.emplace_back(0xee7, 100); // WORLD_STATE_VH_PRISON_STATE + packet.Worldstates.emplace_back(0xee2, 0); // WORLD_STATE_VH_WAVE_COUNT + } + break; + case 4820: // Halls of Refection + if (instance && mapId == 668) + instance->FillInitialWorldStates(packet); + else + { + packet.Worldstates.reserve(2); + packet.Worldstates.emplace_back(0x1314, 0); // WORLD_STATE_HOR_WAVES_ENABLED + packet.Worldstates.emplace_back(0x1312, 0); // WORLD_STATE_HOR_WAVE_COUNT + } + break; + case 4298: // Scarlet Enclave (DK starting zone) // Get Mograine, GUID and ENTRY should NEVER change if (Creature* mograine = ObjectAccessor::GetCreature(*this, ObjectGuid::Create(29173, 130956))) { if (CreatureAI* mograineAI = mograine->AI()) { - data << uint32(3590) << uint32(mograineAI->GetData(3590)); - data << uint32(3591) << uint32(mograineAI->GetData(3591)); - data << uint32(3592) << uint32(mograineAI->GetData(3592)); - data << uint32(3603) << uint32(mograineAI->GetData(3603)); - data << uint32(3604) << uint32(mograineAI->GetData(3604)); - data << uint32(3605) << uint32(mograineAI->GetData(3605)); + packet.Worldstates.reserve(6); + packet.Worldstates.emplace_back(0xe06, mograineAI->GetData(3590)); + packet.Worldstates.emplace_back(0xe07, mograineAI->GetData(3591)); + packet.Worldstates.emplace_back(0xe08, mograineAI->GetData(3592)); + packet.Worldstates.emplace_back(0xe13, mograineAI->GetData(3603)); + packet.Worldstates.emplace_back(0xe14, mograineAI->GetData(3604)); + packet.Worldstates.emplace_back(0xe15, mograineAI->GetData(3605)); } } break; - // Wintergrasp - case 4197: - if (bf && bf->GetTypeId() == BATTLEFIELD_WG) + case 4197: // Wintergrasp + if (battlefield && battlefield->GetTypeId() == BATTLEFIELD_WG) { - bf->FillInitialWorldStates(data); + battlefield->FillInitialWorldStates(packet); break; } [[fallthrough]]; default: - data << uint32(0x914) << uint32(0x0); // 7 - data << uint32(0x913) << uint32(0x0); // 8 - data << uint32(0x912) << uint32(0x0); // 9 - data << uint32(0x915) << uint32(0x0); // 10 + packet.Worldstates.reserve(4); + packet.Worldstates.emplace_back(0x914, 0); + packet.Worldstates.emplace_back(0x913, 0); + packet.Worldstates.emplace_back(0x912, 0); + packet.Worldstates.emplace_back(0x915, 0); break; + } } } - sWorldState->FillInitialWorldStates(data, zoneid, areaid); - - uint16 length = (data.wpos() - countPos) / 8; - data.put(countPos, length); - - GetSession()->SendPacket(&data); + sWorldState->FillInitialWorldStates(packet, zoneId, areaId); + SendDirectMessage(packet.Write()); SendBGWeekendWorldStates(); SendBattlefieldWorldStates(); } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 3c3b5781d..22e694143 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -65,7 +65,7 @@ class SpellCastTargets; class UpdateMask; typedef std::deque PlayerMails; -typedef void(*bgZoneRef)(Battleground*, WorldPacket&); +typedef void(*bgZoneRef)(Battleground*, WorldPackets::WorldState::InitWorldStates&); #define PLAYER_MAX_SKILLS 127 #define PLAYER_MAX_DAILY_QUESTS 25 @@ -2236,7 +2236,7 @@ public: void SetEquipmentSet(uint32 index, EquipmentSet eqset); void DeleteEquipmentSet(uint64 setGuid); - void SendInitWorldStates(uint32 zone, uint32 area); + void SendInitWorldStates(uint32 zoneId, uint32 areaId); void SendUpdateWorldState(uint32 variable, uint32 value) const; void SendDirectMessage(WorldPacket const* data) const; void SendBGWeekendWorldStates(); diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index 89246ed96..86ec413a9 100644 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -23,6 +23,7 @@ #include "TaskScheduler.h" #include "World.h" #include "ZoneScript.h" +#include "WorldStatePackets.h" #include #define OUT_SAVE_INST_DATA LOG_DEBUG("scripts.ai", "Saving Instance Data for Instance {} (Map {}, Instance Id {})", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) @@ -260,7 +261,7 @@ public: void SendEncounterUnit(uint32 type, Unit* unit = nullptr, uint8 param1 = 0, uint8 param2 = 0); - virtual void FillInitialWorldStates(WorldPacket& /*data*/) {} + virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& /*packet*/) { } uint32 GetEncounterCount() const { return bosses.size(); } diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h index 1d4c8c9e7..fe773f1d3 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.h +++ b/src/server/game/OutdoorPvP/OutdoorPvP.h @@ -20,6 +20,7 @@ #include "SharedDefines.h" #include "ZoneScript.h" +#include "WorldStatePackets.h" #include class GameObject; @@ -92,7 +93,7 @@ public: explicit OPvPCapturePoint(OutdoorPvP* pvp); virtual ~OPvPCapturePoint() = default; - virtual void FillInitialWorldStates(WorldPacket& /*data*/) {} + virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& /*packet*/) { } // send world state update to all players present void SendUpdateWorldState(uint32 field, uint32 value); @@ -199,7 +200,7 @@ public: typedef std::pair GoScriptPair; typedef std::pair CreatureScriptPair; - virtual void FillInitialWorldStates(WorldPacket& /*data*/) {} + virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& /*packet*/) {} // called when a player triggers an area trigger virtual bool HandleAreaTrigger(Player* player, uint32 trigger); diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index bd7d556c3..4d193306c 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -681,7 +681,7 @@ void WorldSession::LogoutPlayer(bool save) if (!_player->IsBeingTeleportedFar() && !_player->m_InstanceValid && !_player->IsGameMaster()) _player->RepopAtGraveyard(); - // Repop at GraveYard or other player far teleport will prevent saving player because of not present map + // Repop at Graveyard or other player far teleport will prevent saving player because of not present map // Teleport player immediately for correct player save while (_player && _player->IsBeingTeleportedFar()) HandleMoveWorldportAck(); diff --git a/src/server/game/World/WorldState.cpp b/src/server/game/World/WorldState.cpp index d2fe8f64f..dcec3b958 100644 --- a/src/server/game/World/WorldState.cpp +++ b/src/server/game/World/WorldState.cpp @@ -1035,7 +1035,7 @@ uint32 SunsReachReclamationData::GetSunwellGatePercentage(uint32 gate) return percentage < 0 ? 0 : uint32(percentage); } -void WorldState::FillInitialWorldStates(ByteBuffer& data, uint32 zoneId, uint32 /*areaId*/) +void WorldState::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet, uint32 zoneId, uint32 /*areaId*/) { switch (zoneId) { @@ -1048,38 +1048,38 @@ void WorldState::FillInitialWorldStates(ByteBuffer& data, uint32 zoneId, uint32 switch (m_sunsReachData.m_phase) { case SUNS_REACH_PHASE_1_STAGING_AREA: - data << WORLD_STATE_QUEL_DANAS_SANCTUM << m_sunsReachData.GetPhasePercentage(m_sunsReachData.m_phase); + packet.Worldstates.emplace_back(WORLD_STATE_QUEL_DANAS_SANCTUM, m_sunsReachData.GetPhasePercentage(m_sunsReachData.m_phase)); break; case SUNS_REACH_PHASE_2_SANCTUM: - data << WORLD_STATE_QUEL_DANAS_ARMORY << m_sunsReachData.GetPhasePercentage(m_sunsReachData.m_phase); + packet.Worldstates.emplace_back(WORLD_STATE_QUEL_DANAS_ARMORY, m_sunsReachData.GetPhasePercentage(m_sunsReachData.m_phase)); break; case SUNS_REACH_PHASE_3_ARMORY: - data << WORLD_STATE_QUEL_DANAS_HARBOR << m_sunsReachData.GetPhasePercentage(m_sunsReachData.m_phase); + packet.Worldstates.emplace_back(WORLD_STATE_QUEL_DANAS_HARBOR, m_sunsReachData.GetPhasePercentage(m_sunsReachData.m_phase)); break; case SUNS_REACH_PHASE_4_HARBOR: if ((m_sunsReachData.m_subphaseMask & SUBPHASE_ALCHEMY_LAB) == 0) - data << WORLD_STATE_QUEL_DANAS_ALCHEMY_LAB << m_sunsReachData.GetSubPhasePercentage(SUBPHASE_ALCHEMY_LAB); + packet.Worldstates.emplace_back(WORLD_STATE_QUEL_DANAS_ALCHEMY_LAB, m_sunsReachData.GetSubPhasePercentage(SUBPHASE_ALCHEMY_LAB)); if ((m_sunsReachData.m_subphaseMask & SUBPHASE_MONUMENT) == 0) - data << WORLD_STATE_QUEL_DANAS_MONUMENT << m_sunsReachData.GetSubPhasePercentage(SUBPHASE_MONUMENT); + packet.Worldstates.emplace_back(WORLD_STATE_QUEL_DANAS_MONUMENT, m_sunsReachData.GetSubPhasePercentage(SUBPHASE_MONUMENT)); break; } if (m_sunsReachData.m_phase >= SUNS_REACH_PHASE_2_SANCTUM && (m_sunsReachData.m_subphaseMask & SUBPHASE_PORTAL) == 0) - data << WORLD_STATE_QUEL_DANAS_PORTAL << m_sunsReachData.GetSubPhasePercentage(SUBPHASE_PORTAL); + packet.Worldstates.emplace_back(WORLD_STATE_QUEL_DANAS_PORTAL, m_sunsReachData.GetSubPhasePercentage(SUBPHASE_PORTAL)); if (m_sunsReachData.m_phase >= SUNS_REACH_PHASE_3_ARMORY && (m_sunsReachData.m_subphaseMask & SUBPHASE_ANVIL) == 0) - data << WORLD_STATE_QUEL_DANAS_ANVIL << m_sunsReachData.GetSubPhasePercentage(SUBPHASE_ANVIL); - data << WORLD_STATE_QUEL_DANAS_MUSIC << m_sunsReachData.m_phase; + packet.Worldstates.emplace_back(WORLD_STATE_QUEL_DANAS_ANVIL, m_sunsReachData.GetSubPhasePercentage(SUBPHASE_ANVIL)); + packet.Worldstates.emplace_back(WORLD_STATE_QUEL_DANAS_MUSIC, m_sunsReachData.m_phase); // Sunwell Gates switch (m_sunsReachData.m_gate) { case SUNWELL_ALL_GATES_CLOSED: - data << WORLD_STATE_AGAMATH_THE_FIRST_GATE_HEALTH << m_sunsReachData.GetSunwellGatePercentage(m_sunsReachData.m_gate); + packet.Worldstates.emplace_back(WORLD_STATE_AGAMATH_THE_FIRST_GATE_HEALTH, m_sunsReachData.GetSunwellGatePercentage(m_sunsReachData.m_gate)); break; case SUNWELL_AGAMATH_GATE1_OPEN: - data << WORLD_STATE_ROHENDOR_THE_SECOND_GATE_HEALTH << m_sunsReachData.GetSunwellGatePercentage(m_sunsReachData.m_gate); + packet.Worldstates.emplace_back(WORLD_STATE_ROHENDOR_THE_SECOND_GATE_HEALTH, m_sunsReachData.GetSunwellGatePercentage(m_sunsReachData.m_gate)); break; case SUNWELL_ROHENDOR_GATE2_OPEN: - data << WORLD_STATE_ARCHONISUS_THE_FINAL_GATE_HEALTH << m_sunsReachData.GetSunwellGatePercentage(m_sunsReachData.m_gate); + packet.Worldstates.emplace_back(WORLD_STATE_ARCHONISUS_THE_FINAL_GATE_HEALTH, m_sunsReachData.GetSunwellGatePercentage(m_sunsReachData.m_gate)); break; } break; diff --git a/src/server/game/World/WorldState.h b/src/server/game/World/WorldState.h index 81a084e34..b6198a7b9 100644 --- a/src/server/game/World/WorldState.h +++ b/src/server/game/World/WorldState.h @@ -206,7 +206,7 @@ class WorldState void AddSunwellGateProgress(uint32 questId); void AddSunsReachProgress(uint32 questId); std::string GetSunsReachPrintout(); - void FillInitialWorldStates(ByteBuffer& data, uint32 zoneId, uint32 areaId); + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet, uint32 zoneId, uint32 /*areaId*/); void HandleSunsReachPhaseTransition(uint32 newPhase); void HandleSunsReachSubPhaseTransition(int32 subPhaseMask, bool initial = false); void SetSunsReachCounter(SunsReachCounters index, uint32 value); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp index c6a17339a..8d8d7eb23 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp @@ -22,6 +22,7 @@ #include "ScriptedCreature.h" #include "SpellInfo.h" #include "TemporarySummon.h" +#include "WorldStatePackets.h" #include "culling_of_stratholme.h" class instance_culling_of_stratholme : public InstanceMapScript @@ -53,13 +54,14 @@ public: return false; } - void FillInitialWorldStates(WorldPacket& data) override + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override { - data << uint32(WORLDSTATE_SHOW_CRATES) << uint32(0); - data << uint32(WORLDSTATE_CRATES_REVEALED) << uint32(_crateCount); - data << uint32(WORLDSTATE_WAVE_COUNT) << uint32(0); - data << uint32(WORLDSTATE_TIME_GUARDIAN) << uint32(25); - data << uint32(WORLDSTATE_TIME_GUARDIAN_SHOW) << uint32(0); + packet.Worldstates.reserve(5); + packet.Worldstates.emplace_back(WORLDSTATE_SHOW_CRATES, 0); + packet.Worldstates.emplace_back(WORLDSTATE_CRATES_REVEALED, _crateCount); + packet.Worldstates.emplace_back(WORLDSTATE_WAVE_COUNT, 0); + packet.Worldstates.emplace_back(WORLDSTATE_TIME_GUARDIAN, 25); + packet.Worldstates.emplace_back(WORLDSTATE_TIME_GUARDIAN_SHOW, 0); } void OnPlayerEnter(Player* plr) override diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp index d70eb3b62..b1ed2bf5d 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp @@ -19,10 +19,11 @@ #include "InstanceMapScript.h" #include "InstanceScript.h" #include "Player.h" +#include "SpellScript.h" #include "SpellScriptLoader.h" #include "WorldPacket.h" +#include "WorldStatePackets.h" #include "ruby_sanctum.h" -#include "SpellScript.h" BossBoundaryData const boundaries = { @@ -217,11 +218,12 @@ public: return true; } - void FillInitialWorldStates(WorldPacket& data) override + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override { - data << uint32(WORLDSTATE_CORPOREALITY_MATERIAL) << uint32(50); - data << uint32(WORLDSTATE_CORPOREALITY_TWILIGHT) << uint32(50); - data << uint32(WORLDSTATE_CORPOREALITY_TOGGLE) << uint32(0); + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(WORLDSTATE_CORPOREALITY_MATERIAL, 50); + packet.Worldstates.emplace_back(WORLDSTATE_CORPOREALITY_TWILIGHT, 50); + packet.Worldstates.emplace_back(WORLDSTATE_CORPOREALITY_TOGGLE, 0); } protected: 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 fd43fce38..34c096d0f 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 @@ -15,12 +15,12 @@ * with this program. If not, see . */ +#include "Group.h" #include "InstanceMapScript.h" +#include "InstanceScript.h" #include "MapMgr.h" #include "Transport.h" #include "halls_of_reflection.h" -#include "InstanceScript.h" -#include "Group.h" class UtherBatteredHiltEvent : public BasicEvent { diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index e62411087..fa49b8e2a 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -230,16 +230,14 @@ public: IsSindragosaIntroDone = false; } - void FillInitialWorldStates(WorldPacket& data) override + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override { - if (instance->IsHeroic()) - { - data << uint32(WORLDSTATE_SHOW_TIMER) << uint32(BloodQuickeningState == IN_PROGRESS); - data << uint32(WORLDSTATE_EXECUTION_TIME) << uint32(BloodQuickeningMinutes); - data << uint32(WORLDSTATE_SHOW_ATTEMPTS) << uint32(1); - data << uint32(WORLDSTATE_ATTEMPTS_REMAINING) << uint32(HeroicAttempts); - data << uint32(WORLDSTATE_ATTEMPTS_MAX) << uint32(MaxHeroicAttempts); - } + packet.Worldstates.reserve(5); + packet.Worldstates.emplace_back(WORLDSTATE_SHOW_TIMER, BloodQuickeningState == IN_PROGRESS ? 1 : 0); + packet.Worldstates.emplace_back(WORLDSTATE_EXECUTION_TIME, BloodQuickeningMinutes); + packet.Worldstates.emplace_back(WORLDSTATE_SHOW_ATTEMPTS, 1); // instance->IsHeroic() ? 1 : 0 + packet.Worldstates.emplace_back(WORLDSTATE_ATTEMPTS_REMAINING, HeroicAttempts); + packet.Worldstates.emplace_back(WORLDSTATE_ATTEMPTS_MAX, MaxHeroicAttempts); } void OnPlayerAreaUpdate(Player* player, uint32 /*oldArea*/, uint32 newArea) override diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp index 33069679b..a9be11304 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp @@ -20,6 +20,7 @@ #include "LFGMgr.h" #include "Player.h" #include "ScriptedCreature.h" +#include "WorldStatePackets.h" #include "oculus.h" class instance_oculus : public InstanceMapScript diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 04ab6e9a7..a9de02208 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -22,6 +22,7 @@ #include "ScriptedCreature.h" #include "Transport.h" #include "WorldPacket.h" +#include "WorldStatePackets.h" #include "ulduar.h" class instance_ulduar : public InstanceMapScript @@ -169,10 +170,11 @@ public: m_mimironTramUsed = false; } - void FillInitialWorldStates(WorldPacket& packet) override + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override { - packet << uint32(WORLD_STATE_ALGALON_TIMER_ENABLED) << uint32(m_algalonTimer && m_algalonTimer <= 60); - packet << uint32(WORLD_STATE_ALGALON_DESPAWN_TIMER) << uint32(std::min(m_algalonTimer, 60)); + packet.Worldstates.reserve(2); + packet.Worldstates.emplace_back(WORLD_STATE_ALGALON_TIMER_ENABLED, (m_algalonTimer && m_algalonTimer <= 60) ? 1 : 0); + packet.Worldstates.emplace_back(WORLD_STATE_ALGALON_DESPAWN_TIMER, std::min(m_algalonTimer, 60)); } void OnPlayerEnter(Player* player) override diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp index 33a1e63ee..e2c7d86e5 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp @@ -28,6 +28,7 @@ #include "World.h" #include "WorldPacket.h" #include "WorldSessionMgr.h" +#include "WorldStatePackets.h" OPvPCapturePointEP_EWT::OPvPCapturePointEP_EWT(OutdoorPvP* pvp) : OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_UnitsSummonedSideId(TEAM_NEUTRAL) @@ -41,12 +42,12 @@ void OPvPCapturePointEP_EWT::ChangeState() // if changing from controlling alliance to horde or vice versa if (_oldState == OBJECTIVESTATE_ALLIANCE && _oldState != _state) { - sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_EWT_A)); + sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_EWT_A)); ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_EWT, TEAM_NEUTRAL); } else if (_oldState == OBJECTIVESTATE_HORDE && _oldState != _state) { - sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_EWT_H)); + sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_EWT_H)); ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_EWT, TEAM_NEUTRAL); } @@ -59,14 +60,14 @@ void OPvPCapturePointEP_EWT::ChangeState() artkit = 2; SummonSupportUnitAtNorthpassTower(TEAM_ALLIANCE); ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_EWT, TEAM_ALLIANCE); - if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_A)); + if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_A)); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; artkit = 1; SummonSupportUnitAtNorthpassTower(TEAM_HORDE); ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_EWT, TEAM_HORDE); - if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_H)); + if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_H)); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; @@ -108,13 +109,14 @@ void OPvPCapturePointEP_EWT::SendChangePhase() SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, _neutralValuePct); } -void OPvPCapturePointEP_EWT::FillInitialWorldStates(WorldPacket& data) +void OPvPCapturePointEP_EWT::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << EP_EWT_A << uint32(bool(m_TowerState & EP_TS_A)); - data << EP_EWT_H << uint32(bool(m_TowerState & EP_TS_H)); - data << EP_EWT_N_A << uint32(bool(m_TowerState & EP_TS_N_A)); - data << EP_EWT_N_H << uint32(bool(m_TowerState & EP_TS_N_H)); - data << EP_EWT_N << uint32(bool(m_TowerState & EP_TS_N)); + packet.Worldstates.reserve(5); + packet.Worldstates.emplace_back(EP_EWT_A, (m_TowerState & EP_TS_A) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_EWT_H, (m_TowerState & EP_TS_H) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_EWT_N_A, (m_TowerState & EP_TS_N_A) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_EWT_N_H, (m_TowerState & EP_TS_N_H) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_EWT_N, (m_TowerState & EP_TS_N) != 0 ? 1 : 0); } void OPvPCapturePointEP_EWT::UpdateTowerState() @@ -173,12 +175,12 @@ void OPvPCapturePointEP_NPT::ChangeState() // if changing from controlling alliance to horde or vice versa if (_oldState == OBJECTIVESTATE_ALLIANCE && _oldState != _state) { - sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_A)); + sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_A)); ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_NPT, TEAM_NEUTRAL); } else if (_oldState == OBJECTIVESTATE_HORDE && _oldState != _state) { - sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_H)); + sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_H)); ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_NPT, TEAM_NEUTRAL); } @@ -191,14 +193,14 @@ void OPvPCapturePointEP_NPT::ChangeState() artkit = 2; SummonGO(TEAM_ALLIANCE); ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_NPT, TEAM_ALLIANCE); - if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A)); + if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A)); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; artkit = 1; SummonGO(TEAM_HORDE); ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_NPT, TEAM_HORDE); - if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H)); + if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H)); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; @@ -250,13 +252,14 @@ void OPvPCapturePointEP_NPT::SendChangePhase() SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, _neutralValuePct); } -void OPvPCapturePointEP_NPT::FillInitialWorldStates(WorldPacket& data) +void OPvPCapturePointEP_NPT::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << EP_NPT_A << uint32(bool(m_TowerState & EP_TS_A)); - data << EP_NPT_H << uint32(bool(m_TowerState & EP_TS_H)); - data << EP_NPT_N_A << uint32(bool(m_TowerState & EP_TS_N_A)); - data << EP_NPT_N_H << uint32(bool(m_TowerState & EP_TS_N_H)); - data << EP_NPT_N << uint32(bool(m_TowerState & EP_TS_N)); + packet.Worldstates.reserve(5); + packet.Worldstates.emplace_back(EP_NPT_A, (m_TowerState & EP_TS_A) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_NPT_H, (m_TowerState & EP_TS_H) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_NPT_N_A, (m_TowerState & EP_TS_N_A) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_NPT_N_H, (m_TowerState & EP_TS_N_H) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_NPT_N, (m_TowerState & EP_TS_N) != 0 ? 1 : 0); } void OPvPCapturePointEP_NPT::UpdateTowerState() @@ -315,12 +318,12 @@ void OPvPCapturePointEP_CGT::ChangeState() // if changing from controlling alliance to horde or vice versa if (_oldState == OBJECTIVESTATE_ALLIANCE && _oldState != _state) { - sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_A)); + sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_A)); ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_NEUTRAL); } else if (_oldState == OBJECTIVESTATE_HORDE && _oldState != _state) { - sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_H)); + sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_H)); ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_NEUTRAL); } @@ -333,14 +336,14 @@ void OPvPCapturePointEP_CGT::ChangeState() artkit = 2; LinkGraveyard(TEAM_ALLIANCE); ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_ALLIANCE); - if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_A)); + if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_A)); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; artkit = 1; LinkGraveyard(TEAM_HORDE); ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_CGT, TEAM_HORDE); - if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_H)); + if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_H)); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; @@ -382,13 +385,14 @@ void OPvPCapturePointEP_CGT::SendChangePhase() SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, _neutralValuePct); } -void OPvPCapturePointEP_CGT::FillInitialWorldStates(WorldPacket& data) +void OPvPCapturePointEP_CGT::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << EP_CGT_A << uint32(bool(m_TowerState & EP_TS_A)); - data << EP_CGT_H << uint32(bool(m_TowerState & EP_TS_H)); - data << EP_CGT_N_A << uint32(bool(m_TowerState & EP_TS_N_A)); - data << EP_CGT_N_H << uint32(bool(m_TowerState & EP_TS_N_H)); - data << EP_CGT_N << uint32(bool(m_TowerState & EP_TS_N)); + packet.Worldstates.reserve(5); + packet.Worldstates.emplace_back(EP_CGT_A, (m_TowerState & EP_TS_A) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_CGT_H, (m_TowerState & EP_TS_H) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_CGT_N_A, (m_TowerState & EP_TS_N_A) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_CGT_N_H, (m_TowerState & EP_TS_N_H) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_CGT_N, (m_TowerState & EP_TS_N) != 0 ? 1 : 0); } void OPvPCapturePointEP_CGT::UpdateTowerState() @@ -423,8 +427,8 @@ void OPvPCapturePointEP_CGT::LinkGraveyard(TeamId teamId) { if (m_GraveyardSide != teamId) { - sGraveyard->RemoveGraveyardLink(EP_GraveYardId, EP_GraveYardZone, m_GraveyardSide, false); - sGraveyard->AddGraveyardLink(EP_GraveYardId, EP_GraveYardZone, teamId, false); + sGraveyard->RemoveGraveyardLink(EP_GraveyardId, EP_GraveyardZone, m_GraveyardSide, false); + sGraveyard->AddGraveyardLink(EP_GraveyardId, EP_GraveyardZone, teamId, false); m_GraveyardSide = teamId; } } @@ -442,12 +446,12 @@ void OPvPCapturePointEP_PWT::ChangeState() // if changing from controlling alliance to horde or vice versa if (_oldState == OBJECTIVESTATE_ALLIANCE && _oldState != _state) { - sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_A)); + sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_A)); ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_NEUTRAL); } else if (_oldState == OBJECTIVESTATE_HORDE && _oldState != _state) { - sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_H)); + sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_H)); ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_NEUTRAL); } @@ -460,14 +464,14 @@ void OPvPCapturePointEP_PWT::ChangeState() SummonFlightMaster(TEAM_ALLIANCE); artkit = 2; ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_ALLIANCE); - if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A)); + if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A)); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; SummonFlightMaster(TEAM_HORDE); artkit = 1; ((OutdoorPvPEP*)_pvp)->SetControlledState(EP_PWT, TEAM_HORDE); - if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveYardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H)); + if (_oldState != _state) sWorldSessionMgr->SendZoneText(EP_GraveyardZone, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H)); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; @@ -519,13 +523,14 @@ void OPvPCapturePointEP_PWT::SendChangePhase() SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, _neutralValuePct); } -void OPvPCapturePointEP_PWT::FillInitialWorldStates(WorldPacket& data) +void OPvPCapturePointEP_PWT::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << EP_PWT_A << uint32(bool(m_TowerState & EP_TS_A)); - data << EP_PWT_H << uint32(bool(m_TowerState & EP_TS_H)); - data << EP_PWT_N_A << uint32(bool(m_TowerState & EP_TS_N_A)); - data << EP_PWT_N_H << uint32(bool(m_TowerState & EP_TS_N_H)); - data << EP_PWT_N << uint32(bool(m_TowerState & EP_TS_N)); + packet.Worldstates.reserve(5); + packet.Worldstates.emplace_back(EP_PWT_A, (m_TowerState & EP_TS_A) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_PWT_H, (m_TowerState & EP_TS_H) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_PWT_N_A, (m_TowerState & EP_TS_N_A) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_PWT_N_H, (m_TowerState & EP_TS_N_H) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(EP_PWT_N, (m_TowerState & EP_TS_N) != 0 ? 1 : 0); } void OPvPCapturePointEP_PWT::UpdateTowerState() @@ -712,16 +717,18 @@ void OutdoorPvPEP::SetControlledState(uint32 index, TeamId teamId) EP_ControlsId[index] = teamId; } -void OutdoorPvPEP::FillInitialWorldStates(WorldPacket& data) +void OutdoorPvPEP::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << EP_UI_TOWER_COUNT_A << m_AllianceTowersControlled; - data << EP_UI_TOWER_COUNT_H << m_HordeTowersControlled; - data << EP_UI_TOWER_SLIDER_DISPLAY << uint32(0); - data << EP_UI_TOWER_SLIDER_POS << uint32(50); - data << EP_UI_TOWER_SLIDER_N << uint32(100); + packet.Worldstates.reserve(5); + packet.Worldstates.emplace_back(EP_UI_TOWER_COUNT_A, m_AllianceTowersControlled); + packet.Worldstates.emplace_back(EP_UI_TOWER_COUNT_H, m_HordeTowersControlled); + packet.Worldstates.emplace_back(EP_UI_TOWER_SLIDER_DISPLAY, 0); + packet.Worldstates.emplace_back(EP_UI_TOWER_SLIDER_POS, 50); + packet.Worldstates.emplace_back(EP_UI_TOWER_SLIDER_N, 100); + for (OPvPCapturePointMap::iterator itr = _capturePoints.begin(); itr != _capturePoints.end(); ++itr) { - itr->second->FillInitialWorldStates(data); + itr->second->FillInitialWorldStates(packet); } } diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h index 84f9306ab..b6e5fab91 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h @@ -25,9 +25,9 @@ const uint32 EP_AllianceBuffs[4] = {11413, 11414, 11415, 1386}; const uint32 EP_HordeBuffs[4] = {30880, 30683, 30682, 29520}; -const uint32 EP_GraveYardZone = 139; +const uint32 EP_GraveyardZone = 139; -const uint32 EP_GraveYardId = 927; +const uint32 EP_GraveyardId = 927; const uint8 EPBuffZonesNum = 3; @@ -191,7 +191,7 @@ public: void SendChangePhase() override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; // used when player is activated/inactivated in the area bool HandlePlayerEnter(Player* player) override; @@ -217,7 +217,7 @@ public: void SendChangePhase() override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; // used when player is activated/inactivated in the area bool HandlePlayerEnter(Player* player) override; @@ -243,7 +243,7 @@ public: void SendChangePhase() override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; // used when player is activated/inactivated in the area bool HandlePlayerEnter(Player* player) override; @@ -269,7 +269,7 @@ public: void SendChangePhase() override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; // used when player is activated/inactivated in the area bool HandlePlayerEnter(Player* player) override; @@ -298,7 +298,7 @@ public: bool Update(uint32 diff) override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void SendRemoveWorldStates(Player* player) override; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPGH.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPGH.cpp index e60a89a0b..5037503a9 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPGH.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPGH.cpp @@ -49,11 +49,12 @@ OPvPCapturePointGH::OPvPCapturePointGH(OutdoorPvP* pvp) : OPvPCapturePoint(pvp) SetCapturePointData(189310, 571, 2483.68f, -1873.6f, 10.6877f, -0.104719f, 0.0f, 0.0f, 0.0f, 1.0f); } -void OPvPCapturePointGH::FillInitialWorldStates(WorldPacket& data) +void OPvPCapturePointGH::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << GH_UI_SLIDER_DISPLAY << uint32(0); - data << GH_UI_SLIDER_POS << uint32(50); - data << GH_UI_SLIDER_N << uint32(20); + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(GH_UI_SLIDER_DISPLAY, 0); + packet.Worldstates.emplace_back(GH_UI_SLIDER_POS, 50); + packet.Worldstates.emplace_back(GH_UI_SLIDER_N, 20); } void OPvPCapturePointGH::SendChangePhase() diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPGH.h b/src/server/scripts/OutdoorPvP/OutdoorPvPGH.h index d924f6b49..4ec3f2784 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPGH.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPGH.h @@ -52,7 +52,7 @@ public: void ChangeState() override; void SendChangePhase() override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; bool HandlePlayerEnter(Player* player) override; void HandlePlayerLeave(Player* player) override; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp index b26af4d6f..9e32988d3 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp @@ -154,18 +154,21 @@ void OutdoorPvPHP::SendRemoveWorldStates(Player* player) } } -void OutdoorPvPHP::FillInitialWorldStates(WorldPacket& data) +void OutdoorPvPHP::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(HP_UI_TOWER_DISPLAY_A) << uint32(1); - data << uint32(HP_UI_TOWER_DISPLAY_H) << uint32(1); - data << uint32(HP_UI_TOWER_COUNT_A) << uint32(m_AllianceTowersControlled); - data << uint32(HP_UI_TOWER_COUNT_H) << uint32(m_HordeTowersControlled); - data << uint32(HP_UI_TOWER_SLIDER_DISPLAY) << uint32(0); - data << uint32(HP_UI_TOWER_SLIDER_POS) << uint32(50); - data << uint32(HP_UI_TOWER_SLIDER_N) << uint32(100); + packet.Worldstates.reserve(8); + packet.Worldstates.emplace_back(HP_UI_TOWER_DISPLAY_A, 1); + packet.Worldstates.emplace_back(HP_UI_TOWER_DISPLAY_H, 1); + packet.Worldstates.emplace_back(HP_UI_TOWER_COUNT_A, m_AllianceTowersControlled); + packet.Worldstates.emplace_back(HP_UI_TOWER_COUNT_H, m_HordeTowersControlled); + + packet.Worldstates.emplace_back(HP_UI_TOWER_COUNT_H, m_HordeTowersControlled); + packet.Worldstates.emplace_back(HP_UI_TOWER_SLIDER_DISPLAY, 0); + packet.Worldstates.emplace_back(HP_UI_TOWER_SLIDER_POS, 50); + packet.Worldstates.emplace_back(HP_UI_TOWER_SLIDER_N, 100); for (OPvPCapturePointMap::iterator itr = _capturePoints.begin(); itr != _capturePoints.end(); ++itr) { - itr->second->FillInitialWorldStates(data); + itr->second->FillInitialWorldStates(packet); } } @@ -274,29 +277,32 @@ void OPvPCapturePointHP::SendChangePhase() SendUpdateWorldState(HP_UI_TOWER_SLIDER_DISPLAY, 1); } -void OPvPCapturePointHP::FillInitialWorldStates(WorldPacket& data) +void OPvPCapturePointHP::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { switch (_state) { case OBJECTIVESTATE_ALLIANCE: case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: - data << uint32(HP_MAP_N[m_TowerType]) << uint32(0); - data << uint32(HP_MAP_A[m_TowerType]) << uint32(1); - data << uint32(HP_MAP_H[m_TowerType]) << uint32(0); + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(HP_MAP_N[m_TowerType], 0); + packet.Worldstates.emplace_back(HP_MAP_A[m_TowerType], 1); + packet.Worldstates.emplace_back(HP_MAP_H[m_TowerType], 0); break; case OBJECTIVESTATE_HORDE: case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: - data << uint32(HP_MAP_N[m_TowerType]) << uint32(0); - data << uint32(HP_MAP_A[m_TowerType]) << uint32(0); - data << uint32(HP_MAP_H[m_TowerType]) << uint32(1); + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(HP_MAP_N[m_TowerType], 0); + packet.Worldstates.emplace_back(HP_MAP_A[m_TowerType], 0); + packet.Worldstates.emplace_back(HP_MAP_H[m_TowerType], 1); break; case OBJECTIVESTATE_NEUTRAL: case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: default: - data << uint32(HP_MAP_N[m_TowerType]) << uint32(1); - data << uint32(HP_MAP_A[m_TowerType]) << uint32(0); - data << uint32(HP_MAP_H[m_TowerType]) << uint32(0); + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(HP_MAP_N[m_TowerType], 1); + packet.Worldstates.emplace_back(HP_MAP_A[m_TowerType], 0); + packet.Worldstates.emplace_back(HP_MAP_H[m_TowerType], 0); break; } } diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h index cfcf5a085..95646e5cc 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h @@ -94,7 +94,7 @@ public: void SendChangePhase() override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; // used when player is activated/inactivated in the area bool HandlePlayerEnter(Player* player) override; @@ -116,7 +116,7 @@ public: bool Update(uint32 diff) override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void SendRemoveWorldStates(Player* player) override; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index 77d1b0a73..05930308a 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -29,6 +29,7 @@ #include "World.h" #include "WorldPacket.h" #include "WorldSessionMgr.h" +#include "WorldStatePackets.h" OutdoorPvPNA::OutdoorPvPNA() { @@ -300,61 +301,53 @@ void OutdoorPvPNA::HandlePlayerLeaveZone(Player* player, uint32 zone) OutdoorPvP::HandlePlayerLeaveZone(player, zone); } -void OutdoorPvPNA::FillInitialWorldStates(WorldPacket& data) +void OutdoorPvPNA::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - m_obj->FillInitialWorldStates(data); + m_obj->FillInitialWorldStates(packet); } -void OPvPCapturePointNA::FillInitialWorldStates(WorldPacket& data) +void OPvPCapturePointNA::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { + packet.Worldstates.reserve(25); if (m_ControllingFaction == TEAM_ALLIANCE) { - data << NA_UI_HORDE_GUARDS_SHOW << uint32(0); - data << NA_UI_ALLIANCE_GUARDS_SHOW << uint32(1); + packet.Worldstates.emplace_back(NA_UI_HORDE_GUARDS_SHOW, 0); + packet.Worldstates.emplace_back(NA_UI_ALLIANCE_GUARDS_SHOW, 1); } else if (m_ControllingFaction == TEAM_HORDE) { - data << NA_UI_HORDE_GUARDS_SHOW << uint32(1); - data << NA_UI_ALLIANCE_GUARDS_SHOW << uint32(0); + packet.Worldstates.emplace_back(NA_UI_HORDE_GUARDS_SHOW, 1); + packet.Worldstates.emplace_back(NA_UI_ALLIANCE_GUARDS_SHOW, 0); } else { - data << NA_UI_HORDE_GUARDS_SHOW << uint32(0); - data << NA_UI_ALLIANCE_GUARDS_SHOW << uint32(0); + packet.Worldstates.emplace_back(NA_UI_HORDE_GUARDS_SHOW, 0); + packet.Worldstates.emplace_back(NA_UI_ALLIANCE_GUARDS_SHOW, 0); } - data << NA_UI_GUARDS_MAX << NA_GUARDS_MAX; - data << NA_UI_GUARDS_LEFT << uint32(m_GuardsAlive); - - data << NA_UI_TOWER_SLIDER_DISPLAY << uint32(0); - data << NA_UI_TOWER_SLIDER_POS << uint32(50); - data << NA_UI_TOWER_SLIDER_N << uint32(100); - - data << NA_MAP_WYVERN_NORTH_NEU_H << uint32(bool(m_WyvernStateNorth & WYVERN_NEU_HORDE)); - data << NA_MAP_WYVERN_NORTH_NEU_A << uint32(bool(m_WyvernStateNorth & WYVERN_NEU_ALLIANCE)); - data << NA_MAP_WYVERN_NORTH_H << uint32(bool(m_WyvernStateNorth & WYVERN_HORDE)); - data << NA_MAP_WYVERN_NORTH_A << uint32(bool(m_WyvernStateNorth & WYVERN_ALLIANCE)); - - data << NA_MAP_WYVERN_SOUTH_NEU_H << uint32(bool(m_WyvernStateSouth & WYVERN_NEU_HORDE)); - data << NA_MAP_WYVERN_SOUTH_NEU_A << uint32(bool(m_WyvernStateSouth & WYVERN_NEU_ALLIANCE)); - data << NA_MAP_WYVERN_SOUTH_H << uint32(bool(m_WyvernStateSouth & WYVERN_HORDE)); - data << NA_MAP_WYVERN_SOUTH_A << uint32(bool(m_WyvernStateSouth & WYVERN_ALLIANCE)); - - data << NA_MAP_WYVERN_WEST_NEU_H << uint32(bool(m_WyvernStateWest & WYVERN_NEU_HORDE)); - data << NA_MAP_WYVERN_WEST_NEU_A << uint32(bool(m_WyvernStateWest & WYVERN_NEU_ALLIANCE)); - data << NA_MAP_WYVERN_WEST_H << uint32(bool(m_WyvernStateWest & WYVERN_HORDE)); - data << NA_MAP_WYVERN_WEST_A << uint32(bool(m_WyvernStateWest & WYVERN_ALLIANCE)); - - data << NA_MAP_WYVERN_EAST_NEU_H << uint32(bool(m_WyvernStateEast & WYVERN_NEU_HORDE)); - data << NA_MAP_WYVERN_EAST_NEU_A << uint32(bool(m_WyvernStateEast & WYVERN_NEU_ALLIANCE)); - data << NA_MAP_WYVERN_EAST_H << uint32(bool(m_WyvernStateEast & WYVERN_HORDE)); - data << NA_MAP_WYVERN_EAST_A << uint32(bool(m_WyvernStateEast & WYVERN_ALLIANCE)); - - data << NA_MAP_HALAA_NEUTRAL << uint32(bool(m_HalaaState & HALAA_N)); - data << NA_MAP_HALAA_NEU_A << uint32(bool(m_HalaaState & HALAA_N_A)); - data << NA_MAP_HALAA_NEU_H << uint32(bool(m_HalaaState & HALAA_N_H)); - data << NA_MAP_HALAA_HORDE << uint32(bool(m_HalaaState & HALAA_H)); - data << NA_MAP_HALAA_ALLIANCE << uint32(bool(m_HalaaState & HALAA_A)); + packet.Worldstates.emplace_back(NA_UI_GUARDS_MAX, NA_GUARDS_MAX); + packet.Worldstates.emplace_back(NA_UI_GUARDS_LEFT, m_GuardsAlive); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_NORTH_NEU_H, (m_WyvernStateNorth & WYVERN_NEU_HORDE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_NORTH_NEU_A, (m_WyvernStateNorth & WYVERN_NEU_ALLIANCE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_NORTH_H, (m_WyvernStateNorth & WYVERN_HORDE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_NORTH_A, (m_WyvernStateNorth & WYVERN_ALLIANCE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_SOUTH_NEU_H, (m_WyvernStateSouth & WYVERN_NEU_HORDE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_SOUTH_NEU_A, (m_WyvernStateSouth & WYVERN_NEU_ALLIANCE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_SOUTH_H, (m_WyvernStateSouth & WYVERN_HORDE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_SOUTH_A, (m_WyvernStateSouth & WYVERN_ALLIANCE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_WEST_NEU_H, (m_WyvernStateWest & WYVERN_NEU_HORDE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_WEST_NEU_A, (m_WyvernStateWest & WYVERN_NEU_ALLIANCE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_WEST_H, (m_WyvernStateWest & WYVERN_HORDE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_WEST_A, (m_WyvernStateWest & WYVERN_ALLIANCE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_EAST_NEU_H, (m_WyvernStateEast & WYVERN_NEU_HORDE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_EAST_NEU_A, (m_WyvernStateEast & WYVERN_NEU_ALLIANCE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_EAST_H, (m_WyvernStateEast & WYVERN_HORDE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_WYVERN_EAST_A, (m_WyvernStateEast & WYVERN_ALLIANCE) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_HALAA_NEUTRAL, (m_HalaaState & HALAA_N) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_HALAA_NEU_A, (m_HalaaState & HALAA_N_A) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_HALAA_NEU_H, (m_HalaaState & HALAA_N_H) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_HALAA_HORDE, (m_HalaaState & HALAA_H) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(NA_MAP_HALAA_ALLIANCE, (m_HalaaState & HALAA_A) != 0 ? 1 : 0); } void OutdoorPvPNA::SendRemoveWorldStates(Player* player) diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h index c3a9b8e25..0f8f6ab13 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h @@ -229,7 +229,7 @@ public: void SendChangePhase() override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; // used when player is activated/inactivated in the area bool HandlePlayerEnter(Player* player) override; @@ -287,7 +287,7 @@ public: bool Update(uint32 diff) override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void SendRemoveWorldStates(Player* player) override; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index bde78c3aa..2e01c38e8 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -29,6 +29,7 @@ #include "World.h" #include "WorldPacket.h" #include "WorldSessionMgr.h" +#include "WorldStatePackets.h" OutdoorPvPSI::OutdoorPvPSI() { @@ -38,11 +39,12 @@ OutdoorPvPSI::OutdoorPvPSI() m_LastController = TEAM_NEUTRAL; } -void OutdoorPvPSI::FillInitialWorldStates(WorldPacket& data) +void OutdoorPvPSI::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << SI_GATHERED_A << m_Gathered_A; - data << SI_GATHERED_H << m_Gathered_H; - data << SI_SILITHYST_MAX << SI_MAX_RESOURCES; + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(SI_GATHERED_A, m_Gathered_A); + packet.Worldstates.emplace_back(SI_GATHERED_H, m_Gathered_H); + packet.Worldstates.emplace_back(SI_SILITHYST_MAX, SI_MAX_RESOURCES); } void OutdoorPvPSI::SendRemoveWorldStates(Player* player) diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.h b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.h index ff8735fb4..1ae673954 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.h @@ -63,7 +63,7 @@ public: bool Update(uint32 diff) override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void SendRemoveWorldStates(Player* player) override; @@ -78,7 +78,6 @@ public: private: uint32 m_Gathered_A; uint32 m_Gathered_H; - TeamId m_LastController; }; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp index d312b6abc..cf0e239a8 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp @@ -27,6 +27,7 @@ #include "World.h" #include "WorldPacket.h" #include "WorldSessionMgr.h" +#include "WorldStatePackets.h" OutdoorPvPTF::OutdoorPvPTF() { @@ -51,34 +52,34 @@ OPvPCapturePointTF::OPvPCapturePointTF(OutdoorPvP* pvp, OutdoorPvPTF_TowerType t SetCapturePointData(TFCapturePoints[type].entry, TFCapturePoints[type].map, TFCapturePoints[type].x, TFCapturePoints[type].y, TFCapturePoints[type].z, TFCapturePoints[type].o, TFCapturePoints[type].rot0, TFCapturePoints[type].rot1, TFCapturePoints[type].rot2, TFCapturePoints[type].rot3); } -void OPvPCapturePointTF::FillInitialWorldStates(WorldPacket& data) +void OPvPCapturePointTF::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(TFTowerWorldStates[m_TowerType].n) << uint32(bool(m_TowerState & TF_TOWERSTATE_N)); - data << uint32(TFTowerWorldStates[m_TowerType].h) << uint32(bool(m_TowerState & TF_TOWERSTATE_H)); - data << uint32(TFTowerWorldStates[m_TowerType].a) << uint32(bool(m_TowerState & TF_TOWERSTATE_A)); + packet.Worldstates.reserve(3); + packet.Worldstates.emplace_back(TFTowerWorldStates[m_TowerType].n, (m_TowerState & TF_TOWERSTATE_N) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(TFTowerWorldStates[m_TowerType].h, (m_TowerState & TF_TOWERSTATE_H) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(TFTowerWorldStates[m_TowerType].a, (m_TowerState & TF_TOWERSTATE_A) != 0 ? 1 : 0); } -void OutdoorPvPTF::FillInitialWorldStates(WorldPacket& data) +void OutdoorPvPTF::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << TF_UI_TOWER_SLIDER_POS << uint32(50); - data << TF_UI_TOWER_SLIDER_N << uint32(100); - data << TF_UI_TOWER_SLIDER_DISPLAY << uint32(0); + packet.Worldstates.reserve(12); + packet.Worldstates.emplace_back(TF_UI_TOWER_SLIDER_POS, 50); + packet.Worldstates.emplace_back(TF_UI_TOWER_SLIDER_N, 100); + packet.Worldstates.emplace_back(TF_UI_TOWER_SLIDER_DISPLAY, 0); - data << TF_UI_TOWER_COUNT_H << m_HordeTowersControlled; - data << TF_UI_TOWER_COUNT_A << m_AllianceTowersControlled; - data << TF_UI_TOWERS_CONTROLLED_DISPLAY << uint32(!m_IsLocked); - - data << TF_UI_LOCKED_TIME_MINUTES_FIRST_DIGIT << first_digit; - data << TF_UI_LOCKED_TIME_MINUTES_SECOND_DIGIT << second_digit; - data << TF_UI_LOCKED_TIME_HOURS << hours_left; - - data << TF_UI_LOCKED_DISPLAY_NEUTRAL << uint32(m_IsLocked && !m_HordeTowersControlled && !m_AllianceTowersControlled); - data << TF_UI_LOCKED_DISPLAY_HORDE << uint32(m_IsLocked && (m_HordeTowersControlled > m_AllianceTowersControlled)); - data << TF_UI_LOCKED_DISPLAY_ALLIANCE << uint32(m_IsLocked && (m_HordeTowersControlled < m_AllianceTowersControlled)); + packet.Worldstates.emplace_back(TF_UI_TOWER_COUNT_H, m_HordeTowersControlled); + packet.Worldstates.emplace_back(TF_UI_TOWER_COUNT_A, m_AllianceTowersControlled); + packet.Worldstates.emplace_back(TF_UI_TOWERS_CONTROLLED_DISPLAY, !m_IsLocked); + packet.Worldstates.emplace_back(TF_UI_LOCKED_TIME_MINUTES_FIRST_DIGIT, first_digit); + packet.Worldstates.emplace_back(TF_UI_LOCKED_TIME_MINUTES_SECOND_DIGIT, second_digit); + packet.Worldstates.emplace_back(TF_UI_LOCKED_TIME_HOURS, hours_left); + packet.Worldstates.emplace_back(TF_UI_LOCKED_DISPLAY_NEUTRAL, (m_IsLocked && !m_HordeTowersControlled && !m_AllianceTowersControlled) ? 1 : 0); + packet.Worldstates.emplace_back(TF_UI_LOCKED_DISPLAY_HORDE, (m_IsLocked && (m_HordeTowersControlled > m_AllianceTowersControlled)) ? 1 : 0); + packet.Worldstates.emplace_back(TF_UI_LOCKED_DISPLAY_ALLIANCE, (m_IsLocked && (m_HordeTowersControlled < m_AllianceTowersControlled)) ? 1 : 0); for (OPvPCapturePointMap::iterator itr = _capturePoints.begin(); itr != _capturePoints.end(); ++itr) { - itr->second->FillInitialWorldStates(data); + itr->second->FillInitialWorldStates(packet); } } diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h index 9900c644b..aa9dfef43 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h @@ -132,7 +132,7 @@ public: void SendChangePhase() override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; // used when player is activated/inactivated in the area bool HandlePlayerEnter(Player* player) override; @@ -144,7 +144,6 @@ public: protected: OutdoorPvPTF_TowerType m_TowerType; - uint32 m_TowerState; }; @@ -160,7 +159,7 @@ public: bool Update(uint32 diff) override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void SendRemoveWorldStates(Player* player) override; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp index b681c1604..0e9c36759 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp @@ -26,6 +26,7 @@ #include "World.h" #include "WorldPacket.h" #include "WorldSessionMgr.h" +#include "WorldStatePackets.h" OPvPCapturePointZM_Beacon::OPvPCapturePointZM_Beacon(OutdoorPvP* pvp, ZM_BeaconType type) : OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(ZM_TOWERSTATE_N) @@ -33,14 +34,15 @@ OPvPCapturePointZM_Beacon::OPvPCapturePointZM_Beacon(OutdoorPvP* pvp, ZM_BeaconT SetCapturePointData(ZMCapturePoints[type].entry, ZMCapturePoints[type].map, ZMCapturePoints[type].x, ZMCapturePoints[type].y, ZMCapturePoints[type].z, ZMCapturePoints[type].o, ZMCapturePoints[type].rot0, ZMCapturePoints[type].rot1, ZMCapturePoints[type].rot2, ZMCapturePoints[type].rot3); } -void OPvPCapturePointZM_Beacon::FillInitialWorldStates(WorldPacket& data) +void OPvPCapturePointZM_Beacon::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(ZMBeaconInfo[m_TowerType].ui_tower_n) << uint32(bool(m_TowerState & ZM_TOWERSTATE_N)); - data << uint32(ZMBeaconInfo[m_TowerType].map_tower_n) << uint32(bool(m_TowerState & ZM_TOWERSTATE_N)); - data << uint32(ZMBeaconInfo[m_TowerType].ui_tower_a) << uint32(bool(m_TowerState & ZM_TOWERSTATE_A)); - data << uint32(ZMBeaconInfo[m_TowerType].map_tower_a) << uint32(bool(m_TowerState & ZM_TOWERSTATE_A)); - data << uint32(ZMBeaconInfo[m_TowerType].ui_tower_h) << uint32(bool(m_TowerState & ZM_TOWERSTATE_H)); - data << uint32(ZMBeaconInfo[m_TowerType].map_tower_h) << uint32(bool(m_TowerState & ZM_TOWERSTATE_H)); + packet.Worldstates.reserve(6); + packet.Worldstates.emplace_back(ZMBeaconInfo[m_TowerType].ui_tower_n, (m_TowerState & ZM_TOWERSTATE_N) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(ZMBeaconInfo[m_TowerType].map_tower_n, (m_TowerState & ZM_TOWERSTATE_N) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(ZMBeaconInfo[m_TowerType].ui_tower_a, (m_TowerState & ZM_TOWERSTATE_A) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(ZMBeaconInfo[m_TowerType].map_tower_a, (m_TowerState & ZM_TOWERSTATE_A) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(ZMBeaconInfo[m_TowerType].ui_tower_h, (m_TowerState & ZM_TOWERSTATE_H) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(ZMBeaconInfo[m_TowerType].map_tower_h, (m_TowerState & ZM_TOWERSTATE_H) != 0 ? 1 : 0); } void OPvPCapturePointZM_Beacon::UpdateTowerState() @@ -137,11 +139,11 @@ bool OutdoorPvPZM::Update(uint32 diff) if (changed) { if (m_AllianceTowersControlled == ZM_NUM_BEACONS) - m_GraveYard->SetBeaconState(TEAM_ALLIANCE); + m_Graveyard->SetBeaconState(TEAM_ALLIANCE); else if (m_HordeTowersControlled == ZM_NUM_BEACONS) - m_GraveYard->SetBeaconState(TEAM_HORDE); + m_Graveyard->SetBeaconState(TEAM_HORDE); else - m_GraveYard->SetBeaconState(TEAM_NEUTRAL); + m_Graveyard->SetBeaconState(TEAM_NEUTRAL); } return changed; } @@ -150,12 +152,12 @@ void OutdoorPvPZM::HandlePlayerEnterZone(Player* player, uint32 zone) { if (player->GetTeamId() == TEAM_ALLIANCE) { - if (m_GraveYard->GetGraveYardState() & ZM_GRAVEYARD_A) + if (m_Graveyard->GetGraveyardState() & ZM_GRAVEYARD_A) player->CastSpell(player, ZM_CAPTURE_BUFF, true); } else { - if (m_GraveYard->GetGraveYardState() & ZM_GRAVEYARD_H) + if (m_Graveyard->GetGraveyardState() & ZM_GRAVEYARD_H) player->CastSpell(player, ZM_CAPTURE_BUFF, true); } OutdoorPvP::HandlePlayerEnterZone(player, zone); @@ -174,7 +176,7 @@ void OutdoorPvPZM::HandlePlayerLeaveZone(Player* player, uint32 zone) OutdoorPvPZM::OutdoorPvPZM() { _typeId = OUTDOOR_PVP_ZM; - m_GraveYard = nullptr; + m_Graveyard = nullptr; m_AllianceTowersControlled = 0; m_HordeTowersControlled = 0; } @@ -192,8 +194,8 @@ bool OutdoorPvPZM::SetupOutdoorPvP() AddCapturePoint(new OPvPCapturePointZM_Beacon(this, ZM_BEACON_WEST)); AddCapturePoint(new OPvPCapturePointZM_Beacon(this, ZM_BEACON_EAST)); - m_GraveYard = new OPvPCapturePointZM_GraveYard(this); - AddCapturePoint(m_GraveYard); // though the update function isn't used, the handleusego is! + m_Graveyard = new OPvPCapturePointZM_Graveyard(this); + AddCapturePoint(m_Graveyard); // though the update function isn't used, the handleusego is! return true; } @@ -209,23 +211,23 @@ void OutdoorPvPZM::HandleKillImpl(Player* player, Unit* killed) player->CastSpell(player, ZM_HordePlayerKillReward, true); } -bool OPvPCapturePointZM_GraveYard::Update(uint32 /*diff*/) +bool OPvPCapturePointZM_Graveyard::Update(uint32 /*diff*/) { bool retval = _state != _oldState; _state = _oldState; return retval; } -int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, GameObject* go) +int32 OPvPCapturePointZM_Graveyard::HandleOpenGo(Player* player, GameObject* go) { int32 retval = OPvPCapturePoint::HandleOpenGo(player, go); if (retval >= 0) { - if (player->HasAura(ZM_BATTLE_STANDARD_A) && m_GraveYardState != ZM_GRAVEYARD_A) + if (player->HasAura(ZM_BATTLE_STANDARD_A) && m_GraveyardState != ZM_GRAVEYARD_A) { - if (m_GraveYardState == ZM_GRAVEYARD_H) + if (m_GraveyardState == ZM_GRAVEYARD_H) sWorldSessionMgr->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_ZM_LOSE_GY_H)); - m_GraveYardState = ZM_GRAVEYARD_A; + m_GraveyardState = ZM_GRAVEYARD_A; DelObject(0); // only one gotype is used in the whole outdoor pvp, no need to call it a constant AddObject(0, ZM_Banner_A.entry, ZM_Banner_A.map, ZM_Banner_A.x, ZM_Banner_A.y, ZM_Banner_A.z, ZM_Banner_A.o, ZM_Banner_A.rot0, ZM_Banner_A.rot1, ZM_Banner_A.rot2, ZM_Banner_A.rot3); sGraveyard->RemoveGraveyardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, TEAM_HORDE); // rem gy @@ -234,11 +236,11 @@ int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, GameObject* go) player->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A); sWorldSessionMgr->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_ZM_CAPTURE_GY_A)); } - else if (player->HasAura(ZM_BATTLE_STANDARD_H) && m_GraveYardState != ZM_GRAVEYARD_H) + else if (player->HasAura(ZM_BATTLE_STANDARD_H) && m_GraveyardState != ZM_GRAVEYARD_H) { - if (m_GraveYardState == ZM_GRAVEYARD_A) + if (m_GraveyardState == ZM_GRAVEYARD_A) sWorldSessionMgr->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetAcoreStringForDBCLocale(LANG_OPVP_ZM_LOSE_GY_A)); - m_GraveYardState = ZM_GRAVEYARD_H; + m_GraveyardState = ZM_GRAVEYARD_H; DelObject(0); // only one gotype is used in the whole outdoor pvp, no need to call it a constant AddObject(0, ZM_Banner_H.entry, ZM_Banner_H.map, ZM_Banner_H.x, ZM_Banner_H.y, ZM_Banner_H.z, ZM_Banner_H.o, ZM_Banner_H.rot0, ZM_Banner_H.rot1, ZM_Banner_H.rot2, ZM_Banner_H.rot3); sGraveyard->RemoveGraveyardLink(ZM_GRAVEYARD_ID, ZM_GRAVEYARD_ZONE, TEAM_ALLIANCE); // rem gy @@ -252,11 +254,11 @@ int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, GameObject* go) return retval; } -OPvPCapturePointZM_GraveYard::OPvPCapturePointZM_GraveYard(OutdoorPvP* pvp) +OPvPCapturePointZM_Graveyard::OPvPCapturePointZM_Graveyard(OutdoorPvP* pvp) : OPvPCapturePoint(pvp) { m_BothControllingFactionId = TEAM_NEUTRAL; - m_GraveYardState = ZM_GRAVEYARD_N; + m_GraveyardState = ZM_GRAVEYARD_N; m_FlagCarrierGUID.Clear(); // add field scouts here AddCreature(ZM_ALLIANCE_FIELD_SCOUT, ZM_AllianceFieldScout.entry, ZM_AllianceFieldScout.map, ZM_AllianceFieldScout.x, ZM_AllianceFieldScout.y, ZM_AllianceFieldScout.z, ZM_AllianceFieldScout.o); @@ -265,11 +267,11 @@ OPvPCapturePointZM_GraveYard::OPvPCapturePointZM_GraveYard(OutdoorPvP* pvp) AddObject(0, ZM_Banner_N.entry, ZM_Banner_N.map, ZM_Banner_N.x, ZM_Banner_N.y, ZM_Banner_N.z, ZM_Banner_N.o, ZM_Banner_N.rot0, ZM_Banner_N.rot1, ZM_Banner_N.rot2, ZM_Banner_N.rot3); } -void OPvPCapturePointZM_GraveYard::UpdateTowerState() +void OPvPCapturePointZM_Graveyard::UpdateTowerState() { - _pvp->SendUpdateWorldState(ZM_MAP_GRAVEYARD_N, uint32(bool(m_GraveYardState & ZM_GRAVEYARD_N))); - _pvp->SendUpdateWorldState(ZM_MAP_GRAVEYARD_H, uint32(bool(m_GraveYardState & ZM_GRAVEYARD_H))); - _pvp->SendUpdateWorldState(ZM_MAP_GRAVEYARD_A, uint32(bool(m_GraveYardState & ZM_GRAVEYARD_A))); + _pvp->SendUpdateWorldState(ZM_MAP_GRAVEYARD_N, uint32(bool(m_GraveyardState & ZM_GRAVEYARD_N))); + _pvp->SendUpdateWorldState(ZM_MAP_GRAVEYARD_H, uint32(bool(m_GraveyardState & ZM_GRAVEYARD_H))); + _pvp->SendUpdateWorldState(ZM_MAP_GRAVEYARD_A, uint32(bool(m_GraveyardState & ZM_GRAVEYARD_A))); _pvp->SendUpdateWorldState(ZM_MAP_ALLIANCE_FLAG_READY, uint32(m_BothControllingFactionId == TEAM_ALLIANCE)); _pvp->SendUpdateWorldState(ZM_MAP_ALLIANCE_FLAG_NOT_READY, uint32(m_BothControllingFactionId != TEAM_ALLIANCE)); @@ -277,19 +279,19 @@ void OPvPCapturePointZM_GraveYard::UpdateTowerState() _pvp->SendUpdateWorldState(ZM_MAP_HORDE_FLAG_NOT_READY, uint32(m_BothControllingFactionId != TEAM_HORDE)); } -void OPvPCapturePointZM_GraveYard::FillInitialWorldStates(WorldPacket& data) +void OPvPCapturePointZM_Graveyard::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << ZM_MAP_GRAVEYARD_N << uint32(bool(m_GraveYardState & ZM_GRAVEYARD_N)); - data << ZM_MAP_GRAVEYARD_H << uint32(bool(m_GraveYardState & ZM_GRAVEYARD_H)); - data << ZM_MAP_GRAVEYARD_A << uint32(bool(m_GraveYardState & ZM_GRAVEYARD_A)); - - data << ZM_MAP_ALLIANCE_FLAG_READY << uint32(m_BothControllingFactionId == TEAM_ALLIANCE); - data << ZM_MAP_ALLIANCE_FLAG_NOT_READY << uint32(m_BothControllingFactionId != TEAM_ALLIANCE); - data << ZM_MAP_HORDE_FLAG_READY << uint32(m_BothControllingFactionId == TEAM_HORDE); - data << ZM_MAP_HORDE_FLAG_NOT_READY << uint32(m_BothControllingFactionId != TEAM_HORDE); + packet.Worldstates.reserve(7); + packet.Worldstates.emplace_back(ZM_MAP_GRAVEYARD_N, (m_GraveyardState & ZM_GRAVEYARD_N) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(ZM_MAP_GRAVEYARD_H, (m_GraveyardState & ZM_GRAVEYARD_H) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(ZM_MAP_GRAVEYARD_A, (m_GraveyardState & ZM_GRAVEYARD_A) != 0 ? 1 : 0); + packet.Worldstates.emplace_back(ZM_MAP_ALLIANCE_FLAG_READY, m_BothControllingFactionId == TEAM_ALLIANCE ? 1 : 0); + packet.Worldstates.emplace_back(ZM_MAP_ALLIANCE_FLAG_NOT_READY, m_BothControllingFactionId != TEAM_ALLIANCE ? 1 : 0); + packet.Worldstates.emplace_back(ZM_MAP_HORDE_FLAG_READY, m_BothControllingFactionId == TEAM_HORDE ? 1 : 0); + packet.Worldstates.emplace_back(ZM_MAP_HORDE_FLAG_NOT_READY, m_BothControllingFactionId != TEAM_HORDE ? 1 : 0); } -void OPvPCapturePointZM_GraveYard::SetBeaconState(TeamId controlling_factionId) +void OPvPCapturePointZM_Graveyard::SetBeaconState(TeamId controlling_factionId) { // nothing to do here if (m_BothControllingFactionId == controlling_factionId) @@ -300,20 +302,20 @@ void OPvPCapturePointZM_GraveYard::SetBeaconState(TeamId controlling_factionId) { case TEAM_ALLIANCE: // if ally already controls the gy and taken back both beacons, return, nothing to do for us - if (m_GraveYardState & ZM_GRAVEYARD_A) + if (m_GraveyardState & ZM_GRAVEYARD_A) return; // ally doesn't control the gy, but controls the side beacons -> add gossip option, add neutral banner break; case TEAM_HORDE: // if horde already controls the gy and taken back both beacons, return, nothing to do for us - if (m_GraveYardState & ZM_GRAVEYARD_H) + if (m_GraveyardState & ZM_GRAVEYARD_H) return; // horde doesn't control the gy, but controls the side beacons -> add gossip option, add neutral banner break; default: // if the graveyard is not neutral, then leave it that way // if the graveyard is neutral, then we have to dispel the buff from the flag carrier - if (m_GraveYardState & ZM_GRAVEYARD_N) + if (m_GraveyardState & ZM_GRAVEYARD_N) { // gy was neutral, thus neutral banner was spawned, it is possible that someone was taking the flag to the gy if (m_FlagCarrierGUID) @@ -334,21 +336,21 @@ void OPvPCapturePointZM_GraveYard::SetBeaconState(TeamId controlling_factionId) UpdateTowerState(); } -bool OPvPCapturePointZM_GraveYard::CanTalkTo(Player* player, Creature* c, GossipMenuItems const& /*gso*/) +bool OPvPCapturePointZM_Graveyard::CanTalkTo(Player* player, Creature* c, GossipMenuItems const& /*gso*/) { ObjectGuid guid = c->GetGUID(); auto itr = _creatureTypes.find(guid.GetCounter()); if (itr != _creatureTypes.end()) { - if (itr->second == ZM_ALLIANCE_FIELD_SCOUT && player->GetTeamId() == TEAM_ALLIANCE && m_BothControllingFactionId == TEAM_ALLIANCE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_A) + if (itr->second == ZM_ALLIANCE_FIELD_SCOUT && player->GetTeamId() == TEAM_ALLIANCE && m_BothControllingFactionId == TEAM_ALLIANCE && !m_FlagCarrierGUID && m_GraveyardState != ZM_GRAVEYARD_A) return true; - else if (itr->second == ZM_HORDE_FIELD_SCOUT && player->GetTeamId() == TEAM_HORDE && m_BothControllingFactionId == TEAM_HORDE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_H) + else if (itr->second == ZM_HORDE_FIELD_SCOUT && player->GetTeamId() == TEAM_HORDE && m_BothControllingFactionId == TEAM_HORDE && !m_FlagCarrierGUID && m_GraveyardState != ZM_GRAVEYARD_H) return true; } return false; } -bool OPvPCapturePointZM_GraveYard::HandleGossipOption(Player* player, Creature* creature, uint32 /*gossipid*/) +bool OPvPCapturePointZM_Graveyard::HandleGossipOption(Player* player, Creature* creature, uint32 /*gossipid*/) { auto itr = _creatureTypes.find(creature->GetSpawnId()); if (itr != _creatureTypes.end()) @@ -375,7 +377,7 @@ bool OPvPCapturePointZM_GraveYard::HandleGossipOption(Player* player, Creature* return false; } -bool OPvPCapturePointZM_GraveYard::HandleDropFlag(Player* /*player*/, uint32 spellId) +bool OPvPCapturePointZM_Graveyard::HandleDropFlag(Player* /*player*/, uint32 spellId) { switch (spellId) { @@ -389,9 +391,9 @@ bool OPvPCapturePointZM_GraveYard::HandleDropFlag(Player* /*player*/, uint32 spe return false; } -uint32 OPvPCapturePointZM_GraveYard::GetGraveYardState() const +uint32 OPvPCapturePointZM_Graveyard::GetGraveyardState() const { - return m_GraveYardState; + return m_GraveyardState; } uint32 OutdoorPvPZM::GetAllianceTowersControlled() const @@ -414,12 +416,12 @@ void OutdoorPvPZM::SetHordeTowersControlled(uint32 count) m_HordeTowersControlled = count; } -void OutdoorPvPZM::FillInitialWorldStates(WorldPacket& data) +void OutdoorPvPZM::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << ZM_WORLDSTATE_UNK_1 << uint32(1); + packet.Worldstates.emplace_back(ZM_WORLDSTATE_UNK_1, 1); for (OPvPCapturePointMap::iterator itr = _capturePoints.begin(); itr != _capturePoints.end(); ++itr) { - itr->second->FillInitialWorldStates(data); + itr->second->FillInitialWorldStates(packet); } } diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h index efbb8201a..ef31a4ea2 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h @@ -175,7 +175,7 @@ public: void SendChangePhase() override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; // used when player is activated/inactivated in the area bool HandlePlayerEnter(Player* player) override; @@ -188,23 +188,23 @@ protected: uint32 m_TowerState; }; -enum ZM_GraveYardState +enum Zm_GraveyardState { ZM_GRAVEYARD_N = 1, ZM_GRAVEYARD_A = 2, ZM_GRAVEYARD_H = 4 }; -class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint +class OPvPCapturePointZM_Graveyard : public OPvPCapturePoint { public: - OPvPCapturePointZM_GraveYard(OutdoorPvP* pvp); + OPvPCapturePointZM_Graveyard(OutdoorPvP* pvp); bool Update(uint32 diff) override; void ChangeState() override {} - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void UpdateTowerState(); @@ -218,10 +218,10 @@ public: bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems const& gso) override; - uint32 GetGraveYardState() const; + uint32 GetGraveyardState() const; private: - uint32 m_GraveYardState; + uint32 m_GraveyardState; protected: TeamId m_BothControllingFactionId; @@ -240,7 +240,7 @@ public: bool Update(uint32 diff) override; - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void SendRemoveWorldStates(Player* player) override; @@ -253,7 +253,7 @@ public: void SetHordeTowersControlled(uint32 count); private: - OPvPCapturePointZM_GraveYard* m_GraveYard; + OPvPCapturePointZM_Graveyard* m_Graveyard; uint32 m_AllianceTowersControlled; uint32 m_HordeTowersControlled;