diff options
Diffstat (limited to 'src')
58 files changed, 1073 insertions, 1168 deletions
diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index cea03ac8659..2e7a7c5e3d6 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -56,6 +56,14 @@ enum BattlefieldTimers BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL = 1000 }; +namespace WorldPackets +{ + namespace WorldState + { + class InitWorldStates; + } +} + // some class predefs class Battlefield; class BfGraveyard; @@ -66,6 +74,7 @@ class Map; class Player; class Unit; class WorldPacket; + struct QuaternionData; struct WorldSafeLocsEntry; @@ -79,7 +88,7 @@ class TC_GAME_API BfCapturePoint 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); @@ -320,7 +329,7 @@ class TC_GAME_API Battlefield : public ZoneScript /// 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 0a424c5afbb..d785b043cf1 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -36,6 +36,7 @@ #include "TemporarySummon.h" #include "World.h" #include "WorldSession.h" +#include "WorldStatePackets.h" struct BfWGCoordGY { @@ -1147,45 +1148,43 @@ 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_DEFENDED_A) << uint32(GetData(BATTLEFIELD_WG_DATA_DEF_A)); - data << uint32(BATTLEFIELD_WG_WORLD_STATE_DEFENDED_H) << uint32(GetData(BATTLEFIELD_WG_DATA_DEF_H)); - data << uint32(BATTLEFIELD_WG_WORLD_STATE_ATTACKED_A) << uint32(GetData(BATTLEFIELD_WG_DATA_WON_A)); - data << uint32(BATTLEFIELD_WG_WORLD_STATE_ATTACKED_H) << uint32(GetData(BATTLEFIELD_WG_DATA_WON_H)); - 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.emplace_back(BATTLEFIELD_WG_WORLD_STATE_DEFENDED_A, GetData(BATTLEFIELD_WG_DATA_DEF_A)); + packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_DEFENDED_H, GetData(BATTLEFIELD_WG_DATA_DEF_H)); + packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_ATTACKED_A, GetData(BATTLEFIELD_WG_DATA_WON_A)); + packet.Worldstates.emplace_back(BATTLEFIELD_WG_WORLD_STATE_ATTACKED_H, GetData(BATTLEFIELD_WG_DATA_WON_H)); + 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() + (m_Timer / 1000)); + for (uint32 itr = 0; itr < 2; ++itr) + packet.Worldstates.emplace_back(ClockWorldState[itr], int32(GameTime::GetGameTime()) + int32(m_Timer) / int32(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) << uint32(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) << uint32(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)); for (BfWGGameObjectBuilding* building : BuildingsInZone) - building->FillInitialWorldStates(data); + building->FillInitialWorldStates(packet); for (WintergraspWorkshop* workshop : Workshops) - workshop->FillInitialWorldStates(data); + workshop->FillInitialWorldStates(packet); } void BattlefieldWG::SendInitWorldStatesTo(Player* player) { - WorldPacket data(SMSG_INIT_WORLD_STATES, 4 + 4 + 4 + 2 + (14 + WG_MAX_OBJ + WG_MAX_WORKSHOP) * 8); - - data << uint32(m_MapId); - data << uint32(m_ZoneId); - data << uint32(0); // AreaId - data << uint16(14 + BuildingsInZone.size() + Workshops.size()); // Number of fields - - FillInitialWorldStates(data); + WorldPackets::WorldState::InitWorldStates packet; + packet.MapID = m_MapId; + packet.ZoneID = m_ZoneId; + packet.AreaID = player->GetAreaId(); + FillInitialWorldStates(packet); - player->SendDirectMessage(&data); + player->SendDirectMessage(packet.Write()); } void BattlefieldWG::SendInitWorldStatesToAll() @@ -1758,9 +1757,9 @@ void BfWGGameObjectBuilding::UpdateTurretAttack(bool disable) } } -void BfWGGameObjectBuilding::FillInitialWorldStates(WorldPacket& data) +void BfWGGameObjectBuilding::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(_worldState) << uint32(_state); + packet.Worldstates.emplace_back(_worldState, _state); } void BfWGGameObjectBuilding::Save() @@ -1843,9 +1842,9 @@ void WintergraspWorkshop::UpdateGraveyardAndWorkshop() GiveControlTo(_wg->GetDefenderTeam(), true); } -void WintergraspWorkshop::FillInitialWorldStates(WorldPacket& data) +void WintergraspWorkshop::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(_staticInfo->WorldStateId) << uint32(_state); + packet.Worldstates.emplace_back(_staticInfo->WorldStateId, _state); } void WintergraspWorkshop::Save() diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index a828a3a47b1..85b59180b5b 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -20,6 +20,14 @@ #include "Battlefield.h" +namespace WorldPackets +{ + namespace WorldState + { + class InitWorldStates; + } +} + class Group; class BattlefieldWG; class WintergraspCapturePoint; @@ -365,7 +373,7 @@ class TC_GAME_API BattlefieldWG : public Battlefield 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; @@ -584,7 +592,7 @@ public: void UpdateTurretAttack(bool disable); - void FillInitialWorldStates(WorldPacket& data); + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet); void Save(); }; @@ -611,7 +619,7 @@ public: void UpdateGraveyardAndWorkshop(); - void FillInitialWorldStates(WorldPacket& data); + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet); void Save(); }; diff --git a/src/server/game/Battlegrounds/Arena.cpp b/src/server/game/Battlegrounds/Arena.cpp index 9d0df06f9fc..ba55774de44 100644 --- a/src/server/game/Battlegrounds/Arena.cpp +++ b/src/server/game/Battlegrounds/Arena.cpp @@ -23,6 +23,7 @@ #include "Player.h" #include "World.h" #include "WorldSession.h" +#include "WorldStatePackets.h" void ArenaScore::AppendToPacket(WorldPacket& data) { @@ -102,10 +103,10 @@ void Arena::RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team* CheckWinConditions(); } -void Arena::FillInitialWorldStates(WorldPacket& data) +void Arena::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN) << uint32(GetAlivePlayersCountByTeam(HORDE)); - data << uint32(ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD) << uint32(GetAlivePlayersCountByTeam(ALLIANCE)); + packet.Worldstates.emplace_back(ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN, GetAlivePlayersCountByTeam(HORDE)); + packet.Worldstates.emplace_back(ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD, GetAlivePlayersCountByTeam(ALLIANCE)); } void Arena::UpdateArenaWorldState() diff --git a/src/server/game/Battlegrounds/Arena.h b/src/server/game/Battlegrounds/Arena.h index 577e24f0b2a..8e1f44b8ac2 100644 --- a/src/server/game/Battlegrounds/Arena.h +++ b/src/server/game/Battlegrounds/Arena.h @@ -52,7 +52,7 @@ class TC_GAME_API Arena : public Battleground void AddPlayer(Player* player) override; void RemovePlayer(Player* /*player*/, ObjectGuid /*guid*/, uint32 /*team*/) 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 2100b0da546..58d40f28f13 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -26,6 +26,14 @@ #include "SharedDefines.h" #include <map> +namespace WorldPackets +{ + namespace WorldState + { + class InitWorldStates; + } +} + class BattlegroundMap; class Creature; class GameObject; @@ -362,7 +370,7 @@ class TC_GAME_API Battleground // Packet Transfer // method that should fill worldpacket with actual world states (not yet implemented for all battlegrounds!) - virtual void FillInitialWorldStates(WorldPacket& /*data*/) { } + virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& /*packet*/) { } void SendPacketToTeam(uint32 TeamID, WorldPacket const* packet, Player* sender = nullptr, bool self = true); void SendPacketToAll(WorldPacket const* packet); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 13a1456aaf4..ec0871ad0d3 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -28,6 +28,7 @@ #include "Util.h" #include "WorldPacket.h" #include "WorldSession.h" +#include "WorldStatePackets.h" void BattlegroundABScore::BuildObjectivesBlock(WorldPacket& data) { @@ -303,38 +304,38 @@ void BattlegroundAB::_DelBanner(uint8 node, uint8 type, uint8 teamIndex) SpawnBGObject(obj, RESPAWN_ONE_DAY); } -void BattlegroundAB::FillInitialWorldStates(WorldPacket& data) +void BattlegroundAB::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { const uint8 plusArray[] = {0, 2, 3, 0, 1}; // Node icons for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) - data << uint32(BG_AB_OP_NODEICONS[node]) << uint32((m_Nodes[node] == 0)?1:0); + packet.Worldstates.emplace_back(BG_AB_OP_NODEICONS[node], (m_Nodes[node] == 0) ? 1 : 0); // Node occupied states for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) - for (uint8 i = 1; i < BG_AB_DYNAMIC_NODES_COUNT; ++i) - data << uint32(BG_AB_OP_NODESTATES[node] + plusArray[i]) << uint32((m_Nodes[node] == i)?1:0); + for (uint8 itr = 1; itr < BG_AB_DYNAMIC_NODES_COUNT; ++itr) + packet.Worldstates.emplace_back(BG_AB_OP_NODESTATES[node] + plusArray[itr], (m_Nodes[node] == itr) ? 1 : 0); // How many bases each team owns - uint8 ally = 0, horde = 0; + int32 ally = 0, horde = 0; for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node) if (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) ++ally; else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED) ++horde; - data << uint32(BG_AB_OP_OCCUPIED_BASES_ALLY) << uint32(ally); - data << uint32(BG_AB_OP_OCCUPIED_BASES_HORDE) << uint32(horde); + packet.Worldstates.emplace_back(BG_AB_OP_OCCUPIED_BASES_ALLY, ally); + packet.Worldstates.emplace_back(BG_AB_OP_OCCUPIED_BASES_HORDE, horde); // Team scores - 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]); + 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]); - // other unknown - data << uint32(0x745) << uint32(0x2); // 37 1861 unk + // other unknown BG_AB_UNK_01 + packet.Worldstates.emplace_back(1861, 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 228c4fd9123..d876febb88d 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -316,7 +316,7 @@ class BattlegroundAB : public Battleground /* 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; /* Nodes occupying */ void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 918b500584f..bcfb6a96adb 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -26,6 +26,7 @@ #include "ObjectMgr.h" #include "Player.h" #include "WorldSession.h" +#include "WorldStatePackets.h" void BattlegroundAVScore::BuildObjectivesBlock(WorldPacket& data) { @@ -1029,32 +1030,34 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) UpdatePlayerScore(player, (IsTower(node)) ? SCORE_TOWERS_ASSAULTED : SCORE_GRAVEYARDS_ASSAULTED, 1); } -void BattlegroundAV::FillInitialWorldStates(WorldPacket& data) +void BattlegroundAV::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) + for (uint8 itr = BG_AV_NODES_FIRSTAID_STATION; itr < BG_AV_NODES_MAX; ++itr) { - uint16 owner = m_Nodes[i].Owner; - BG_AV_States state = m_Nodes[i].State; + uint16 owner = m_Nodes[itr].Owner; + BG_AV_States state = m_Nodes[itr].State; - data << uint32(BGAVNodeInfo[i].WorldStateIds.AllianceAssault) << uint32(owner == ALLIANCE && state == POINT_ASSAULTED); - data << uint32(BGAVNodeInfo[i].WorldStateIds.AllianceControl) << uint32(owner == ALLIANCE && state >= POINT_DESTROYED); - data << uint32(BGAVNodeInfo[i].WorldStateIds.HordeAssault) << uint32(owner == HORDE && state == POINT_ASSAULTED); - data << uint32(BGAVNodeInfo[i].WorldStateIds.HordeControl) << uint32(owner == HORDE && state >= POINT_DESTROYED); + packet.Worldstates.emplace_back(BGAVNodeInfo[itr].WorldStateIds.AllianceAssault, (owner == ALLIANCE && state == POINT_ASSAULTED) ? 1 : 0); + packet.Worldstates.emplace_back(BGAVNodeInfo[itr].WorldStateIds.AllianceControl, (owner == ALLIANCE && state >= POINT_DESTROYED) ? 1 : 0); + packet.Worldstates.emplace_back(BGAVNodeInfo[itr].WorldStateIds.HordeAssault, (owner == HORDE && state == POINT_ASSAULTED) ? 1 : 0); + packet.Worldstates.emplace_back(BGAVNodeInfo[itr].WorldStateIds.HordeControl, (owner == HORDE && state >= POINT_DESTROYED) ? 1 : 0); } - data << uint32(AV_SNOWFALL_N) << uint32(m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == AV_NEUTRAL_TEAM); + packet.Worldstates.emplace_back(AV_SNOWFALL_N, (m_Nodes[BG_AV_NODES_SNOWFALL_GRAVE].Owner == AV_NEUTRAL_TEAM ? 1 : 0)); + packet.Worldstates.emplace_back(AV_Alliance_Score, m_Team_Scores[0]); + packet.Worldstates.emplace_back(AV_Horde_Score, m_Team_Scores[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); + // only if game started the teamscores are displayed + if (GetStatus() == STATUS_IN_PROGRESS) { + packet.Worldstates.emplace_back(AV_SHOW_A_SCORE, 1); + packet.Worldstates.emplace_back(AV_SHOW_H_SCORE, 1); } else { - data << uint32(AV_SHOW_A_SCORE) << uint32(0); - data << uint32(AV_SHOW_H_SCORE) << uint32(0); + packet.Worldstates.emplace_back(AV_SHOW_A_SCORE, 0); + packet.Worldstates.emplace_back(AV_SHOW_H_SCORE, 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 75fb539fd01..ff03d8db7c3 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -1674,7 +1674,7 @@ class BattlegroundAV : public Battleground void ChangeMineOwner(uint8 mine, uint32 team, bool initial = false); /*worldstates*/ - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; 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 25a7a6f1a57..abb75bc8361 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp @@ -20,6 +20,7 @@ #include "Log.h" #include "Player.h" #include "WorldPacket.h" +#include "WorldStatePackets.h" BattlegroundBE::BattlegroundBE() { @@ -60,10 +61,11 @@ 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 show - Arena::FillInitialWorldStates(data); + packet.Worldstates.emplace_back(2547, 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 b646881c5bc..9db9f9de5ed 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h @@ -53,6 +53,6 @@ class BattlegroundBE : public Arena void HandleAreaTrigger(Player* Source, uint32 Trigger) override; bool SetupBattleground() override; - void FillInitialWorldStates(WorldPacket &d) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index 14c633f39a1..5a03c629168 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -22,6 +22,7 @@ #include "Player.h" #include "Random.h" #include "WorldPacket.h" +#include "WorldStatePackets.h" BattlegroundDS::BattlegroundDS() { @@ -146,10 +147,11 @@ void BattlegroundDS::HandleAreaTrigger(Player* player, uint32 trigger) } } -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(3610, 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 f4f8c774010..503bda41244 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -100,7 +100,7 @@ class BattlegroundDS : public Arena void HandleAreaTrigger(Player* Source, uint32 Trigger) override; bool SetupBattleground() override; - void FillInitialWorldStates(WorldPacket &d) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; private: void PostUpdateImpl(uint32 diff) override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index 6398b5529c3..4acfd1b7f9e 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -17,17 +17,18 @@ */ #include "BattlegroundEY.h" -#include "WorldPacket.h" #include "BattlegroundMgr.h" #include "Creature.h" #include "DBCStores.h" #include "GameObject.h" #include "Log.h" #include "Map.h" +#include "ObjectAccessor.h" #include "Player.h" #include "Random.h" #include "Util.h" -#include "ObjectAccessor.h" +#include "WorldPacket.h" +#include "WorldStatePackets.h" // these variables aren't used outside of this file, so declare them only here uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] = @@ -831,54 +832,42 @@ bool BattlegroundEY::UpdatePlayerScore(Player* player, uint32 type, uint32 value return true; } -void BattlegroundEY::FillInitialWorldStates(WorldPacket& data) -{ - data << uint32(EY_HORDE_BASE) << uint32(m_TeamPointsCount[TEAM_HORDE]); - data << uint32(EY_ALLIANCE_BASE) << uint32(m_TeamPointsCount[TEAM_ALLIANCE]); - data << uint32(0xab6) << uint32(0x0); - data << uint32(0xab5) << uint32(0x0); - data << uint32(0xab4) << uint32(0x0); - data << uint32(0xab3) << uint32(0x0); - data << uint32(0xab2) << uint32(0x0); - data << uint32(0xab1) << uint32(0x0); - data << uint32(0xab0) << uint32(0x0); - data << uint32(0xaaf) << uint32(0x0); - - data << uint32(DRAENEI_RUINS_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[DRAENEI_RUINS] == HORDE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL); - - data << uint32(DRAENEI_RUINS_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[DRAENEI_RUINS] == ALLIANCE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL); - - data << uint32(DRAENEI_RUINS_UNCONTROL) << uint32(m_PointState[DRAENEI_RUINS] != EY_POINT_UNDER_CONTROL); - - data << uint32(MAGE_TOWER_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[MAGE_TOWER] == ALLIANCE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL); - - data << uint32(MAGE_TOWER_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[MAGE_TOWER] == HORDE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL); - - data << uint32(MAGE_TOWER_UNCONTROL) << uint32(m_PointState[MAGE_TOWER] != EY_POINT_UNDER_CONTROL); - - data << uint32(FEL_REAVER_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[FEL_REAVER] == HORDE && m_PointState[FEL_REAVER] == EY_POINT_UNDER_CONTROL); - - data << uint32(FEL_REAVER_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[FEL_REAVER] == ALLIANCE && m_PointState[FEL_REAVER] == EY_POINT_UNDER_CONTROL); - - data << uint32(FEL_REAVER_UNCONTROL) << uint32(m_PointState[FEL_REAVER] != EY_POINT_UNDER_CONTROL); - - data << uint32(BLOOD_ELF_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[BLOOD_ELF] == HORDE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL); - - data << uint32(BLOOD_ELF_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[BLOOD_ELF] == ALLIANCE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL); - - data << uint32(BLOOD_ELF_UNCONTROL) << uint32(m_PointState[BLOOD_ELF] != EY_POINT_UNDER_CONTROL); - - data << uint32(NETHERSTORM_FLAG) << uint32(m_FlagState == BG_EY_FLAG_STATE_ON_BASE); - - data << uint32(0xad2) << uint32(0x1); - data << uint32(0xad1) << uint32(0x1); - data << uint32(0xabe) << uint32(GetTeamScore(TEAM_HORDE)); - data << uint32(0xabd) << uint32(GetTeamScore(TEAM_ALLIANCE)); - data << uint32(0xa05) << uint32(0x8e); - data << uint32(0xaa0) << uint32(0x0); - data << uint32(0xa9f) << uint32(0x0); - data << uint32(0xa9e) << uint32(0x0); - data << uint32(0xc0d) << uint32(0x17b); +void BattlegroundEY::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) +{ + packet.Worldstates.emplace_back(EY_HORDE_BASE, m_TeamPointsCount[TEAM_HORDE]); + packet.Worldstates.emplace_back(EY_ALLIANCE_BASE, m_TeamPointsCount[TEAM_ALLIANCE]); + packet.Worldstates.emplace_back(2742, 0); // Mage Tower - Horde conflict + packet.Worldstates.emplace_back(2741, 0); // Mage Tower - Alliance conflict + packet.Worldstates.emplace_back(2740, 0); // Fel Reaver - Horde conflict + packet.Worldstates.emplace_back(2739, 0); // Fel Reaver - Alliance conflict + packet.Worldstates.emplace_back(2738, 0); // Draenei - Alliance conflict + packet.Worldstates.emplace_back(2737, 0); // Draenei - Horde conflict + packet.Worldstates.emplace_back(2736, 0); // unk (0 at start) + packet.Worldstates.emplace_back(2735, 0); // unk (0 at start) + + packet.Worldstates.emplace_back(DRAENEI_RUINS_HORDE_CONTROL, (m_PointOwnedByTeam[DRAENEI_RUINS] == HORDE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL) ? 1 : 0); + packet.Worldstates.emplace_back(DRAENEI_RUINS_ALLIANCE_CONTROL, (m_PointOwnedByTeam[DRAENEI_RUINS] == ALLIANCE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL) ? 1 : 0); + packet.Worldstates.emplace_back(DRAENEI_RUINS_UNCONTROL, (m_PointState[DRAENEI_RUINS] != EY_POINT_UNDER_CONTROL) ? 1 : 0); + packet.Worldstates.emplace_back(MAGE_TOWER_ALLIANCE_CONTROL, (m_PointOwnedByTeam[MAGE_TOWER] == ALLIANCE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL) ? 1 : 0); + packet.Worldstates.emplace_back(MAGE_TOWER_HORDE_CONTROL, (m_PointOwnedByTeam[MAGE_TOWER] == HORDE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL) ? 1 : 0); + packet.Worldstates.emplace_back(MAGE_TOWER_UNCONTROL, (m_PointState[MAGE_TOWER] != EY_POINT_UNDER_CONTROL) ? 1 : 0); + packet.Worldstates.emplace_back(FEL_REAVER_HORDE_CONTROL, (m_PointOwnedByTeam[FEL_REAVER] == HORDE && m_PointState[FEL_REAVER] == EY_POINT_UNDER_CONTROL) ? 1 : 0); + packet.Worldstates.emplace_back(FEL_REAVER_ALLIANCE_CONTROL, (m_PointOwnedByTeam[FEL_REAVER] == ALLIANCE && m_PointState[FEL_REAVER] == EY_POINT_UNDER_CONTROL) ? 1 : 0); + packet.Worldstates.emplace_back(FEL_REAVER_UNCONTROL, (m_PointState[FEL_REAVER] != EY_POINT_UNDER_CONTROL) ? 1 : 0); + packet.Worldstates.emplace_back(BLOOD_ELF_HORDE_CONTROL, (m_PointOwnedByTeam[BLOOD_ELF] == HORDE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL) ? 1 : 0); + packet.Worldstates.emplace_back(BLOOD_ELF_ALLIANCE_CONTROL, (m_PointOwnedByTeam[BLOOD_ELF] == ALLIANCE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL) ? 1 : 0); + packet.Worldstates.emplace_back(BLOOD_ELF_UNCONTROL, (m_PointState[BLOOD_ELF] != EY_POINT_UNDER_CONTROL) ? 1 : 0); + packet.Worldstates.emplace_back(NETHERSTORM_FLAG, (m_FlagState == BG_EY_FLAG_STATE_ON_BASE) ? 1 : 0); + + packet.Worldstates.emplace_back(2770, 1); // Horde top-stats (1 - show, 0 - hide) // 02 -> horde picked up the flag + packet.Worldstates.emplace_back(2769, 1); // Alliance top-stats (1 - show, 0 - hide) // 02 -> alliance picked up the flag + packet.Worldstates.emplace_back(2750, GetTeamScore(TEAM_HORDE)); // Horde resources + packet.Worldstates.emplace_back(2749, GetTeamScore(TEAM_ALLIANCE)); // Alliance resources + packet.Worldstates.emplace_back(2565, 142); // unk, constant? + packet.Worldstates.emplace_back(2720, 0); // Capturing progress-bar (100 -> empty (only grey), 0 -> blue|red (no grey), default 0) + packet.Worldstates.emplace_back(2719, 0); // Capturing progress-bar (0 - left, 100 - right) + packet.Worldstates.emplace_back(2718, 0); // Capturing progress-bar (1 - show, 0 - hide) + packet.Worldstates.emplace_back(3085, 379); // unk, constant? } WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveyard(Player* player) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index ff03dcb048c..8406e877319 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -406,7 +406,7 @@ class BattlegroundEY : public Battleground void UpdateTeamScore(uint32 Team); void EndBattleground(uint32 winner) 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, int32 /*TeamID*/ = -1) override { m_DroppedFlagGUID = guid; } ObjectGuid GetDroppedFlagGUID() const { return m_DroppedFlagGUID; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 98897615ca5..45ca4009a52 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -25,6 +25,7 @@ #include "Transport.h" #include "Vehicle.h" #include "WorldPacket.h" +#include "WorldStatePackets.h" void BattlegroundICScore::BuildObjectivesBlock(WorldPacket& data) { @@ -290,21 +291,21 @@ void BattlegroundIC::HandleAreaTrigger(Player* player, uint32 trigger) } } -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.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) + for (uint8 itr = 0; itr < MAX_FORTRESS_GATES_SPAWNS; ++itr) { - uint32 uws = GetWorldStateFromGateEntry(BG_IC_ObjSpawnlocs[i].entry, (GateStatus[GetGateIDFromEntry(BG_IC_ObjSpawnlocs[i].entry)] == BG_IC_GATE_DESTROYED ? true : false)); - data << uint32(uws) << uint32(1); + int32 worldState = GetWorldStateFromGateEntry(BG_IC_ObjSpawnlocs[itr].entry, (GateStatus[GetGateIDFromEntry(BG_IC_ObjSpawnlocs[itr].entry)] == BG_IC_GATE_DESTROYED ? true : false)); + packet.Worldstates.emplace_back(worldState, 1); } - for (uint8 i = 0; i < MAX_NODE_TYPES; ++i) - data << uint32(nodePoint[i].worldStates[nodePoint[i].nodeState]) << uint32(1); + for (uint8 itr = 0; itr < MAX_NODE_TYPES; ++itr) + packet.Worldstates.emplace_back(nodePoint[itr].worldStates[nodePoint[itr].nodeState], 1); } bool BattlegroundIC::SetupBattleground() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h index 74e239d19ea..90346c3465e 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h @@ -965,7 +965,7 @@ class BattlegroundIC : public Battleground WorldSafeLocsEntry const* GetClosestGraveyard(Player* player) override; /* Scorekeeping */ - 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 2f9a461939f..cae952d8326 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp @@ -20,6 +20,7 @@ #include "Log.h" #include "Player.h" #include "WorldPacket.h" +#include "WorldStatePackets.h" BattlegroundNA::BattlegroundNA() { @@ -57,10 +58,11 @@ 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 show - Arena::FillInitialWorldStates(data); + packet.Worldstates.emplace_back(2577, 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 5cf8e8484f8..2bd1c5be3f9 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h @@ -52,6 +52,6 @@ class BattlegroundNA : public Arena void HandleAreaTrigger(Player* Source, uint32 Trigger) override; bool SetupBattleground() override; - void FillInitialWorldStates(WorldPacket &d) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp index 39fd1dd6826..6b68dc04f6c 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp @@ -20,6 +20,7 @@ #include "Log.h" #include "Player.h" #include "WorldPacket.h" +#include "WorldStatePackets.h" BattlegroundRL::BattlegroundRL() { @@ -57,10 +58,11 @@ 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 show - Arena::FillInitialWorldStates(data); + packet.Worldstates.emplace_back(3002, 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 917601efe5c..759fdf4a659 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h @@ -43,7 +43,7 @@ class BattlegroundRL : public Arena 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 d95a394ecc0..dcad7a5d708 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -22,6 +22,7 @@ #include "ObjectAccessor.h" #include "Player.h" #include "WorldPacket.h" +#include "WorldStatePackets.h" BattlegroundRV::BattlegroundRV() { @@ -101,10 +102,11 @@ 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); } bool BattlegroundRV::SetupBattleground() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h index 32d18bca31a..3e1e2a77f6a 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h @@ -97,7 +97,7 @@ class BattlegroundRV : public Arena /* inherited from BattlegroundClass */ void StartingEventOpenDoors() override; - void FillInitialWorldStates(WorldPacket &d) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void HandleAreaTrigger(Player* Source, uint32 Trigger) override; bool SetupBattleground() override; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index bec8ff03451..bfb5708e6d5 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -28,6 +28,7 @@ #include "ScriptedCreature.h" #include "UpdateData.h" #include "WorldPacket.h" +#include "WorldStatePackets.h" void BattlegroundSAScore::BuildObjectivesBlock(WorldPacket& data) { @@ -443,44 +444,41 @@ void BattlegroundSA::StartingEventCloseDoors() { } void BattlegroundSA::StartingEventOpenDoors() { } -void BattlegroundSA::FillInitialWorldStates(WorldPacket& data) +void BattlegroundSA::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - bool allyAttacks = Attackers == TEAM_ALLIANCE; - bool hordeAttacks = Attackers == TEAM_HORDE; + bool const allyAttacks = Attackers == TEAM_ALLIANCE; + bool const hordeAttacks = 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.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); - - data << uint32(BG_SA_HORDE_ATTACKS) << uint32(hordeAttacks); - data << uint32(BG_SA_ALLY_ATTACKS) << uint32(allyAttacks); + packet.Worldstates.emplace_back(BG_SA_BONUS_TIMER, 0); + packet.Worldstates.emplace_back(BG_SA_HORDE_ATTACKS, hordeAttacks); + packet.Worldstates.emplace_back(BG_SA_ALLY_ATTACKS, allyAttacks); // Time will be sent on first update... - data << uint32(BG_SA_ENABLE_TIMER) << uint32(TimerEnabled); - 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); - - data << uint32(BG_SA_RIGHT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE); - data << uint32(BG_SA_LEFT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE); - data << uint32(BG_SA_CENTER_GY_HORDE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE); - - data << uint32(BG_SA_RIGHT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE); - data << uint32(BG_SA_LEFT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE); - data << uint32(BG_SA_CENTER_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE); - - data << uint32(BG_SA_HORDE_DEFENCE_TOKEN) << uint32(allyAttacks); - data << uint32(BG_SA_ALLIANCE_DEFENCE_TOKEN) << uint32(hordeAttacks); - - data << uint32(BG_SA_LEFT_ATT_TOKEN_HRD) << uint32(hordeAttacks); - data << uint32(BG_SA_RIGHT_ATT_TOKEN_HRD) << uint32(hordeAttacks); - data << uint32(BG_SA_RIGHT_ATT_TOKEN_ALL) << uint32(allyAttacks); - data << uint32(BG_SA_LEFT_ATT_TOKEN_ALL) << uint32(allyAttacks); + packet.Worldstates.emplace_back(BG_SA_ENABLE_TIMER, TimerEnabled); + 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); + + 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); + 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); + + packet.Worldstates.emplace_back(BG_SA_HORDE_DEFENCE_TOKEN, allyAttacks); + packet.Worldstates.emplace_back(BG_SA_ALLIANCE_DEFENCE_TOKEN, hordeAttacks); + packet.Worldstates.emplace_back(BG_SA_LEFT_ATT_TOKEN_HRD, hordeAttacks); + packet.Worldstates.emplace_back(BG_SA_RIGHT_ATT_TOKEN_HRD, hordeAttacks); + packet.Worldstates.emplace_back(BG_SA_RIGHT_ATT_TOKEN_ALL, allyAttacks); + packet.Worldstates.emplace_back(BG_SA_LEFT_ATT_TOKEN_ALL, allyAttacks); } void BattlegroundSA::AddPlayer(Player* player) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 7a19912e610..5c62cccc3a6 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -573,7 +573,7 @@ class BattlegroundSA : public Battleground bool SetupBattleground() override; void Reset() override; /// Called for generate packet contain worldstate data - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; /// Called when a player kill a unit in bg void HandleKillUnit(Creature* creature, Player* killer) override; /// Return the nearest graveyard where player can respawn diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 397442273dc..ecf03ac11c1 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -26,6 +26,7 @@ #include "ObjectAccessor.h" #include "Player.h" #include "WorldPacket.h" +#include "WorldStatePackets.h" // these variables aren't used outside of this file, so declare them only here enum BG_WSG_Rewards @@ -818,44 +819,44 @@ WorldSafeLocsEntry const* BattlegroundWS::GetClosestGraveyard(Player* player) } } -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)); + packet.Worldstates.emplace_back(BG_WS_FLAG_CAPTURES_ALLIANCE, GetTeamScore(TEAM_ALLIANCE)); + packet.Worldstates.emplace_back(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(TEAM_HORDE)); if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND) - data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(-1); + packet.Worldstates.emplace_back(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1)); // ?? else if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER) - data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(1); + packet.Worldstates.emplace_back(BG_WS_FLAG_UNK_ALLIANCE, 1); else - data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(0); + packet.Worldstates.emplace_back(BG_WS_FLAG_UNK_ALLIANCE, 0); if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND) - data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(-1); + packet.Worldstates.emplace_back(BG_WS_FLAG_UNK_HORDE, uint32(-1)); // ?? else if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER) - data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(1); + packet.Worldstates.emplace_back(BG_WS_FLAG_UNK_HORDE, 1); else - data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(0); + packet.Worldstates.emplace_back(BG_WS_FLAG_UNK_HORDE, 0); - data << uint32(BG_WS_FLAG_CAPTURES_MAX) << uint32(BG_WS_MAX_TEAM_SCORE); + packet.Worldstates.emplace_back(BG_WS_FLAG_CAPTURES_MAX, BG_WS_MAX_TEAM_SCORE); if (GetStatus() == STATUS_IN_PROGRESS) { - data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(1); - data << uint32(BG_WS_STATE_TIMER) << uint32(25-_minutesElapsed); + packet.Worldstates.emplace_back(BG_WS_STATE_TIMER_ACTIVE, 1); + packet.Worldstates.emplace_back(BG_WS_STATE_TIMER, 25 - _minutesElapsed); } else - data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(0); + packet.Worldstates.emplace_back(BG_WS_STATE_TIMER_ACTIVE, 0); if (_flagState[TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER) - data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(2); + packet.Worldstates.emplace_back(BG_WS_FLAG_STATE_HORDE, 2); else - data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(1); + packet.Worldstates.emplace_back(BG_WS_FLAG_STATE_HORDE, 1); if (_flagState[TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER) - data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(2); + packet.Worldstates.emplace_back(BG_WS_FLAG_STATE_ALLIANCE, 2); else - data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(1); + packet.Worldstates.emplace_back(BG_WS_FLAG_STATE_ALLIANCE, 1); } uint32 BattlegroundWS::GetPrematureWinner() diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index 21de87d57cb..0e84a31c43e 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h @@ -247,7 +247,7 @@ class BattlegroundWS : public Battleground } ObjectGuid GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)]; } - void FillInitialWorldStates(WorldPacket& data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; /* Scorekeeping */ void AddPoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 21d9b0d5623..3f6d658763f 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -8782,629 +8782,608 @@ void Player::SendUpdateWorldState(uint32 variable, uint32 value) const SendDirectMessage(worldstate.Write()); } -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); - TC_LOG_DEBUG("network", "Sending SMSG_INIT_WORLD_STATES to Map: %u, Zone: %u", mapid, zoneid); + TC_LOG_DEBUG("network", "Player::SendInitWorldStates: Sending SMSG_INIT_WORLD_STATES for Map: %u, Zone: %u", mapId, zoneId); - 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 - 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(sWorld->getBoolConfig(CONFIG_ARENA_SEASON_IN_PROGRESS)); - // 8 Arena season id - data << uint32(0xF3D) << uint32(sWorld->getIntConfig(CONFIG_ARENA_SEASON_ID)); - - if (mapid == 530) // Outland - { - data << uint32(0x9bf) << uint32(0x0); // 7 - data << uint32(0x9bd) << uint32(0xF); // 8 - data << uint32(0x9bb) << uint32(0xF); // 9 - } - - // insert <field> <value> - 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 + WorldPackets::WorldState::InitWorldStates packet; + packet.MapID = mapId; + packet.ZoneID = zoneId; + packet.AreaID = areaId; + + packet.Worldstates.emplace_back(2264, 0); // SCOURGE_EVENT_WORLDSTATE_EASTERN_PLAGUELANDS + packet.Worldstates.emplace_back(2263, 0); // SCOURGE_EVENT_WORLDSTATE_TANARIS + packet.Worldstates.emplace_back(2262, 0); // SCOURGE_EVENT_WORLDSTATE_BURNING_STEPPES + packet.Worldstates.emplace_back(2261, 0); // SCOURGE_EVENT_WORLDSTATE_BLASTED_LANDS + packet.Worldstates.emplace_back(2260, 0); // SCOURGE_EVENT_WORLDSTATE_AZSHARA + packet.Worldstates.emplace_back(2259, 0); // SCOURGE_EVENT_WORLDSTATE_WINTERSPRING + + // ARENA_SEASON_IN_PROGRESS + // 7 - arena season in progress + // 0 - end of season + packet.Worldstates.emplace_back(3191, sWorld->getBoolConfig(CONFIG_ARENA_SEASON_IN_PROGRESS) ? sWorld->getIntConfig(CONFIG_ARENA_SEASON_ID) : 0); + + // Previous arena season id + packet.Worldstates.emplace_back(3901, (sWorld->getIntConfig(CONFIG_ARENA_SEASON_ID) - (sWorld->getBoolConfig(CONFIG_ARENA_SEASON_IN_PROGRESS)) ? 1 : 0)); + + if (mapId == 530) // Outland + { + packet.Worldstates.emplace_back(2495, 0); // NA_UI_OUTLAND_01 "Progress: %2494w" + packet.Worldstates.emplace_back(2493, 15); // NA_UI_GUARDS_MAX + packet.Worldstates.emplace_back(2491, 15); // NA_UI_GUARDS_LEFT + } + + 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 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.emplace_back(2426, 0); // GENERAL_WORLDSTATES_01 "Progress: %2427w" + packet.Worldstates.emplace_back(2327, 0); // EP_UI_TOWER_COUNT_A + packet.Worldstates.emplace_back(2328, 0); // EP_UI_TOWER_COUNT_H + packet.Worldstates.emplace_back(2427, 50); // GENERAL_WORLDSTATES_02 + packet.Worldstates.emplace_back(2428, 50); // GENERAL_WORLDSTATES_03 + packet.Worldstates.emplace_back(2355, 1); // EP_CGT_N + packet.Worldstates.emplace_back(2374, 0); // EP_CGT_N_A + packet.Worldstates.emplace_back(2375, 0); // EP_CGT_N_H + packet.Worldstates.emplace_back(2376, 0); // GENERAL_WORLDSTATES_04 + packet.Worldstates.emplace_back(2377, 0); // GENERAL_WORLDSTATES_05 + packet.Worldstates.emplace_back(2378, 0); // EP_CGT_A + packet.Worldstates.emplace_back(2379, 0); // EP_CGT_H + packet.Worldstates.emplace_back(2354, 0); // EP_EWT_A + packet.Worldstates.emplace_back(2356, 0); // EP_EWT_H + packet.Worldstates.emplace_back(2357, 0); // GENERAL_WORLDSTATES_06 + packet.Worldstates.emplace_back(2358, 0); // GENERAL_WORLDSTATES_07 + packet.Worldstates.emplace_back(2359, 0); // EP_EWT_N_A + packet.Worldstates.emplace_back(2360, 0); // EP_EWT_N_H + packet.Worldstates.emplace_back(2361, 1); // EP_EWT_N + packet.Worldstates.emplace_back(2352, 1); // EP_NPT_N + packet.Worldstates.emplace_back(2362, 0); // EP_NPT_N_A + packet.Worldstates.emplace_back(2363, 0); // GENERAL_WORLDSTATES_08 + packet.Worldstates.emplace_back(2364, 0); // GENERAL_WORLDSTATES_09 + packet.Worldstates.emplace_back(2365, 0); // GENERAL_WORLDSTATES_10 + packet.Worldstates.emplace_back(2372, 0); // EP_NPT_A + packet.Worldstates.emplace_back(2373, 0); // EP_NPT_H + packet.Worldstates.emplace_back(2353, 1); // EP_PWT_N + packet.Worldstates.emplace_back(2366, 0); // EP_PWT_N_A + //packet.Worldstates.emplace_back(2367, 1); // GENERAL_WORLDSTATES_13 grey horde not in dbc! + packet.Worldstates.emplace_back(2368, 0); // GENERAL_WORLDSTATES_11 + packet.Worldstates.emplace_back(2369, 0); // GENERAL_WORLDSTATES_12 + packet.Worldstates.emplace_back(2370, 0); // EP_PWT_A + packet.Worldstates.emplace_back(2371, 0); // EP_PWT_H } break; - case 1377: // Silithus - if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_SI) - pvp->FillInitialWorldStates(data); + case 1377: // Silithus + if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_SI) + outdoorPvP->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 + packet.Worldstates.emplace_back(2313, 0); // SI_GATHERED_A + packet.Worldstates.emplace_back(2314, 0); // SI_GATHERED_H + packet.Worldstates.emplace_back(2317, 0); // SI_SILITHYST_MAX } - // 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 + // unknown, aq opening? + packet.Worldstates.emplace_back(2322, 0); // AQ_SANDWORM_N + packet.Worldstates.emplace_back(2323, 0); // AQ_SANDWORM_S + packet.Worldstates.emplace_back(2324, 0); // AQ_SANDWORM_SW + packet.Worldstates.emplace_back(2325, 0); // AQ_SANDWORM_E break; - case 2597: // Alterac Valley - if (bg && bg->GetTypeID(true) == BATTLEGROUND_AV) - bg->FillInitialWorldStates(data); + case 2597: // Alterac Valley + if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_AV) + battleground->FillInitialWorldStates(packet); 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.emplace_back(1966, 1); // AV_SNOWFALL_N + packet.Worldstates.emplace_back(1330, 1); // AV_FROSTWOLFHUT_H_C + packet.Worldstates.emplace_back(1329, 0); // AV_FROSTWOLFHUT_A_C + packet.Worldstates.emplace_back(1326, 0); // AV_AID_A_A + packet.Worldstates.emplace_back(1393, 0); // East Frostwolf Tower Horde Assaulted - UNUSED + packet.Worldstates.emplace_back(1392, 0); // West Frostwolf Tower Horde Assaulted - UNUSED + packet.Worldstates.emplace_back(1383, 1); // AV_FROSTWOLFE_CONTROLLED + packet.Worldstates.emplace_back(1382, 1); // AV_FROSTWOLFW_CONTROLLED + packet.Worldstates.emplace_back(1360, 1); // AV_N_MINE_N + packet.Worldstates.emplace_back(1348, 0); // AV_ICEBLOOD_A_A + packet.Worldstates.emplace_back(1334, 0); // AV_PIKEGRAVE_H_C + packet.Worldstates.emplace_back(1333, 1); // AV_PIKEGRAVE_A_C + packet.Worldstates.emplace_back(1304, 0); // AV_STONEHEART_A_A + packet.Worldstates.emplace_back(1303, 0); // AV_STONEHEART_H_A + packet.Worldstates.emplace_back(1396, 0); // unk + packet.Worldstates.emplace_back(1395, 0); // Iceblood Tower Horde Assaulted - UNUSED + packet.Worldstates.emplace_back(1394, 0); // Towerpoint Horde Assaulted - UNUSED + packet.Worldstates.emplace_back(1391, 0); // unk + packet.Worldstates.emplace_back(1390, 0); // AV_ICEBLOOD_ASSAULTED + packet.Worldstates.emplace_back(1389, 0); // AV_TOWERPOINT_ASSAULTED + packet.Worldstates.emplace_back(1388, 0); // AV_FROSTWOLFE_ASSAULTED + packet.Worldstates.emplace_back(1387, 0); // AV_FROSTWOLFW_ASSAULTED + packet.Worldstates.emplace_back(1386, 1); // unk + packet.Worldstates.emplace_back(1385, 1); // AV_ICEBLOOD_CONTROLLED + packet.Worldstates.emplace_back(1384, 1); // AV_TOWERPOINT_CONTROLLED + packet.Worldstates.emplace_back(1381, 0); // AV_STONEH_ASSAULTED + packet.Worldstates.emplace_back(1380, 0); // AV_ICEWING_ASSAULTED + packet.Worldstates.emplace_back(1379, 0); // AV_DUNN_ASSAULTED + packet.Worldstates.emplace_back(1378, 0); // AV_DUNS_ASSAULTED + packet.Worldstates.emplace_back(1377, 0); // Stoneheart Bunker Alliance Assaulted - UNUSED + packet.Worldstates.emplace_back(1376, 0); // Icewing Bunker Alliance Assaulted - UNUSED + packet.Worldstates.emplace_back(1375, 0); // Dunbaldar South Alliance Assaulted - UNUSED + packet.Worldstates.emplace_back(1374, 0); // Dunbaldar North Alliance Assaulted - UNUSED + packet.Worldstates.emplace_back(1373, 0); // AV_STONEH_DESTROYED + packet.Worldstates.emplace_back(966, 0); // AV_UNK_02 + packet.Worldstates.emplace_back(964, 0); // AV_UNK_01 + packet.Worldstates.emplace_back(962, 0); // AV_STORMPIKE_COMMANDERS + packet.Worldstates.emplace_back(1302, 1); // AV_STONEHEART_A_C + packet.Worldstates.emplace_back(1301, 0); // AV_STONEHEART_H_C + packet.Worldstates.emplace_back(950, 0); // AV_STORMPIKE_LIEUTENANTS + packet.Worldstates.emplace_back(1372, 0); // AV_ICEWING_DESTROYED + packet.Worldstates.emplace_back(1371, 0); // AV_DUNN_DESTROYED + packet.Worldstates.emplace_back(1370, 0); // AV_DUNS_DESTROYED + packet.Worldstates.emplace_back(1369, 0); // unk + packet.Worldstates.emplace_back(1368, 0); // AV_ICEBLOOD_DESTROYED + packet.Worldstates.emplace_back(1367, 0); // AV_TOWERPOINT_DESTROYED + packet.Worldstates.emplace_back(1366, 0); // AV_FROSTWOLFE_DESTROYED + packet.Worldstates.emplace_back(1365, 0); // AV_FROSTWOLFW_DESTROYED + packet.Worldstates.emplace_back(1364, 1); // AV_STONEH_CONTROLLED + packet.Worldstates.emplace_back(1363, 1); // AV_ICEWING_CONTROLLED + packet.Worldstates.emplace_back(1362, 1); // AV_DUNN_CONTROLLED + packet.Worldstates.emplace_back(1361, 1); // AV_DUNS_CONTROLLED + packet.Worldstates.emplace_back(1359, 0); // AV_N_MINE_H + packet.Worldstates.emplace_back(1358, 0); // AV_N_MINE_A + packet.Worldstates.emplace_back(1357, 1); // AV_S_MINE_N + packet.Worldstates.emplace_back(1356, 0); // AV_S_MINE_H + packet.Worldstates.emplace_back(1355, 0); // AV_S_MINE_A + packet.Worldstates.emplace_back(1349, 0); // AV_ICEBLOOD_H_A + packet.Worldstates.emplace_back(1347, 1); // AV_ICEBLOOD_H_C + packet.Worldstates.emplace_back(1346, 0); // AV_ICEBLOOD_A_C + packet.Worldstates.emplace_back(1344, 0); // AV_SNOWFALL_H_A + packet.Worldstates.emplace_back(1343, 0); // AV_SNOWFALL_A_A + packet.Worldstates.emplace_back(1342, 0); // AV_SNOWFALL_H_C + packet.Worldstates.emplace_back(1341, 0); // AV_SNOWFALL_A_C + packet.Worldstates.emplace_back(1340, 0); // AV_FROSTWOLF_H_A + packet.Worldstates.emplace_back(1339, 0); // AV_FROSTWOLF_A_A + packet.Worldstates.emplace_back(1338, 1); // AV_FROSTWOLF_H_C + packet.Worldstates.emplace_back(1337, 0); // AV_FROSTWOLF_A_C + packet.Worldstates.emplace_back(1336, 0); // AV_PIKEGRAVE_H_A + packet.Worldstates.emplace_back(1335, 0); // AV_PIKEGRAVE_A_A + packet.Worldstates.emplace_back(1332, 0); // AV_FROSTWOLFHUT_H_A + packet.Worldstates.emplace_back(1331, 0); // AV_FROSTWOLFHUT_A_A + packet.Worldstates.emplace_back(1328, 0); // AV_AID_H_A + packet.Worldstates.emplace_back(1327, 0); // AV_AID_H_C + packet.Worldstates.emplace_back(1325, 1); // AV_AID_A_C } break; - case 3277: // Warsong Gulch - if (bg && bg->GetTypeID(true) == BATTLEGROUND_WS) - bg->FillInitialWorldStates(data); + case 3277: // Warsong Gulch + if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_WS) + 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.emplace_back(1581, 0); // alliance flag captures + packet.Worldstates.emplace_back(1582, 0); // horde flag captures + packet.Worldstates.emplace_back(1545, 0); // unk, set to 1 on alliance flag pickup... + packet.Worldstates.emplace_back(1546, 0); // unk, set to 1 on horde flag pickup, after drop it's -1 + packet.Worldstates.emplace_back(1547, 2); // unk + packet.Worldstates.emplace_back(1601, 3); // unk (max flag captures?) + packet.Worldstates.emplace_back(2338, 1); // horde (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) + packet.Worldstates.emplace_back(2339, 1); // alliance (0 - hide, 1 - flag ok, 2 - flag picked up (flashing), 3 - flag picked up (not flashing) } break; - case 3358: // Arathi Basin - if (bg && bg->GetTypeID(true) == BATTLEGROUND_AB) - bg->FillInitialWorldStates(data); + case 3358: // Arathi Basin + if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_AB) + 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(0x7d0); // 19 1780 max resources (2000) - 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, wtf?, 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(0x708); // 38 1955 warning limit (1800) + packet.Worldstates.emplace_back(1767, 0); // stables alliance + packet.Worldstates.emplace_back(1768, 0); // stables horde + packet.Worldstates.emplace_back(1769, 0); // stables alliance controlled + packet.Worldstates.emplace_back(1770, 0); // stables horde controlled + packet.Worldstates.emplace_back(1772, 0); // farm alliance + packet.Worldstates.emplace_back(1773, 0); // farm horde + packet.Worldstates.emplace_back(1774, 0); // farm alliance controlled + packet.Worldstates.emplace_back(1775, 0); // farm horde controlled + packet.Worldstates.emplace_back(1776, 0); // alliance resources + packet.Worldstates.emplace_back(1777, 0); // horde resources + packet.Worldstates.emplace_back(1778, 0); // horde bases + packet.Worldstates.emplace_back(1779, 0); // alliance bases + packet.Worldstates.emplace_back(1780, 2000); // max resources (2000) + packet.Worldstates.emplace_back(1782, 0); // blacksmith alliance + packet.Worldstates.emplace_back(1783, 0); // blacksmith horde + packet.Worldstates.emplace_back(1784, 0); // blacksmith alliance controlled + packet.Worldstates.emplace_back(1785, 0); // blacksmith horde controlled + packet.Worldstates.emplace_back(1787, 0); // gold mine alliance + packet.Worldstates.emplace_back(1788, 0); // gold mine horde + packet.Worldstates.emplace_back(1789, 0); // gold mine alliance controlled + packet.Worldstates.emplace_back(1790, 0); // gold mine horde controlled + packet.Worldstates.emplace_back(1792, 0); // lumber mill alliance + packet.Worldstates.emplace_back(1793, 0); // lumber mill horde + packet.Worldstates.emplace_back(1794, 0); // lumber mill alliance controlled + packet.Worldstates.emplace_back(1795, 0); // lumber mill horde controlled + packet.Worldstates.emplace_back(1842, 1); // stables (1 - uncontrolled) + packet.Worldstates.emplace_back(1843, 1); // gold mine (1 - uncontrolled) + packet.Worldstates.emplace_back(1844, 1); // lumber mill (1 - uncontrolled) + packet.Worldstates.emplace_back(1845, 1); // farm (1 - uncontrolled) + packet.Worldstates.emplace_back(1846, 1); // blacksmith (1 - uncontrolled) + packet.Worldstates.emplace_back(1861, 2); // unk + packet.Worldstates.emplace_back(1955, 1800); // warning limit (1800) } break; - case 3820: // Eye of the Storm - if (bg && bg->GetTypeID(true) == BATTLEGROUND_EY) - bg->FillInitialWorldStates(data); + case 3820: // Eye of the Storm + if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_EY) + battleground->FillInitialWorldStates(packet); 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.emplace_back(2753, 0); // Horde Bases + packet.Worldstates.emplace_back(2752, 0); // Alliance Bases + packet.Worldstates.emplace_back(2742, 0); // Mage Tower - Horde conflict + packet.Worldstates.emplace_back(2741, 0); // Mage Tower - Alliance conflict + packet.Worldstates.emplace_back(2740, 0); // Fel Reaver - Horde conflict + packet.Worldstates.emplace_back(2739, 0); // Fel Reaver - Alliance conflict + packet.Worldstates.emplace_back(2738, 0); // Draenei - Alliance conflict + packet.Worldstates.emplace_back(2737, 0); // Draenei - Horde conflict + packet.Worldstates.emplace_back(2736, 0); // unk (0 at start) + packet.Worldstates.emplace_back(2735, 0); // unk (0 at start) + packet.Worldstates.emplace_back(2733, 0); // Draenei - Horde control + packet.Worldstates.emplace_back(2732, 0); // Draenei - Alliance control + packet.Worldstates.emplace_back(2731, 1); // Draenei uncontrolled (1 - yes, 0 - no) + packet.Worldstates.emplace_back(2730, 0); // Mage Tower - Alliance control + packet.Worldstates.emplace_back(2729, 0); // Mage Tower - Horde control + packet.Worldstates.emplace_back(2728, 1); // Mage Tower uncontrolled (1 - yes, 0 - no) + packet.Worldstates.emplace_back(2727, 0); // Fel Reaver - Horde control + packet.Worldstates.emplace_back(2726, 0); // Fel Reaver - Alliance control + packet.Worldstates.emplace_back(2725, 1); // Fel Reaver uncontrolled (1 - yes, 0 - no) + packet.Worldstates.emplace_back(2724, 0); // Boold Elf - Horde control + packet.Worldstates.emplace_back(2723, 0); // Boold Elf - Alliance control + packet.Worldstates.emplace_back(2722, 1); // Boold Elf uncontrolled (1 - yes, 0 - no) + packet.Worldstates.emplace_back(2757, 1); // Flag (1 - show, 0 - hide) - doesn't work exactly this way! + packet.Worldstates.emplace_back(2770, 1); // Horde top-stats (1 - show, 0 - hide) // 02 -> horde picked up the flag + packet.Worldstates.emplace_back(2769, 1); // Alliance top-stats (1 - show, 0 - hide) // 02 -> alliance picked up the flag + packet.Worldstates.emplace_back(2750, 0); // Horde resources + packet.Worldstates.emplace_back(2749, 0); // Alliance resources + packet.Worldstates.emplace_back(2565, 142); // unk, constant? + packet.Worldstates.emplace_back(2720, 0); // Capturing progress-bar (100 -> empty (only grey), 0 -> blue|red (no grey), default 0) + packet.Worldstates.emplace_back(2719, 0); // Capturing progress-bar (0 - left, 100 - right) + packet.Worldstates.emplace_back(2718, 0); // Capturing progress-bar (1 - show, 0 - hide) + packet.Worldstates.emplace_back(3085, 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.emplace_back(2490, 1); // add ally tower main gui icon + packet.Worldstates.emplace_back(2489, 1); // add horde tower main gui icon + packet.Worldstates.emplace_back(2485, 0); // show neutral broken hill icon + packet.Worldstates.emplace_back(2484, 1); // show icon above broken hill + packet.Worldstates.emplace_back(2483, 0); // show ally broken hill icon + packet.Worldstates.emplace_back(2482, 0); // show neutral overlook icon + packet.Worldstates.emplace_back(2481, 1); // show the overlook arrow + packet.Worldstates.emplace_back(2480, 0); // show ally overlook icon + packet.Worldstates.emplace_back(2478, 0); // horde pvp objectives captured + packet.Worldstates.emplace_back(2476, 0); // ally pvp objectives captured + packet.Worldstates.emplace_back(2475, 100); // horde slider grey area + packet.Worldstates.emplace_back(2474, 50); // horde slider percentage, 100 for ally, 0 for horde + packet.Worldstates.emplace_back(2473, 0); // horde slider display + packet.Worldstates.emplace_back(2472, 0); // show the neutral stadium icon + packet.Worldstates.emplace_back(2471, 0); // show the ally stadium icon + packet.Worldstates.emplace_back(2470, 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 { - 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.emplace_back(2503, 0); // NA_UI_HORDE_GUARDS_SHOW + packet.Worldstates.emplace_back(2502, 0); // NA_UI_ALLIANCE_GUARDS_SHOW + packet.Worldstates.emplace_back(2493, 0); // NA_UI_GUARDS_MAX + packet.Worldstates.emplace_back(2491, 0); // NA_UI_GUARDS_LEFT + packet.Worldstates.emplace_back(2495, 0); // NA_UI_OUTLAND_01 + packet.Worldstates.emplace_back(2494, 0); // NA_UI_UNK_1 + packet.Worldstates.emplace_back(2497, 0); // NA_UI_UNK_2 + packet.Worldstates.emplace_back(2762, 0); // NA_MAP_WYVERN_NORTH_NEU_H + packet.Worldstates.emplace_back(2662, 0); // NA_MAP_WYVERN_NORTH_NEU_A + packet.Worldstates.emplace_back(2663, 0); // NA_MAP_WYVERN_NORTH_H + packet.Worldstates.emplace_back(2664, 0); // NA_MAP_WYVERN_NORTH_A + packet.Worldstates.emplace_back(2760, 0); // NA_MAP_WYVERN_SOUTH_NEU_H + packet.Worldstates.emplace_back(2670, 0); // NA_MAP_WYVERN_SOUTH_NEU_A + packet.Worldstates.emplace_back(2668, 0); // NA_MAP_WYVERN_SOUTH_H + packet.Worldstates.emplace_back(2669, 0); // NA_MAP_WYVERN_SOUTH_A + packet.Worldstates.emplace_back(2761, 0); // NA_MAP_WYVERN_WEST_NEU_H + packet.Worldstates.emplace_back(2667, 0); // NA_MAP_WYVERN_WEST_NEU_A + packet.Worldstates.emplace_back(2665, 0); // NA_MAP_WYVERN_WEST_H + packet.Worldstates.emplace_back(2666, 0); // NA_MAP_WYVERN_WEST_A + packet.Worldstates.emplace_back(2763, 0); // NA_MAP_WYVERN_EAST_NEU_H + packet.Worldstates.emplace_back(2659, 0); // NA_MAP_WYVERN_EAST_NEU_A + packet.Worldstates.emplace_back(2660, 0); // NA_MAP_WYVERN_EAST_H + packet.Worldstates.emplace_back(2661, 0); // NA_MAP_WYVERN_EAST_A + packet.Worldstates.emplace_back(2671, 0); // NA_MAP_HALAA_NEUTRAL + packet.Worldstates.emplace_back(2676, 0); // NA_MAP_HALAA_NEU_A + packet.Worldstates.emplace_back(2677, 0); // NA_MAP_HALAA_NEU_H + packet.Worldstates.emplace_back(2672, 0); // NA_MAP_HALAA_HORDE + packet.Worldstates.emplace_back(2673, 0); // NA_MAP_HALAA_ALLIANCE } break; - case 3519: // Terokkar Forest - if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_TF) - pvp->FillInitialWorldStates(data); + case 3519: // Terokkar Forest + if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_TF) + 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.emplace_back(2625, 0); // TF_UI_CAPTURE_BAR_POS + packet.Worldstates.emplace_back(2624, 20); // TF_UI_CAPTURE_BAR_NEUTRAL + packet.Worldstates.emplace_back(2623, 0); // TF_UI_SHOW CAPTURE BAR + packet.Worldstates.emplace_back(2622, 0); // TF_UI_TOWER_COUNT_H + packet.Worldstates.emplace_back(2621, 5); // TF_UI_TOWER_COUNT_A + packet.Worldstates.emplace_back(2620, 0); // TF_UI_TOWERS_CONTROLLED_DISPLAY + packet.Worldstates.emplace_back(2696, 0); // TF_TOWER_NUM_15 - SE Neutral + packet.Worldstates.emplace_back(2695, 0); // TF_TOWER_NUM_14 - SE Horde + packet.Worldstates.emplace_back(2694, 0); // TF_TOWER_NUM_13 - SE Alliance + packet.Worldstates.emplace_back(2693, 0); // TF_TOWER_NUM_12 - S Neutral + packet.Worldstates.emplace_back(2692, 0); // TF_TOWER_NUM_11 - S Horde + packet.Worldstates.emplace_back(2691, 0); // TF_TOWER_NUM_10 - S Alliance + packet.Worldstates.emplace_back(2690, 0); // TF_TOWER_NUM_09 - NE Neutral + packet.Worldstates.emplace_back(2689, 0); // TF_TOWER_NUM_08 - NE Horde + packet.Worldstates.emplace_back(2688, 0); // TF_TOWER_NUM_07 - NE Alliance + packet.Worldstates.emplace_back(2687, 0); // TF_TOWER_NUM_16 - unk + packet.Worldstates.emplace_back(2686, 0); // TF_TOWER_NUM_06 - N Neutral + packet.Worldstates.emplace_back(2685, 0); // TF_TOWER_NUM_05 - N Horde + packet.Worldstates.emplace_back(2684, 0); // TF_TOWER_NUM_04 - N Alliance + packet.Worldstates.emplace_back(2683, 0); // TF_TOWER_NUM_03 - NW Alliance + packet.Worldstates.emplace_back(2682, 0); // TF_TOWER_NUM_02 - NW Horde + packet.Worldstates.emplace_back(2681, 0); // TF_TOWER_NUM_01 - NW Neutral + packet.Worldstates.emplace_back(2512, 5); // TF_UI_LOCKED_TIME_MINUTES_FIRST_DIGIT + packet.Worldstates.emplace_back(2510, 0); // TF_UI_LOCKED_TIME_MINUTES_SECOND_DIGIT + packet.Worldstates.emplace_back(2509, 0); // TF_UI_LOCKED_TIME_HOURS + packet.Worldstates.emplace_back(2508, 0); // TF_UI_LOCKED_DISPLAY_NEUTRAL + packet.Worldstates.emplace_back(2768, 0); // TF_UI_LOCKED_DISPLAY_HORDE + packet.Worldstates.emplace_back(2767, 1); // TF_UI_LOCKED_DISPLAY_ALLIANCE } break; - case 3521: // Zangarmarsh - if (pvp && pvp->GetTypeId() == OUTDOOR_PVP_ZM) - pvp->FillInitialWorldStates(data); + case 3521: // Zangarmarsh + if (outdoorPvP && outdoorPvP->GetTypeId() == OUTDOOR_PVP_ZM) + outdoorPvP->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.emplace_back(2529, 0); // ZM_UNK_1 + packet.Worldstates.emplace_back(2528, 0); // ZM_UNK_2 + packet.Worldstates.emplace_back(2527, 0); // ZM_UNK_3 + packet.Worldstates.emplace_back(2653, 1); // ZM_WORLDSTATE_UNK_1 + packet.Worldstates.emplace_back(2652, 0); // ZM_MAP_TOWER_EAST_N + packet.Worldstates.emplace_back(2651, 1); // ZM_MAP_TOWER_EAST_H + packet.Worldstates.emplace_back(2650, 0); // ZM_MAP_TOWER_EAST_A + packet.Worldstates.emplace_back(2649, 1); // ZM_MAP_GRAVEYARD_H - Twin spire graveyard horde + packet.Worldstates.emplace_back(2648, 0); // ZM_MAP_GRAVEYARD_A + packet.Worldstates.emplace_back(2647, 0); // ZM_MAP_GRAVEYARD_N + packet.Worldstates.emplace_back(2646, 0); // ZM_MAP_TOWER_WEST_N + packet.Worldstates.emplace_back(2645, 1); // ZM_MAP_TOWER_WEST_H + packet.Worldstates.emplace_back(2644, 0); // ZM_MAP_TOWER_WEST_A + packet.Worldstates.emplace_back(2535, 0); // ZM_UNK_4 + packet.Worldstates.emplace_back(2534, 0); // ZM_UNK_5 + packet.Worldstates.emplace_back(2533, 0); // ZM_UNK_6 + packet.Worldstates.emplace_back(2560, 0); // ZM_UI_TOWER_EAST_N + packet.Worldstates.emplace_back(2559, 1); // ZM_UI_TOWER_EAST_H + packet.Worldstates.emplace_back(2558, 0); // ZM_UI_TOWER_EAST_A + packet.Worldstates.emplace_back(2557, 0); // ZM_UI_TOWER_WEST_N + packet.Worldstates.emplace_back(2556, 1); // ZM_UI_TOWER_WEST_H + packet.Worldstates.emplace_back(2555, 0); // ZM_UI_TOWER_WEST_A + packet.Worldstates.emplace_back(2658, 0); // ZM_MAP_HORDE_FLAG_READY + packet.Worldstates.emplace_back(2657, 1); // ZM_MAP_HORDE_FLAG_NOT_READY + packet.Worldstates.emplace_back(2656, 1); // ZM_MAP_ALLIANCE_FLAG_NOT_READY + packet.Worldstates.emplace_back(2655, 0); // ZM_MAP_ALLIANCE_FLAG_READY } break; - case 3698: // Nagrand Arena - if (bg && bg->GetTypeID(true) == BATTLEGROUND_NA) - bg->FillInitialWorldStates(data); + case 3698: // Nagrand Arena + if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_NA) + 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.emplace_back(2575, 0); // BATTLEGROUND_NAGRAND_ARENA_GOLD + packet.Worldstates.emplace_back(2576, 0); // BATTLEGROUND_NAGRAND_ARENA_GREEN + packet.Worldstates.emplace_back(2577, 0); // BATTLEGROUND_NAGRAND_ARENA_SHOW } break; - case 3702: // Blade's Edge Arena - if (bg && bg->GetTypeID(true) == BATTLEGROUND_BE) - bg->FillInitialWorldStates(data); + case 3702: // Blade's Edge Arena + if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_BE) + 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.emplace_back(2544, 0); // BATTLEGROUND_BLADES_EDGE_ARENA_GOLD + packet.Worldstates.emplace_back(2545, 0); // BATTLEGROUND_BLADES_EDGE_ARENA_GREEN + packet.Worldstates.emplace_back(2547, 0); // BATTLEGROUND_BLADES_EDGE_ARENA_SHOW } break; - case 3968: // Ruins of Lordaeron - if (bg && bg->GetTypeID(true) == BATTLEGROUND_RL) - bg->FillInitialWorldStates(data); + case 3968: // Ruins of Lordaeron + if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_RL) + 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.emplace_back(3000, 0); // BATTELGROUND_RUINS_OF_LORDAERNON_GOLD + packet.Worldstates.emplace_back(3001, 0); // BATTELGROUND_RUINS_OF_LORDAERNON_GREEN + packet.Worldstates.emplace_back(3002, 0); // BATTELGROUND_RUINS_OF_LORDAERNON_SHOW } break; - case 4378: // Dalaran Sewers - if (bg && bg->GetTypeID(true) == BATTLEGROUND_DS) - bg->FillInitialWorldStates(data); + case 4378: // Dalaran Sewers + if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_DS) + battleground->FillInitialWorldStates(packet); else { - data << uint32(3601) << uint32(0x0); // 7 gold - data << uint32(3600) << uint32(0x0); // 8 green - data << uint32(3610) << uint32(0x0); // 9 show + packet.Worldstates.emplace_back(3601, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD + packet.Worldstates.emplace_back(3600, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN + packet.Worldstates.emplace_back(3610, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_SHOW } break; - case 4384: // Strand of the Ancients - if (bg && bg->GetTypeID(true) == BATTLEGROUND_SA) - bg->FillInitialWorldStates(data); + case 4384: // Strand of the Ancients + if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_SA) + battleground->FillInitialWorldStates(packet); else { - // 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 - - 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... + packet.Worldstates.emplace_back(3849, 0); // Gate of Temple + packet.Worldstates.emplace_back(3638, 0); // Gate of Yellow Moon + packet.Worldstates.emplace_back(3623, 0); // Gate of Green Emerald + packet.Worldstates.emplace_back(3620, 0); // Gate of Blue Sapphire + packet.Worldstates.emplace_back(3617, 0); // Gate of Red Sun + packet.Worldstates.emplace_back(3614, 0); // Gate of Purple Ametyst + packet.Worldstates.emplace_back(3571, 0); // bonus timer (1 - on, 0 - off) + packet.Worldstates.emplace_back(3565, 0); // Horde Attacker + packet.Worldstates.emplace_back(3564, 0); // Alliance Attacker + + // End Round timer, example: 19:59 -> A:BC + packet.Worldstates.emplace_back(3561, 0); // C + packet.Worldstates.emplace_back(3560, 0); // B + packet.Worldstates.emplace_back(3559, 0); // A + + packet.Worldstates.emplace_back(3637, 0); // BG_SA_CENTER_GY_ALLIANCE + packet.Worldstates.emplace_back(3636, 0); // BG_SA_RIGHT_GY_ALLIANCE + packet.Worldstates.emplace_back(3635, 0); // BG_SA_LEFT_GY_ALLIANCE + packet.Worldstates.emplace_back(3634, 0); // BG_SA_CENTER_GY_HORDE + packet.Worldstates.emplace_back(3633, 0); // BG_SA_LEFT_GY_HORDE + packet.Worldstates.emplace_back(3632, 0); // BG_SA_RIGHT_GY_HORDE + packet.Worldstates.emplace_back(3631, 0); // BG_SA_HORDE_DEFENCE_TOKEN + packet.Worldstates.emplace_back(3630, 0); // BG_SA_ALLIANCE_DEFENCE_TOKEN + packet.Worldstates.emplace_back(3629, 0); // BG_SA_LEFT_ATT_TOKEN_HRD + packet.Worldstates.emplace_back(3628, 0); // BG_SA_RIGHT_ATT_TOKEN_HRD + packet.Worldstates.emplace_back(3627, 0); // BG_SA_RIGHT_ATT_TOKEN_ALL + packet.Worldstates.emplace_back(3626, 0); // BG_SA_LEFT_ATT_TOKEN_ALL + // missing unknowns } break; - case 4406: // Ring of Valor - if (bg && bg->GetTypeID(true) == BATTLEGROUND_RV) - bg->FillInitialWorldStates(data); + case 4406: // Ring of Valor + if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_RV) + battleground->FillInitialWorldStates(packet); else { - data << uint32(0xe10) << uint32(0x0); // 7 gold - data << uint32(0xe11) << uint32(0x0); // 8 green - data << uint32(0xe1a) << uint32(0x0); // 9 show + packet.Worldstates.emplace_back(3600, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_GREEN + packet.Worldstates.emplace_back(3601, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_GOLD + packet.Worldstates.emplace_back(3610, 0); // ARENA_WORLD_STATE_ALIVE_PLAYERS_SHOW } break; - case 4710: - if (bg && bg->GetTypeID(true) == BATTLEGROUND_IC) - bg->FillInitialWorldStates(data); + case 4710: // Isle of Conquest + if (battleground && battleground->GetTypeID(true) == BATTLEGROUND_IC) + battleground->FillInitialWorldStates(packet); 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 - - 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(4221, 1); // BG_IC_ALLIANCE_RENFORT_SET + packet.Worldstates.emplace_back(4222, 1); // BG_IC_HORDE_RENFORT_SET + packet.Worldstates.emplace_back(4226, 300); // BG_IC_ALLIANCE_RENFORT + packet.Worldstates.emplace_back(4227, 300); // BG_IC_HORDE_RENFORT + packet.Worldstates.emplace_back(4322, 1); // BG_IC_GATE_FRONT_H_WS_OPEN + packet.Worldstates.emplace_back(4321, 1); // BG_IC_GATE_WEST_H_WS_OPEN + packet.Worldstates.emplace_back(4320, 1); // BG_IC_GATE_EAST_H_WS_OPEN + packet.Worldstates.emplace_back(4323, 1); // BG_IC_GATE_FRONT_A_WS_OPEN + packet.Worldstates.emplace_back(4324, 1); // BG_IC_GATE_WEST_A_WS_OPEN + packet.Worldstates.emplace_back(4325, 1); // BG_IC_GATE_EAST_A_WS_OPEN + packet.Worldstates.emplace_back(4317, 1); // unk + packet.Worldstates.emplace_back(4301, 1); // BG_IC_DOCKS_UNCONTROLLED + packet.Worldstates.emplace_back(4296, 1); // BG_IC_HANGAR_UNCONTROLLED + packet.Worldstates.emplace_back(4306, 1); // BG_IC_QUARRY_UNCONTROLLED + packet.Worldstates.emplace_back(4311, 1); // BG_IC_REFINERY_UNCONTROLLED + packet.Worldstates.emplace_back(4294, 1); // BG_IC_WORKSHOP_UNCONTROLLED + packet.Worldstates.emplace_back(4243, 1); // unk + packet.Worldstates.emplace_back(4345, 1); // unk } break; - // The Ruby Sanctum - case 4987: - if (instance && mapid == 724) - instance->FillInitialWorldStates(data); + case 4987: // The Ruby Sanctum + if (instance) + instance->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.emplace_back(5049, 50); // WORLDSTATE_CORPOREALITY_MATERIAL + packet.Worldstates.emplace_back(5050, 50); // WORLDSTATE_CORPOREALITY_TWILIGHT + packet.Worldstates.emplace_back(5051, 0); // WORLDSTATE_CORPOREALITY_TOGGLE } break; - // Icecrown Citadel - case 4812: - if (instance && mapid == 631) - instance->FillInitialWorldStates(data); + case 4812: // Icecrown Citadel + if (instance) + instance->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.emplace_back(4903, 0); // WORLDSTATE_SHOW_TIMER (Blood Quickening weekly) + packet.Worldstates.emplace_back(4904, 30); // WORLDSTATE_EXECUTION_TIME + packet.Worldstates.emplace_back(4940, 0); // WORLDSTATE_SHOW_ATTEMPTS + packet.Worldstates.emplace_back(4941, 50); // WORLDSTATE_ATTEMPTS_REMAINING + packet.Worldstates.emplace_back(4942, 50); // WORLDSTATE_ATTEMPTS_MAX } break; - // The Culling of Stratholme - case 4100: - if (instance && mapid == 595) - instance->FillInitialWorldStates(data); + case 4100: // The Culling of Stratholme + 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.emplace_back(3479, 0); // WORLDSTATE_SHOW_CRATES + packet.Worldstates.emplace_back(3480, 0); // WORLDSTATE_CRATES_REVEALED + packet.Worldstates.emplace_back(3504, 0); // WORLDSTATE_WAVE_COUNT + packet.Worldstates.emplace_back(3931, 25); // WORLDSTATE_TIME_GUARDIAN + packet.Worldstates.emplace_back(3932, 0); // WORLDSTATE_TIME_GUARDIAN_SHOW } break; - // The Oculus - case 4228: - if (instance && mapid == 578) - instance->FillInitialWorldStates(data); + case 4228: // The Oculus + if (instance) + 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.emplace_back(3524, 0); // WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW + packet.Worldstates.emplace_back(3486, 0); // WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT } break; - // Ulduar - case 4273: - if (instance && mapid == 603) - instance->FillInitialWorldStates(data); + case 4273: // Ulduar + if (instance) + 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.emplace_back(4132, 0); // WORLDSTATE_ALGALON_TIMER_ENABLED + packet.Worldstates.emplace_back(4131, 0); // WORLDSTATE_ALGALON_DESPAWN_TIMER } break; - // Violet Hold - case 4415: - if (instance && mapid == 608) - instance->FillInitialWorldStates(data); + case 4415: // Violet Hold + if (instance) + instance->FillInitialWorldStates(packet); else { - data << uint32(3816) << uint32(0); // 9 WORLD_STATE_VH_SHOW - data << uint32(3815) << uint32(100); // 10 WORLD_STATE_VH_PRISON_STATE - data << uint32(3810) << uint32(0); // 11 WORLD_STATE_VH_WAVE_COUNT + packet.Worldstates.emplace_back(3816, 0); // WORLD_STATE_VH_SHOW + packet.Worldstates.emplace_back(3815, 100); // WORLD_STATE_VH_PRISON_STATE + packet.Worldstates.emplace_back(3810, 0); // WORLD_STATE_VH_WAVE_COUNT } break; - // Halls of Refection - case 4820: - if (instance && mapid == 668) - instance->FillInitialWorldStates(data); + case 4820: // Halls of Refection + if (instance) + 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.emplace_back(4884, 0); // WORLD_STATE_HOR_WAVES_ENABLED + packet.Worldstates.emplace_back(4882, 0); // WORLD_STATE_HOR_WAVE_COUNT } break; - // Wintergrasp - case 4197: - if (bf && bf->GetTypeId() == BATTLEFIELD_WG) + case 4197: // Wintergrasp + if (battlefield && battlefield->GetTypeId() == BATTLEFIELD_WG) + battlefield->FillInitialWorldStates(packet); + else { - bf->FillInitialWorldStates(data); - break; } - // No break here, intended. + break; 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 break; } - uint16 length = (data.wpos() - countPos) / 8; - data.put<uint16>(countPos, length); - - SendDirectMessage(&data); + SendDirectMessage(packet.Write()); SendBGWeekendWorldStates(); SendBattlefieldWorldStates(); } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index e31f9f7d3b4..337149a5082 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1852,7 +1852,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> void SetEquipmentSet(EquipmentSetInfo::EquipmentSetData const& 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() const; diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index 6b878ab1205..6fd35f7c556 100644 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -31,6 +31,14 @@ #define OUT_LOAD_INST_DATA_COMPLETE TC_LOG_DEBUG("scripts", "Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) #define OUT_LOAD_INST_DATA_FAIL TC_LOG_ERROR("scripts", "Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +namespace WorldPackets +{ + namespace WorldState + { + class InitWorldStates; + } +} + class AreaBoundary; class Creature; class GameObject; @@ -249,7 +257,7 @@ class TC_GAME_API InstanceScript : public ZoneScript 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 7e0738fa432..1ad70f1e9a3 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.h +++ b/src/server/game/OutdoorPvP/OutdoorPvP.h @@ -66,6 +66,14 @@ struct creature_type Position pos; }; +namespace WorldPackets +{ + namespace WorldState + { + class InitWorldStates; + } +} + class Creature; class GameObject; class Map; @@ -83,7 +91,7 @@ class TC_GAME_API OPvPCapturePoint virtual ~OPvPCapturePoint() { } - 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); @@ -193,7 +201,7 @@ class TC_GAME_API OutdoorPvP : public ZoneScript typedef std::pair<ObjectGuid::LowType, GameObject*> GoScriptPair; typedef std::pair<ObjectGuid::LowType, Creature*> CreatureScriptPair; - virtual void FillInitialWorldStates(WorldPacket & /*data*/) { } + virtual void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& /*packet*/) { } // called when a player triggers an areatrigger virtual bool HandleAreaTrigger(Player* player, uint32 trigger); 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 180ffd49929..d30f45e8bc2 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 @@ -15,18 +15,19 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptMgr.h" +#include "culling_of_stratholme.h" #include "CreatureAI.h" #include "CreatureTextMgr.h" -#include "culling_of_stratholme.h" #include "EventMap.h" #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" #include "MotionMaster.h" #include "Player.h" +#include "ScriptMgr.h" #include "SpellInfo.h" #include "TemporarySummon.h" +#include "WorldStatePackets.h" /* Culling of Stratholme encounters: 0 - Meathook @@ -71,13 +72,13 @@ class instance_culling_of_stratholme : public InstanceMapScript _infiniteCouterState = NOT_STARTED; } - void FillInitialWorldStates(WorldPacket& data) override + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override { - data << uint32(WORLDSTATE_SHOW_CRATES) << uint32(1); - 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.emplace_back(WORLDSTATE_SHOW_CRATES, 1); + 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 OnCreatureCreate(Creature* creature) override diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp index 634b9ca32f2..97a41464fe5 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp @@ -209,21 +209,6 @@ class boss_skeram : public CreatureScript } }; -class PlayerOrPetCheck -{ - public: - bool operator()(WorldObject* object) const - { - if (object->GetTypeId() == TYPEID_PLAYER) - return false; - - if (Creature* creature = object->ToCreature()) - return !creature->IsPet(); - - return true; - } -}; - // 26192 - Arcane Explosion class spell_skeram_arcane_explosion : public SpellScriptLoader { @@ -236,7 +221,16 @@ class spell_skeram_arcane_explosion : public SpellScriptLoader void FilterTargets(std::list<WorldObject*>& targets) { - targets.remove_if(PlayerOrPetCheck()); + targets.remove_if([](WorldObject* object) -> bool + { + if (object->GetTypeId() == TYPEID_PLAYER) + return false; + + if (Creature* creature = object->ToCreature()) + return !creature->IsPet(); + + return true; + }); } void Register() 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 72269798a8a..8f783a5073f 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp @@ -15,15 +15,15 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptMgr.h" +#include "ruby_sanctum.h" #include "AreaBoundary.h" #include "CreatureAI.h" #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" -#include "ruby_sanctum.h" +#include "ScriptMgr.h" #include "TemporarySummon.h" -#include "WorldPacket.h" +#include "WorldStatePackets.h" Position const HalionControllerSpawnPos = { 3156.037f, 533.2656f, 72.97205f, 0.0f }; @@ -197,11 +197,11 @@ class instance_ruby_sanctum : public InstanceMapScript return BaltharusSharedHealth; } - 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.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 adaa87f184f..fbab443f327 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,15 +15,15 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptMgr.h" #include "halls_of_reflection.h" #include "InstanceScript.h" #include "Map.h" #include "Player.h" #include "ScriptedCreature.h" +#include "ScriptMgr.h" #include "TemporarySummon.h" #include "Transport.h" -#include "WorldPacket.h" +#include "WorldStatePackets.h" Position const JainaSpawnPos = { 5236.659f, 1929.894f, 707.7781f, 0.8726646f }; // Jaina Spawn Position Position const SylvanasSpawnPos = { 5236.667f, 1929.906f, 707.7781f, 0.8377581f }; // Sylvanas Spawn Position (sniffed) @@ -290,10 +290,10 @@ class instance_halls_of_reflection : public InstanceMapScript } } - void FillInitialWorldStates(WorldPacket& data) override + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override { - data << uint32(WORLD_STATE_HOR_WAVES_ENABLED) << uint32(_introState == DONE && GetBossState(DATA_MARWYN) != DONE); - data << uint32(WORLD_STATE_HOR_WAVE_COUNT) << uint32(_waveCount); + packet.Worldstates.emplace_back(WORLD_STATE_HOR_WAVES_ENABLED, (_introState == DONE && GetBossState(DATA_MARWYN) != DONE) ? 1 : 0); + packet.Worldstates.emplace_back(WORLD_STATE_HOR_WAVE_COUNT, _waveCount); } bool SetBossState(uint32 type, EncounterState state) override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 024dd39f462..3f6f2f59f6e 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -15,19 +15,19 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptMgr.h" +#include "icecrown_citadel.h" #include "AreaBoundary.h" #include "CreatureAI.h" -#include "icecrown_citadel.h" #include "InstanceScript.h" #include "Map.h" #include "ObjectMgr.h" #include "Player.h" #include "PoolMgr.h" +#include "ScriptMgr.h" #include "TemporarySummon.h" #include "Transport.h" #include "TransportMgr.h" -#include "WorldPacket.h" +#include "WorldStatePackets.h" enum EventIds { @@ -166,13 +166,13 @@ class instance_icecrown_citadel : public InstanceMapScript } } - void FillInitialWorldStates(WorldPacket& data) override + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override { - data << uint32(WORLDSTATE_SHOW_TIMER) << uint32(BloodQuickeningState == IN_PROGRESS); - data << uint32(WORLDSTATE_EXECUTION_TIME) << uint32(BloodQuickeningMinutes); - data << uint32(WORLDSTATE_SHOW_ATTEMPTS) << uint32(instance->IsHeroic()); - data << uint32(WORLDSTATE_ATTEMPTS_REMAINING) << uint32(HeroicAttempts); - data << uint32(WORLDSTATE_ATTEMPTS_MAX) << uint32(MaxHeroicAttempts); + 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, instance->IsHeroic() ? 1 : 0); + packet.Worldstates.emplace_back(WORLDSTATE_ATTEMPTS_REMAINING, HeroicAttempts); + packet.Worldstates.emplace_back(WORLDSTATE_ATTEMPTS_MAX, MaxHeroicAttempts); } void OnPlayerEnter(Player* player) override diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp index f2a32072a00..feb075aaf85 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp @@ -15,16 +15,16 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptMgr.h" +#include "oculus.h" #include "Creature.h" #include "CreatureAI.h" #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" #include "MotionMaster.h" -#include "oculus.h" +#include "ScriptMgr.h" #include "TemporarySummon.h" -#include "WorldPacket.h" +#include "WorldStatePackets.h" DoorData const doorData[] = { @@ -145,17 +145,17 @@ class instance_oculus : public InstanceMapScript } } - void FillInitialWorldStates(WorldPacket& data) override + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override { if (GetBossState(DATA_DRAKOS) == DONE && GetBossState(DATA_VAROS) != DONE) { - data << uint32(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW) << uint32(1); - data << uint32(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT) << uint32(CentrifugueConstructCounter); + packet.Worldstates.emplace_back(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 1); + packet.Worldstates.emplace_back(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, CentrifugueConstructCounter); } else { - data << uint32(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW) << uint32(0); - data << uint32(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT) << uint32(0); + packet.Worldstates.emplace_back(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); + packet.Worldstates.emplace_back(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, 0); } } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp index 12820df6dbf..bc11a51c016 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp @@ -526,9 +526,18 @@ class spell_auriaya_sentinel_blast : public SpellScript { PrepareSpellScript(spell_auriaya_sentinel_blast); - void FilterTargets(std::list<WorldObject*>& unitList) + void FilterTargets(std::list<WorldObject*>& targets) { - unitList.remove_if(PlayerOrPetCheck()); + targets.remove_if([](WorldObject* object) -> bool + { + if (object->GetTypeId() == TYPEID_PLAYER) + return false; + + if (Creature* creature = object->ToCreature()) + return !creature->IsPet(); + + return true; + }); } void Register() override diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index 375dab28cf9..c32d16f5129 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -617,9 +617,18 @@ class spell_kologarn_stone_shout : public SpellScriptLoader { PrepareSpellScript(spell_kologarn_stone_shout_SpellScript); - void FilterTargets(std::list<WorldObject*>& unitList) + void FilterTargets(std::list<WorldObject*>& targets) { - unitList.remove_if(PlayerOrPetCheck()); + targets.remove_if([](WorldObject* object) -> bool + { + if (object->GetTypeId() == TYPEID_PLAYER) + return false; + + if (Creature* creature = object->ToCreature()) + return !creature->IsPet(); + + return true; + }); } void Register() override diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp index c69a542c873..cf200c689af 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp @@ -599,7 +599,7 @@ class boss_thorim : public CreatureScript events.ScheduleEvent(EVENT_OUTRO_2, _hardMode ? 8000 : 11000); events.ScheduleEvent(EVENT_OUTRO_3, _hardMode ? 19000 : 21000); - me->m_Events.AddEvent(new KeeperDespawnEvent(me), me->m_Events.CalculateTime(35000)); + me->m_Events.AddEvent(new UlduarKeeperDespawnEvent(me), me->m_Events.CalculateTime(35000)); } void MovementInform(uint32 type, uint32 id) override @@ -1730,9 +1730,18 @@ class spell_thorim_frostbolt_volley : public SpellScriptLoader { PrepareSpellScript(spell_thorim_frostbolt_volley_SpellScript); - void FilterTargets(std::list<WorldObject*>& unitList) + void FilterTargets(std::list<WorldObject*>& targets) { - unitList.remove_if(PlayerOrPetCheck()); + targets.remove_if([](WorldObject* object) -> bool + { + if (object->GetTypeId() == TYPEID_PLAYER) + return false; + + if (Creature* creature = object->ToCreature()) + return !creature->IsPet(); + + return true; + }); } void Register() override diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index a51a3ce8cd2..d974bd2b7e0 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -853,7 +853,16 @@ class spell_xt002_tympanic_tantrum : public SpellScript void FilterTargets(std::list<WorldObject*>& targets) { - targets.remove_if(PlayerOrPetCheck()); + targets.remove_if([](WorldObject* object) -> bool + { + if (object->GetTypeId() == TYPEID_PLAYER) + return false; + + if (Creature* creature = object->ToCreature()) + return !creature->IsPet(); + + return true; + }); } void RecalculateDamage() diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index efcecae2537..75e167cbf1d 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -15,7 +15,7 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptMgr.h" +#include "ulduar.h" #include "AreaBoundary.h" #include "CreatureAI.h" #include "GameObject.h" @@ -23,12 +23,12 @@ #include "Item.h" #include "Map.h" #include "Player.h" +#include "ScriptMgr.h" #include "Spell.h" #include "SpellScript.h" #include "TemporarySummon.h" -#include "ulduar.h" #include "Vehicle.h" -#include "WorldPacket.h" +#include "WorldStatePackets.h" static BossBoundaryData const boundaries = { @@ -142,6 +142,17 @@ ObjectData const objectData[] = { 0, 0 } }; +UlduarKeeperDespawnEvent::UlduarKeeperDespawnEvent(Creature* owner, uint32 despawnTimerOffset) : _owner(owner), _despawnTimer(despawnTimerOffset) +{ +} + +bool UlduarKeeperDespawnEvent::Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) +{ + _owner->CastSpell(_owner, SPELL_TELEPORT_KEEPER_VISUAL); + _owner->DespawnOrUnsummon(1000 + _despawnTimer); + return true; +} + class instance_ulduar : public InstanceMapScript { public: @@ -215,10 +226,10 @@ class instance_ulduar : public InstanceMapScript bool Unbroken; bool IsDriveMeCrazyEligible; - void FillInitialWorldStates(WorldPacket& packet) override + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override { - packet << uint32(WORLD_STATE_ALGALON_TIMER_ENABLED) << uint32(_algalonTimer && _algalonTimer <= 60); - packet << uint32(WORLD_STATE_ALGALON_DESPAWN_TIMER) << uint32(std::min<uint32>(_algalonTimer, 60)); + packet.Worldstates.emplace_back(WORLD_STATE_ALGALON_TIMER_ENABLED, (_algalonTimer && _algalonTimer <= 60) ? 1 : 0); + packet.Worldstates.emplace_back(WORLD_STATE_ALGALON_DESPAWN_TIMER, std::min<int32>(_algalonTimer, 60)); } void OnPlayerEnter(Player* player) override diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h index 2c75a2cc0cb..345bbfbcbed 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h @@ -19,6 +19,8 @@ #define DEF_ULDUAR_H #include "CreatureAIImpl.h" +#include "EventProcessor.h" +#include "Position.h" #define UlduarScriptName "instance_ulduar" #define DataHeader "UU" @@ -506,44 +508,26 @@ enum YoggSaronIllusions STORMWIND_ILLUSION = 2, }; -template <class AI, class T> -inline AI* GetUlduarAI(T* obj) -{ - return GetInstanceAI<AI, T>(obj, UlduarScriptName); -} - -#define RegisterUlduarCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetUlduarAI) +class Creature; -class KeeperDespawnEvent : public BasicEvent +class UlduarKeeperDespawnEvent : public BasicEvent { public: - KeeperDespawnEvent(Creature* owner, uint32 despawnTimerOffset = 500) : _owner(owner), _despawnTimer(despawnTimerOffset) { } + UlduarKeeperDespawnEvent(Creature* owner, uint32 despawnTimerOffset = 500); - bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) override - { - _owner->CastSpell(_owner, SPELL_TELEPORT_KEEPER_VISUAL); - _owner->DespawnOrUnsummon(1000 + _despawnTimer); - return true; - } + bool Execute(uint64 /*eventTime*/, uint32 /*updateTime*/) override; private: Creature* _owner; uint32 _despawnTimer; }; -class PlayerOrPetCheck +template <class AI, class T> +inline AI* GetUlduarAI(T* obj) { - public: - bool operator()(WorldObject* object) const - { - if (object->GetTypeId() == TYPEID_PLAYER) - return false; - - if (Creature* creature = object->ToCreature()) - return !creature->IsPet(); + return GetInstanceAI<AI, T>(obj, UlduarScriptName); +} - return true; - } -}; +#define RegisterUlduarCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetUlduarAI) #endif diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index fde6f9585ef..e665752c054 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -15,16 +15,16 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptMgr.h" +#include "violet_hold.h" #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" #include "MotionMaster.h" #include "Player.h" #include "ScriptedCreature.h" +#include "ScriptMgr.h" #include "TemporarySummon.h" -#include "violet_hold.h" -#include "WorldPacket.h" +#include "WorldStatePackets.h" /* * TODO: @@ -290,11 +290,11 @@ class instance_violet_hold : public InstanceMapScript } } - void FillInitialWorldStates(WorldPacket& data) override + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override { - data << uint32(WORLD_STATE_VH_SHOW) << uint32(EventState == IN_PROGRESS ? 1 : 0); - data << uint32(WORLD_STATE_VH_PRISON_STATE) << uint32(DoorIntegrity); - data << uint32(WORLD_STATE_VH_WAVE_COUNT) << uint32(WaveCount); + packet.Worldstates.emplace_back(WORLD_STATE_VH_SHOW, EventState == IN_PROGRESS ? 1 : 0); + packet.Worldstates.emplace_back(WORLD_STATE_VH_PRISON_STATE, DoorIntegrity); + packet.Worldstates.emplace_back(WORLD_STATE_VH_WAVE_COUNT, WaveCount); } bool CheckRequiredBosses(uint32 bossId, Player const* player = nullptr) const override diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.h b/src/server/scripts/Northrend/VioletHold/violet_hold.h index 601ce93a49e..283c620afc1 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.h +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.h @@ -19,6 +19,7 @@ #define VIOLET_HOLD_H_ #include "CreatureAIImpl.h" +#include "Position.h" #define VioletHoldScriptName "instance_violet_hold" #define DataHeader "VH" diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp index 86ea4b1fa21..b1df97b7883 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp @@ -15,39 +15,30 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "MapManager.h" -#include "ScriptMgr.h" #include "OutdoorPvPEP.h" -#include "WorldPacket.h" -#include "Player.h" +#include "Creature.h" #include "GameObject.h" -#include "ObjectMgr.h" +#include "GossipDef.h" +#include "MapManager.h" #include "ObjectAccessor.h" +#include "ObjectMgr.h" #include "OutdoorPvPMgr.h" -#include "Creature.h" -#include "GossipDef.h" +#include "ScriptMgr.h" +#include "Player.h" +#include "WorldStatePackets.h" uint32 const EP_AllianceBuffs[4] = { 11413, 11414, 11415, 1386 }; - uint32 const EP_HordeBuffs[4] = { 30880, 30683, 30682, 29520 }; - uint32 const EP_GraveyardZone = 139; - uint32 const EP_GraveyardId = 927; - uint8 const EPBuffZonesNum = 3; - uint32 const EP_EWT_CM = 17690; uint32 const EP_CGT_CM = 17689; uint32 const EP_NPT_CM = 17696; uint32 const EP_PWT_CM = 17698; - uint32 const EPBuffZones[EPBuffZonesNum] = { 139, 2017, 2057 }; - -/* -uint32 const EPTowerPlayerEnterEvents[EP_TOWER_NUM] = { 10691, 10699, 10701, 10705 }; -uint32 const EPTowerPlayerLeaveEvents[EP_TOWER_NUM] = { 10692, 10698, 10700, 10704 }; -*/ +//uint32 const EPTowerPlayerEnterEvents[EP_TOWER_NUM] = { 10691, 10699, 10701, 10705 }; +//uint32 const EPTowerPlayerLeaveEvents[EP_TOWER_NUM] = { 10692, 10698, 10700, 10704 }; go_type const EPCapturePoints[EP_TOWER_NUM] = { @@ -94,8 +85,7 @@ creature_type const EP_PWT_FlightMaster = { 17209, 0, { 2987.5f, -3049.11f, 120. // after spawning, modify the faction so that only the controller will be able to use it with SetUInt32Value(GAMEOBJECT_FACTION, faction_id); go_type const EP_NPT_LordaeronShrine = { 181682, 0, { 3167.72f, -4355.91f, 138.785f, 1.69297f }, { 0.0f, 0.0f, 0.748956f, 0.66262f } }; -OPvPCapturePointEP_EWT::OPvPCapturePointEP_EWT(OutdoorPvP* pvp) -: OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_UnitsSummonedSide(0) +OPvPCapturePointEP_EWT::OPvPCapturePointEP_EWT(OutdoorPvP* pvp) : OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_UnitsSummonedSide(0) { SetCapturePointData(EPCapturePoints[EP_EWT].entry, EPCapturePoints[EP_EWT].map, EPCapturePoints[EP_EWT].pos, EPCapturePoints[EP_EWT].rot); AddObject(EP_EWT_FLAGS, EPTowerFlags[EP_EWT].entry, EPTowerFlags[EP_EWT].map, EPTowerFlags[EP_EWT].pos, EPTowerFlags[EP_EWT].rot); @@ -154,13 +144,13 @@ void OPvPCapturePointEP_EWT::ChangeState() SendObjectiveComplete(EP_EWT_CM, ObjectGuid::Empty); } -void OPvPCapturePointEP_EWT::FillInitialWorldStates(WorldPacket &data) +void OPvPCapturePointEP_EWT::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << EP_EWT_A << uint32((m_TowerState & EP_TS_A) != 0); - data << EP_EWT_H << uint32((m_TowerState & EP_TS_H) != 0); - data << EP_EWT_N_A << uint32((m_TowerState & EP_TS_N_A) != 0); - data << EP_EWT_N_H << uint32((m_TowerState & EP_TS_N_H) != 0); - data << EP_EWT_N << uint32((m_TowerState & EP_TS_N) != 0); + 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() @@ -262,13 +252,13 @@ void OPvPCapturePointEP_NPT::ChangeState() SendObjectiveComplete(EP_NPT_CM, ObjectGuid::Empty); } -void OPvPCapturePointEP_NPT::FillInitialWorldStates(WorldPacket &data) +void OPvPCapturePointEP_NPT::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << EP_NPT_A << uint32((m_TowerState & EP_TS_A) != 0); - data << EP_NPT_H << uint32((m_TowerState & EP_TS_H) != 0); - data << EP_NPT_N_A << uint32((m_TowerState & EP_TS_N_A) != 0); - data << EP_NPT_N_H << uint32((m_TowerState & EP_TS_N_H) != 0); - data << EP_NPT_N << uint32((m_TowerState & EP_TS_N) != 0); + 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() @@ -357,13 +347,13 @@ void OPvPCapturePointEP_CGT::ChangeState() SendObjectiveComplete(EP_CGT_CM, ObjectGuid::Empty); } -void OPvPCapturePointEP_CGT::FillInitialWorldStates(WorldPacket &data) +void OPvPCapturePointEP_CGT::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << EP_CGT_A << uint32((m_TowerState & EP_TS_A) != 0); - data << EP_CGT_H << uint32((m_TowerState & EP_TS_H) != 0); - data << EP_CGT_N_A << uint32((m_TowerState & EP_TS_N_A) != 0); - data << EP_CGT_N_H << uint32((m_TowerState & EP_TS_N_H) != 0); - data << EP_CGT_N << uint32((m_TowerState & EP_TS_N) != 0); + 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() @@ -456,13 +446,13 @@ void OPvPCapturePointEP_PWT::ChangeState() SendObjectiveComplete(EP_PWT_CM, ObjectGuid::Empty); } -void OPvPCapturePointEP_PWT::FillInitialWorldStates(WorldPacket &data) +void OPvPCapturePointEP_PWT::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << EP_PWT_A << uint32((m_TowerState & EP_TS_A) != 0); - data << EP_PWT_H << uint32((m_TowerState & EP_TS_H) != 0); - data << EP_PWT_N_A << uint32((m_TowerState & EP_TS_N_A) != 0); - data << EP_PWT_N_H << uint32((m_TowerState & EP_TS_N_H) != 0); - data << EP_PWT_N << uint32((m_TowerState & EP_TS_N) != 0); + 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() @@ -628,13 +618,13 @@ void OutdoorPvPEP::SetControlledState(uint32 index, uint32 state) EP_Controls[index] = state; } -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; + packet.Worldstates.emplace_back(EP_UI_TOWER_COUNT_A, m_AllianceTowersControlled); + packet.Worldstates.emplace_back(EP_UI_TOWER_COUNT_H, m_HordeTowersControlled); for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) - itr->second->FillInitialWorldStates(data); + itr->second->FillInitialWorldStates(packet); } void OutdoorPvPEP::SendRemoveWorldStates(Player* player) diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h index bcc08469ba7..f0ed3d873e6 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h @@ -123,25 +123,39 @@ enum EP_TowerStates EP_TS_H = 64 }; -class OutdoorPvPEP; +class OutdoorPvPEP : public OutdoorPvP +{ + public: + OutdoorPvPEP(); + + bool SetupOutdoorPvP() override; + void HandlePlayerEnterZone(Player* player, uint32 zone) override; + void HandlePlayerLeaveZone(Player* player, uint32 zone) override; + bool Update(uint32 diff) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; + void SendRemoveWorldStates(Player* player) override; + + void BuffTeams(); + void SetControlledState(uint32 index, uint32 state); + + uint32 EP_Controls[EP_TOWER_NUM]; // how many towers are controlled + uint32 m_AllianceTowersControlled; + uint32 m_HordeTowersControlled; +}; class OPvPCapturePointEP_EWT : public OPvPCapturePoint { public: OPvPCapturePointEP_EWT(OutdoorPvP* pvp); - void ChangeState(); - - void FillInitialWorldStates(WorldPacket & data); + void ChangeState() override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; protected: void SummonSupportUnitAtNorthpassTower(uint32 team); - void UpdateTowerState(); - protected: uint32 m_TowerState; - uint32 m_UnitsSummonedSide; }; @@ -150,18 +164,14 @@ class OPvPCapturePointEP_NPT : public OPvPCapturePoint public: OPvPCapturePointEP_NPT(OutdoorPvP* pvp); - void ChangeState(); - - void FillInitialWorldStates(WorldPacket & data); + void ChangeState() override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; protected: void SummonGO(uint32 team); - void UpdateTowerState(); - protected: uint32 m_TowerState; - uint32 m_SummonedGOSide; }; @@ -170,18 +180,14 @@ class OPvPCapturePointEP_CGT : public OPvPCapturePoint public: OPvPCapturePointEP_CGT(OutdoorPvP* pvp); - void ChangeState(); - - void FillInitialWorldStates(WorldPacket & data); + void ChangeState() override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; protected: void LinkGraveyard(uint32 team); - void UpdateTowerState(); - protected: uint32 m_TowerState; - uint32 m_GraveyardSide; }; @@ -190,47 +196,15 @@ class OPvPCapturePointEP_PWT : public OPvPCapturePoint public: OPvPCapturePointEP_PWT(OutdoorPvP* pvp); - void ChangeState(); - - void FillInitialWorldStates(WorldPacket & data); + void ChangeState() override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; protected: void SummonFlightMaster(uint32 team); - void UpdateTowerState(); - protected: uint32 m_FlightMasterSpawned; - uint32 m_TowerState; }; -class OutdoorPvPEP : public OutdoorPvP -{ - public: - OutdoorPvPEP(); - - bool SetupOutdoorPvP(); - - void HandlePlayerEnterZone(Player* player, uint32 zone); - void HandlePlayerLeaveZone(Player* player, uint32 zone); - - bool Update(uint32 diff); - - void FillInitialWorldStates(WorldPacket &data); - - void SendRemoveWorldStates(Player* player); - - void BuffTeams(); - - void SetControlledState(uint32 index, uint32 state); - - private: - // how many towers are controlled - uint32 EP_Controls[EP_TOWER_NUM]; - - uint32 m_AllianceTowersControlled; - uint32 m_HordeTowersControlled; -}; - #endif diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp index a9b7f7b97a7..f44b9770656 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp @@ -15,29 +15,22 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptMgr.h" +#include "OutdoorPvPHP.h" #include "GameObject.h" #include "Map.h" -#include "OutdoorPvPHP.h" #include "OutdoorPvPMgr.h" #include "Player.h" -#include "WorldPacket.h" +#include "ScriptMgr.h" +#include "WorldStatePackets.h" uint32 const OutdoorPvPHPBuffZonesNum = 6; - // HP, citadel, ramparts, blood furnace, shattered halls, mag's lair -uint32 const OutdoorPvPHPBuffZones[OutdoorPvPHPBuffZonesNum] = { 3483, 3563, 3562, 3713, 3714, 3836 }; - +uint32 const OutdoorPvPHPBuffZones[OutdoorPvPHPBuffZonesNum] = { 3483, 3563, 3562, 3713, 3714, 3836 }; // HP, citadel, ramparts, blood furnace, shattered halls, mag's lair uint32 const HP_CREDITMARKER[HP_TOWER_NUM] = { 19032, 19028, 19029 }; - -/* -uint32 const HP_CapturePointEvent_Enter[HP_TOWER_NUM] = { 11404, 11396, 11388 }; -uint32 const HP_CapturePointEvent_Leave[HP_TOWER_NUM] = { 11403, 11395, 11387 }; -*/ - +//uint32 const HP_CapturePointEvent_Enter[HP_TOWER_NUM] = { 11404, 11396, 11388 }; +//uint32 const HP_CapturePointEvent_Leave[HP_TOWER_NUM] = { 11403, 11395, 11387 }; uint32 const HP_MAP_N[HP_TOWER_NUM] = { 0x9b5, 0x9b2, 0x9a8 }; uint32 const HP_MAP_A[HP_TOWER_NUM] = { 0x9b3, 0x9b0, 0x9a7 }; uint32 const HP_MAP_H[HP_TOWER_NUM] = { 0x9b4, 0x9b1, 0x9a6 }; - uint32 const HP_TowerArtKit_A[HP_TOWER_NUM] = { 65, 62, 67 }; uint32 const HP_TowerArtKit_H[HP_TOWER_NUM] = { 64, 61, 68 }; uint32 const HP_TowerArtKit_N[HP_TOWER_NUM] = { 66, 63, 69 }; @@ -59,13 +52,11 @@ go_type const HPTowerFlags[HP_TOWER_NUM] = uint32 const HP_LANG_CAPTURE_A[HP_TOWER_NUM] = { TEXT_BROKEN_HILL_TAKEN_ALLIANCE, TEXT_OVERLOOK_TAKEN_ALLIANCE, TEXT_STADIUM_TAKEN_ALLIANCE }; uint32 const HP_LANG_CAPTURE_H[HP_TOWER_NUM] = { TEXT_BROKEN_HILL_TAKEN_HORDE, TEXT_OVERLOOK_TAKEN_HORDE, TEXT_STADIUM_TAKEN_HORDE }; -OPvPCapturePointHP::OPvPCapturePointHP(OutdoorPvP* pvp, OutdoorPvPHPTowerType type) -: OPvPCapturePoint(pvp), m_TowerType(type) +OPvPCapturePointHP::OPvPCapturePointHP(OutdoorPvP* pvp, OutdoorPvPHPTowerType type) : OPvPCapturePoint(pvp), m_TowerType(type) { SetCapturePointData(HPCapturePoints[type].entry, HPCapturePoints[type].map, HPCapturePoints[type].pos, HPCapturePoints[type].rot); AddObject(type, HPTowerFlags[type].entry, HPTowerFlags[type].map, HPTowerFlags[type].pos, HPTowerFlags[type].rot); } - OutdoorPvPHP::OutdoorPvPHP() { m_TypeId = OUTDOOR_PVP_HP; @@ -156,15 +147,15 @@ 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); + 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); for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) - itr->second->FillInitialWorldStates(data); + itr->second->FillInitialWorldStates(packet); } void OPvPCapturePointHP::ChangeState() @@ -270,29 +261,29 @@ void OPvPCapturePointHP::ChangeState() SendObjectiveComplete(HP_CREDITMARKER[m_TowerType], ObjectGuid::Empty); } -void OPvPCapturePointHP::FillInitialWorldStates(WorldPacket &data) +void OPvPCapturePointHP::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { switch (m_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.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.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.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 7464a9dea84..ad96953b89e 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h @@ -61,8 +61,7 @@ class OPvPCapturePointHP : public OPvPCapturePoint OPvPCapturePointHP(OutdoorPvP* pvp, OutdoorPvPHPTowerType type); void ChangeState() override; - - void FillInitialWorldStates(WorldPacket & data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; private: OutdoorPvPHPTowerType m_TowerType; @@ -79,22 +78,17 @@ class OutdoorPvPHP : public OutdoorPvP void HandlePlayerLeaveZone(Player* player, uint32 zone) override; bool Update(uint32 diff) override; - - void FillInitialWorldStates(WorldPacket &data) override; - + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void SendRemoveWorldStates(Player* player) override; - void HandleKillImpl(Player* player, Unit* killed) override; uint32 GetAllianceTowersControlled() const; void SetAllianceTowersControlled(uint32 count); - uint32 GetHordeTowersControlled() const; void SetHordeTowersControlled(uint32 count); private: - // how many towers are controlled - uint32 m_AllianceTowersControlled; + uint32 m_AllianceTowersControlled; // how many towers are controlled uint32 m_HordeTowersControlled; }; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index f9f8172249b..f63f8849a77 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -15,33 +15,24 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptMgr.h" +#include "OutdoorPvPNA.h" #include "Creature.h" #include "GameObject.h" +#include "Map.h" #include "ObjectMgr.h" #include "OutdoorPvPMgr.h" -#include "OutdoorPvPNA.h" -#include "Map.h" #include "Player.h" -#include "WorldPacket.h" - - // kill credit for pks -uint32 const NA_CREDIT_MARKER = 24867; +#include "ScriptMgr.h" +#include "WorldStatePackets.h" +uint32 const NA_CREDIT_MARKER = 24867; // kill credit for pks uint32 const NA_GUARDS_MAX = 15; - uint32 const NA_BUFF_ZONE = 3518; - uint32 const NA_HALAA_GRAVEYARD = 993; - uint32 const NA_HALAA_GRAVEYARD_ZONE = 3518; // need to add zone id, not area id - uint32 const NA_RESPAWN_TIME = 3600000; // one hour to capture after defeating all guards - uint32 const NA_GUARD_CHECK_TIME = 500; // every half second - uint32 const FLIGHT_NODES_NUM = 4; - uint32 const FlightPathStartNodes[FLIGHT_NODES_NUM] = { 103, 105, 107, 109 }; uint32 const FlightPathEndNodes[FLIGHT_NODES_NUM] = { 104, 106, 108, 110 }; @@ -285,10 +276,8 @@ void OPvPCapturePointNA::FactionTakeOver(uint32 team) UpdateWyvernRoostWorldState(NA_ROOST_E); } -OPvPCapturePointNA::OPvPCapturePointNA(OutdoorPvP* pvp) : -OPvPCapturePoint(pvp), m_capturable(true), m_GuardsAlive(0), m_ControllingFaction(0), -m_WyvernStateNorth(0), m_WyvernStateSouth(0), m_WyvernStateEast(0), m_WyvernStateWest(0), -m_HalaaState(HALAA_N), m_RespawnTimer(NA_RESPAWN_TIME), m_GuardCheckTimer(NA_GUARD_CHECK_TIME) +OPvPCapturePointNA::OPvPCapturePointNA(OutdoorPvP* pvp) : OPvPCapturePoint(pvp), m_capturable(true), m_GuardsAlive(0), m_ControllingFaction(0), m_WyvernStateNorth(0), m_WyvernStateSouth(0), m_WyvernStateEast(0), + m_WyvernStateWest(0), m_HalaaState(HALAA_N), m_RespawnTimer(NA_RESPAWN_TIME), m_GuardCheckTimer(NA_GUARD_CHECK_TIME) { SetCapturePointData(182210, 530, { -1572.57f, 7945.3f, -22.475f, 2.05949f }, { 0.0f, 0.0f, 0.857167f, 0.515038f }); } @@ -322,57 +311,52 @@ 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) { if (m_ControllingFaction == 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 == 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_MAP_WYVERN_NORTH_NEU_H << uint32((m_WyvernStateNorth & WYVERN_NEU_HORDE) != 0); - data << NA_MAP_WYVERN_NORTH_NEU_A << uint32((m_WyvernStateNorth & WYVERN_NEU_ALLIANCE) != 0); - data << NA_MAP_WYVERN_NORTH_H << uint32((m_WyvernStateNorth & WYVERN_HORDE) != 0); - data << NA_MAP_WYVERN_NORTH_A << uint32((m_WyvernStateNorth & WYVERN_ALLIANCE) != 0); - - data << NA_MAP_WYVERN_SOUTH_NEU_H << uint32((m_WyvernStateSouth & WYVERN_NEU_HORDE) != 0); - data << NA_MAP_WYVERN_SOUTH_NEU_A << uint32((m_WyvernStateSouth & WYVERN_NEU_ALLIANCE) != 0); - data << NA_MAP_WYVERN_SOUTH_H << uint32((m_WyvernStateSouth & WYVERN_HORDE) != 0); - data << NA_MAP_WYVERN_SOUTH_A << uint32((m_WyvernStateSouth & WYVERN_ALLIANCE) != 0); - - data << NA_MAP_WYVERN_WEST_NEU_H << uint32((m_WyvernStateWest & WYVERN_NEU_HORDE) != 0); - data << NA_MAP_WYVERN_WEST_NEU_A << uint32((m_WyvernStateWest & WYVERN_NEU_ALLIANCE) != 0); - data << NA_MAP_WYVERN_WEST_H << uint32((m_WyvernStateWest & WYVERN_HORDE) != 0); - data << NA_MAP_WYVERN_WEST_A << uint32((m_WyvernStateWest & WYVERN_ALLIANCE) != 0); - - data << NA_MAP_WYVERN_EAST_NEU_H << uint32((m_WyvernStateEast & WYVERN_NEU_HORDE) != 0); - data << NA_MAP_WYVERN_EAST_NEU_A << uint32((m_WyvernStateEast & WYVERN_NEU_ALLIANCE) != 0); - data << NA_MAP_WYVERN_EAST_H << uint32((m_WyvernStateEast & WYVERN_HORDE) != 0); - data << NA_MAP_WYVERN_EAST_A << uint32((m_WyvernStateEast & WYVERN_ALLIANCE) != 0); - - data << NA_MAP_HALAA_NEUTRAL << uint32((m_HalaaState & HALAA_N) != 0); - data << NA_MAP_HALAA_NEU_A << uint32((m_HalaaState & HALAA_N_A) != 0); - data << NA_MAP_HALAA_NEU_H << uint32((m_HalaaState & HALAA_N_H) != 0); - data << NA_MAP_HALAA_HORDE << uint32((m_HalaaState & HALAA_H) != 0); - data << NA_MAP_HALAA_ALLIANCE << uint32((m_HalaaState & HALAA_A) != 0); + 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 95c7d0ed553..c13dd37e212 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h @@ -148,7 +148,6 @@ enum HalaaStates class Unit; class Creature; -class OutdoorPvPNA; class OPvPCapturePointNA : public OPvPCapturePoint { @@ -156,47 +155,31 @@ class OPvPCapturePointNA : public OPvPCapturePoint OPvPCapturePointNA(OutdoorPvP* pvp); bool Update(uint32 diff) override; - void ChangeState() override; - - void FillInitialWorldStates(WorldPacket & data) override; - + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go) override; - int32 HandleOpenGo(Player* player, GameObject* go) override; uint32 GetAliveGuardsCount(); uint32 GetControllingFaction() const; - - protected: - // called when a faction takes control - void FactionTakeOver(uint32 team); - + void FactionTakeOver(uint32 team); // called when a faction takes control void DeSpawnNPCs(); void DeSpawnGOs(); - void SpawnNPCsForTeam(uint32 team); void SpawnGOsForTeam(uint32 team); - void UpdateWyvernRoostWorldState(uint32 roost); void UpdateHalaaWorldState(); private: bool m_capturable; - uint32 m_GuardsAlive; - uint32 m_ControllingFaction; - uint32 m_WyvernStateNorth; uint32 m_WyvernStateSouth; uint32 m_WyvernStateEast; uint32 m_WyvernStateWest; - uint32 m_HalaaState; - uint32 m_RespawnTimer; - uint32 m_GuardCheckTimer; }; @@ -206,20 +189,15 @@ class OutdoorPvPNA : public OutdoorPvP OutdoorPvPNA(); bool SetupOutdoorPvP() override; - void HandlePlayerEnterZone(Player* player, uint32 zone) override; void HandlePlayerLeaveZone(Player* player, uint32 zone) override; - bool Update(uint32 diff) override; - - void FillInitialWorldStates(WorldPacket &data) override; - + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void SendRemoveWorldStates(Player* player) override; - void HandleKillImpl(Player* player, Unit* killed) override; private: - OPvPCapturePointNA * m_obj; + OPvPCapturePointNA* m_obj; }; #endif diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index a6cf63375b4..90d11689872 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -15,29 +15,25 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptMgr.h" +#include "OutdoorPvPSI.h" #include "DBCStores.h" #include "GameObject.h" #include "Language.h" #include "Map.h" #include "ObjectMgr.h" #include "OutdoorPvPMgr.h" -#include "OutdoorPvPSI.h" #include "Player.h" #include "ReputationMgr.h" +#include "ScriptMgr.h" #include "World.h" -#include "WorldPacket.h" +#include "WorldStatePackets.h" uint32 const SI_MAX_RESOURCES = 200; - uint32 const SI_AREATRIGGER_H = 4168; uint32 const SI_AREATRIGGER_A = 4162; - uint32 const SI_TURNIN_QUEST_CM_A = 17090; uint32 const SI_TURNIN_QUEST_CM_H = 18199; - uint32 const SI_SILITHYST_MOUND = 181597; - uint8 const OutdoorPvPSIBuffZonesNum = 3; uint32 const OutdoorPvPSIBuffZones[OutdoorPvPSIBuffZonesNum] = { 1377, 3428, 3429 }; @@ -49,11 +45,11 @@ OutdoorPvPSI::OutdoorPvPSI() m_LastController = 0; } -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.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 1d32a0e5b2b..0235f19c0c6 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.h @@ -41,28 +41,19 @@ class OutdoorPvPSI : public OutdoorPvP OutdoorPvPSI(); bool SetupOutdoorPvP() override; - void HandlePlayerEnterZone(Player* player, uint32 zone) override; void HandlePlayerLeaveZone(Player* player, uint32 zone) override; - bool Update(uint32 diff) override; - - void FillInitialWorldStates(WorldPacket &data) override; - + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void SendRemoveWorldStates(Player* player) override; - bool HandleAreaTrigger(Player* player, uint32 trigger) override; - bool HandleDropFlag(Player* player, uint32 spellId) override; - bool HandleCustomSpell(Player* player, uint32 spellId, GameObject* go) override; - void UpdateWorldState(); private: uint32 m_Gathered_A; uint32 m_Gathered_H; - uint32 m_LastController; }; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp index c78960fca45..3ed223e8895 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp @@ -15,14 +15,14 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ScriptMgr.h" #include "GameObject.h" #include "Map.h" #include "ObjectAccessor.h" #include "OutdoorPvPMgr.h" #include "OutdoorPvPTF.h" #include "Player.h" -#include "WorldPacket.h" +#include "ScriptMgr.h" +#include "WorldStatePackets.h" uint8 const OutdoorPvPTFBuffZonesNum = 5; uint32 const OutdoorPvPTFBuffZones[OutdoorPvPTFBuffZonesNum] = @@ -94,50 +94,42 @@ uint32 const TFTowerPlayerLeaveEvents[TF_TOWER_NUM] = OutdoorPvPTF::OutdoorPvPTF() { m_TypeId = OUTDOOR_PVP_TF; - m_IsLocked = false; m_LockTimer = TF_LOCK_TIME; m_LockTimerUpdate = 0; - m_AllianceTowersControlled = 0; m_HordeTowersControlled = 0; - hours_left = 6; second_digit = 0; first_digit = 0; } -OPvPCapturePointTF::OPvPCapturePointTF(OutdoorPvP* pvp, OutdoorPvPTF_TowerType type) -: OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(TF_TOWERSTATE_N) +OPvPCapturePointTF::OPvPCapturePointTF(OutdoorPvP* pvp, OutdoorPvPTF_TowerType type) : OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(TF_TOWERSTATE_N) { SetCapturePointData(TFCapturePoints[type].entry, TFCapturePoints[type].map, TFCapturePoints[type].pos, TFCapturePoints[type].rot); } -void OPvPCapturePointTF::FillInitialWorldStates(WorldPacket &data) +void OPvPCapturePointTF::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(TFTowerWorldStates[m_TowerType].n) << uint32((m_TowerState & TF_TOWERSTATE_N) != 0); - data << uint32(TFTowerWorldStates[m_TowerType].h) << uint32((m_TowerState & TF_TOWERSTATE_H) != 0); - data << uint32(TFTowerWorldStates[m_TowerType].a) << uint32((m_TowerState & TF_TOWERSTATE_A) != 0); + 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_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 = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) - { - itr->second->FillInitialWorldStates(data); - } + itr->second->FillInitialWorldStates(packet); } void OutdoorPvPTF::SendRemoveWorldStates(Player* player) diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h index 381bd373224..59850bbb3e6 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h @@ -67,16 +67,13 @@ class OPvPCapturePointTF : public OPvPCapturePoint OPvPCapturePointTF(OutdoorPvP* pvp, OutdoorPvPTF_TowerType type); bool Update(uint32 diff) override; - void ChangeState() override; - - void FillInitialWorldStates(WorldPacket & data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void UpdateTowerState(); protected: OutdoorPvPTF_TowerType m_TowerType; - uint32 m_TowerState; }; @@ -86,32 +83,24 @@ class OutdoorPvPTF : public OutdoorPvP OutdoorPvPTF(); bool SetupOutdoorPvP() override; - void HandlePlayerEnterZone(Player* player, uint32 zone) override; void HandlePlayerLeaveZone(Player* player, uint32 zone) override; - bool Update(uint32 diff) override; - - void FillInitialWorldStates(WorldPacket &data) override; - + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void SendRemoveWorldStates(Player* player) override; uint32 GetAllianceTowersControlled() const; void SetAllianceTowersControlled(uint32 count); - uint32 GetHordeTowersControlled() const; void SetHordeTowersControlled(uint32 count); - bool IsLocked() const; private: bool m_IsLocked; uint32 m_LockTimer; uint32 m_LockTimerUpdate; - uint32 m_AllianceTowersControlled; uint32 m_HordeTowersControlled; - uint32 hours_left, second_digit, first_digit; }; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp index 40184e6a0ab..ca2f4ec51a1 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp @@ -15,16 +15,16 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "MapManager.h" -#include "ScriptMgr.h" #include "OutdoorPvPZM.h" +#include "Creature.h" +#include "GossipDef.h" +#include "MapManager.h" +#include "ObjectAccessor.h" #include "ObjectMgr.h" #include "OutdoorPvPMgr.h" #include "Player.h" -#include "Creature.h" -#include "ObjectAccessor.h" -#include "WorldPacket.h" -#include "GossipDef.h" +#include "ScriptMgr.h" +#include "WorldStatePackets.h" uint8 const OutdoorPvPZMBuffZonesNum = 5; @@ -85,20 +85,19 @@ go_type const ZMCapturePoints[ZM_NUM_BEACONS] = { 182522, 530, { 336.466f, 7340.26f, 41.4984f, -1.58825f }, { 0.0f, 0.0f, 0.71325f, -0.700909f } } }; -OPvPCapturePointZM_Beacon::OPvPCapturePointZM_Beacon(OutdoorPvP* pvp, ZM_BeaconType type) -: OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(ZM_TOWERSTATE_N) +OPvPCapturePointZM_Beacon::OPvPCapturePointZM_Beacon(OutdoorPvP* pvp, ZM_BeaconType type) : OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(ZM_TOWERSTATE_N) { SetCapturePointData(ZMCapturePoints[type].entry, ZMCapturePoints[type].map, ZMCapturePoints[type].pos, ZMCapturePoints[type].rot); } -void OPvPCapturePointZM_Beacon::FillInitialWorldStates(WorldPacket &data) +void OPvPCapturePointZM_Beacon::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << uint32(ZMBeaconInfo[m_TowerType].ui_tower_n) << uint32((m_TowerState & ZM_TOWERSTATE_N) != 0); - data << uint32(ZMBeaconInfo[m_TowerType].map_tower_n) << uint32((m_TowerState & ZM_TOWERSTATE_N) != 0); - data << uint32(ZMBeaconInfo[m_TowerType].ui_tower_a) << uint32((m_TowerState & ZM_TOWERSTATE_A) != 0); - data << uint32(ZMBeaconInfo[m_TowerType].map_tower_a) << uint32((m_TowerState & ZM_TOWERSTATE_A) != 0); - data << uint32(ZMBeaconInfo[m_TowerType].ui_tower_h) << uint32((m_TowerState & ZM_TOWERSTATE_H) != 0); - data << uint32(ZMBeaconInfo[m_TowerType].map_tower_h) << uint32((m_TowerState & ZM_TOWERSTATE_H) != 0); + 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() @@ -275,8 +274,7 @@ int32 OPvPCapturePointZM_Graveyard::HandleOpenGo(Player* player, GameObject* go) return retval; } -OPvPCapturePointZM_Graveyard::OPvPCapturePointZM_Graveyard(OutdoorPvP* pvp) -: OPvPCapturePoint(pvp) +OPvPCapturePointZM_Graveyard::OPvPCapturePointZM_Graveyard(OutdoorPvP* pvp) : OPvPCapturePoint(pvp) { m_BothControllingFaction = 0; m_GraveyardState = ZM_GRAVEYARD_N; @@ -300,16 +298,15 @@ void OPvPCapturePointZM_Graveyard::UpdateTowerState() m_PvP->SendUpdateWorldState(ZM_MAP_HORDE_FLAG_NOT_READY, uint32(m_BothControllingFaction != HORDE)); } -void OPvPCapturePointZM_Graveyard::FillInitialWorldStates(WorldPacket &data) +void OPvPCapturePointZM_Graveyard::FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) { - data << ZM_MAP_GRAVEYARD_N << uint32((m_GraveyardState & ZM_GRAVEYARD_N) != 0); - data << ZM_MAP_GRAVEYARD_H << uint32((m_GraveyardState & ZM_GRAVEYARD_H) != 0); - data << ZM_MAP_GRAVEYARD_A << uint32((m_GraveyardState & ZM_GRAVEYARD_A) != 0); - - data << ZM_MAP_ALLIANCE_FLAG_READY << uint32(m_BothControllingFaction == ALLIANCE); - data << ZM_MAP_ALLIANCE_FLAG_NOT_READY << uint32(m_BothControllingFaction != ALLIANCE); - data << ZM_MAP_HORDE_FLAG_READY << uint32(m_BothControllingFaction == HORDE); - data << ZM_MAP_HORDE_FLAG_NOT_READY << uint32(m_BothControllingFaction != HORDE); + 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_BothControllingFaction == ALLIANCE ? 1 : 0); + packet.Worldstates.emplace_back(ZM_MAP_ALLIANCE_FLAG_NOT_READY, m_BothControllingFaction != ALLIANCE ? 1 : 0); + packet.Worldstates.emplace_back(ZM_MAP_HORDE_FLAG_READY, m_BothControllingFaction == HORDE ? 1 : 0); + packet.Worldstates.emplace_back(ZM_MAP_HORDE_FLAG_NOT_READY, m_BothControllingFaction != HORDE ? 1 : 0); } void OPvPCapturePointZM_Graveyard::SetBeaconState(uint32 controlling_faction) @@ -436,12 +433,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 = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) - itr->second->FillInitialWorldStates(data); + itr->second->FillInitialWorldStates(packet); } void OutdoorPvPZM::SendRemoveWorldStates(Player* player) diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h index 9736fd22499..31fe0495395 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h @@ -96,16 +96,13 @@ enum ZM_TowerStateMask ZM_TOWERSTATE_H = 4 }; -class OutdoorPvPZM; - class OPvPCapturePointZM_Beacon : public OPvPCapturePoint { public: OPvPCapturePointZM_Beacon(OutdoorPvP* pvp, ZM_BeaconType type); void ChangeState() override; - - void FillInitialWorldStates(WorldPacket & data) override; + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void UpdateTowerState(); @@ -127,64 +124,46 @@ class OPvPCapturePointZM_Graveyard : public OPvPCapturePoint OPvPCapturePointZM_Graveyard(OutdoorPvP* pvp); bool Update(uint32 diff) override; - void ChangeState() override { } - - void FillInitialWorldStates(WorldPacket & data) override; - - void UpdateTowerState(); - + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; int32 HandleOpenGo(Player* player, GameObject* go) override; - - void SetBeaconState(uint32 controlling_team); // not good atm - bool HandleGossipOption(Player* player, Creature* creature, uint32 gossipid) override; - bool HandleDropFlag(Player* player, uint32 spellId) override; - bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems const& gso) override; + void UpdateTowerState(); + void SetBeaconState(uint32 controlling_team); // not good atm uint32 GetGraveyardState() const; - private: - uint32 m_GraveyardState; - protected: uint32 m_BothControllingFaction; - ObjectGuid m_FlagCarrierGUID; + uint32 m_GraveyardState; }; +/// @todo flag carrier death/leave/mount/activitychange should give back the gossip options class OutdoorPvPZM : public OutdoorPvP { public: OutdoorPvPZM(); bool SetupOutdoorPvP() override; - void HandlePlayerEnterZone(Player* player, uint32 zone) override; void HandlePlayerLeaveZone(Player* player, uint32 zone) override; - bool Update(uint32 diff) override; - - void FillInitialWorldStates(WorldPacket &data) override; - + void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override; void SendRemoveWorldStates(Player* player) override; - void HandleKillImpl(Player* player, Unit* killed) override; uint32 GetAllianceTowersControlled() const; void SetAllianceTowersControlled(uint32 count); - uint32 GetHordeTowersControlled() const; void SetHordeTowersControlled(uint32 count); private: - OPvPCapturePointZM_Graveyard * m_Graveyard; - + OPvPCapturePointZM_Graveyard* m_Graveyard; uint32 m_AllianceTowersControlled; uint32 m_HordeTowersControlled; }; -/// @todo flag carrier death/leave/mount/activitychange should give back the gossip options #endif |