From dad95d16b263b9c1cb8df6edac8043138fb4da9e Mon Sep 17 00:00:00 2001 From: Aokromes Date: Wed, 17 Apr 2019 23:59:02 +0200 Subject: Core/SmartScripts: Implement SMART_ACTION_PLAY_CINEMATIC By Malcrom (cherry picked from commit 63aa5d1e3559f580551544b71fb7dd63d6b54b60) --- src/server/game/AI/SmartScripts/SmartScript.cpp | 11 +++++++++++ src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 10 ++++++++++ src/server/game/AI/SmartScripts/SmartScriptMgr.h | 7 ++++++- 3 files changed, 27 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 1c80fd111e2..0a3ed95a6dc 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2467,6 +2467,17 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; } + case SMART_ACTION_PLAY_CINEMATIC: + { + for (WorldObject* target : targets) + { + if (!IsPlayer(target)) + continue; + + target->ToPlayer()->SendCinematicStart(e.action.cinematic.entry); + } + break; + } default: TC_LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry " SI64FMTD " SourceType %u, Event %u, Unhandled Action type %u", 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 8340357ae73..7a2c896325f 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -1662,6 +1662,16 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) break; } + case SMART_ACTION_PLAY_CINEMATIC: + { + if (!sCinematicSequencesStore.LookupEntry(e.action.cinematic.entry)) + { + TC_LOG_ERROR("sql.sql", "SmartAIMgr: SMART_ACTION_PLAY_CINEMATIC Entry " SI64FMTD " SourceType %u Event %u Action %u uses invalid entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.cinematic.entry); + return false; + } + + break; + } case SMART_ACTION_SET_MOVEMENT_SPEED: { if (e.action.movementSpeed.movementType >= MAX_MOVE_TYPE) diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index b4587a0aaca..7822e8d554d 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -598,7 +598,7 @@ enum SMART_ACTION SMART_ACTION_DESPAWN_SPAWNGROUP = 132, // Group ID, min secs, max secs, spawnflags SMART_ACTION_RESPAWN_BY_SPAWNID = 133, // spawnType, spawnId SMART_ACTION_INVOKER_CAST = 134, // spellID, castFlags - SMART_ACTION_PLAY_CINEMATIC = 135, // reserved for future uses + SMART_ACTION_PLAY_CINEMATIC = 135, // entry, cinematic SMART_ACTION_SET_MOVEMENT_SPEED = 136, // movementType, speedInteger, speedFraction SMART_ACTION_PLAY_SPELL_VISUAL_KIT = 137, // spellVisualKitId, kitType (unknown values, copypaste from packet dumps), duration SMART_ACTION_CREATE_CONVERSATION = 143, // conversation_template.id @@ -1183,6 +1183,11 @@ struct SmartAction uint32 sceneId; } scene; + struct + { + uint32 entry; + } cinematic; + struct { uint32 movementType; -- cgit v1.2.3