Core/Auras: Fix refresh of auras with spellmodifiers applied to currently cast spell.
This commit is contained in:
@@ -19609,7 +19609,7 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Restore spellmods in case of failed cast
|
// Restore spellmods in case of failed cast
|
||||||
void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId)
|
void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId, Aura* aura)
|
||||||
{
|
{
|
||||||
if (!spell || spell->m_appliedMods.empty())
|
if (!spell || spell->m_appliedMods.empty())
|
||||||
return;
|
return;
|
||||||
@@ -19628,6 +19628,9 @@ void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId)
|
|||||||
if (ownerAuraId && (ownerAuraId != mod->ownerAura->GetSpellProto()->Id))
|
if (ownerAuraId && (ownerAuraId != mod->ownerAura->GetSpellProto()->Id))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (aura && mod->ownerAura != aura)
|
||||||
|
continue;
|
||||||
|
|
||||||
// check if mod affected this spell
|
// check if mod affected this spell
|
||||||
Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(mod->ownerAura);
|
Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(mod->ownerAura);
|
||||||
if (iterMod == spell->m_appliedMods.end())
|
if (iterMod == spell->m_appliedMods.end())
|
||||||
@@ -19653,6 +19656,13 @@ void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::RestoreAllSpellMods(uint32 ownerAuraId, Aura* aura)
|
||||||
|
{
|
||||||
|
for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
|
||||||
|
if (m_currentSpells[i])
|
||||||
|
RestoreSpellMods(m_currentSpells[i], ownerAuraId, aura);
|
||||||
|
}
|
||||||
|
|
||||||
void Player::RemoveSpellMods(Spell* spell)
|
void Player::RemoveSpellMods(Spell* spell)
|
||||||
{
|
{
|
||||||
if (!spell)
|
if (!spell)
|
||||||
|
|||||||
@@ -1658,7 +1658,8 @@ class Player : public Unit, public GridObject<Player>
|
|||||||
bool IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell* spell = NULL);
|
bool IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell* spell = NULL);
|
||||||
template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell = NULL);
|
template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell = NULL);
|
||||||
void RemoveSpellMods(Spell* spell);
|
void RemoveSpellMods(Spell* spell);
|
||||||
void RestoreSpellMods(Spell* spell, uint32 ownerAuraId=0);
|
void RestoreSpellMods(Spell* spell, uint32 ownerAuraId = 0, Aura* aura = NULL);
|
||||||
|
void RestoreAllSpellMods(uint32 ownerAuraId = 0, Aura* aura = NULL);
|
||||||
void DropModCharge(SpellModifier* mod, Spell* spell);
|
void DropModCharge(SpellModifier* mod, Spell* spell);
|
||||||
void SetSpellModTakingSpell(Spell* spell, bool apply);
|
void SetSpellModTakingSpell(Spell* spell, bool apply);
|
||||||
|
|
||||||
|
|||||||
@@ -2115,6 +2115,8 @@ class Unit : public WorldObject
|
|||||||
bool m_isSorted;
|
bool m_isSorted;
|
||||||
uint32 m_transform;
|
uint32 m_transform;
|
||||||
|
|
||||||
|
Spell* m_currentSpells[CURRENT_MAX_SPELL];
|
||||||
|
|
||||||
AuraMap m_ownedAuras;
|
AuraMap m_ownedAuras;
|
||||||
AuraApplicationMap m_appliedAuras;
|
AuraApplicationMap m_appliedAuras;
|
||||||
AuraList m_removedAuras;
|
AuraList m_removedAuras;
|
||||||
@@ -2185,8 +2187,6 @@ class Unit : public WorldObject
|
|||||||
uint32 m_CombatTimer;
|
uint32 m_CombatTimer;
|
||||||
uint32 m_lastManaUse; // msecs
|
uint32 m_lastManaUse; // msecs
|
||||||
|
|
||||||
Spell* m_currentSpells[CURRENT_MAX_SPELL];
|
|
||||||
|
|
||||||
Diminishing m_Diminishing;
|
Diminishing m_Diminishing;
|
||||||
// Manage all Units that are threatened by us
|
// Manage all Units that are threatened by us
|
||||||
HostileRefManager m_HostileRefManager;
|
HostileRefManager m_HostileRefManager;
|
||||||
|
|||||||
@@ -826,6 +826,7 @@ bool Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode)
|
|||||||
|
|
||||||
if (refresh)
|
if (refresh)
|
||||||
{
|
{
|
||||||
|
RefreshSpellMods();
|
||||||
RefreshTimers();
|
RefreshTimers();
|
||||||
|
|
||||||
// reset charges
|
// reset charges
|
||||||
@@ -835,6 +836,13 @@ bool Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Aura::RefreshSpellMods()
|
||||||
|
{
|
||||||
|
for (Aura::ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
|
||||||
|
if (Player * player = appIter->second->GetTarget()->ToPlayer())
|
||||||
|
player->RestoreAllSpellMods(0, this);
|
||||||
|
}
|
||||||
|
|
||||||
bool Aura::IsPassive() const
|
bool Aura::IsPassive() const
|
||||||
{
|
{
|
||||||
return IsPassiveSpell(GetSpellProto());
|
return IsPassiveSpell(GetSpellProto());
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ class Aura
|
|||||||
void SetStackAmount(uint8 num);
|
void SetStackAmount(uint8 num);
|
||||||
bool ModStackAmount(int32 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
bool ModStackAmount(int32 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||||
|
|
||||||
|
void RefreshSpellMods();
|
||||||
|
|
||||||
uint8 GetCasterLevel() const { return m_casterLevel; }
|
uint8 GetCasterLevel() const { return m_casterLevel; }
|
||||||
|
|
||||||
bool IsPassive() const;
|
bool IsPassive() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user