*Check auraname when auraeffect is constructed

--HG--
branch : trunk
This commit is contained in:
megamage
2009-06-03 11:22:00 -05:00
parent 5036cf91f4
commit e861df8795
3 changed files with 13 additions and 17 deletions
+7 -9
View File
@@ -456,10 +456,9 @@ Aura::~Aura()
AuraEffect::AuraEffect(Aura * parentAura, uint8 effIndex, int32 * currentBasePoints , Unit *caster, Item* castItem, WorldObject *source) : AuraEffect::AuraEffect(Aura * parentAura, uint8 effIndex, int32 * currentBasePoints , Unit *caster, Item* castItem, WorldObject *source) :
m_parentAura(parentAura), m_spellmod(NULL), m_periodicTimer(0), m_isPeriodic(false), m_isAreaAura(false), m_isPersistent(false), m_parentAura(parentAura), m_spellmod(NULL), m_periodicTimer(0), m_isPeriodic(false), m_isAreaAura(false), m_isPersistent(false),
m_target(parentAura->GetTarget()), m_tickNumber(0) m_target(parentAura->GetTarget()), m_tickNumber(0)
, m_spellProto(parentAura->GetSpellProto()), m_effIndex(effIndex), m_auraName(AuraType(m_spellProto->EffectApplyAuraName[m_effIndex]))
{ {
m_spellProto = parentAura->GetSpellProto(); assert(m_auraName < TOTAL_AURAS);
m_effIndex = effIndex;
m_auraName = AuraType(m_spellProto->EffectApplyAuraName[m_effIndex]);
if(currentBasePoints) if(currentBasePoints)
m_currentBasePoints = *currentBasePoints; m_currentBasePoints = *currentBasePoints;
@@ -533,12 +532,12 @@ AreaAuraEffect::AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * curre
case SPELL_EFFECT_APPLY_AREA_AURA_PARTY: case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
m_areaAuraType = AREA_AURA_PARTY; m_areaAuraType = AREA_AURA_PARTY;
if(m_target->GetTypeId() == TYPEID_UNIT && ((Creature*)m_target)->isTotem()) if(m_target->GetTypeId() == TYPEID_UNIT && ((Creature*)m_target)->isTotem())
m_auraName = SPELL_AURA_NONE; const_cast<AuraType>(m_auraName) = SPELL_AURA_NONE;
break; break;
case SPELL_EFFECT_APPLY_AREA_AURA_RAID: case SPELL_EFFECT_APPLY_AREA_AURA_RAID:
m_areaAuraType = AREA_AURA_RAID; m_areaAuraType = AREA_AURA_RAID;
if(m_target->GetTypeId() == TYPEID_UNIT && ((Creature*)m_target)->isTotem()) if(m_target->GetTypeId() == TYPEID_UNIT && ((Creature*)m_target)->isTotem())
m_auraName = SPELL_AURA_NONE; const_cast<AuraType>(m_auraName) = SPELL_AURA_NONE;
break; break;
case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND: case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND:
m_areaAuraType = AREA_AURA_FRIEND; m_areaAuraType = AREA_AURA_FRIEND;
@@ -546,7 +545,7 @@ AreaAuraEffect::AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * curre
case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY: case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY:
m_areaAuraType = AREA_AURA_ENEMY; m_areaAuraType = AREA_AURA_ENEMY;
if(m_target == caster_ptr) if(m_target == caster_ptr)
m_auraName = SPELL_AURA_NONE; // Do not do any effect on self const_cast<AuraType>(m_auraName) = SPELL_AURA_NONE; // Do not do any effect on self
break; break;
case SPELL_EFFECT_APPLY_AREA_AURA_PET: case SPELL_EFFECT_APPLY_AREA_AURA_PET:
m_areaAuraType = AREA_AURA_PET; m_areaAuraType = AREA_AURA_PET;
@@ -554,7 +553,7 @@ AreaAuraEffect::AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * curre
case SPELL_EFFECT_APPLY_AREA_AURA_OWNER: case SPELL_EFFECT_APPLY_AREA_AURA_OWNER:
m_areaAuraType = AREA_AURA_OWNER; m_areaAuraType = AREA_AURA_OWNER;
if(m_target == caster_ptr) if(m_target == caster_ptr)
m_auraName = SPELL_AURA_NONE; const_cast<AuraType>(m_auraName) = SPELL_AURA_NONE;
break; break;
default: default:
sLog.outError("Wrong spell effect in AreaAura constructor"); sLog.outError("Wrong spell effect in AreaAura constructor");
@@ -856,8 +855,7 @@ void AuraEffect::ApplyModifier(bool apply, bool Real, bool changeAmount)
if (GetParentAura()->IsRemoved()) if (GetParentAura()->IsRemoved())
return; return;
if(m_auraName<TOTAL_AURAS) (*this.*AuraHandler [m_auraName])(apply,Real, changeAmount);
(*this.*AuraHandler [m_auraName])(apply,Real, changeAmount);
} }
void AuraEffect::RecalculateAmount(bool applied) void AuraEffect::RecalculateAmount(bool applied)
+3 -3
View File
@@ -377,11 +377,11 @@ class TRINITY_DLL_SPEC AuraEffect
Unit * const m_target; Unit * const m_target;
uint64 m_sourceGUID; // Spell::m_caster/trap? for normal aura, totem/paladin for areaaura, dynobj for persistent aura uint64 m_sourceGUID; // Spell::m_caster/trap? for normal aura, totem/paladin for areaaura, dynobj for persistent aura
SpellEntry const *m_spellProto;
uint32 m_tickNumber; uint32 m_tickNumber;
uint8 m_effIndex; const SpellEntry * const m_spellProto;
AuraType m_auraName; const uint8 m_effIndex;
const AuraType m_auraName;
int32 m_currentBasePoints; int32 m_currentBasePoints;
int32 m_amount; int32 m_amount;
+3 -5
View File
@@ -4099,7 +4099,6 @@ void Unit::RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId)
void Unit::RemoveAurasByType(AuraType auraType, uint64 casterGUID, Aura * except) void Unit::RemoveAurasByType(AuraType auraType, uint64 casterGUID, Aura * except)
{ {
if (auraType >= TOTAL_AURAS) return;
for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();) for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
{ {
Aura * aur = (*iter)->GetParentAura(); Aura * aur = (*iter)->GetParentAura();
@@ -4116,7 +4115,6 @@ void Unit::RemoveAurasByType(AuraType auraType, uint64 casterGUID, Aura * except
void Unit::RemoveAurasByTypeWithDispel(AuraType auraType, Spell * spell) void Unit::RemoveAurasByTypeWithDispel(AuraType auraType, Spell * spell)
{ {
if (auraType >= TOTAL_AURAS) return;
std::queue < std::pair < uint32, uint64 > > remove_list; std::queue < std::pair < uint32, uint64 > > remove_list;
for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();++iter) for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();++iter)
@@ -11999,10 +11997,10 @@ typedef std::list< ProcTriggeredData > ProcTriggeredList;
// for example SPELL_AURA_MECHANIC_IMMUNITY - need check for mechanic // for example SPELL_AURA_MECHANIC_IMMUNITY - need check for mechanic
bool InitTriggerAuraData() bool InitTriggerAuraData()
{ {
for (int i=0;i<TOTAL_AURAS;i++) for (int i = 0; i < TOTAL_AURAS; ++i)
{ {
isTriggerAura[i]=false; isTriggerAura[i]=false;
isNonTriggerAura[i] = false; isNonTriggerAura[i] = false;
} }
isTriggerAura[SPELL_AURA_DUMMY] = true; isTriggerAura[SPELL_AURA_DUMMY] = true;
isTriggerAura[SPELL_AURA_MOD_CONFUSE] = true; isTriggerAura[SPELL_AURA_MOD_CONFUSE] = true;