Core/SAI: Add new action SMART_ACTION_SET_HEALTH_PCT

Port From (https://github.com/TrinityCore/TrinityCore/commit/4c30b2a1827b81774136d37cb521dbd5823c3423)
This commit is contained in:
hondacrx
2022-05-25 13:30:00 -04:00
parent b83c96a59e
commit 6297e81009
3 changed files with 48 additions and 17 deletions
@@ -1515,6 +1515,15 @@ namespace Game.AI
Log.outError(LogFilter.Sql, $"SmartAIMgr: Deprecated Event:({e}) skipped.");
break;
}
case SmartActions.SetHealthPct:
{
if (e.Action.setHealthPct.percent > 100 || e.Action.setHealthPct.percent == 0)
{
Log.outError(LogFilter.Sql, $"SmartAIMgr: {e} is trying to set invalid HP percent {e.Action.setHealthPct.percent}, skipped.");
return false;
}
break;
}
case SmartActions.CreateConversation:
{
if (Global.ConversationDataStorage.GetConversationTemplate(e.Action.conversation.id) == null)
@@ -2666,6 +2675,9 @@ namespace Game.AI
[FieldOffset(4)]
public Evade evade;
[FieldOffset(4)]
public SetHealthPct setHealthPct;
[FieldOffset(4)]
public Conversation conversation;
@@ -3218,6 +3230,10 @@ namespace Game.AI
{
public uint toRespawnPosition;
}
public struct SetHealthPct
{
public uint percent;
}
public struct Conversation
{
public uint id;