Core/Server: 3785a35 followup

This commit is contained in:
ccrs
2019-07-14 13:21:49 +02:00
parent eed9267685
commit bbb9d94acc
3 changed files with 12 additions and 6 deletions

View File

@@ -24607,8 +24607,8 @@ void Player::ResyncRunes() const
for (uint32 itr = 0; itr < MAX_RUNES; ++itr)
{
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);
uint32 cooldown = uint32(255) - ((GetRuneCooldown(itr) * uint32(255)) / uint32(RUNE_BASE_COOLDOWN)); // cooldown time (0-255)
packet.Runes.emplace_back(type, cooldown);
}
SendDirectMessage(packet.Write());
}

View File

@@ -162,10 +162,10 @@ WorldPacket const* WorldPackets::Spells::SpellStart::Write()
WorldPacket const* WorldPackets::Spells::ResyncRunes::Write()
{
_worldPacket << Count;
for (auto itr = Cooldowns.begin(); itr != Cooldowns.end(); ++itr)
for (WorldPackets::Spells::ResyncRune const& rune : Runes)
{
_worldPacket << itr->first;
_worldPacket << itr->second;
_worldPacket << rune.RuneType;
_worldPacket << rune.Cooldown;
}
return &_worldPacket;
}

View File

@@ -114,6 +114,12 @@ namespace WorldPackets
SpellCastData Cast;
};
struct ResyncRune
{
uint8 RuneType = 0;
uint8 Cooldown = 0;
};
class ResyncRunes final : public ServerPacket
{
public:
@@ -122,7 +128,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
uint32 Count = 0;
std::vector<std::pair<uint8, uint8>> Cooldowns;
std::vector<ResyncRune> Runes;
};
}
}