oops, now it builds (and a bonus refactor that annoyed me)

Port From (https://github.com/TrinityCore/TrinityCore/commit/bd158f6c29581e08633c3971a130b0720f90b630)
This commit is contained in:
hondacrx
2021-06-23 22:51:38 -04:00
parent 4206c48aaa
commit d12ae8cde2
2 changed files with 22 additions and 20 deletions
+10 -8
View File
@@ -567,6 +567,8 @@ namespace Game.AI
public override void InitializeAI() public override void InitializeAI()
{ {
GetScript().OnInitialize(me);
_despawnTime = 0; _despawnTime = 0;
_respawnTime = 0; _respawnTime = 0;
_despawnState = 0; _despawnState = 0;
@@ -574,11 +576,11 @@ namespace Game.AI
me.SetVisible(true); me.SetVisible(true);
if (me.GetFaction() != me.GetCreatureTemplate().Faction) if (!me.IsDead())
me.RestoreFaction(); {
GetScript().ProcessEventsFor(SmartEvents.Respawn);
GetScript().OnReset(); GetScript().OnReset();
GetScript().ProcessEventsFor(SmartEvents.Respawn); }
_followGuid.Clear();//do not reset follower on Reset(), we need it after combat evade _followGuid.Clear();//do not reset follower on Reset(), we need it after combat evade
_followDist = 0; _followDist = 0;
@@ -883,7 +885,7 @@ namespace Game.AI
GetScript().ProcessEventsFor(SmartEvents.FollowCompleted, player); GetScript().ProcessEventsFor(SmartEvents.FollowCompleted, player);
} }
public void SetScript9(SmartScriptHolder e, uint entry, Unit invoker) public void SetTimedActionList(SmartScriptHolder e, uint entry, Unit invoker)
{ {
GetScript().SetScript9(e, entry, invoker); GetScript().SetScript9(e, entry, invoker);
} }
@@ -1127,7 +1129,7 @@ namespace Game.AI
GetScript().ProcessEventsFor(SmartEvents.DataSet, null, id, value); GetScript().ProcessEventsFor(SmartEvents.DataSet, null, id, value);
} }
public void SetScript9(SmartScriptHolder e, uint entry, Unit invoker) public void SetTimedActionList(SmartScriptHolder e, uint entry, Unit invoker)
{ {
GetScript().SetScript9(e, entry, invoker); GetScript().SetScript9(e, entry, invoker);
} }
@@ -1178,7 +1180,7 @@ namespace Game.AI
GetScript().ProcessEventsFor(SmartEvents.AreatriggerOntrigger, unit); GetScript().ProcessEventsFor(SmartEvents.AreatriggerOntrigger, unit);
} }
public void SetScript9(SmartScriptHolder e, uint entry, Unit invoker) public void SetTimedActionList(SmartScriptHolder e, uint entry, Unit invoker)
{ {
GetScript().SetScript9(e, entry, invoker); GetScript().SetScript9(e, entry, invoker);
} }
+12 -12
View File
@@ -1571,7 +1571,7 @@ namespace Game.AI
if (creature != null) if (creature != null)
{ {
if (IsSmart(creature)) if (IsSmart(creature))
creature.GetAI<SmartAI>().SetScript9(e, e.Action.timedActionList.id, GetLastInvoker()); creature.GetAI<SmartAI>().SetTimedActionList(e, e.Action.timedActionList.id, GetLastInvoker());
} }
else else
{ {
@@ -1579,7 +1579,7 @@ namespace Game.AI
if (go != null) if (go != null)
{ {
if (IsSmartGO(go)) if (IsSmartGO(go))
go.GetAI<SmartGameObjectAI>().SetScript9(e, e.Action.timedActionList.id, GetLastInvoker()); go.GetAI<SmartGameObjectAI>().SetTimedActionList(e, e.Action.timedActionList.id, GetLastInvoker());
} }
else else
{ {
@@ -1588,7 +1588,7 @@ namespace Game.AI
{ {
SmartAreaTriggerAI atSAI = areaTriggerTarget.GetAI<SmartAreaTriggerAI>(); SmartAreaTriggerAI atSAI = areaTriggerTarget.GetAI<SmartAreaTriggerAI>();
if (atSAI != null) if (atSAI != null)
atSAI.SetScript9(e, e.Action.timedActionList.id, GetLastInvoker()); atSAI.SetTimedActionList(e, e.Action.timedActionList.id, GetLastInvoker());
} }
} }
} }
@@ -1672,7 +1672,7 @@ namespace Game.AI
if (creature != null) if (creature != null)
{ {
if (IsSmart(creature)) if (IsSmart(creature))
creature.GetAI<SmartAI>().SetScript9(e, randomId, GetLastInvoker()); creature.GetAI<SmartAI>().SetTimedActionList(e, randomId, GetLastInvoker());
} }
else else
{ {
@@ -1680,7 +1680,7 @@ namespace Game.AI
if (go != null) if (go != null)
{ {
if (IsSmartGO(go)) if (IsSmartGO(go))
go.GetAI<SmartGameObjectAI>().SetScript9(e, randomId, GetLastInvoker()); go.GetAI<SmartGameObjectAI>().SetTimedActionList(e, randomId, GetLastInvoker());
} }
else else
{ {
@@ -1689,7 +1689,7 @@ namespace Game.AI
{ {
SmartAreaTriggerAI atSAI = areaTriggerTarget.GetAI<SmartAreaTriggerAI>(); SmartAreaTriggerAI atSAI = areaTriggerTarget.GetAI<SmartAreaTriggerAI>();
if (atSAI != null) if (atSAI != null)
atSAI.SetScript9(e, randomId, GetLastInvoker()); atSAI.SetTimedActionList(e, randomId, GetLastInvoker());
} }
} }
} }
@@ -1711,7 +1711,7 @@ namespace Game.AI
if (creature != null) if (creature != null)
{ {
if (IsSmart(creature)) if (IsSmart(creature))
creature.GetAI<SmartAI>().SetScript9(e, id, GetLastInvoker()); creature.GetAI<SmartAI>().SetTimedActionList(e, id, GetLastInvoker());
} }
else else
{ {
@@ -1719,7 +1719,7 @@ namespace Game.AI
if (go != null) if (go != null)
{ {
if (IsSmartGO(go)) if (IsSmartGO(go))
go.GetAI<SmartGameObjectAI>().SetScript9(e, id, GetLastInvoker()); go.GetAI<SmartGameObjectAI>().SetTimedActionList(e, id, GetLastInvoker());
} }
else else
{ {
@@ -1728,7 +1728,7 @@ namespace Game.AI
{ {
SmartAreaTriggerAI atSAI = areaTriggerTarget.GetAI<SmartAreaTriggerAI>(); SmartAreaTriggerAI atSAI = areaTriggerTarget.GetAI<SmartAreaTriggerAI>();
if (atSAI != null) if (atSAI != null)
atSAI.SetScript9(e, id, GetLastInvoker()); atSAI.SetTimedActionList(e, id, GetLastInvoker());
} }
} }
} }
@@ -3641,10 +3641,10 @@ namespace Game.AI
{ {
if (e.GetScriptType() == SmartScriptType.TimedActionlist) if (e.GetScriptType() == SmartScriptType.TimedActionlist)
{ {
Unit invoker9 = null; Unit invoker = null;
if (_me != null && !mTimedActionListInvoker.IsEmpty()) if (_me != null && !mTimedActionListInvoker.IsEmpty())
invoker9 = Global.ObjAccessor.GetUnit(_me, mTimedActionListInvoker); invoker = Global.ObjAccessor.GetUnit(_me, mTimedActionListInvoker);
ProcessEvent(e, invoker9); ProcessEvent(e, invoker);
e.EnableTimed = false;//disable event if it is in an ActionList and was processed once e.EnableTimed = false;//disable event if it is in an ActionList and was processed once
foreach (var holder in _timedActionList) foreach (var holder in _timedActionList)
{ {