Core/SmartScripts: Implement SMART_ACTION_PLAY_CINEMATIC

Port From (https://github.com/TrinityCore/TrinityCore/commit/dad95d16b263b9c1cb8df6edac8043138fb4da9e)
This commit is contained in:
hondacrx
2021-12-01 11:44:02 -05:00
parent 8701a862cc
commit a04e405383
3 changed files with 29 additions and 1 deletions
+1 -1
View File
@@ -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
@@ -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;
@@ -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;