diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 30c2c1616..82b4b18c1 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -737,22 +737,13 @@ void Player::SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 Curre StopMirrorTimer(Type); return; } - WorldPacket data(SMSG_START_MIRROR_TIMER, (21)); - data << (uint32)Type; - data << CurrentValue; - data << MaxValue; - data << Regen; - data << (uint8)0; - data << (uint32)0; // spell id - GetSession()->SendPacket(&data); + SendDirectMessage(WorldPackets::Misc::StartMirrorTimer(Type, CurrentValue, MaxValue, Regen, 0, 0).Write()); } void Player::StopMirrorTimer(MirrorTimerType Type) { m_MirrorTimer[Type] = DISABLED_MIRROR_TIMER; - WorldPacket data(SMSG_STOP_MIRROR_TIMER, 4); - data << (uint32)Type; - GetSession()->SendPacket(&data); + SendDirectMessage(WorldPackets::Misc::StopMirrorTimer(Type).Write()); } bool Player::IsImmuneToEnvironmentalDamage() diff --git a/src/server/game/Server/Packets/MiscPackets.cpp b/src/server/game/Server/Packets/MiscPackets.cpp index cf192ade6..052f1700a 100644 --- a/src/server/game/Server/Packets/MiscPackets.cpp +++ b/src/server/game/Server/Packets/MiscPackets.cpp @@ -83,6 +83,33 @@ WorldPacket const* WorldPackets::Misc::RandomRoll::Write() return &_worldPacket; } +WorldPacket const* WorldPackets::Misc::StartMirrorTimer::Write() +{ + _worldPacket << uint32(Timer); + _worldPacket << uint32(Value); + _worldPacket << uint32(MaxValue); + _worldPacket << int32(Scale); + _worldPacket << uint8(Paused); + _worldPacket << uint32(SpellID); + + return &_worldPacket; +} + +WorldPacket const* WorldPackets::Misc::PauseMirrorTimer::Write() +{ + _worldPacket << uint32(Timer); + _worldPacket << uint8(Paused); + + return &_worldPacket; +} + +WorldPacket const* WorldPackets::Misc::StopMirrorTimer::Write() +{ + _worldPacket << uint32(Timer); + + return &_worldPacket; +} + WorldPacket const* WorldPackets::Misc::CrossedInebriationThreshold::Write() { _worldPacket << Guid; diff --git a/src/server/game/Server/Packets/MiscPackets.h b/src/server/game/Server/Packets/MiscPackets.h index d708654e4..1a6b4e66b 100644 --- a/src/server/game/Server/Packets/MiscPackets.h +++ b/src/server/game/Server/Packets/MiscPackets.h @@ -114,6 +114,46 @@ namespace WorldPackets ObjectGuid Roller; }; + class StartMirrorTimer final : public ServerPacket + { + public: + StartMirrorTimer() : ServerPacket(SMSG_START_MIRROR_TIMER, 21) { } + StartMirrorTimer(uint32 timer, uint32 value, uint32 maxValue, int32 scale, bool paused, uint32 spellID) : + ServerPacket(SMSG_START_MIRROR_TIMER, 21), Timer(timer), Value(value), MaxValue(maxValue), Scale(scale), Paused(paused), SpellID(spellID) { } + + WorldPacket const* Write() override; + + uint32 Timer = 0; + uint32 Value = 0; + uint32 MaxValue = 0; + int32 Scale = 0; + bool Paused = false; + uint32 SpellID = 0; + }; + + class PauseMirrorTimer final : public ServerPacket + { + public: + PauseMirrorTimer() : ServerPacket(SMSG_PAUSE_MIRROR_TIMER, 5) { } + PauseMirrorTimer(uint32 timer, bool paused) : ServerPacket(SMSG_PAUSE_MIRROR_TIMER, 5), Timer(timer), Paused(paused) { } + + WorldPacket const* Write() override; + + uint32 Timer = 0; + bool Paused = true; + }; + + class StopMirrorTimer final : public ServerPacket + { + public: + StopMirrorTimer() : ServerPacket(SMSG_STOP_MIRROR_TIMER, 4) { } + StopMirrorTimer(uint32 timer) : ServerPacket(SMSG_STOP_MIRROR_TIMER, 4), Timer(timer) { } + + WorldPacket const* Write() override; + + uint32 Timer = 0; + }; + class DurabilityDamageDeath final : public ServerPacket { public: