diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/bindings/scripts/scripts/northrend/nexus/nexus/boss_keristrasza.cpp | 2 | ||||
| -rw-r--r-- | src/game/Player.cpp | 68 | ||||
| -rw-r--r-- | src/game/Unit.cpp | 20 | ||||
| -rw-r--r-- | src/game/Unit.h | 3 |
4 files changed, 43 insertions, 50 deletions
diff --git a/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_keristrasza.cpp b/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_keristrasza.cpp index 791ecbd76cf..9bfd6048de1 100644 --- a/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_keristrasza.cpp +++ b/src/bindings/scripts/scripts/northrend/nexus/nexus/boss_keristrasza.cpp @@ -192,7 +192,7 @@ struct TRINITY_DLL_DECL boss_keristraszaAI : public ScriptedAI 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); Enrage = true; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 56d8fda813e..e9634722fab 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -22024,80 +22024,72 @@ void Player::UpdateSpecCount(uint8 count) void Player::ActivateSpec(uint8 spec) { - if(GetActiveSpec() == spec) + if (GetActiveSpec() == spec) return; - if(GetSpecsCount() != MAX_TALENT_SPECS) + if (GetSpecsCount() != MAX_TALENT_SPECS) return; - if(GetMap()->IsBattleGround() && !HasAura(44521)) // In BattleGround with no Preparation buff + 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(); uint32 const* talentTabIds = GetTalentTabPages(getClass()); - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++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); - if(!talentInfo) + if (!talentInfo) continue; // skip another tab talents - if(talentInfo->TalentTab != talentTabId) + if (talentInfo->TalentTab != talentTabId) continue; // 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); - } - } + 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)) - { + 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; - for(uint8 i = 0; i < 3; ++i) + for (uint8 i = 0; i < 3; ++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); - if(!talentInfo) + if (!talentInfo) continue; // skip another tab talents - if(talentInfo->TalentTab != talentTabId) + if (talentInfo->TalentTab != talentTabId) continue; // 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); spentTalents += (rank + 1); @@ -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)) - { - CastSpell(this, gp->SpellId, true); - } - } + 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); + if (pw != POWER_MANA) + SetPower(POWER_MANA, 0); // what on earth is this for?! SetPower(pw, 0); } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 3647ee87fae..b349182ecfc 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -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);) { - Aura * aur= iter->second; + Aura * aur = iter->second; if (casterGUID == aur->GetCasterGUID()) { int32 damage[MAX_SPELL_EFFECTS]; @@ -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,17 +4191,13 @@ 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,9 +12081,7 @@ 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); - } } } diff --git a/src/game/Unit.h b/src/game/Unit.h index 7729233a757..efe615d5c17 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1514,7 +1514,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler); void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer); 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 RemoveRankAurasDueToSpell(uint32 spellId); @@ -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); |
