From 9f702c199b95add33ffba9d2f1803199130c4a27 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sun, 29 May 2022 22:55:34 -0400 Subject: [PATCH] Core/SAI: Remove possibility to set/remove unit_flags2 Port From (https://github.com/TrinityCore/TrinityCore/commit/f55e86d90735aad1c0cfd8d1b6e79aa721e8267c) --- Source/Framework/Constants/SmartAIConst.cs | 4 +-- Source/Game/AI/SmartScripts/SmartAIManager.cs | 1 - Source/Game/AI/SmartScripts/SmartScript.cs | 30 ++++--------------- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/Source/Framework/Constants/SmartAIConst.cs b/Source/Framework/Constants/SmartAIConst.cs index e264d36ba..8ebbf9e1d 100644 --- a/Source/Framework/Constants/SmartAIConst.cs +++ b/Source/Framework/Constants/SmartAIConst.cs @@ -261,8 +261,8 @@ namespace Framework.Constants CallAreaexploredoreventhappens = 15, // Questid SetIngamePhaseGroup = 16, // phaseGroupId, apply SetEmoteState = 17, // Emoteid - SetUnitFlag = 18, // Flags (May Be More Than One Field Or'D Together), Target - RemoveUnitFlag = 19, // Flags (May Be More Than One Field Or'D Together), Target + SetUnitFlag = 18, // Flags + RemoveUnitFlag = 19, // Flags AutoAttack = 20, // Allowattackstate (0 = Stop Attack, Anything Else Means Continue Attacking) AllowCombatMovement = 21, // Allowcombatmovement (0 = Stop Combat Based Movement, Anything Else Continue Attacking) SetEventPhase = 22, // Phase diff --git a/Source/Game/AI/SmartScripts/SmartAIManager.cs b/Source/Game/AI/SmartScripts/SmartAIManager.cs index 85b402c19..ac649e71f 100644 --- a/Source/Game/AI/SmartScripts/SmartAIManager.cs +++ b/Source/Game/AI/SmartScripts/SmartAIManager.cs @@ -3518,7 +3518,6 @@ namespace Game.AI public struct UnitFlag { public uint flag; - public uint type; } public struct Flag { diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index 2fdcf757f..9a60ab8e2 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -632,18 +632,9 @@ namespace Game.AI { if (IsUnit(target)) { - if (e.Action.unitFlag.type == 0) - { - target.ToUnit().AddUnitFlag((UnitFlags)e.Action.unitFlag.flag); - Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_SET_UNIT_FLAG. Unit {0} added flag {1} to UNIT_FIELD_FLAGS", - target.GetGUID().ToString(), e.Action.unitFlag.flag); - } - else - { - target.ToUnit().AddUnitFlag2((UnitFlags2)e.Action.unitFlag.flag); - Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_SET_UNIT_FLAG. Unit {0} added flag {1} to UNIT_FIELD_FLAGS_2", - target.GetGUID().ToString(), e.Action.unitFlag.flag); - } + target.ToUnit().AddUnitFlag((UnitFlags)e.Action.unitFlag.flag); + Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_SET_UNIT_FLAG. Unit {0} added flag {1} to UNIT_FIELD_FLAGS", + target.GetGUID().ToString(), e.Action.unitFlag.flag); } } break; @@ -654,18 +645,9 @@ namespace Game.AI { if (IsUnit(target)) { - if (e.Action.unitFlag.type == 0) - { - target.ToUnit().RemoveUnitFlag((UnitFlags)e.Action.unitFlag.flag); - Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_REMOVE_UNIT_FLAG. Unit {0} removed flag {1} to UNIT_FIELD_FLAGS", - target.GetGUID().ToString(), e.Action.unitFlag.flag); - } - else - { - target.ToUnit().RemoveUnitFlag2((UnitFlags2)e.Action.unitFlag.flag); - Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_REMOVE_UNIT_FLAG. Unit {0} removed flag {1} to UNIT_FIELD_FLAGS_2", - target.GetGUID().ToString(), e.Action.unitFlag.flag); - } + target.ToUnit().RemoveUnitFlag((UnitFlags)e.Action.unitFlag.flag); + Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_REMOVE_UNIT_FLAG. Unit {0} removed flag {1} to UNIT_FIELD_FLAGS", + target.GetGUID().ToString(), e.Action.unitFlag.flag); } } break;