*Store aura::source for all types of aura effect.
--HG-- branch : trunk
This commit is contained in:
+1
-1
@@ -1226,7 +1226,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
|
|||||||
if (aura_effmask)
|
if (aura_effmask)
|
||||||
{
|
{
|
||||||
Unit * caster = m_originalCaster ? m_originalCaster : m_caster;
|
Unit * caster = m_originalCaster ? m_originalCaster : m_caster;
|
||||||
Aura * Aur = new Aura(m_spellInfo, aura_effmask, m_currentBasePoints, unit, caster, m_CastItem, m_caster);
|
Aura * Aur = new Aura(m_spellInfo, aura_effmask, m_currentBasePoints, unit, m_caster, caster, m_CastItem);
|
||||||
|
|
||||||
if (!Aur->IsAreaAura())
|
if (!Aur->IsAreaAura())
|
||||||
{
|
{
|
||||||
|
|||||||
+21
-13
@@ -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 * source) :
|
Aura::Aura(SpellEntry const* spellproto, uint32 effMask, int32 *currentBasePoints, Unit *target, WorldObject *source, Unit *caster, Item* castItem) :
|
||||||
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)
|
||||||
@@ -453,7 +453,7 @@ Aura::~Aura()
|
|||||||
delete m_partAuras[i];
|
delete m_partAuras[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraEffect::AuraEffect(Aura * parentAura, uint8 effIndex, int32 * currentBasePoints , Unit * caster, Item* castItem) :
|
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)
|
||||||
{
|
{
|
||||||
@@ -496,6 +496,7 @@ m_target(parentAura->GetTarget()), m_tickNumber(0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player* modOwner = caster ? caster->GetSpellModOwner() : NULL;
|
Player* modOwner = caster ? caster->GetSpellModOwner() : NULL;
|
||||||
|
m_sourceGUID = source ? source->GetGUID() : (caster ? caster->GetGUID() : 0);
|
||||||
m_amplitude = m_spellProto->EffectAmplitude[m_effIndex];
|
m_amplitude = m_spellProto->EffectAmplitude[m_effIndex];
|
||||||
|
|
||||||
//apply casting time mods for channeled spells
|
//apply casting time mods for channeled spells
|
||||||
@@ -512,12 +513,13 @@ m_target(parentAura->GetTarget()), m_tickNumber(0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
AreaAuraEffect::AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * currentBasePoints, Unit * caster, Item * castItem, Unit * source)
|
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, source)
|
||||||
{
|
{
|
||||||
m_removeTime = FRIENDLY_AA_REMOVE_TIME;
|
m_removeTime = FRIENDLY_AA_REMOVE_TIME;
|
||||||
m_isAreaAura = true;
|
m_isAreaAura = true;
|
||||||
|
|
||||||
Unit* caster_ptr = source ? source : caster ? caster : m_target;
|
Unit* caster_ptr = source ? source : caster ? caster : m_target;
|
||||||
|
//this can be removed, already set in auraeffect
|
||||||
m_sourceGUID = 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)
|
||||||
@@ -567,8 +569,8 @@ AreaAuraEffect::~AreaAuraEffect()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
PersistentAreaAuraEffect::PersistentAreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * currentBasePoints, Unit * caster,Item * castItem)
|
PersistentAreaAuraEffect::PersistentAreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * currentBasePoints, Unit * caster,Item * castItem, DynamicObject *source)
|
||||||
: AuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem)
|
: AuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem, source)
|
||||||
{
|
{
|
||||||
m_isPersistent = true;
|
m_isPersistent = true;
|
||||||
}
|
}
|
||||||
@@ -577,16 +579,21 @@ PersistentAreaAuraEffect::~PersistentAreaAuraEffect()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem, Unit* source)
|
AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem, WorldObject* source)
|
||||||
{
|
{
|
||||||
assert (parentAura);
|
// TODO: source should belong to aura, but not areaeffect. multiple areaaura/persistent aura should use one source
|
||||||
|
assert(parentAura);
|
||||||
if (IsAreaAuraEffect(parentAura->GetSpellProto()->Effect[effIndex]))
|
if (IsAreaAuraEffect(parentAura->GetSpellProto()->Effect[effIndex]))
|
||||||
return new AreaAuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem, source);
|
{
|
||||||
|
//TODO: determine source here
|
||||||
|
if(source && source->isType(TYPEMASK_UNIT))
|
||||||
|
return new AreaAuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem, (Unit*)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, source);
|
||||||
else if (parentAura->GetSpellProto()->Effect[effIndex] == SPELL_EFFECT_PERSISTENT_AREA_AURA)
|
else if (parentAura->GetSpellProto()->Effect[effIndex] == SPELL_EFFECT_PERSISTENT_AREA_AURA)
|
||||||
return new PersistentAreaAuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem);
|
return new PersistentAreaAuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem);
|
||||||
else return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit* Aura::GetCaster() const
|
Unit* Aura::GetCaster() const
|
||||||
@@ -600,14 +607,15 @@ Unit* Aura::GetCaster() const
|
|||||||
return unit && unit->IsInWorld() ? unit : NULL;
|
return unit && unit->IsInWorld() ? unit : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Unit* AreaAuraEffect::GetSource() const
|
Unit* AuraEffect::GetSource() const
|
||||||
{
|
{
|
||||||
if(m_sourceGUID==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_sourceGUID, (Unit*)NULL);
|
Unit *unit = ObjectAccessor::GetObjectInWorld(m_sourceGUID, (Unit*)NULL);
|
||||||
|
//only player can be not in world while in objectaccessor
|
||||||
return unit && unit->IsInWorld() ? unit : NULL;
|
return unit && unit->IsInWorld() ? unit : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6811,7 +6819,7 @@ void AuraEffect::HandleAuraControlVehicle(bool apply, bool Real, bool /*changeAm
|
|||||||
if(m_target->GetTypeId() != TYPEID_UNIT || !((Creature*)m_target)->isVehicle())
|
if(m_target->GetTypeId() != TYPEID_UNIT || !((Creature*)m_target)->isVehicle())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Unit *caster = GetCaster();
|
Unit *caster = GetSource();
|
||||||
if(!caster || caster == m_target)
|
if(!caster || caster == m_target)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
+12
-10
@@ -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 * source=NULL);
|
explicit Aura(SpellEntry const* spellproto, uint32 effMask, int32 *currentBasePoints, Unit *target, WorldObject *source = NULL, Unit *caster = NULL, Item *castItem = 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 * source);
|
friend AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem, WorldObject *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)
|
||||||
@@ -333,8 +333,9 @@ class TRINITY_DLL_SPEC AuraEffect
|
|||||||
// add/remove SPELL_AURA_MOD_SHAPESHIFT (36) linked auras
|
// add/remove SPELL_AURA_MOD_SHAPESHIFT (36) linked auras
|
||||||
void HandleShapeshiftBoosts(bool apply);
|
void HandleShapeshiftBoosts(bool apply);
|
||||||
|
|
||||||
inline Unit * GetCaster() const{ return m_parentAura->GetCaster(); }
|
Unit * GetCaster() const { return m_parentAura->GetCaster(); }
|
||||||
inline uint64 GetCasterGUID() const{ return m_parentAura->GetCasterGUID(); }
|
uint64 GetCasterGUID() const{ return m_parentAura->GetCasterGUID(); }
|
||||||
|
Unit* GetSource() const; // { return m_parentAura->GetSource(); }
|
||||||
Aura * GetParentAura() const { return m_parentAura; }
|
Aura * GetParentAura() const { return m_parentAura; }
|
||||||
|
|
||||||
SpellEntry const* GetSpellProto() const { return m_spellProto; }
|
SpellEntry const* GetSpellProto() const { return m_spellProto; }
|
||||||
@@ -369,9 +370,10 @@ class TRINITY_DLL_SPEC AuraEffect
|
|||||||
void CleanupTriggeredSpells();
|
void CleanupTriggeredSpells();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
AuraEffect (Aura * parentAura, uint8 effIndex, int32 * currentBasePoints , Unit * caster,Item * castItem);
|
explicit AuraEffect(Aura * parentAura, uint8 effIndex, int32 *currentBasePoints , Unit *caster, Item *castItem, WorldObject *source);
|
||||||
Aura * const m_parentAura;
|
Aura * const m_parentAura;
|
||||||
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
|
||||||
|
|
||||||
SpellEntry const *m_spellProto;
|
SpellEntry const *m_spellProto;
|
||||||
uint32 m_tickNumber;
|
uint32 m_tickNumber;
|
||||||
@@ -394,23 +396,23 @@ 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 * source=NULL);
|
AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * currentBasePoints, Unit * caster=NULL, Item * castItem=NULL, Unit * source = NULL);
|
||||||
~AreaAuraEffect();
|
~AreaAuraEffect();
|
||||||
Unit* GetSource() const;
|
|
||||||
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_sourceGUID; // used for check range
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TRINITY_DLL_SPEC PersistentAreaAuraEffect : public AuraEffect
|
class TRINITY_DLL_SPEC PersistentAreaAuraEffect : public AuraEffect
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PersistentAreaAuraEffect(Aura * parentAura, uint32 eff, int32 *currentBasePoints, Unit *caster = NULL, Item* castItem = NULL);
|
PersistentAreaAuraEffect(Aura * parentAura, uint32 eff, int32 *currentBasePoints, Unit *caster = NULL, Item* castItem = NULL, DynamicObject * source = NULL);
|
||||||
~PersistentAreaAuraEffect();
|
~PersistentAreaAuraEffect();
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
};
|
};
|
||||||
AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem = NULL, Unit * source=NULL);
|
|
||||||
|
AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit *caster, Item *castItem = NULL, WorldObject *source = NULL);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+5
-4
@@ -13762,7 +13762,8 @@ void Unit::AddAura(uint32 spellId, Unit* target)
|
|||||||
if (!eff_mask)
|
if (!eff_mask)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Aura *Aur = new Aura(spellInfo, eff_mask, NULL, target, this, NULL, target);
|
//TODO: we use target as source for now, but that may not be true
|
||||||
|
Aura *Aur = new Aura(spellInfo, eff_mask, NULL, target, target, this, NULL);
|
||||||
target->AddAura(Aur);
|
target->AddAura(Aur);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13787,10 +13788,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,source);
|
aur = new Aura(spellInfo, 1<<effIndex, amount, this, source, caster, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
aur = new Aura(spellInfo, 1<<effIndex, NULL, this ,caster, NULL,source);
|
aur = new Aura(spellInfo, 1<<effIndex, NULL, this, source ,caster, NULL);
|
||||||
|
|
||||||
if(!AddAura(aur))
|
if(!AddAura(aur))
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -13959,7 +13960,7 @@ void Unit::EnterVehicle(Vehicle *vehicle, int8 seatId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_Vehicle->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_24);
|
m_Vehicle->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_24);
|
||||||
m_Vehicle->setFaction(getFaction());
|
//m_Vehicle->setFaction(getFaction());
|
||||||
|
|
||||||
addUnitState(UNIT_STAT_ONVEHICLE);
|
addUnitState(UNIT_STAT_ONVEHICLE);
|
||||||
//movementInfo is set in AddPassenger
|
//movementInfo is set in AddPassenger
|
||||||
|
|||||||
Reference in New Issue
Block a user