Core/SAI: implement new smart actions to change AI Animkits and to enable/disable hover movement

Port From (https://github.com/TrinityCore/TrinityCore/commit/dde5a3e32645060fbcc4856770dfc6a0c43a3947)
This commit is contained in:
hondacrx
2022-05-24 13:40:19 -04:00
parent f10f1e4000
commit 871dc5ab5d
3 changed files with 22 additions and 0 deletions
@@ -391,6 +391,8 @@ namespace Framework.Constants
PlaySpellVisualKit = 137, // spellVisualKitId, kitType (unknown values, copypaste from packet dumps), duration
OverrideLight = 138, // zoneId, overrideLightID, transitionMilliseconds
OverrideWeather = 139, // zoneId, weatherId, intensity
SetAIAnimKit = 140, // DEPRECATED, DO REUSE (it was never used in any branch, treat as free action id)
SetHover = 141, // 0/1
CreateConversation = 143, // conversation_template.id
SetImmunePC = 144, // 0/1
SetImmuneNPC = 145, // 0/1
@@ -1510,6 +1510,11 @@ namespace Game.AI
break;
}
case SmartActions.SetAIAnimKit:
{
Log.outError(LogFilter.Sql, $"SmartAIMgr: Deprecated Event:({e}) skipped.");
break;
}
case SmartActions.CreateConversation:
{
if (Global.ConversationDataStorage.GetConversationTemplate(e.Action.conversation.id) == null)
@@ -1599,6 +1604,7 @@ namespace Game.AI
case SmartActions.RemoveAllGameobjects:
case SmartActions.SpawnSpawngroup:
case SmartActions.DespawnSpawngroup:
case SmartActions.SetHover:
case SmartActions.AddToStoredTargetList:
break;
case SmartActions.BecomePersonalCloneForPlayer:
@@ -2654,6 +2660,9 @@ namespace Game.AI
[FieldOffset(4)]
public OverrideWeather overrideWeather;
[FieldOffset(4)]
public SetHover setHover;
[FieldOffset(4)]
public Evade evade;
@@ -3201,6 +3210,10 @@ namespace Game.AI
public uint weatherId;
public uint intensity;
}
public struct SetHover
{
public uint enable;
}
public struct Evade
{
public uint toRespawnPosition;
@@ -2429,6 +2429,13 @@ namespace Game.AI
}
break;
}
case SmartActions.SetHover:
{
foreach (WorldObject target in targets)
if (IsUnit(target))
target.ToUnit().SetHover(e.Action.setHover.enable != 0);
break;
}
case SmartActions.PlaySpellVisualKit:
{
foreach (var target in targets)