Core/Packets: converted SMSG_CLEAR_COOLDOWN and SMSG_CLEAR_COOLDOWNS to packet class

This commit is contained in:
Ovahlord committed 2021-08-16 11:02:22 +02:00
1 parent 8ac7e71690
commit da5564fa47
6 files changed
+72 -37

No files matched your search

+8 -31
View File
@@ -467,10 +467,10 @@ void SpellHistory::ResetCooldown(CooldownStorageType::iterator& itr, bool update
{
if (Player* playerOwner = GetPlayerOwner())
{
WorldPacket data(SMSG_CLEAR_COOLDOWN, 4 + 8);
data << uint32(itr->first);
data << uint64(_owner->GetGUID());
playerOwner->SendDirectMessage(&data);
WorldPackets::Spells::ClearCooldown packet;
packet.SpellID = itr->first;
packet.CasterGUID = _owner->GetGUID();
playerOwner->SendDirectMessage(packet.Write());
}
}
@@ -664,33 +664,10 @@ void SpellHistory::SendClearCooldowns(std::vector<int32> const& cooldowns) const
{
if (Player* playerOwner = GetPlayerOwner())
{
ObjectGuid guid = playerOwner->GetGUID();
WorldPacket data(SMSG_CLEAR_COOLDOWNS, 4 + 8);
data.WriteBit(guid[1]);
data.WriteBit(guid[3]);
data.WriteBit(guid[6]);
data.WriteBits(cooldowns.size(), 24); // Spell Count
data.WriteBit(guid[7]);
data.WriteBit(guid[5]);
data.WriteBit(guid[2]);
data.WriteBit(guid[4]);
data.WriteBit(guid[0]);
data.FlushBits();
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[3]);
for (int32 spell : cooldowns)
data << uint32(spell); // Spell ID
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[6]);
playerOwner->SendDirectMessage(&data);
WorldPackets::Spells::ClearCooldowns packet;
packet.Guid = playerOwner->GetGUID();
packet.SpellID = cooldowns;
playerOwner->SendDirectMessage(packet.Write());
}
}