refactor(Core/Packets): Rewrite MSG_MINIMAP_PING to modern packet class. (#22696)
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
#include "LFGMgr.h"
|
#include "LFGMgr.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "MapMgr.h"
|
#include "MapMgr.h"
|
||||||
|
#include "MiscPackets.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "Opcodes.h"
|
#include "Opcodes.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
@@ -2059,6 +2060,16 @@ GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const*
|
|||||||
return GroupJoinBattlegroundResult(bgTemplate->GetBgTypeID());
|
return GroupJoinBattlegroundResult(bgTemplate->GetBgTypeID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Group::DoMinimapPing(ObjectGuid sourceGuid, float mapX, float mapY)
|
||||||
|
{
|
||||||
|
WorldPackets::Misc::MinimapPing minimapPing;
|
||||||
|
minimapPing.SourceGuid = sourceGuid;
|
||||||
|
minimapPing.MapX = mapX;
|
||||||
|
minimapPing.MapY = mapY;
|
||||||
|
|
||||||
|
BroadcastPacket(minimapPing.Write(), true, -1, sourceGuid);
|
||||||
|
}
|
||||||
|
|
||||||
//===================================================
|
//===================================================
|
||||||
//============== Roll ===============================
|
//============== Roll ===============================
|
||||||
//===================================================
|
//===================================================
|
||||||
|
|||||||
@@ -255,6 +255,8 @@ public:
|
|||||||
void SetBattlefieldGroup(Battlefield* bf);
|
void SetBattlefieldGroup(Battlefield* bf);
|
||||||
GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
|
GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
|
||||||
|
|
||||||
|
void DoMinimapPing(ObjectGuid sourceGuid, float mapX, float mapY);
|
||||||
|
|
||||||
void ChangeMembersGroup(ObjectGuid guid, uint8 group);
|
void ChangeMembersGroup(ObjectGuid guid, uint8 group);
|
||||||
void SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid);
|
void SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid);
|
||||||
void SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags flag);
|
void SetGroupMemberFlag(ObjectGuid guid, bool apply, GroupMemberFlags flag);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include "LFGMgr.h"
|
#include "LFGMgr.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
#include "MapMgr.h"
|
||||||
#include "MiscPackets.h"
|
#include "MiscPackets.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "Opcodes.h"
|
#include "Opcodes.h"
|
||||||
@@ -522,24 +523,17 @@ void WorldSession::HandleLootRoll(WorldPacket& recvData)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleMinimapPingOpcode(WorldPacket& recvData)
|
void WorldSession::HandleMinimapPingOpcode(WorldPackets::Misc::MinimapPingClient& packet)
|
||||||
{
|
{
|
||||||
if (!GetPlayer()->GetGroup())
|
if (!sMapMgr->IsValidMapCoord(GetPlayer()->GetMap()->GetId(), packet.MapX, packet.MapY))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float x, y;
|
Group* group = GetPlayer()->GetGroup();
|
||||||
recvData >> x;
|
|
||||||
recvData >> y;
|
|
||||||
|
|
||||||
/** error handling **/
|
if (!group)
|
||||||
/********************/
|
return;
|
||||||
|
|
||||||
// everything's fine, do it
|
group->DoMinimapPing(GetPlayer()->GetGUID(), packet.MapX, packet.MapY);
|
||||||
WorldPacket data(MSG_MINIMAP_PING, (8 + 4 + 4));
|
|
||||||
data << GetPlayer()->GetGUID();
|
|
||||||
data << float(x);
|
|
||||||
data << float(y);
|
|
||||||
GetPlayer()->GetGroup()->BroadcastPacket(&data, true, -1, GetPlayer()->GetGUID());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleRandomRollOpcode(WorldPackets::Misc::RandomRollClient& packet)
|
void WorldSession::HandleRandomRollOpcode(WorldPackets::Misc::RandomRollClient& packet)
|
||||||
|
|||||||
@@ -67,6 +67,21 @@ WorldPacket const* WorldPackets::Misc::Playsound::Write()
|
|||||||
return &_worldPacket;
|
return &_worldPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldPackets::Misc::MinimapPingClient::Read()
|
||||||
|
{
|
||||||
|
_worldPacket >> MapX;
|
||||||
|
_worldPacket >> MapY;
|
||||||
|
}
|
||||||
|
|
||||||
|
WorldPacket const* WorldPackets::Misc::MinimapPing::Write()
|
||||||
|
{
|
||||||
|
_worldPacket << SourceGuid;
|
||||||
|
_worldPacket << float(MapX);
|
||||||
|
_worldPacket << float(MapY);
|
||||||
|
|
||||||
|
return &_worldPacket;
|
||||||
|
}
|
||||||
|
|
||||||
void WorldPackets::Misc::RandomRollClient::Read()
|
void WorldPackets::Misc::RandomRollClient::Read()
|
||||||
{
|
{
|
||||||
_worldPacket >> Min;
|
_worldPacket >> Min;
|
||||||
|
|||||||
@@ -93,6 +93,29 @@ namespace WorldPackets
|
|||||||
uint32 SoundKitID = 0;
|
uint32 SoundKitID = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MinimapPingClient final : public ClientPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MinimapPingClient(WorldPacket&& packet) : ClientPacket(MSG_MINIMAP_PING, std::move(packet)) {}
|
||||||
|
|
||||||
|
void Read() override;
|
||||||
|
|
||||||
|
float MapX = 0.0f; // Raw position coordinates
|
||||||
|
float MapY = 0.0f;
|
||||||
|
};
|
||||||
|
|
||||||
|
class MinimapPing final : public ServerPacket
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MinimapPing() : ServerPacket(MSG_MINIMAP_PING, 8 + 4 + 4) { }
|
||||||
|
|
||||||
|
WorldPacket const* Write() override;
|
||||||
|
|
||||||
|
ObjectGuid SourceGuid;
|
||||||
|
float MapX = 0.0f;
|
||||||
|
float MapY = 0.0f;
|
||||||
|
};
|
||||||
|
|
||||||
class RandomRollClient final : public ClientPacket
|
class RandomRollClient final : public ClientPacket
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ namespace WorldPackets
|
|||||||
|
|
||||||
namespace Misc
|
namespace Misc
|
||||||
{
|
{
|
||||||
|
class MinimapPingClient;
|
||||||
class RandomRollClient;
|
class RandomRollClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -933,7 +934,7 @@ public: // opcodes handlers
|
|||||||
|
|
||||||
void HandleWardenDataOpcode(WorldPacket& recvData);
|
void HandleWardenDataOpcode(WorldPacket& recvData);
|
||||||
void HandleWorldTeleportOpcode(WorldPacket& recvData);
|
void HandleWorldTeleportOpcode(WorldPacket& recvData);
|
||||||
void HandleMinimapPingOpcode(WorldPacket& recvData);
|
void HandleMinimapPingOpcode(WorldPackets::Misc::MinimapPingClient& packet);
|
||||||
void HandleRandomRollOpcode(WorldPackets::Misc::RandomRollClient& packet);
|
void HandleRandomRollOpcode(WorldPackets::Misc::RandomRollClient& packet);
|
||||||
void HandleFarSightOpcode(WorldPacket& recvData);
|
void HandleFarSightOpcode(WorldPacket& recvData);
|
||||||
void HandleSetDungeonDifficultyOpcode(WorldPacket& recvData);
|
void HandleSetDungeonDifficultyOpcode(WorldPacket& recvData);
|
||||||
|
|||||||
Reference in New Issue
Block a user