mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 17:49:10 +00:00
fix(Core/Spells): Properly handle pet spell auras with infinity cooldown. (#9576)
Fixes #9339
This commit is contained in:
@@ -750,7 +750,10 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
|
||||
|
||||
if (result == SPELL_CAST_OK)
|
||||
{
|
||||
pet->ToCreature()->AddSpellCooldown(spellid, 0, spellInfo->IsCooldownStartedOnEvent() ? infinityCooldownDelay : 0);
|
||||
if (!spellInfo->IsCooldownStartedOnEvent())
|
||||
{
|
||||
pet->ToCreature()->AddSpellCooldown(spellid, 0, 0);
|
||||
}
|
||||
|
||||
unit_target = spell->m_targets.GetUnitTarget();
|
||||
|
||||
|
||||
@@ -553,16 +553,6 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
|
||||
}
|
||||
|
||||
pet->RemoveOwnedAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL);
|
||||
|
||||
if (spellInfo->IsCooldownStartedOnEvent())
|
||||
{
|
||||
pet->AddSpellCooldown(spellId, 0, 0);
|
||||
|
||||
WorldPacket data(SMSG_COOLDOWN_EVENT, 4 + 8);
|
||||
data << uint32(spellInfo->Id);
|
||||
data << pet->GetGUID();
|
||||
_player->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleCancelGrowthAuraOpcode(WorldPacket& /*recvPacket*/)
|
||||
|
||||
@@ -494,12 +494,16 @@ void Aura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication* auraApp)
|
||||
m_applications[target->GetGUID()] = auraApp;
|
||||
|
||||
// set infinity cooldown state for spells
|
||||
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if (m_spellInfo->IsCooldownStartedOnEvent() && !m_castItemGuid && caster)
|
||||
{
|
||||
if (m_spellInfo->IsCooldownStartedOnEvent() && !m_castItemGuid)
|
||||
if (caster->IsPlayer())
|
||||
{
|
||||
caster->ToPlayer()->AddSpellAndCategoryCooldowns(m_spellInfo, 0, nullptr, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
caster->ToCreature()->AddSpellCooldown(m_spellInfo->Id, 0, infinityCooldownDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -526,6 +530,30 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication* auraAp
|
||||
m_removedApplications.push_back(auraApp);
|
||||
|
||||
// reset cooldown state for spells
|
||||
if (m_spellInfo->IsCooldownStartedOnEvent() && !m_castItemGuid && caster)
|
||||
{
|
||||
if (caster->IsPlayer())
|
||||
{
|
||||
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
|
||||
caster->ToPlayer()->SendCooldownEvent(GetSpellInfo());
|
||||
}
|
||||
else
|
||||
{
|
||||
caster->ToCreature()->AddSpellCooldown(m_spellInfo->Id, 0, 0);
|
||||
|
||||
if (Unit* owner = caster->GetCharmerOrOwner())
|
||||
{
|
||||
if (Player* playerOwner = owner->ToPlayer())
|
||||
{
|
||||
WorldPacket data(SMSG_COOLDOWN_EVENT, 4 + 8);
|
||||
data << uint32(m_spellInfo->Id);
|
||||
data << caster->GetGUID();
|
||||
playerOwner->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (GetSpellInfo()->IsCooldownStartedOnEvent() && !m_castItemGuid)
|
||||
|
||||
Reference in New Issue
Block a user