From f55e86d90735aad1c0cfd8d1b6e79aa721e8267c Mon Sep 17 00:00:00 2001 From: offl Date: Sun, 19 Sep 2021 02:15:09 +0300 Subject: Core/SAI: Remove possibility to set/remove unit_flags2 So far I see that only Cannot Turn flag can be changed by scripts and action to change it didn't existed in 3xx. If someone will need to change that flag, it should be implemented by action which will change only that flag and not any flag of that type. (cherry picked from commit c8061d8ba620e78c1344ad5f2d476d7d6e5057cb) --- src/server/game/AI/SmartScripts/SmartScript.cpp | 30 +++++------------------- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 5 ++-- 2 files changed, 8 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 0c0bfd218b2..a5a647aabd3 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -757,18 +757,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (IsUnit(target)) { - if (!e.action.unitFlag.type) - { - target->ToUnit()->AddUnitFlag(UnitFlags(e.action.unitFlag.flag)); - TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %s added flag %u to UNIT_FIELD_FLAGS", - target->GetGUID().ToString().c_str(), e.action.unitFlag.flag); - } - else - { - target->ToUnit()->AddUnitFlag2(UnitFlags2(e.action.unitFlag.flag)); - TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %s added flag %u to UNIT_FIELD_FLAGS_2", - target->GetGUID().ToString().c_str(), e.action.unitFlag.flag); - } + target->ToUnit()->AddUnitFlag(UnitFlags(e.action.unitFlag.flag)); + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %s added flag %u to UNIT_FIELD_FLAGS", + target->GetGUID().ToString().c_str(), e.action.unitFlag.flag); } } break; @@ -779,18 +770,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (IsUnit(target)) { - if (!e.action.unitFlag.type) - { - target->ToUnit()->RemoveUnitFlag(UnitFlags(e.action.unitFlag.flag)); - TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %s removed flag %u to UNIT_FIELD_FLAGS", - target->GetGUID().ToString().c_str(), e.action.unitFlag.flag); - } - else - { - target->ToUnit()->RemoveUnitFlag2(UnitFlags2(e.action.unitFlag.flag)); - TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %s removed flag %u to UNIT_FIELD_FLAGS_2", - target->GetGUID().ToString().c_str(), e.action.unitFlag.flag); - } + target->ToUnit()->RemoveUnitFlag(UnitFlags(e.action.unitFlag.flag)); + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %s removed flag %u to UNIT_FIELD_FLAGS", + target->GetGUID().ToString().c_str(), e.action.unitFlag.flag); } } break; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 0875b988921..f8e4a29635b 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -480,8 +480,8 @@ enum SMART_ACTION SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS = 15, // QuestID SMART_ACTION_SET_INGAME_PHASE_GROUP = 16, // phaseGroupId, apply SMART_ACTION_SET_EMOTE_STATE = 17, // emoteID - SMART_ACTION_SET_UNIT_FLAG = 18, // Flags (may be more than one field OR'd together), Target - SMART_ACTION_REMOVE_UNIT_FLAG = 19, // Flags (may be more than one field OR'd together), Target + SMART_ACTION_SET_UNIT_FLAG = 18, // Flags + SMART_ACTION_REMOVE_UNIT_FLAG = 19, // Flags SMART_ACTION_AUTO_ATTACK = 20, // AllowAttackState (0 = stop attack, anything else means continue attacking) SMART_ACTION_ALLOW_COMBAT_MOVEMENT = 21, // AllowCombatMovement (0 = stop combat based movement, anything else continue attacking) SMART_ACTION_SET_EVENT_PHASE = 22, // Phase @@ -966,7 +966,6 @@ struct SmartAction struct { uint32 flag; - uint32 type; } unitFlag; struct -- cgit v1.2.3