Core/Spells: Expose corpseTarget to spell scripts with SpellScript::GetHitCorpse()
Port From (https://github.com/TrinityCore/TrinityCore/commit/c7cf9f8c6c59f7fcc61d5f18a4c53302fb450bbd)
This commit is contained in:
@@ -649,9 +649,11 @@ namespace Game.Scripting
|
|||||||
}
|
}
|
||||||
return m_spell.GetCorpseTargetCountForEffect(effect);
|
return m_spell.GetCorpseTargetCountForEffect(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
// methods useable only during spell hit on target, or during spell launch on target:
|
/// <summary>
|
||||||
// returns: target of current effect if it was Unit otherwise null
|
/// useable only during spell hit on target, or during spell launch on target
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>target of current effect if it was Unit otherwise null</returns>
|
||||||
public Unit GetHitUnit()
|
public Unit GetHitUnit()
|
||||||
{
|
{
|
||||||
if (!IsInTargetHook())
|
if (!IsInTargetHook())
|
||||||
@@ -661,7 +663,11 @@ namespace Game.Scripting
|
|||||||
}
|
}
|
||||||
return m_spell.unitTarget;
|
return m_spell.unitTarget;
|
||||||
}
|
}
|
||||||
// returns: target of current effect if it was Creature otherwise null
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>target of current effect if it was Creature otherwise null</returns>
|
||||||
public Creature GetHitCreature()
|
public Creature GetHitCreature()
|
||||||
{
|
{
|
||||||
if (!IsInTargetHook())
|
if (!IsInTargetHook())
|
||||||
@@ -674,7 +680,11 @@ namespace Game.Scripting
|
|||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// returns: target of current effect if it was Player otherwise null
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>target of current effect if it was Player otherwise null</returns>
|
||||||
public Player GetHitPlayer()
|
public Player GetHitPlayer()
|
||||||
{
|
{
|
||||||
if (!IsInTargetHook())
|
if (!IsInTargetHook())
|
||||||
@@ -687,7 +697,11 @@ namespace Game.Scripting
|
|||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// returns: target of current effect if it was Item otherwise null
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>target of current effect if it was Item otherwise null</returns>
|
||||||
public Item GetHitItem()
|
public Item GetHitItem()
|
||||||
{
|
{
|
||||||
if (!IsInTargetHook())
|
if (!IsInTargetHook())
|
||||||
@@ -697,7 +711,11 @@ namespace Game.Scripting
|
|||||||
}
|
}
|
||||||
return m_spell.itemTarget;
|
return m_spell.itemTarget;
|
||||||
}
|
}
|
||||||
// returns: target of current effect if it was GameObject otherwise null
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>target of current effect if it was GameObject otherwise null</returns>
|
||||||
public GameObject GetHitGObj()
|
public GameObject GetHitGObj()
|
||||||
{
|
{
|
||||||
if (!IsInTargetHook())
|
if (!IsInTargetHook())
|
||||||
@@ -707,7 +725,25 @@ namespace Game.Scripting
|
|||||||
}
|
}
|
||||||
return m_spell.gameObjTarget;
|
return m_spell.gameObjTarget;
|
||||||
}
|
}
|
||||||
// returns: destination of current effect
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>target of current effect if it was Corpse otherwise nullptr</returns>
|
||||||
|
public Corpse GetHitCorpse()
|
||||||
|
{
|
||||||
|
if (!IsInTargetHook())
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Scripts, $"Script: `{m_scriptName}` Spell: `{m_scriptSpellId}`: function SpellScript::GetHitCorpse was called, but function has no effect in current hook!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return m_spell.corpseTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>destination of current effect</returns>
|
||||||
public WorldLocation GetHitDest()
|
public WorldLocation GetHitDest()
|
||||||
{
|
{
|
||||||
if (!IsInEffectHook())
|
if (!IsInEffectHook())
|
||||||
@@ -717,6 +753,7 @@ namespace Game.Scripting
|
|||||||
}
|
}
|
||||||
return m_spell.destTarget;
|
return m_spell.destTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
// setter/getter for for damage done by spell to target of spell hit
|
// setter/getter for for damage done by spell to target of spell hit
|
||||||
// returns damage calculated before hit, and real dmg done after hit
|
// returns damage calculated before hit, and real dmg done after hit
|
||||||
public int GetHitDamage()
|
public int GetHitDamage()
|
||||||
|
|||||||
Reference in New Issue
Block a user