[10570] Store spell entry of triggering spell on triggered, original patch provided by insider42

This commit is contained in:
Laise 2010-10-01 13:16:48 +02:00
parent ead698e881
commit a67b6a1da5
5 changed files with 44 additions and 27 deletions

View file

@ -319,7 +319,7 @@ void SpellCastTargets::write( ByteBuffer& data ) const
data << m_strTarget; data << m_strTarget;
} }
Spell::Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid originalCasterGUID, Spell** triggeringContainer ) Spell::Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid originalCasterGUID, Spell** triggeringContainer, SpellEntry const* triggeredBy )
{ {
MANGOS_ASSERT( caster != NULL && info != NULL ); MANGOS_ASSERT( caster != NULL && info != NULL );
MANGOS_ASSERT( info == sSpellStore.LookupEntry( info->Id ) && "`info` must be pointer to sSpellStore element"); MANGOS_ASSERT( info == sSpellStore.LookupEntry( info->Id ) && "`info` must be pointer to sSpellStore element");
@ -334,6 +334,7 @@ Spell::Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid o
else else
m_spellInfo = info; m_spellInfo = info;
m_triggeredBySpellInfo = triggeredBy;
m_caster = caster; m_caster = caster;
m_selfContainer = NULL; m_selfContainer = NULL;
m_triggeringContainer = triggeringContainer; m_triggeringContainer = triggeringContainer;

View file

@ -342,7 +342,7 @@ class Spell
void EffectSpecCount(SpellEffectIndex eff_idx); void EffectSpecCount(SpellEffectIndex eff_idx);
void EffectActivateSpec(SpellEffectIndex eff_idx); void EffectActivateSpec(SpellEffectIndex eff_idx);
Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid originalCasterGUID = ObjectGuid(), Spell** triggeringContainer = NULL ); Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid originalCasterGUID = ObjectGuid(), Spell** triggeringContainer = NULL, SpellEntry const* triggeredBy = NULL);
~Spell(); ~Spell();
void prepare(SpellCastTargets const* targets, Aura* triggeredByAura = NULL); void prepare(SpellCastTargets const* targets, Aura* triggeredByAura = NULL);
@ -422,6 +422,7 @@ class Spell
//void HandleAddAura(Unit* Target); //void HandleAddAura(Unit* Target);
SpellEntry const* m_spellInfo; SpellEntry const* m_spellInfo;
SpellEntry const* m_triggeredBySpellInfo;
int32 m_currentBasePoints[MAX_EFFECT_INDEX]; // cache SpellEntry::CalculateSimpleValue and use for set custom base points int32 m_currentBasePoints[MAX_EFFECT_INDEX]; // cache SpellEntry::CalculateSimpleValue and use for set custom base points
Item* m_CastItem; Item* m_CastItem;
uint8 m_cast_count; uint8 m_cast_count;

View file

