refactor(Core/Packet): use WorldPackets::WorldState::InitWorldStates definition (#20475)

Co-authored-by: ccrs <ccrs@users.noreply.github.com>
This commit is contained in:
Jelle Meeus
2025-02-19 11:55:09 +01:00
committed by GitHub
parent bc17d068cd
commit 4c4b04f07b
55 changed files with 1006 additions and 947 deletions

View File

@@ -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)