Server/Packets: implement SMSG_RESYNC_RUNES packet structure

This commit is contained in:
ccrs
2019-07-13 18:58:04 +02:00
parent 7421ccaf7e
commit 3785a35511
5 changed files with 36 additions and 13 deletions
+7 -7
View File
@@ -83,6 +83,7 @@
#include "SpellAuras.h"
#include "SpellHistory.h"
#include "SpellMgr.h"
#include "SpellPackets.h"
#include "TicketMgr.h"
#include "TradeData.h"
#include "Trainer.h"
@@ -24601,16 +24602,15 @@ void Player::ResyncRunes() const
if (GetClass() != CLASS_DEATH_KNIGHT)
return;
WorldPacket data(SMSG_RESYNC_RUNES, 4 + MAX_RUNES * 2);
data << uint32(MAX_RUNES);
WorldPackets::Spells::ResyncRunes packet;
packet.Count = MAX_RUNES;
for (uint32 itr = 0; itr < MAX_RUNES; ++itr)
{
data << uint8(GetCurrentRune(itr)); // rune type
uint32 value = uint32(255) - ((GetRuneCooldown(itr) * uint32(255)) / uint32(RUNE_BASE_COOLDOWN));
data << uint8(value); // passed cooldown time (0-255)
uint8 type = GetCurrentRune(itr);
uint32 value = uint32(255) - ((GetRuneCooldown(itr) * uint32(255)) / uint32(RUNE_BASE_COOLDOWN)); // cooldown time (0-255)
packet.Cooldowns.emplace_back(type, value);
}
SendDirectMessage(&data);
SendDirectMessage(packet.Write());
}
void Player::AddRunePower(uint8 index) const
-2
View File
@@ -255,8 +255,6 @@ struct Areas
float y2;
};
#define MAX_RUNES 6
enum RuneCooldowns
{
RUNE_BASE_COOLDOWN = 10000,
@@ -158,3 +158,14 @@ WorldPacket const* WorldPackets::Spells::SpellStart::Write()
_worldPacket << Cast;
return &_worldPacket;
}
WorldPacket const* WorldPackets::Spells::ResyncRunes::Write()
{
_worldPacket << Count;
for (auto itr = Cooldowns.begin(); itr != Cooldowns.end(); ++itr)
{
_worldPacket << itr->first;
_worldPacket << itr->second;
}
return &_worldPacket;
}
+16 -4
View File
@@ -22,6 +22,7 @@
#include "ObjectGuid.h"
#include "Optional.h"
#include "Position.h"
#include "SharedDefines.h"
namespace WorldPackets
{
@@ -79,10 +80,10 @@ namespace WorldPackets
{
ObjectGuid CasterGUID;
ObjectGuid CasterUnit;
uint8 CastID = 0;
uint32 SpellID = 0;
uint32 CastFlags = 0;
uint32 CastTime = 0;
uint8 CastID = 0;
uint32 SpellID = 0;
uint32 CastFlags = 0;
uint32 CastTime = 0;
mutable Optional<std::vector<ObjectGuid>> HitTargets;
mutable Optional<std::vector<SpellMissStatus>> MissStatus;
SpellTargetData Target;
@@ -112,6 +113,17 @@ namespace WorldPackets
SpellCastData Cast;
};
class ResyncRunes final : public ServerPacket
{
public:
ResyncRunes() : ServerPacket(SMSG_RESYNC_RUNES, 4 + 2 * MAX_RUNES) { }
WorldPacket const* Write() override;
uint32 Count = 0;
std::vector<std::pair<uint8, uint8>> Cooldowns;
};
}
}
+2
View File
@@ -291,6 +291,8 @@ enum Powers : int8
POWER_ALL = 127 // SKIP
};
#define MAX_RUNES 6
// EnumUtils: DESCRIBE THIS
enum SpellSchools
{