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 PlaySpellVisualKit = 137, // spellVisualKitId, kitType (unknown values, copypaste from packet dumps), duration
OverrideLight = 138, // zoneId, overrideLightID, transitionMilliseconds OverrideLight = 138, // zoneId, overrideLightID, transitionMilliseconds
OverrideWeather = 139, // zoneId, weatherId, intensity 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 CreateConversation = 143, // conversation_template.id
SetImmunePC = 144, // 0/1 SetImmunePC = 144, // 0/1
SetImmuneNPC = 145, // 0/1 SetImmuneNPC = 145, // 0/1
@@ -1510,6 +1510,11 @@ namespace Game.AI
break; break;
} }
case SmartActions.SetAIAnimKit:
{
Log.outError(LogFilter.Sql, $"SmartAIMgr: Deprecated Event:({e}) skipped.");
break;
}
case SmartActions.CreateConversation: case SmartActions.CreateConversation:
{ {
if (Global.ConversationDataStorage.GetConversationTemplate(e.Action.conversation.id) == null) if (Global.ConversationDataStorage.GetConversationTemplate(e.Action.conversation.id) == null)
@@ -1599,6 +1604,7 @@ namespace Game.AI
case SmartActions.RemoveAllGameobjects: case SmartActions.RemoveAllGameobjects:
case SmartActions.SpawnSpawngroup: case SmartActions.SpawnSpawngroup:
case SmartActions.DespawnSpawngroup: case SmartActions.DespawnSpawngroup:
case SmartActions.SetHover:
case SmartActions.AddToStoredTargetList: case SmartActions.AddToStoredTargetList:
break; break;
case SmartActions.BecomePersonalCloneForPlayer: case SmartActions.BecomePersonalCloneForPlayer:
@@ -2654,6 +2660,9 @@ namespace Game.AI
[FieldOffset(4)] [FieldOffset(4)]
public OverrideWeather overrideWeather; public OverrideWeather overrideWeather;
[FieldOffset(4)]
public SetHover setHover;
[FieldOffset(4)] [FieldOffset(4)]
public Evade evade; public Evade evade;
@@ -3201,6 +3210,10 @@ namespace Game.AI
public uint weatherId; public uint weatherId;
public uint intensity; public uint intensity;
} }
public struct SetHover
{
public uint enable;
}
public struct Evade public struct Evade
{ {
public uint toRespawnPosition; public uint toRespawnPosition;
@@ -2429,6 +2429,13 @@ namespace Game.AI
} }
break; break;
} }
case SmartActions.SetHover:
{
foreach (WorldObject target in targets)
if (IsUnit(target))
target.ToUnit().SetHover(e.Action.setHover.enable != 0);
break;
}
case SmartActions.PlaySpellVisualKit: case SmartActions.PlaySpellVisualKit:
{ {
foreach (var target in targets) foreach (var target in targets)