Game/AI: Implement option to move a creature back to Homeposition on Evade.

Port From (https://github.com/TrinityCore/TrinityCore/commit/dfeb8c267f94f6a2b2ebe717fd43c5d4fd36a549)
This commit is contained in:
hondacrx
2022-05-04 09:29:44 -04:00
parent 52ce6b2700
commit ecb3f5f857
2 changed files with 14 additions and 0 deletions
@@ -2652,6 +2652,9 @@ namespace Game.AI
[FieldOffset(4)]
public OverrideWeather overrideWeather;
[FieldOffset(4)]
public Evade evade;
[FieldOffset(4)]
public Conversation conversation;
@@ -3196,6 +3199,10 @@ namespace Game.AI
public uint weatherId;
public uint intensity;
}
public struct Evade
{
public uint toRespawnPosition;
}
public struct Conversation
{
public uint id;
@@ -711,6 +711,13 @@ namespace Game.AI
if (_me == null)
break;
// Reset home position to respawn position if specified in the parameters
if (e.Action.evade.toRespawnPosition == 0)
{
_me.GetRespawnPosition(out float homeX, out float homeY, out float homeZ, out float homeO);
_me.SetHomePosition(homeX, homeY, homeZ, homeO);
}
_me.GetAI().EnterEvadeMode();
Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_EVADE: Creature {0} EnterEvadeMode", _me.GetGUID().ToString());
break;