fix(Core/Spells): Fixed sending category cooldowns. (#15192)

This commit is contained in:
UltraNix
2023-03-04 21:41:31 +01:00
committed by GitHub
parent ac0581bd43
commit ab4e95cc20

View File

@@ -10798,7 +10798,6 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite
// cooldown information stored in item prototype
// This used in same way in WorldSession::HandleItemQuerySingleOpcode data sending to client.
bool useSpellCooldown = spellInfo->HasAttribute(SPELL_ATTR7_CAN_BE_MULTI_CAST);
if (itemId)
{
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId))
@@ -10810,12 +10809,6 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite
cat = proto->Spells[idx].SpellCategory;
rec = proto->Spells[idx].SpellCooldown;
catrec = proto->Spells[idx].SpellCategoryCooldown;
if (static_cast<int32>(cat) != catrec)
{
useSpellCooldown = true;
}
break;
}
}
@@ -10852,14 +10845,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite
// Now we have cooldown data (if found any), time to apply mods
if (rec > 0)
{
int32 oldRec = rec;
ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, rec, spell);
if (oldRec != rec)
{
useSpellCooldown = true;
}
}
if (catrec > 0 && !spellInfo->HasAttribute(SPELL_ATTR6_NO_CATEGORY_COOLDOWN_MODS))
{
@@ -10872,7 +10858,6 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite
if (HasSpell(spellInfo->Id))
{
needsCooldownPacket = true;
useSpellCooldown = true;
rec += cooldownMod * IN_MILLISECONDS; // SPELL_AURA_MOD_COOLDOWN does not affect category cooldows, verified with shaman shocks
}
}
@@ -10892,11 +10877,11 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite
// category spells
if (cat && catrec > 0)
{
_AddSpellCooldown(spellInfo->Id, cat, itemId, useSpellCooldown ? recTime : catrecTime, true, true);
_AddSpellCooldown(spellInfo->Id, 0, itemId, recTime, true, true);
if (needsCooldownPacket)
{
WorldPacket data;
BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spellInfo->Id, useSpellCooldown ? recTime : catrecTime);
BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spellInfo->Id, recTime);
SendDirectMessage(&data);
}