Core/SAI: Rename LeavingWorld to OnDespawn & use it in SAI

Port From (https://github.com/TrinityCore/TrinityCore/commit/b0164fb2b9cc35663e337d48660d5bca1e973d99)
This commit is contained in:
hondacrx
2022-09-05 21:57:54 -04:00
parent 747c91bf73
commit 0a28bd434a
7 changed files with 16 additions and 6 deletions
+5
View File
@@ -726,6 +726,11 @@ namespace Game.AI
GetScript().ProcessEventsFor(SmartEvents.CorpseRemoved, null, (uint)respawnDelay);
}
public override void OnDespawn()
{
GetScript().ProcessEventsFor(SmartEvents.OnDespawn);
}
public override void PassengerBoarded(Unit passenger, sbyte seatId, bool apply)
{
GetScript().ProcessEventsFor(apply ? SmartEvents.PassengerBoarded : SmartEvents.PassengerRemoved, passenger, (uint)seatId, 0, apply);
@@ -634,7 +634,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)),
_ => Marshal.SizeOf(typeof(SmartEvent.Raw)),
SmartEvents.OnDespawn => 0,
_ => Marshal.SizeOf(typeof(SmartEvent.Raw)),
};
int rawCount = Marshal.SizeOf(typeof(SmartEvent.Raw)) / sizeof(uint);
@@ -1296,6 +1297,7 @@ namespace Game.AI
case SmartEvents.JustCreated:
case SmartEvents.FollowCompleted:
case SmartEvents.OnSpellclick:
case SmartEvents.OnDespawn:
case SmartEvents.SceneStart:
case SmartEvents.SceneCancel:
case SmartEvents.SceneComplete:
@@ -2425,6 +2427,7 @@ namespace Game.AI
SmartEvents.OnSpellCast => SmartScriptTypeMaskId.Creature,
SmartEvents.OnSpellFailed => SmartScriptTypeMaskId.Creature,
SmartEvents.OnSpellStart => SmartScriptTypeMaskId.Creature,
SmartEvents.OnDespawn => SmartScriptTypeMaskId.Creature,
_ => 0,
};
@@ -3211,6 +3211,7 @@ namespace Game.AI
case SmartEvents.JustCreated:
case SmartEvents.FollowCompleted:
case SmartEvents.OnSpellclick:
case SmartEvents.OnDespawn:
ProcessAction(e, unit, var0, var1, bvar, spell, gob);
break;
case SmartEvents.GossipHello: