mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-27 12:22:39 +01:00
Core/Phases: updated packet handling to new format
This commit is contained in:
@@ -1399,32 +1399,13 @@ void WorldSession::HandleUITimeRequest(WorldPackets::Misc::UITimeRequest& /*requ
|
||||
|
||||
void WorldSession::SendSetPhaseShift(std::set<uint32> const& phaseIds, std::set<uint32> const& terrainswaps, std::set<uint32> const& worldMapAreaSwaps)
|
||||
{
|
||||
WorldPacket data(SMSG_PHASE_SHIFT_CHANGE, 1 + 8 + 4 + 4 + 4 + 4 + 2 * phaseIds.size() + 4 + terrainswaps.size() * 2);
|
||||
|
||||
data << _player->GetGUID(); // Client
|
||||
data << uint32(phaseIds.size() ? 0 : 8); // PhaseShiftFlags
|
||||
|
||||
data << uint32(phaseIds.size()); // PhaseShiftCount
|
||||
data << _player->GetGUID(); // PersonalGUID
|
||||
for (std::set<uint32>::const_iterator itr = phaseIds.begin(); itr != phaseIds.end(); ++itr)
|
||||
{
|
||||
data << uint16(1); // PhaseFlags
|
||||
data << uint16(*itr); // Id
|
||||
}
|
||||
|
||||
data << uint32(terrainswaps.size()) * 2; // Active terrain swaps
|
||||
for (std::set<uint32>::const_iterator itr = terrainswaps.begin(); itr != terrainswaps.end(); ++itr)
|
||||
data << uint16(*itr);
|
||||
|
||||
data << uint32(0); // Inactive terrain swaps
|
||||
//for (uint8 i = 0; i < inactiveSwapsCount; ++i)
|
||||
// data << uint16(0);
|
||||
|
||||
data << uint32(worldMapAreaSwaps.size()) * 2;
|
||||
for (auto mapSwap : worldMapAreaSwaps)
|
||||
data << uint16(mapSwap); // WorldMapArea.dbc id (controls map display)
|
||||
|
||||
SendPacket(&data);
|
||||
WorldPackets::Misc::PhaseShift phaseShift;
|
||||
phaseShift.ClientGUID = _player->GetGUID();
|
||||
phaseShift.PersonalGUID = _player->GetGUID();
|
||||
phaseShift.PhaseShifts = phaseIds;
|
||||
phaseShift.VisibleMapIDs = terrainswaps;
|
||||
phaseShift.UiWorldMapAreaIDSwaps = worldMapAreaSwaps;
|
||||
SendPacket(phaseShift.Write());
|
||||
}
|
||||
|
||||
// Battlefield and Battleground
|
||||
|
||||
@@ -379,3 +379,30 @@ WorldPacket const* WorldPackets::Misc::RandomRoll::Write()
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::PhaseShift::Write()
|
||||
{
|
||||
_worldPacket << ClientGUID; // CLientGUID
|
||||
_worldPacket << uint32(PhaseShifts.size() ? 0 : 8); // PhaseShiftFlags
|
||||
_worldPacket << uint32(PhaseShifts.size()); // PhaseShiftCount
|
||||
_worldPacket << PersonalGUID; // PersonalGUID
|
||||
for (uint32 phase : PhaseShifts)
|
||||
{
|
||||
_worldPacket << uint16(1); // PhaseFlags
|
||||
_worldPacket << uint16(phase); // PhaseID
|
||||
}
|
||||
|
||||
_worldPacket << uint32(VisibleMapIDs.size() * 2); // Active terrain swaps size
|
||||
for (uint32 map : VisibleMapIDs)
|
||||
_worldPacket << uint16(map); // Active terrain swap map id
|
||||
|
||||
_worldPacket << uint32(PreloadMapIDs.size() * 2); // Inactive terrain swaps size
|
||||
for (uint32 map : PreloadMapIDs)
|
||||
_worldPacket << uint16(map); // Inactive terrain swap map id
|
||||
|
||||
_worldPacket << uint32(UiWorldMapAreaIDSwaps.size() * 2); // UI map swaps size
|
||||
for (uint32 map : UiWorldMapAreaIDSwaps)
|
||||
_worldPacket << uint16(map); // UI map id, WorldMapArea.dbc, controls map display
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
@@ -538,6 +538,21 @@ namespace WorldPackets
|
||||
|
||||
WorldPacket const* Write() override { return &_worldPacket; }
|
||||
};
|
||||
|
||||
class PhaseShift final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PhaseShift() : ServerPacket(SMSG_PHASE_SHIFT_CHANGE, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid ClientGUID;
|
||||
ObjectGuid PersonalGUID;
|
||||
std::set<uint32> PhaseShifts;
|
||||
std::set<uint32> PreloadMapIDs;
|
||||
std::set<uint32> UiWorldMapAreaIDSwaps;
|
||||
std::set<uint32> VisibleMapIDs;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user