mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[11879] Inform AI function of original caster in some cases
Inform the AI of an original caster for JustSummoned and SpellHitTarget. This should make scripting some hard cases easier. Remark that _both_ caster and original caster will be informed (if they are different). Check your scripts that they still behave as expected!
This commit is contained in:
parent
461be74c3a
commit
177bc78108
3 changed files with 20 additions and 2 deletions
|
|
@ -1152,6 +1152,8 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
|
||||||
// Call scripted function for AI if this spell is casted by a creature
|
// Call scripted function for AI if this spell is casted by a creature
|
||||||
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
||||||
((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo);
|
((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo);
|
||||||
|
if (real_caster && real_caster != m_caster && real_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)real_caster)->AI())
|
||||||
|
((Creature*)real_caster)->AI()->SpellHitTarget(unit, m_spellInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask)
|
void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask)
|
||||||
|
|
|
||||||
|
|
@ -4849,6 +4849,8 @@ void Spell::DoSummon(SpellEffectIndex eff_idx)
|
||||||
|
|
||||||
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
||||||
((Creature*)m_caster)->AI()->JustSummoned((Creature*)spawnCreature);
|
((Creature*)m_caster)->AI()->JustSummoned((Creature*)spawnCreature);
|
||||||
|
if (m_originalCaster && m_originalCaster != m_caster && m_originalCaster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_originalCaster)->AI())
|
||||||
|
((Creature*)m_originalCaster)->AI()->JustSummoned((Creature*)spawnCreature);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectLearnSpell(SpellEffectIndex eff_idx)
|
void Spell::EffectLearnSpell(SpellEffectIndex eff_idx)
|
||||||
|
|
@ -5150,7 +5152,7 @@ void Spell::DoSummonWild(SpellEffectIndex eff_idx, uint32 forceFaction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Creature *summon = m_caster->SummonCreature(creature_entry, px, py, pz, m_caster->GetOrientation(), summonType, m_duration))
|
if (Creature* summon = m_caster->SummonCreature(creature_entry, px, py, pz, m_caster->GetOrientation(), summonType, m_duration))
|
||||||
{
|
{
|
||||||
summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||||
|
|
||||||
|
|
@ -5160,6 +5162,10 @@ void Spell::DoSummonWild(SpellEffectIndex eff_idx, uint32 forceFaction)
|
||||||
|
|
||||||
if(forceFaction)
|
if(forceFaction)
|
||||||
summon->setFaction(forceFaction);
|
summon->setFaction(forceFaction);
|
||||||
|
|
||||||
|
// Notify original caster if not done already
|
||||||
|
if (m_originalCaster && m_originalCaster != m_caster && m_originalCaster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_originalCaster)->AI())
|
||||||
|
((Creature*)m_originalCaster)->AI()->JustSummoned(summon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5286,6 +5292,8 @@ void Spell::DoSummonGuardian(SpellEffectIndex eff_idx, uint32 forceFaction)
|
||||||
// Notify Summoner
|
// Notify Summoner
|
||||||
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
||||||
((Creature*)m_caster)->AI()->JustSummoned(spawnCreature);
|
((Creature*)m_caster)->AI()->JustSummoned(spawnCreature);
|
||||||
|
if (m_originalCaster && m_originalCaster != m_caster && m_originalCaster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_originalCaster)->AI())
|
||||||
|
((Creature*)m_originalCaster)->AI()->JustSummoned(spawnCreature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6273,6 +6281,8 @@ void Spell::EffectSummonObjectWild(SpellEffectIndex eff_idx)
|
||||||
|
|
||||||
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
||||||
((Creature*)m_caster)->AI()->JustSummoned(pGameObj);
|
((Creature*)m_caster)->AI()->JustSummoned(pGameObj);
|
||||||
|
if (m_originalCaster && m_originalCaster != m_caster && m_originalCaster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_originalCaster)->AI())
|
||||||
|
((Creature*)m_originalCaster)->AI()->JustSummoned(pGameObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
|
void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
|
||||||
|
|
@ -8421,6 +8431,8 @@ void Spell::EffectSummonObject(SpellEffectIndex eff_idx)
|
||||||
|
|
||||||
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
||||||
((Creature*)m_caster)->AI()->JustSummoned(pGameObj);
|
((Creature*)m_caster)->AI()->JustSummoned(pGameObj);
|
||||||
|
if (m_originalCaster && m_originalCaster != m_caster && m_originalCaster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_originalCaster)->AI())
|
||||||
|
((Creature*)m_originalCaster)->AI()->JustSummoned(pGameObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectResurrect(SpellEffectIndex /*eff_idx*/)
|
void Spell::EffectResurrect(SpellEffectIndex /*eff_idx*/)
|
||||||
|
|
@ -8750,6 +8762,8 @@ void Spell::DoSummonCritter(SpellEffectIndex eff_idx, uint32 forceFaction)
|
||||||
// Notify Summoner
|
// Notify Summoner
|
||||||
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
||||||
((Creature*)m_caster)->AI()->JustSummoned(critter);
|
((Creature*)m_caster)->AI()->JustSummoned(critter);
|
||||||
|
if (m_originalCaster && m_originalCaster != m_caster && m_originalCaster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_originalCaster)->AI())
|
||||||
|
((Creature*)m_originalCaster)->AI()->JustSummoned(critter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectKnockBack(SpellEffectIndex eff_idx)
|
void Spell::EffectKnockBack(SpellEffectIndex eff_idx)
|
||||||
|
|
@ -9070,6 +9084,8 @@ void Spell::EffectTransmitted(SpellEffectIndex eff_idx)
|
||||||
|
|
||||||
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI())
|
||||||
((Creature*)m_caster)->AI()->JustSummoned(pGameObj);
|
((Creature*)m_caster)->AI()->JustSummoned(pGameObj);
|
||||||
|
if (m_originalCaster && m_originalCaster != m_caster && m_originalCaster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_originalCaster)->AI())
|
||||||
|
((Creature*)m_originalCaster)->AI()->JustSummoned(pGameObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectProspecting(SpellEffectIndex /*eff_idx*/)
|
void Spell::EffectProspecting(SpellEffectIndex /*eff_idx*/)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11878"
|
#define REVISION_NR "11879"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue