*Cleanup, remove all positive auras (ie: buffs from another spec) on spec change.
--HG-- branch : trunk
This commit is contained in:
+7
-21
@@ -22033,6 +22033,8 @@ void Player::ActivateSpec(uint8 spec)
|
|||||||
if (GetMap()->IsBattleGround() && !HasAura(44521)) // In BattleGround with no Preparation buff
|
if (GetMap()->IsBattleGround() && !HasAura(44521)) // In BattleGround with no Preparation buff
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
RemoveAllAuras(this->GetGUID(), NULL, false, true); // remove all positive auras (ie: buffs from another spec)
|
||||||
|
|
||||||
_SaveActions();
|
_SaveActions();
|
||||||
|
|
||||||
UnsummonPetTemporaryIfAny();
|
UnsummonPetTemporaryIfAny();
|
||||||
@@ -22055,27 +22057,17 @@ void Player::ActivateSpec(uint8 spec)
|
|||||||
|
|
||||||
// remove all talent ranks, starting at highest rank
|
// remove all talent ranks, starting at highest rank
|
||||||
for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
|
for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
|
||||||
{
|
|
||||||
if (talentInfo->RankID[rank] != 0 && HasTalent(talentInfo->RankID[rank], m_activeSpec))
|
if (talentInfo->RankID[rank] != 0 && HasTalent(talentInfo->RankID[rank], m_activeSpec))
|
||||||
{
|
|
||||||
removeSpell(talentInfo->RankID[rank], true);
|
removeSpell(talentInfo->RankID[rank], true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// set glyphs
|
// set glyphs
|
||||||
for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot)
|
for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot)
|
||||||
{
|
|
||||||
// remove secondary glyph
|
// remove secondary glyph
|
||||||
if (uint32 oldglyph = m_Glyphs[m_activeSpec][slot])
|
if (uint32 oldglyph = m_Glyphs[m_activeSpec][slot])
|
||||||
{
|
|
||||||
if (GlyphPropertiesEntry const *old_gp = sGlyphPropertiesStore.LookupEntry(oldglyph))
|
if (GlyphPropertiesEntry const *old_gp = sGlyphPropertiesStore.LookupEntry(oldglyph))
|
||||||
{
|
|
||||||
RemoveAurasDueToSpell(old_gp->SpellId);
|
RemoveAurasDueToSpell(old_gp->SpellId);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SetActiveSpec(spec);
|
SetActiveSpec(spec);
|
||||||
uint32 spentTalents = 0;
|
uint32 spentTalents = 0;
|
||||||
@@ -22110,14 +22102,11 @@ void Player::ActivateSpec(uint8 spec)
|
|||||||
for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot)
|
for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot)
|
||||||
{
|
{
|
||||||
uint32 glyph = m_Glyphs[m_activeSpec][slot];
|
uint32 glyph = m_Glyphs[m_activeSpec][slot];
|
||||||
|
|
||||||
// apply primary glyph
|
// apply primary glyph
|
||||||
if (glyph)
|
if (glyph && GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph))
|
||||||
{
|
|
||||||
if (GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph))
|
|
||||||
{
|
|
||||||
CastSpell(this, gp->SpellId, true);
|
CastSpell(this, gp->SpellId, true);
|
||||||
}
|
|
||||||
}
|
|
||||||
SetGlyph(slot, glyph);
|
SetGlyph(slot, glyph);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22125,18 +22114,15 @@ void Player::ActivateSpec(uint8 spec)
|
|||||||
InitTalentForLevel();
|
InitTalentForLevel();
|
||||||
|
|
||||||
m_actionButtons.clear();
|
m_actionButtons.clear();
|
||||||
QueryResult *result = CharacterDatabase.PQuery("SELECT button,action,type FROM character_action WHERE guid = '%u' AND spec = '%u' ORDER BY button", GetGUIDLow(), m_activeSpec);
|
if (QueryResult *result = CharacterDatabase.PQuery("SELECT button,action,type FROM character_action WHERE guid = '%u' AND spec = '%u' ORDER BY button", GetGUIDLow(), m_activeSpec))
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
_LoadActions(result, false);
|
_LoadActions(result, false);
|
||||||
}
|
|
||||||
|
|
||||||
ResummonPetTemporaryUnSummonedIfAny();
|
ResummonPetTemporaryUnSummonedIfAny();
|
||||||
SendActionButtons(1);
|
SendActionButtons(1);
|
||||||
|
|
||||||
Powers pw = getPowerType();
|
Powers pw = getPowerType();
|
||||||
if (pw != POWER_MANA)
|
if (pw != POWER_MANA)
|
||||||
SetPower(POWER_MANA, 0);
|
SetPower(POWER_MANA, 0); // what on earth is this for?!
|
||||||
|
|
||||||
SetPower(pw, 0);
|
SetPower(pw, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-6
@@ -4133,6 +4133,18 @@ void Unit::RemoveAllAuras()
|
|||||||
RemoveAura(iter);
|
RemoveAura(iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Unit::RemoveAllAuras(uint64 casterGUID, Aura * except /*=NULL*/, bool negative /*=true*/, bool positive /*=true*/)
|
||||||
|
{
|
||||||
|
AuraMap::iterator iter = m_Auras.begin();
|
||||||
|
while (!m_Auras.empty())
|
||||||
|
{
|
||||||
|
Aura * aur = (*iter)->GetParentAura();
|
||||||
|
if (aur != except && (!casterGUID || aur->GetCasterGUID()==casterGUID)
|
||||||
|
&& ((negative && !aur->IsPositive()) || (positive && aur->IsPositive())))
|
||||||
|
RemoveAura(aur);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Unit::RemoveArenaAuras(bool onleave)
|
void Unit::RemoveArenaAuras(bool onleave)
|
||||||
{
|
{
|
||||||
// in join, remove positive buffs, on end, remove negative
|
// in join, remove positive buffs, on end, remove negative
|
||||||
@@ -4179,18 +4191,14 @@ void Unit::DelayAura(uint32 spellId, uint64 caster, int32 delaytime)
|
|||||||
void Unit::_RemoveAllAuraMods()
|
void Unit::_RemoveAllAuraMods()
|
||||||
{
|
{
|
||||||
for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i)
|
for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i)
|
||||||
{
|
|
||||||
(*i).second->ApplyAllModifiers(false);
|
(*i).second->ApplyAllModifiers(false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Unit::_ApplyAllAuraMods()
|
void Unit::_ApplyAllAuraMods()
|
||||||
{
|
{
|
||||||
for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i)
|
for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i)
|
||||||
{
|
|
||||||
(*i).second->ApplyAllModifiers(true);
|
(*i).second->ApplyAllModifiers(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool Unit::HasAuraTypeWithMiscvalue(AuraType auratype, uint32 miscvalue) const
|
bool Unit::HasAuraTypeWithMiscvalue(AuraType auratype, uint32 miscvalue) const
|
||||||
{
|
{
|
||||||
@@ -12073,11 +12081,9 @@ void Unit::SetPower(Powers power, uint32 val)
|
|||||||
|
|
||||||
// Update the pet's character sheet with happiness damage bonus
|
// Update the pet's character sheet with happiness damage bonus
|
||||||
if(pet->getPetType() == HUNTER_PET && power == POWER_HAPPINESS)
|
if(pet->getPetType() == HUNTER_PET && power == POWER_HAPPINESS)
|
||||||
{
|
|
||||||
pet->UpdateDamagePhysical(BASE_ATTACK);
|
pet->UpdateDamagePhysical(BASE_ATTACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Unit::SetMaxPower(Powers power, uint32 val)
|
void Unit::SetMaxPower(Powers power, uint32 val)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1524,6 +1524,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
void RemoveMovementImpairingAuras();
|
void RemoveMovementImpairingAuras();
|
||||||
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode = AURA_REMOVE_BY_DEFAULT, uint32 except=0);
|
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode = AURA_REMOVE_BY_DEFAULT, uint32 except=0);
|
||||||
void RemoveAllAuras();
|
void RemoveAllAuras();
|
||||||
|
void RemoveAllAuras(uint64 casterGUID, Aura * except = NULL, bool negative = true, bool positive = true);
|
||||||
void RemoveArenaAuras(bool onleave = false);
|
void RemoveArenaAuras(bool onleave = false);
|
||||||
void RemoveAllAurasOnDeath();
|
void RemoveAllAurasOnDeath();
|
||||||
void DelayAura(uint32 spellId, uint64 caster, int32 delaytime);
|
void DelayAura(uint32 spellId, uint64 caster, int32 delaytime);
|
||||||
|
|||||||
Reference in New Issue
Block a user