Core/AI: Implement OnAuraApplied and OnAuraRemoved hooks
Port From (https://github.com/TrinityCore/TrinityCore/commit/d1e07ac6553c7ae1e3296fc044247f0d0f95d267)
This commit is contained in:
@@ -642,6 +642,16 @@ namespace Game.AI
|
||||
GetScript().ProcessEventsFor(SmartEvents.OnSpellStart, null, 0, 0, false, spellInfo);
|
||||
}
|
||||
|
||||
public override void OnAuraApplied(AuraApplication aurApp)
|
||||
{
|
||||
GetScript().ProcessEventsFor(SmartEvents.OnAuraApplied, null, 0, 0, false, aurApp.GetBase().GetSpellInfo());
|
||||
}
|
||||
|
||||
public override void OnAuraRemoved(AuraApplication aurApp)
|
||||
{
|
||||
GetScript().ProcessEventsFor(SmartEvents.OnAuraRemoved, null, 0, 0, false, aurApp.GetBase().GetSpellInfo());
|
||||
}
|
||||
|
||||
public override void DamageTaken(Unit attacker, ref uint damage, DamageEffectType damageType, SpellInfo spellInfo = null)
|
||||
{
|
||||
GetScript().ProcessEventsFor(SmartEvents.Damaged, attacker, damage);
|
||||
|
||||
@@ -628,6 +628,8 @@ namespace Game.AI
|
||||
SmartEvents.OnSpellCast => Marshal.SizeOf(typeof(SmartEvent.SpellCast)),
|
||||
SmartEvents.OnSpellFailed => Marshal.SizeOf(typeof(SmartEvent.SpellCast)),
|
||||
SmartEvents.OnSpellStart => Marshal.SizeOf(typeof(SmartEvent.SpellCast)),
|
||||
SmartEvents.OnAuraApplied => Marshal.SizeOf(typeof(SmartEvent.SpellCast)),
|
||||
SmartEvents.OnAuraRemoved => Marshal.SizeOf(typeof(SmartEvent.SpellCast)),
|
||||
SmartEvents.OnDespawn => 0,
|
||||
SmartEvents.SendEventTrigger => 0,
|
||||
SmartEvents.AreatriggerExit => 0,
|
||||
@@ -1056,6 +1058,8 @@ namespace Game.AI
|
||||
case SmartEvents.OnSpellCast:
|
||||
case SmartEvents.OnSpellFailed:
|
||||
case SmartEvents.OnSpellStart:
|
||||
case SmartEvents.OnAuraApplied:
|
||||
case SmartEvents.OnAuraRemoved:
|
||||
{
|
||||
if (!IsSpellValid(e, e.Event.spellCast.spell))
|
||||
return false;
|
||||
@@ -2587,6 +2591,8 @@ namespace Game.AI
|
||||
SmartEvents.OnDespawn => SmartScriptTypeMaskId.Creature,
|
||||
SmartEvents.SendEventTrigger => SmartScriptTypeMaskId.Event,
|
||||
SmartEvents.AreatriggerExit => SmartScriptTypeMaskId.Areatrigger + SmartScriptTypeMaskId.AreatrigggerEntity,
|
||||
SmartEvents.OnAuraApplied => SmartScriptTypeMaskId.Creature,
|
||||
SmartEvents.OnAuraRemoved => SmartScriptTypeMaskId.Creature,
|
||||
_ => 0,
|
||||
};
|
||||
|
||||
|
||||
@@ -3500,6 +3500,8 @@ namespace Game.AI
|
||||
case SmartEvents.OnSpellCast:
|
||||
case SmartEvents.OnSpellFailed:
|
||||
case SmartEvents.OnSpellStart:
|
||||
case SmartEvents.OnAuraApplied:
|
||||
case SmartEvents.OnAuraRemoved:
|
||||
{
|
||||
if (spell == null)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user