Skip to content

Commit 12d3e07

Browse files
committed
Core/SAI: implement SMART_ACTION_RESUME_MOVEMENT
param0 MovementSlot (default = 0, active = 1, controlled = 2) param1 ResumeTime (ms)
1 parent 328f82d commit 12d3e07

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

src/server/game/AI/SmartScripts/SmartScript.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,6 +2323,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
23232323
}
23242324
break;
23252325
}
2326+
case SMART_ACTION_RESUME_MOVEMENT:
2327+
{
2328+
for (WorldObject* const target : targets)
2329+
if (IsUnit(target))
2330+
target->ToUnit()->ResumeMovement(e.action.resumeMovement.resumeTimer, e.action.resumeMovement.movementSlot);
2331+
break;
2332+
}
23262333
default:
23272334
TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry {} SourceType {}, Event {}, Unhandled Action type {}", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
23282335
break;

src/server/game/AI/SmartScripts/SmartScriptMgr.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,7 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e)
937937
case SMART_ACTION_SET_UNINTERACTIBLE: return sizeof(SmartAction::setUninteractible);
938938
case SMART_ACTION_ACTIVATE_GAMEOBJECT: return sizeof(SmartAction::activateGameObject);
939939
case SMART_ACTION_ADD_TO_STORED_TARGET_LIST: return sizeof(SmartAction::addToStoredTargets);
940+
case SMART_ACTION_RESUME_MOVEMENT: return sizeof(SmartAction::resumeMovement);
940941
default:
941942
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.",
942943
e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
@@ -2078,6 +2079,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
20782079
}
20792080
break;
20802081
}
2082+
case SMART_ACTION_RESUME_MOVEMENT:
2083+
if (e.action.resumeMovement.resumeTimer < 0)
2084+
{
2085+
TC_LOG_ERROR("sql.sql", "Entry {} SourceType {} Event {} Action {} specifies invalid resume duration", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
2086+
return false;
2087+
}
2088+
break;
20812089
case SMART_ACTION_FOLLOW:
20822090
case SMART_ACTION_SET_ORIENTATION:
20832091
case SMART_ACTION_STORE_TARGET_LIST:

src/server/game/AI/SmartScripts/SmartScriptMgr.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,8 @@ enum SMART_ACTION
611611
SMART_ACTION_ENTER_VEHICLE = 155, // seat id (RESERVED, PENDING CHERRYPICK)
612612
SMART_ACTION_BOARD_PASSENGER = 156, // seat id (RESERVED, PENDING CHERRYPICK)
613613
SMART_ACTION_EXIT_VEHICLE = 157, // (RESERVED, PENDING CHERRYPICK)
614-
SMART_ACTION_END = 158
614+
SMART_ACTION_RESUME_MOVEMENT = 158, // MovementSlot (default = 0, active = 1, controlled = 2), ResumeTime (ms)
615+
SMART_ACTION_END = 159
615616
};
616617

617618
enum class SmartActionSummonCreatureFlags
@@ -1189,6 +1190,12 @@ struct SmartAction
11891190
uint32 id;
11901191
} addToStoredTargets;
11911192

1193+
struct
1194+
{
1195+
uint32 movementSlot;
1196+
uint32 resumeTimer;
1197+
} resumeMovement;
1198+
11921199
//! Note for any new future actions
11931200
//! All parameters must have type uint32
11941201

0 commit comments

Comments
 (0)