From 5047eb7a6265d2bf496ef22d7c9a6b30fa21d466 Mon Sep 17 00:00:00 2001 From: QAston Date: Mon, 17 Aug 2009 16:57:36 +0200 Subject: [PATCH] *Implement aura type SPELL_AURA_PREVENT_REGENERATE_POWER(294). --HG-- branch : trunk --- src/game/Player.cpp | 3 +++ src/game/SpellAuraDefines.h | 2 +- src/game/SpellAuras.cpp | 2 +- src/game/Unit.cpp | 10 ++++++++++ src/game/Unit.h | 1 + 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e7630948d1..45b9677347 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2041,6 +2041,9 @@ void Player::RegenerateAll() void Player::Regenerate(Powers power) { + // TODO: possible use of miscvalueb instead of amount + if (HasAuraTypeWithValue(SPELL_AURA_PREVENT_REGENERATE_POWER, power)) + return; uint32 curValue = GetPower(power); uint32 maxValue = GetMaxPower(power); diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h index d25ac1659b..0c2fefa848 100644 --- a/src/game/SpellAuraDefines.h +++ b/src/game/SpellAuraDefines.h @@ -339,7 +339,7 @@ enum AuraType SPELL_AURA_MOD_XP_QUEST_PCT, SPELL_AURA_292, SPELL_AURA_293, - SPELL_AURA_294, + SPELL_AURA_PREVENT_REGENERATE_POWER, TOTAL_AURAS = 295 }; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 738c011a48..82a907feb8 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -347,7 +347,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &Aura::HandleNoImmediateEffect, //291 SPELL_AURA_MOD_XP_QUEST_PCT implemented in Player::RewardQuest &Aura::HandleNULL, //292 call stabled pet &Aura::HandleNULL, //293 2 test spells - &Aura::HandleNULL //294 2 spells, possible prevent mana regen + &Aura::HandleNoImmediateEffect //294 SPELL_AURA_PREVENT_REGENERATE_POWER implemented in Player::Regenerate(Powers power) }; #undef Aura diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 4107631356..25e077cc97 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4185,6 +4185,16 @@ bool Unit::HasAuraTypeWithMiscvalue(AuraType auratype, uint32 miscvalue) const return false; } +bool Unit::HasAuraTypeWithValue(AuraType auratype, uint32 value) const +{ + AuraEffectList const& mTotalAuraList = GetAurasByType(auratype); + for(AuraEffectList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i) + if (value == (*i)->GetAmount()) + return true; + return false; +} + + bool Unit::HasAuraType(AuraType auraType) const { return (!m_modAuras[auraType].empty()); diff --git a/src/game/Unit.h b/src/game/Unit.h index 21b92bfb7a..bb6b426254 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1613,6 +1613,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject bool HasAura(Aura * aur) const; bool HasAuraType(AuraType auraType) const; bool HasAuraTypeWithMiscvalue(AuraType auratype, uint32 miscvalue) const; + bool HasAuraTypeWithValue(AuraType auratype, uint32 value) const; inline AuraEffect* GetDummyAura(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const { return GetAuraEffect(SPELL_AURA_DUMMY, name, iconId, effIndex);} AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const; uint32 GetDiseasesByCaster(uint64 casterGUID, bool remove = false);