diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 842bfd574..3545ad19f 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -23137,18 +23137,30 @@ void Player::SendCooldownEvent(SpellInfo const* spellInfo, uint32 itemId /*= 0*/ SendDirectMessage(&data); } -void Player::UpdatePotionCooldown() +void Player::UpdatePotionCooldown(Spell* spell) { // no potion used i combat or still in combat if (!GetLastPotionId() || IsInCombat()) return; - // spell/item pair let set proper cooldown (except not existed charged spell cooldown spellmods for potions) - if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(GetLastPotionId())) - for (uint8 idx = 0; idx < MAX_ITEM_SPELLS; ++idx) - if (proto->Spells[idx].SpellId && proto->Spells[idx].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE) - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(proto->Spells[idx].SpellId)) - SendCooldownEvent(spellInfo, GetLastPotionId()); + // Call not from spell cast, send cooldown event for item spells if no in combat + if (!spell) + { + // spell/item pair let set proper cooldown (except not existed charged spell cooldown spellmods for potions) + if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(GetLastPotionId())) + for (uint8 idx = 0; idx < MAX_ITEM_SPELLS; ++idx) + if (proto->Spells[idx].SpellId && proto->Spells[idx].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE) + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(proto->Spells[idx].SpellId)) + SendCooldownEvent(spellInfo, GetLastPotionId()); + } + // from spell cases (m_lastPotionId set in Spell::SendSpellCooldown) + else + { + if (spell->IsIgnoringCooldowns()) + return; + else + SendCooldownEvent(spell->m_spellInfo, m_lastPotionId, spell); + } SetLastPotionId(0); } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 0128371cb..916bb8089 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1803,7 +1803,7 @@ public: void _SaveSpellCooldowns(SQLTransaction& trans, bool logout); uint32 GetLastPotionId() { return m_lastPotionId; } void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; } - void UpdatePotionCooldown(); + void UpdatePotionCooldown(Spell* spell = nullptr); void setResurrectRequestData(ObjectGuid guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana) { diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index e93740960..fce58c165 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4101,9 +4101,9 @@ void Spell::finish(bool ok) } } - // xinef: potions disabled by client, send event "not in combat" if need - if (m_caster->GetTypeId() == TYPEID_PLAYER && !IsTriggered()) - m_caster->ToPlayer()->UpdatePotionCooldown(); + // potions disabled by client, send event "not in combat" if need + if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_triggeredByAuraSpell) + m_caster->ToPlayer()->UpdatePotionCooldown(this); // Take mods after trigger spell (needed for 14177 to affect 48664) // mods are taken only on succesfull cast and independantly from targets of the spell @@ -7380,6 +7380,11 @@ bool Spell::IsNextMeleeSwingSpell() const return m_spellInfo->HasAttribute(SPELL_ATTR0_ON_NEXT_SWING_NO_DAMAGE); } +bool Spell::IsIgnoringCooldowns() const +{ + return (_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD) != 0; +} + bool Spell::IsAutoActionResetSpell() const { /// @todo changed SPELL_INTERRUPT_FLAG_AUTOATTACK -> SPELL_INTERRUPT_FLAG_INTERRUPT to fix compile - is this check correct at all? diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index d9c007c8c..6abacefe5 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -509,6 +509,7 @@ public: bool IsTriggered() const { return _triggeredCastFlags & TRIGGERED_FULL_MASK; }; bool IsChannelActive() const { return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0; } bool IsAutoActionResetSpell() const; + bool IsIgnoringCooldowns() const; bool IsDeletable() const { return !m_referencedFromCurrentSpell && !m_executedCurrently; } void SetReferencedFromCurrent(bool yes) { m_referencedFromCurrentSpell = yes; }