*Rename formalCaster as "source"

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-23 20:50:21 -05:00
parent 94692ea5f7
commit af1f0fd419
4 changed files with 26 additions and 27 deletions
+13 -13
View File
@@ -343,7 +343,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&AuraEffect::HandleUnused, //288 not used by any spells (3.09) except 1 test spell. &AuraEffect::HandleUnused, //288 not used by any spells (3.09) except 1 test spell.
}; };
Aura::Aura(SpellEntry const* spellproto, uint32 effMask, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem, Unit * formalCaster) : Aura::Aura(SpellEntry const* spellproto, uint32 effMask, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem, Unit * source) :
m_caster_guid(0), m_castItemGuid(castItem?castItem->GetGUID():0), m_target(target), m_caster_guid(0), m_castItemGuid(castItem?castItem->GetGUID():0), m_target(target),
m_timeCla(1000), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE), m_timeCla(1000), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE),
m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),m_auraStateMask(0), m_updated(false), m_isRemoved(false) m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),m_auraStateMask(0), m_updated(false), m_isRemoved(false)
@@ -411,9 +411,9 @@ m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),m_aura
if (m_auraFlags & (uint8(1) << i)) if (m_auraFlags & (uint8(1) << i))
{ {
if (currentBasePoints) if (currentBasePoints)
m_partAuras[i] = CreateAuraEffect(this, i, currentBasePoints + i, caster, NULL, formalCaster); m_partAuras[i] = CreateAuraEffect(this, i, currentBasePoints + i, caster, NULL, source);
else else
m_partAuras[i] = CreateAuraEffect(this, i, NULL, caster, NULL, formalCaster); m_partAuras[i] = CreateAuraEffect(this, i, NULL, caster, NULL, source);
// correct flags if aura couldn't be created // correct flags if aura couldn't be created
if (!m_partAuras[i]) if (!m_partAuras[i])
m_auraFlags &= uint8(~(1<< i)); m_auraFlags &= uint8(~(1<< i));
@@ -511,14 +511,14 @@ m_target(parentAura->GetTarget()), m_tickNumber(0)
m_periodicTimer += m_amplitude; m_periodicTimer += m_amplitude;
} }
AreaAuraEffect::AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * currentBasePoints, Unit * caster, Item * castItem, Unit * formalCaster) AreaAuraEffect::AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * currentBasePoints, Unit * caster, Item * castItem, Unit * source)
: AuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem) : AuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem)
{ {
m_removeTime = FRIENDLY_AA_REMOVE_TIME; m_removeTime = FRIENDLY_AA_REMOVE_TIME;
m_isAreaAura = true; m_isAreaAura = true;
Unit* caster_ptr = formalCaster ? formalCaster : caster ? caster : m_target; Unit* caster_ptr = source ? source : caster ? caster : m_target;
m_formalCasterGUID = caster_ptr->GetGUID(); m_sourceGUID = caster_ptr->GetGUID();
if (m_spellProto->Effect[effIndex] == SPELL_EFFECT_APPLY_AREA_AURA_ENEMY) if (m_spellProto->Effect[effIndex] == SPELL_EFFECT_APPLY_AREA_AURA_ENEMY)
m_radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(GetSpellProto()->EffectRadiusIndex[m_effIndex])); m_radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(GetSpellProto()->EffectRadiusIndex[m_effIndex]));
@@ -577,11 +577,11 @@ PersistentAreaAuraEffect::~PersistentAreaAuraEffect()
{ {
} }
AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem, Unit* formalCaster) AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem, Unit* source)
{ {
assert (parentAura); assert (parentAura);
if (IsAreaAuraEffect(parentAura->GetSpellProto()->Effect[effIndex])) if (IsAreaAuraEffect(parentAura->GetSpellProto()->Effect[effIndex]))
return new AreaAuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem, formalCaster); return new AreaAuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem, source);
else if (parentAura->GetSpellProto()->Effect[effIndex] == SPELL_EFFECT_APPLY_AURA) else if (parentAura->GetSpellProto()->Effect[effIndex] == SPELL_EFFECT_APPLY_AURA)
return new AuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem); return new AuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem);
else if (parentAura->GetSpellProto()->Effect[effIndex] == SPELL_EFFECT_PERSISTENT_AREA_AURA) else if (parentAura->GetSpellProto()->Effect[effIndex] == SPELL_EFFECT_PERSISTENT_AREA_AURA)
@@ -600,14 +600,14 @@ Unit* Aura::GetCaster() const
return unit && unit->IsInWorld() ? unit : NULL; return unit && unit->IsInWorld() ? unit : NULL;
} }
Unit* AreaAuraEffect::GetFormalCaster() const Unit* AreaAuraEffect::GetSource() const
{ {
if(m_formalCasterGUID==m_target->GetGUID()) if(m_sourceGUID==m_target->GetGUID())
return m_target; return m_target;
//return ObjectAccessor::GetUnit(*m_target,m_caster_guid); //return ObjectAccessor::GetUnit(*m_target,m_caster_guid);
//must return caster even if it's in another grid/map //must return caster even if it's in another grid/map
Unit *unit = ObjectAccessor::GetObjectInWorld(m_formalCasterGUID, (Unit*)NULL); Unit *unit = ObjectAccessor::GetObjectInWorld(m_sourceGUID, (Unit*)NULL);
return unit && unit->IsInWorld() ? unit : NULL; return unit && unit->IsInWorld() ? unit : NULL;
} }
@@ -682,7 +682,7 @@ void AuraEffect::Update(uint32 diff)
void AreaAuraEffect::Update(uint32 diff) void AreaAuraEffect::Update(uint32 diff)
{ {
// update for the caster of the aura // update for the caster of the aura
if(m_formalCasterGUID == m_target->GetGUID()) if(m_sourceGUID == m_target->GetGUID())
{ {
Unit* caster = m_target; Unit* caster = m_target;
Unit * originalCaster = GetCaster(); Unit * originalCaster = GetCaster();
@@ -773,7 +773,7 @@ void AreaAuraEffect::Update(uint32 diff)
return; return;
// Caster may be deleted due to update // Caster may be deleted due to update
Unit* caster = GetFormalCaster(); Unit* caster = GetSource();
// remove aura if out-of-range from caster (after teleport for example) // remove aura if out-of-range from caster (after teleport for example)
// or caster is isolated or caster no longer has the aura // or caster is isolated or caster no longer has the aura
+6 -7
View File
@@ -54,7 +54,7 @@ class TRINITY_DLL_SPEC Aura
friend void Player::SendAurasForTarget(Unit *target); friend void Player::SendAurasForTarget(Unit *target);
public: public:
virtual ~Aura(); virtual ~Aura();
Aura(SpellEntry const* spellproto, uint32 effMask, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL, Unit * formalCaster=NULL); Aura(SpellEntry const* spellproto, uint32 effMask, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL, Unit * source=NULL);
SpellEntry const* GetSpellProto() const { return m_spellProto; } SpellEntry const* GetSpellProto() const { return m_spellProto; }
uint32 GetId() const{ return m_spellProto->Id; } uint32 GetId() const{ return m_spellProto->Id; }
@@ -171,7 +171,7 @@ class TRINITY_DLL_SPEC Aura
class TRINITY_DLL_SPEC AuraEffect class TRINITY_DLL_SPEC AuraEffect
{ {
public: public:
friend AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem, Unit * formalCaster); friend AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem, Unit * source);
friend void Aura::SetStackAmount(uint8 stackAmount, bool applied); friend void Aura::SetStackAmount(uint8 stackAmount, bool applied);
//aura handlers //aura handlers
void HandleNULL(bool, bool, bool) void HandleNULL(bool, bool, bool)
@@ -394,16 +394,15 @@ class TRINITY_DLL_SPEC AuraEffect
class TRINITY_DLL_SPEC AreaAuraEffect : public AuraEffect class TRINITY_DLL_SPEC AreaAuraEffect : public AuraEffect
{ {
public: public:
AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * currentBasePoints, Unit * caster=NULL, Item * castItem=NULL, Unit * formalCaster=NULL); AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * currentBasePoints, Unit * caster=NULL, Item * castItem=NULL, Unit * source=NULL);
~AreaAuraEffect(); ~AreaAuraEffect();
Unit* GetFormalCaster() const; Unit* GetSource() const;
uint64 const& GetFormalCasterGUID() const { return m_formalCasterGUID; }
void Update(uint32 diff); void Update(uint32 diff);
private: private:
float m_radius; float m_radius;
int32 m_removeTime; int32 m_removeTime;
AreaAuraType m_areaAuraType; AreaAuraType m_areaAuraType;
uint64 m_formalCasterGUID; // used for check range uint64 m_sourceGUID; // used for check range
}; };
class TRINITY_DLL_SPEC PersistentAreaAuraEffect : public AuraEffect class TRINITY_DLL_SPEC PersistentAreaAuraEffect : public AuraEffect
@@ -413,5 +412,5 @@ class TRINITY_DLL_SPEC PersistentAreaAuraEffect : public AuraEffect
~PersistentAreaAuraEffect(); ~PersistentAreaAuraEffect();
void Update(uint32 diff); void Update(uint32 diff);
}; };
AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem = NULL, Unit * formalCaster=NULL); AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem = NULL, Unit * source=NULL);
#endif #endif
+6 -6
View File
@@ -8499,7 +8499,7 @@ Unit* Unit::SelectMagnetTarget(Unit *victim, SpellEntry const *spellInfo)
Unit::AuraEffectList const& magnetAuras = victim->GetAurasByType(SPELL_AURA_SPELL_MAGNET); Unit::AuraEffectList const& magnetAuras = victim->GetAurasByType(SPELL_AURA_SPELL_MAGNET);
for(Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr) for(Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
if(Unit* magnet = (*itr)->IsAreaAura() ? ((AreaAuraEffect*)(*itr))->GetFormalCaster():(*itr)->GetCaster() ) if(Unit* magnet = (*itr)->IsAreaAura() ? ((AreaAuraEffect*)(*itr))->GetSource():(*itr)->GetCaster() )
if(magnet->isAlive()) if(magnet->isAlive())
{ {
return magnet; return magnet;
@@ -8510,7 +8510,7 @@ Unit* Unit::SelectMagnetTarget(Unit *victim, SpellEntry const *spellInfo)
{ {
AuraEffectList const& hitTriggerAuras = victim->GetAurasByType(SPELL_AURA_ADD_CASTER_HIT_TRIGGER); AuraEffectList const& hitTriggerAuras = victim->GetAurasByType(SPELL_AURA_ADD_CASTER_HIT_TRIGGER);
for(AuraEffectList::const_iterator i = hitTriggerAuras.begin(); i != hitTriggerAuras.end(); ++i) for(AuraEffectList::const_iterator i = hitTriggerAuras.begin(); i != hitTriggerAuras.end(); ++i)
if(Unit* magnet = (*i)->IsAreaAura() ? ((AreaAuraEffect*)(*i))->GetFormalCaster():(*i)->GetCaster() ) if(Unit* magnet = (*i)->IsAreaAura() ? ((AreaAuraEffect*)(*i))->GetSource():(*i)->GetCaster() )
if(magnet->isAlive() && magnet->IsWithinLOSInMap(this)) if(magnet->isAlive() && magnet->IsWithinLOSInMap(this))
if(roll_chance_i((*i)->GetAmount())) if(roll_chance_i((*i)->GetAmount()))
{ {
@@ -13766,7 +13766,7 @@ void Unit::AddAura(uint32 spellId, Unit* target)
target->AddAura(Aur); target->AddAura(Aur);
} }
Aura * Unit::AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, Unit* caster, int32 * basePoints, Unit * formalCaster) Aura * Unit::AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, Unit* caster, int32 * basePoints, Unit * source)
{ {
// can't do that for passive auras - they stack from same caster so there is no way to get exact aura which should get effect // can't do that for passive auras - they stack from same caster so there is no way to get exact aura which should get effect
//assert (!IsPassiveSpell(spellInfo)); //assert (!IsPassiveSpell(spellInfo));
@@ -13777,7 +13777,7 @@ Aura * Unit::AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, Unit* c
if (aur) if (aur)
{ {
AuraEffect *aurEffect = CreateAuraEffect(aur, effIndex, basePoints, caster,NULL, formalCaster); AuraEffect *aurEffect = CreateAuraEffect(aur, effIndex, basePoints, caster,NULL, source);
if (aurEffect && !aur->SetPartAura(aurEffect, effIndex)) if (aurEffect && !aur->SetPartAura(aurEffect, effIndex))
delete aurEffect; delete aurEffect;
} }
@@ -13787,10 +13787,10 @@ Aura * Unit::AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, Unit* c
{ {
int32 amount[3]; int32 amount[3];
amount[effIndex] = *basePoints; amount[effIndex] = *basePoints;
aur = new Aura(spellInfo, 1<<effIndex, amount, this ,caster, NULL,formalCaster); aur = new Aura(spellInfo, 1<<effIndex, amount, this ,caster, NULL,source);
} }
else else
aur = new Aura(spellInfo, 1<<effIndex, NULL, this ,caster, NULL,formalCaster); aur = new Aura(spellInfo, 1<<effIndex, NULL, this ,caster, NULL,source);
if(!AddAura(aur)) if(!AddAura(aur))
return NULL; return NULL;
+1 -1
View File
@@ -1190,7 +1190,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); void CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
void AddAura(uint32 spellId, Unit *target); void AddAura(uint32 spellId, Unit *target);
void HandleAuraEffect(AuraEffect * aureff, bool apply); void HandleAuraEffect(AuraEffect * aureff, bool apply);
Aura *AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, Unit* caster, int32 * basePoints=NULL, Unit * formalCaster=NULL); Aura *AddAuraEffect(const SpellEntry * spellInfo, uint8 effIndex, Unit* caster, int32 * basePoints=NULL, Unit * source=NULL);
bool IsDamageToThreatSpell(SpellEntry const * spellInfo) const; bool IsDamageToThreatSpell(SpellEntry const * spellInfo) const;