aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorccrs <ccrs@users.noreply.github.com>2025-10-16 20:43:11 +0200
committerccrs <ccrs@users.noreply.github.com>2025-10-16 20:43:11 +0200
commit12d3e077c374f193c6d883f03e0d10806e46b4b8 (patch)
tree11a2f819fee02806a81f59468f5e5916b7d43e0c
parent328f82da78a347943124388f50a607b2a69a00a4 (diff)
Core/SAI: implement SMART_ACTION_RESUME_MOVEMENT
param0 MovementSlot (default = 0, active = 1, controlled = 2) param1 ResumeTime (ms)
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp7
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp8
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h9
3 files changed, 23 insertions, 1 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 8c0fbf0bfb7..2709ba65e2d 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -2323,6 +2323,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
break;
}
+ case SMART_ACTION_RESUME_MOVEMENT:
+ {
+ for (WorldObject* const target : targets)
+ if (IsUnit(target))
+ target->ToUnit()->ResumeMovement(e.action.resumeMovement.resumeTimer, e.action.resumeMovement.movementSlot);
+ break;
+ }
default:
TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry {} SourceType {}, Event {}, Unhandled Action type {}", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
break;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index d86bf0d9ef5..e59fbdd2190 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -937,6 +937,7 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e)
case SMART_ACTION_SET_UNINTERACTIBLE: return sizeof(SmartAction::setUninteractible);
case SMART_ACTION_ACTIVATE_GAMEOBJECT: return sizeof(SmartAction::activateGameObject);
case SMART_ACTION_ADD_TO_STORED_TARGET_LIST: return sizeof(SmartAction::addToStoredTargets);
+ case SMART_ACTION_RESUME_MOVEMENT: return sizeof(SmartAction::resumeMovement);
default:
TC_LOG_WARN("sql.sql", "SmartAIMgr: Entry {} SourceType {} Event {} Action {} is using an action with no unused params specified in SmartAIMgr::CheckUnusedActionParams(), please report this.",
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
@@ -2078,6 +2079,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
}
+ case SMART_ACTION_RESUME_MOVEMENT:
+ if (e.action.resumeMovement.resumeTimer < 0)
+ {
+ TC_LOG_ERROR("sql.sql", "Entry {} SourceType {} Event {} Action {} specifies invalid resume duration", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
+ return false;
+ }
+ break;
case SMART_ACTION_FOLLOW:
case SMART_ACTION_SET_ORIENTATION:
case SMART_ACTION_STORE_TARGET_LIST:
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 350503e0755..52204eab64e 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -611,7 +611,8 @@ enum SMART_ACTION
SMART_ACTION_ENTER_VEHICLE = 155, // seat id (RESERVED, PENDING CHERRYPICK)
SMART_ACTION_BOARD_PASSENGER = 156, // seat id (RESERVED, PENDING CHERRYPICK)
SMART_ACTION_EXIT_VEHICLE = 157, // (RESERVED, PENDING CHERRYPICK)
- SMART_ACTION_END = 158
+ SMART_ACTION_RESUME_MOVEMENT = 158, // MovementSlot (default = 0, active = 1, controlled = 2), ResumeTime (ms)
+ SMART_ACTION_END = 159
};
enum class SmartActionSummonCreatureFlags
@@ -1189,6 +1190,12 @@ struct SmartAction
uint32 id;
} addToStoredTargets;
+ struct
+ {
+ uint32 movementSlot;
+ uint32 resumeTimer;
+ } resumeMovement;
+
//! Note for any new future actions
//! All parameters must have type uint32