*Cleanup, remove all positive auras (ie: buffs from another spec) on spec change.

--HG--
branch : trunk
This commit is contained in:
maximius
2009-10-17 02:52:10 -07:00
parent ad91c3a94b
commit 46f2faf1f3
4 changed files with 43 additions and 50 deletions
+7 -21
View File
@@ -22033,6 +22033,8 @@ void Player::ActivateSpec(uint8 spec)
if (GetMap()->IsBattleGround() && !HasAura(44521)) // In BattleGround with no Preparation buff
return;
RemoveAllAuras(this->GetGUID(), NULL, false, true); // remove all positive auras (ie: buffs from another spec)
_SaveActions();
UnsummonPetTemporaryIfAny();
@@ -22055,27 +22057,17 @@ void Player::ActivateSpec(uint8 spec)
// remove all talent ranks, starting at highest rank
for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
{
if (talentInfo->RankID[rank] != 0 && HasTalent(talentInfo->RankID[rank], m_activeSpec))
{
removeSpell(talentInfo->RankID[rank], true);
}
}
}
}
// set glyphs
for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot)
{
// remove secondary glyph
if (uint32 oldglyph = m_Glyphs[m_activeSpec][slot])
{
if (GlyphPropertiesEntry const *old_gp = sGlyphPropertiesStore.LookupEntry(oldglyph))
{
RemoveAurasDueToSpell(old_gp->SpellId);
}
}
}
SetActiveSpec(spec);
uint32 spentTalents = 0;
@@ -22110,14 +22102,11 @@ void Player::ActivateSpec(uint8 spec)
for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot)
{
uint32 glyph = m_Glyphs[m_activeSpec][slot];
// apply primary glyph
if (glyph)
{
if (GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph))
{
if (glyph && GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph))
CastSpell(this, gp->SpellId, true);
}
}
SetGlyph(slot, glyph);
}
@@ -22125,18 +22114,15 @@ void Player::ActivateSpec(uint8 spec)
InitTalentForLevel();
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 (result)
{
if (QueryResult *result = CharacterDatabase.PQuery("SELECT button,action,type FROM character_action WHERE guid = '%u' AND spec = '%u' ORDER BY button", GetGUIDLow(), m_activeSpec))
_LoadActions(result, false);
}
ResummonPetTemporaryUnSummonedIfAny();
SendActionButtons(1);
Powers pw = getPowerType();
if (pw != POWER_MANA)
SetPower(POWER_MANA, 0);
SetPower(POWER_MANA, 0); // what on earth is this for?!
SetPower(pw, 0);
}
+12 -6
View File
@@ -4133,6 +4133,18 @@ void Unit::RemoveAllAuras()
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)
{
// 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()
{
for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i)
{
(*i).second->ApplyAllModifiers(false);
}
}
void Unit::_ApplyAllAuraMods()
{
for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i)
{
(*i).second->ApplyAllModifiers(true);
}
}
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
if(pet->getPetType() == HUNTER_PET && power == POWER_HAPPINESS)
{
pet->UpdateDamagePhysical(BASE_ATTACK);
}
}
}
void Unit::SetMaxPower(Powers power, uint32 val)
{
+1
View File
@@ -1524,6 +1524,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void RemoveMovementImpairingAuras();
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode = AURA_REMOVE_BY_DEFAULT, uint32 except=0);
void RemoveAllAuras();
void RemoveAllAuras(uint64 casterGUID, Aura * except = NULL, bool negative = true, bool positive = true);
void RemoveArenaAuras(bool onleave = false);
void RemoveAllAurasOnDeath();
void DelayAura(uint32 spellId, uint64 caster, int32 delaytime);