@ -1080,7 +1080,7 @@ void Unit::CastStop(uint32 except_spellid)
InterruptSpell(CurrentSpellTypes(i),false); InterruptSpell(CurrentSpellTypes(i),false);
} }
void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem, Aura* triggeredByAura, ObjectGuid originalCaster) void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem, Aura* triggeredByAura, ObjectGuid originalCaster, SpellEntry const* triggeredBy)
{ {
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
@ -1093,10 +1093,10 @@ void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castIte
return; return;
} }
CastSpell(Victim, spellInfo, triggered, castItem, triggeredByAura, originalCaster); CastSpell(Victim, spellInfo, triggered, castItem, triggeredByAura, originalCaster, triggeredBy);
} }
void Unit::CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered, Item *castItem, Aura* triggeredByAura, ObjectGuid originalCaster) void Unit::CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered, Item *castItem, Aura* triggeredByAura, ObjectGuid originalCaster, SpellEntry const* triggeredBy)
{ {
if(!spellInfo) if(!spellInfo)
{ {
@ -1110,10 +1110,15 @@ void Unit::CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered,
if (castItem) if (castItem)
DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id); DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id);
if(originalCaster.IsEmpty() && triggeredByAura) if (triggeredByAura)
originalCaster = triggeredByAura->GetCasterGUID(); {
if(originalCaster.IsEmpty())
originalCaster = triggeredByAura->GetCasterGUID();
Spell *spell = new Spell(this, spellInfo, triggered, originalCaster); triggeredBy = triggeredByAura->GetSpellProto();
}
Spell *spell = new Spell(this, spellInfo, triggered, originalCaster, NULL, triggeredBy);
SpellCastTargets targets; SpellCastTargets targets;
targets.setUnitTarget( Victim ); targets.setUnitTarget( Victim );
@ -1121,7 +1126,7 @@ void Unit::CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered,
spell->prepare(&targets, triggeredByAura); spell->prepare(&targets, triggeredByAura);
} }
void Unit::CastCustomSpell(Unit* Victim,uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggeredByAura, ObjectGuid originalCaster) void Unit::CastCustomSpell(Unit* Victim,uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggeredByAura, ObjectGuid originalCaster, SpellEntry const* triggeredBy)
{ {
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
@ -1134,10 +1139,10 @@ void Unit::CastCustomSpell(Unit* Victim,uint32 spellId, int32 const* bp0, int32
return; return;
} }
CastCustomSpell(Victim, spellInfo, bp0, bp1, bp2, triggered, castItem, triggeredByAura, originalCaster); CastCustomSpell(Victim, spellInfo, bp0, bp1, bp2, triggered, castItem, triggeredByAura, originalCaster, triggeredBy);
} }
void Unit::CastCustomSpell(Unit* Victim, SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggeredByAura, ObjectGuid originalCaster) void Unit::CastCustomSpell(Unit* Victim, SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggeredByAura, ObjectGuid originalCaster, SpellEntry const* triggeredBy)
{ {
if(!spellInfo) if(!spellInfo)
{ {
@ -1151,10 +1156,15 @@ void Unit::CastCustomSpell(Unit* Victim, SpellEntry const *spellInfo, int32 cons
if (castItem) if (castItem)
DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id); DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id);
if(originalCaster.IsEmpty() && triggeredByAura) if (triggeredByAura)
originalCaster = triggeredByAura->GetCasterGUID(); {
if(originalCaster.IsEmpty())
originalCaster = triggeredByAura->GetCasterGUID();
Spell *spell = new Spell(this, spellInfo, triggered, originalCaster); triggeredBy = triggeredByAura->GetSpellProto();
}
Spell *spell = new Spell(this, spellInfo, triggered, originalCaster, NULL, triggeredBy);
if(bp0) if(bp0)
spell->m_currentBasePoints[EFFECT_INDEX_0] = *bp0; spell->m_currentBasePoints[EFFECT_INDEX_0] = *bp0;
@ -1172,7 +1182,7 @@ void Unit::CastCustomSpell(Unit* Victim, SpellEntry const *spellInfo, int32 cons
} }
// used for scripting // used for scripting
void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem, Aura* triggeredByAura, ObjectGuid originalCaster) void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem, Aura* triggeredByAura, ObjectGuid originalCaster, SpellEntry const* triggeredBy)
{ {
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
@ -1185,11 +1195,11 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered,
return; return;
} }
CastSpell(x, y, z, spellInfo, triggered, castItem, triggeredByAura, originalCaster); CastSpell(x, y, z, spellInfo, triggered, castItem, triggeredByAura, originalCaster, triggeredBy);
} }
// used for scripting // used for scripting
void Unit::CastSpell(float x, float y, float z, SpellEntry const *spellInfo, bool triggered, Item *castItem, Aura* triggeredByAura, ObjectGuid originalCaster) void Unit::CastSpell(float x, float y, float z, SpellEntry const *spellInfo, bool triggered, Item *castItem, Aura* triggeredByAura, ObjectGuid originalCaster, SpellEntry const* triggeredBy)
{ {
if(!spellInfo) if(!spellInfo)
{ {
@ -1203,10 +1213,15 @@ void Unit::CastSpell(float x, float y, float z, SpellEntry const *spellInfo, boo
if (castItem) if (castItem)
DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id); DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: cast Item spellId - %i", spellInfo->Id);
if(originalCaster.IsEmpty() && triggeredByAura) if (triggeredByAura)
originalCaster = triggeredByAura->GetCasterGUID(); {
if(originalCaster.IsEmpty())
originalCaster = triggeredByAura->GetCasterGUID();
Spell *spell = new Spell(this, spellInfo, triggered, originalCaster); triggeredBy = triggeredByAura->GetSpellProto();
}
Spell *spell = new Spell(this, spellInfo, triggered, originalCaster, NULL, triggeredBy);
SpellCastTargets targets; SpellCastTargets targets;
targets.setDestination(x, y, z); targets.setDestination(x, y, z);

View file

@ -1428,12 +1428,12 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype); void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype);
void EnergizeBySpell(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype); void EnergizeBySpell(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype);
uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage); uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage);
void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid()); void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid(), SpellEntry const* triggeredBy = NULL);
void CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, Aura* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid()); void CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, Aura* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid(), SpellEntry const* triggeredBy = NULL);
void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, Aura* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid()); void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, Aura* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid(), SpellEntry const* triggeredBy = NULL);
void CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, Aura* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid()); void CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, Aura* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid(), SpellEntry const* triggeredBy = NULL);
void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid()); void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid(), SpellEntry const* triggeredBy = NULL);
void CastSpell(float x, float y, float z, SpellEntry const *spellInfo, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid()); void CastSpell(float x, float y, float z, SpellEntry const *spellInfo, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, ObjectGuid originalCaster = ObjectGuid(), SpellEntry const* triggeredBy = NULL);
bool IsDamageToThreatSpell(SpellEntry const * spellInfo) const; bool IsDamageToThreatSpell(SpellEntry const * spellInfo) const;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10569" #define REVISION_NR "10570"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__