diff --git a/Source/Framework/Constants/SmartAIConst.cs b/Source/Framework/Constants/SmartAIConst.cs index 740b1f503..8688ebd11 100644 --- a/Source/Framework/Constants/SmartAIConst.cs +++ b/Source/Framework/Constants/SmartAIConst.cs @@ -389,7 +389,7 @@ namespace Framework.Constants DespawnSpawngroup = 132, // Group ID, min secs, max secs, spawnflags RespawnBySpawnId = 133, // spawnType, spawnId InvokerCast = 134, // spellID, castFlags - PlayCinematic = 135, // reserved for future uses + PlayCinematic = 135, // entry, cinematic SetMovementSpeed = 136, // movementType, speedInteger, speedFraction PlaySpellVisualKit = 137, // spellVisualKitId, kitType (unknown values, copypaste from packet dumps), duration CreateConversation = 143, // conversation_template.id diff --git a/Source/Game/AI/SmartScripts/SmartAIManager.cs b/Source/Game/AI/SmartScripts/SmartAIManager.cs index f57c66493..48849b68d 100644 --- a/Source/Game/AI/SmartScripts/SmartAIManager.cs +++ b/Source/Game/AI/SmartScripts/SmartAIManager.cs @@ -1412,6 +1412,16 @@ namespace Game.AI } break; } + case SmartActions.PlayCinematic: + { + if (!CliDB.CinematicSequencesStorage.ContainsKey(e.Action.cinematic.entry)) + { + Log.outError(LogFilter.Sql, $"SmartAIMgr: SMART_ACTION_PLAY_CINEMATIC {e} uses invalid entry {e.Action.cinematic.entry}, skipped."); + return false; + } + + break; + } case SmartActions.SetMovementSpeed: { if (e.Action.movementSpeed.movementType >= (int)MovementGeneratorType.Max) @@ -2530,6 +2540,9 @@ namespace Game.AI [FieldOffset(4)] public Scene scene; + [FieldOffset(4)] + public Cinematic cinematic; + [FieldOffset(4)] public MovementSpeed movementSpeed; @@ -3045,6 +3058,10 @@ namespace Game.AI { public uint sceneId; } + public struct Cinematic + { + public uint entry; + } public struct MovementSpeed { public uint movementType; diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index 3f167aa07..415111413 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -2438,6 +2438,17 @@ namespace Game.AI break; } + case SmartActions.PlayCinematic: + { + foreach (WorldObject target in targets) + { + if (!IsPlayer(target)) + continue; + + target.ToPlayer().SendCinematicStart(e.Action.cinematic.entry); + } + break; + } default: Log.outError(LogFilter.Sql, "SmartScript.ProcessAction: Entry {0} SourceType {1}, Event {2}, Unhandled Action type {3}", e.EntryOrGuid, e.GetScriptType(), e.EventId, e.GetActionType()); break;