Core/SAI: Implement new action to set movement speed

Port From (https://github.com/TrinityCore/TrinityCore/commit/5dd6d31c01dcc48f3d286196808ca0f6de9eaf04)
This commit is contained in:
hondacrx
2019-09-04 13:32:16 -04:00
parent b3bcfd1a8f
commit eaadad3774
3 changed files with 43 additions and 1 deletions
@@ -1245,6 +1245,22 @@ namespace Game.AI
Log.outError(LogFilter.Sql, $"Entry {e.entryOrGuid} SourceType {e.GetScriptType()} Event {e.event_id} Action {e.GetActionType()} uses invalid data type {e.Action.auraType.type} (value range 0-TOTAL_AURAS), skipped.");
return false;
}
break;
}
case SmartActions.SetMovementSpeed:
{
if (e.Action.movementSpeed.movementType >= (int)MovementGeneratorType.Max)
{
Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.entryOrGuid} SourceType {e.GetScriptType()} Event {e.event_id} Action {e.GetActionType()} uses invalid movementType {e.Action.movementSpeed.movementType}, skipped.");
return false;
}
if (e.Action.movementSpeed.speedInteger == 0 && e.Action.movementSpeed.speedFraction == 0)
{
Log.outError(LogFilter.Sql, $"SmartAIMgr: Entry {e.entryOrGuid} SourceType {e.GetScriptType()} Event {e.event_id} Action {e.GetActionType()} uses speed 0, skipped.");
return false;
}
break;
}
case SmartActions.StartClosestWaypoint:
@@ -2325,6 +2341,9 @@ namespace Game.AI
[FieldOffset(4)]
public Scene scene;
[FieldOffset(4)]
public MovementSpeed movementSpeed;
[FieldOffset(4)]
public Raw raw;
@@ -2816,6 +2835,12 @@ namespace Game.AI
{
public uint sceneId;
}
public struct MovementSpeed
{
public uint movementType;
public uint speedInteger;
public uint speedFraction;
}
public struct Raw
{
public uint param1;