mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 11:25:42 +00:00
refactor(Core/Packets): Rewrite MSG_RANDOM_ROLL to new packet class (#10590)
* refactor(Core/Packets): Rewrite MSG_RANDOM_ROLL
* cherry-pick commit (c0f516caee)
Co-Authored-By: ForesterDev <11771800+ForesterDev@users.noreply.github.com>
Co-Authored-By: DJScias <439655+DJScias@users.noreply.github.com>
* handle crash check in DoRandomRoll()
* Update MiscPackets.h
* Update Player.h
Co-authored-by: ForesterDev <11771800+ForesterDev@users.noreply.github.com>
Co-authored-by: DJScias <439655+DJScias@users.noreply.github.com>
This commit is contained in:
@@ -30,3 +30,19 @@ WorldPacket const* WorldPackets::Misc::Weather::Write()
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::RandomRollClient::Read()
|
||||
{
|
||||
_worldPacket >> Min;
|
||||
_worldPacket >> Max;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::RandomRoll::Write()
|
||||
{
|
||||
_worldPacket << uint32(Min);
|
||||
_worldPacket << uint32(Max);
|
||||
_worldPacket << uint32(Result);
|
||||
_worldPacket << Roller;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#define MiscPackets_h__
|
||||
|
||||
#include "Packet.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "Weather.h"
|
||||
|
||||
enum WeatherState : uint32;
|
||||
@@ -39,6 +40,30 @@ namespace WorldPackets
|
||||
float Intensity = 0.0f;
|
||||
WeatherState WeatherID = WeatherState(0);
|
||||
};
|
||||
|
||||
class RandomRollClient final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
RandomRollClient(WorldPacket&& packet) : ClientPacket(MSG_RANDOM_ROLL, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint32 Min = 0;
|
||||
uint32 Max = 0;
|
||||
};
|
||||
|
||||
class RandomRoll final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
RandomRoll() : ServerPacket(MSG_RANDOM_ROLL, 4 + 4 + 4 + 8) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 Min = 0;
|
||||
uint32 Max = 0;
|
||||
uint32 Result = 0;
|
||||
ObjectGuid Roller;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user