mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 05:36:23 +00:00
fix(Core/Cooldown): Implement spell cooldown overrides to address cha… (#15143)
This commit is contained in:
@@ -2804,6 +2804,16 @@ void Creature::AddSpellCooldown(uint32 spell_id, uint32 /*itemid*/, uint32 end_t
|
||||
{
|
||||
_AddCreatureSpellCooldown(spellInfo->Id, 0, spellcooldown);
|
||||
}
|
||||
|
||||
if (sSpellMgr->HasSpellCooldownOverride(spellInfo->Id))
|
||||
{
|
||||
if (IsCharmed() && GetCharmer()->IsPlayer())
|
||||
{
|
||||
WorldPacket data;
|
||||
BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spellInfo->Id, spellcooldown);
|
||||
GetCharmer()->ToPlayer()->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32 Creature::GetSpellCooldown(uint32 spell_id) const
|
||||
|
||||
@@ -15876,6 +15876,24 @@ bool CharmInfo::AddSpellToActionBar(SpellInfo const* spellInfo, ActiveStates new
|
||||
if (!PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
|
||||
{
|
||||
SetActionBar(i, spell_id, newstate == ACT_DECIDE ? spellInfo->IsAutocastable() ? ACT_DISABLED : ACT_PASSIVE : newstate);
|
||||
|
||||
if (_unit->GetCharmer() && _unit->GetCharmer()->IsPlayer())
|
||||
{
|
||||
if (Creature* creature = _unit->ToCreature())
|
||||
{
|
||||
// Processing this packet needs to be delayed
|
||||
_unit->m_Events.AddEventAtOffset([creature, spell_id]()
|
||||
{
|
||||
if (uint32 cooldown = creature->GetSpellCooldown(spell_id))
|
||||
{
|
||||
WorldPacket data;
|
||||
creature->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spell_id, cooldown);
|
||||
creature->GetCharmer()->ToPlayer()->SendDirectMessage(&data);
|
||||
}
|
||||
}, 500ms);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user