*Cleanup, remove all positive auras (ie: buffs from another spec) on spec change.
--HG-- branch : trunk
This commit is contained in:
@@ -192,7 +192,7 @@ struct TRINITY_DLL_DECL boss_keristraszaAI : public ScriptedAI
|
|||||||
|
|
||||||
if (!Enrage && (m_creature->GetHealth() < m_creature->GetMaxHealth() * 0.25))
|
if (!Enrage && (m_creature->GetHealth() < m_creature->GetMaxHealth() * 0.25))
|
||||||
{
|
{
|
||||||
DoScriptText(SAY_ENRAGE , m_creature);
|
DoScriptText(SAY_ENRAGE, m_creature);
|
||||||
DoCast(m_creature, SPELL_ENRAGE);
|
DoCast(m_creature, SPELL_ENRAGE);
|
||||||
Enrage = true;
|
Enrage = true;
|
||||||
}
|
}
|
||||||
|
|||||||
+27
-41
@@ -22024,80 +22024,72 @@ void Player::UpdateSpecCount(uint8 count)
|
|||||||
|
|
||||||
void Player::ActivateSpec(uint8 spec)
|
void Player::ActivateSpec(uint8 spec)
|
||||||
{
|
{
|
||||||
if(GetActiveSpec() == spec)
|
if (GetActiveSpec() == spec)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(GetSpecsCount() != MAX_TALENT_SPECS)
|
if (GetSpecsCount() != MAX_TALENT_SPECS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
uint32 const* talentTabIds = GetTalentTabPages(getClass());
|
uint32 const* talentTabIds = GetTalentTabPages(getClass());
|
||||||
|
|
||||||
for(uint8 i = 0; i < 3; ++i)
|
for (uint8 i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
uint32 talentTabId = talentTabIds[i];
|
uint32 talentTabId = talentTabIds[i];
|
||||||
|
|
||||||
for(uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
|
for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
|
||||||
{
|
{
|
||||||
TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
|
TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
|
||||||
if(!talentInfo)
|
if (!talentInfo)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip another tab talents
|
// skip another tab talents
|
||||||
if(talentInfo->TalentTab != talentTabId)
|
if (talentInfo->TalentTab != talentTabId)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
||||||
for(uint8 i = 0; i < 3; ++i)
|
for (uint8 i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
uint32 talentTabId = talentTabIds[i];
|
uint32 talentTabId = talentTabIds[i];
|
||||||
|
|
||||||
for(uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
|
for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
|
||||||
{
|
{
|
||||||
TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
|
TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
|
||||||
if(!talentInfo)
|
if (!talentInfo)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip another tab talents
|
// skip another tab talents
|
||||||
if(talentInfo->TalentTab != talentTabId)
|
if (talentInfo->TalentTab != talentTabId)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// learn highest talent rank that exists in newly activated spec
|
// learn highest talent rank that exists in newly activated spec
|
||||||
for(int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
|
for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
|
||||||
{
|
{
|
||||||
if(talentInfo->RankID[rank] && HasTalent(talentInfo->RankID[rank], m_activeSpec))
|
if (talentInfo->RankID[rank] && HasTalent(talentInfo->RankID[rank], m_activeSpec))
|
||||||
{
|
{
|
||||||
learnSpell(talentInfo->RankID[rank], false);
|
learnSpell(talentInfo->RankID[rank], false);
|
||||||
spentTalents += (rank + 1);
|
spentTalents += (rank + 1);
|
||||||
@@ -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))
|
||||||
{
|
CastSpell(this, gp->SpellId, true);
|
||||||
if (GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph))
|
|
||||||
{
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-7
@@ -3959,7 +3959,7 @@ void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit
|
|||||||
|
|
||||||
for(AuraMap::iterator iter = m_Auras.lower_bound(spellId); iter != m_Auras.upper_bound(spellId);)
|
for(AuraMap::iterator iter = m_Auras.lower_bound(spellId); iter != m_Auras.upper_bound(spellId);)
|
||||||
{
|
{
|
||||||
Aura * aur= iter->second;
|
Aura * aur = iter->second;
|
||||||
if (casterGUID == aur->GetCasterGUID())
|
if (casterGUID == aur->GetCasterGUID())
|
||||||
{
|
{
|
||||||
int32 damage[MAX_SPELL_EFFECTS];
|
int32 damage[MAX_SPELL_EFFECTS];
|
||||||
@@ -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,17 +4191,13 @@ 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,9 +12081,7 @@ 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);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -1514,7 +1514,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler);
|
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler);
|
||||||
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer);
|
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer);
|
||||||
void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId);
|
void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId);
|
||||||
void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura * except=NULL, bool negative = true, bool positive = true);
|
void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura * except = NULL, bool negative = true, bool positive = true);
|
||||||
void RemoveNotOwnSingleTargetAuras(uint32 newPhase = 0x0);
|
void RemoveNotOwnSingleTargetAuras(uint32 newPhase = 0x0);
|
||||||
|
|
||||||
void RemoveRankAurasDueToSpell(uint32 spellId);
|
void RemoveRankAurasDueToSpell(uint32 spellId);
|
||||||
@@ -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