mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 18:10:26 +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:
@@ -57,6 +57,7 @@
|
||||
#include "Log.h"
|
||||
#include "LootItemStorage.h"
|
||||
#include "MapMgr.h"
|
||||
#include "MiscPackets.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
@@ -15698,6 +15699,25 @@ void Player::RemoveRestFlag(RestFlag restFlag)
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Player::DoRandomRoll(uint32 minimum, uint32 maximum)
|
||||
{
|
||||
ASSERT(minimum <= maximum || maximum <= 10000);
|
||||
|
||||
uint32 roll = urand(minimum, maximum);
|
||||
|
||||
WorldPackets::Misc::RandomRoll randomRoll;
|
||||
randomRoll.Min = minimum;
|
||||
randomRoll.Max = maximum;
|
||||
randomRoll.Result = roll;
|
||||
randomRoll.Roller = GetGUID();
|
||||
if (Group* group = GetGroup())
|
||||
group->BroadcastPacket(randomRoll.Write(), false);
|
||||
else
|
||||
SendDirectMessage(randomRoll.Write());
|
||||
|
||||
return roll;
|
||||
}
|
||||
|
||||
void Player::SetArenaTeamInfoField(uint8 slot, ArenaTeamInfoType type, uint32 value)
|
||||
{
|
||||
if (sScriptMgr->NotSetArenaTeamInfoField(this, slot, type, value))
|
||||
|
||||
Reference in New Issue
Block a user