feat(Core/SmartScripts): SMART_ACTION_PLAY_CINEMATIC (#10231)

* cherry-pick commit (https://github.com/TrinityCore/TrinityCore/commit/63aa5d1e3559f580551544b71fb7dd63d6b54b60)
This commit is contained in:
IntelligentQuantum
2022-01-29 02:23:27 +03:30
committed by GitHub
parent 8f249a3d84
commit 9fadfa6499
3 changed files with 25 additions and 2 deletions
@@ -3372,6 +3372,23 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
delete targets; delete targets;
break; break;
} }
case SMART_ACTION_PLAY_CINEMATIC:
{
ObjectList* targets = GetTargets(e, unit);
if (!targets)
{
break;
}
for (auto const& target : *targets)
{
if (!IsPlayer(target))
continue;
target->ToPlayer()->SendCinematicStart(e.action.cinematic.entry);
}
break;
}
default: default:
LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry {} SourceType {}, Event {}, Unhandled Action type {}", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry {} SourceType {}, Event {}, Unhandled Action type {}", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
break; break;
@@ -1448,6 +1448,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_DO_ACTION: case SMART_ACTION_DO_ACTION:
case SMART_ACTION_SET_CORPSE_DELAY: case SMART_ACTION_SET_CORPSE_DELAY:
case SMART_ACTION_ATTACK_STOP: case SMART_ACTION_ATTACK_STOP:
case SMART_ACTION_PLAY_CINEMATIC:
break; break;
default: default:
LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type({}), event_type({}), Entry {} SourceType {} Event {}, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id); LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type({}), event_type({}), Entry {} SourceType {} Event {}, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
@@ -618,12 +618,12 @@ enum SMART_ACTION
SMART_ACTION_DESPAWN_SPAWNGROUP = 132, // TODO: NOT SUPPORTED YET SMART_ACTION_DESPAWN_SPAWNGROUP = 132, // TODO: NOT SUPPORTED YET
SMART_ACTION_RESPAWN_BY_SPAWNID = 133, // TODO: NOT SUPPORTED YET SMART_ACTION_RESPAWN_BY_SPAWNID = 133, // TODO: NOT SUPPORTED YET
// SMART_ACTION_INVOKER_CAST = 134, // TODO: solve name conflicts // SMART_ACTION_INVOKER_CAST = 134, // TODO: solve name conflicts
SMART_ACTION_PLAY_CINEMATIC = 135, // entry, cinematic
SMART_ACTION_TC_END = 135, // placeholder
SMART_ACTION_SET_MOVEMENT_SPEED = 136, // movementType, speedInteger, speedFraction SMART_ACTION_SET_MOVEMENT_SPEED = 136, // movementType, speedInteger, speedFraction
SMART_ACTION_SET_HEALTH_PCT = 142, // percent SMART_ACTION_SET_HEALTH_PCT = 142, // percent
SMART_ACTION_TC_END = 199, // placeholder
// AC-only SmartActions: // AC-only SmartActions:
SMART_ACTION_AC_START = 200, // placeholder SMART_ACTION_AC_START = 200, // placeholder
@@ -1316,6 +1316,11 @@ struct SmartAction
{ {
uint32 percent; uint32 percent;
} setHealthPct; } setHealthPct;
struct
{
uint32 entry;
} cinematic;
//! Note for any new future actions //! Note for any new future actions
//! All parameters must have type uint32 //! All parameters must have type uint32