mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
fix(Core/SmartScripts): Allow SAI_ACTION_DIE to accept params (#16411)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
--
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid` = 19716 AND `source_type` = 0 AND `id` IN (5, 6);
|
||||
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
|
||||
(19716, 0, 5, 6, 34, 2, 100, 1, 8, 0, 0, 0, 0, 11, 35058, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Mechanar Tinkerer - On Reached Point 0 - Cast \'Nether Explosion\' (Phase 2) (No Repeat)'),
|
||||
(19716, 0, 6, 0, 61, 2, 100, 1, 0, 0, 0, 0, 0, 37, 1001, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Mechanar Tinkerer - On Reached Point 0 - Kill Self (Phase 2) (No Repeat)');
|
||||
@@ -1138,8 +1138,23 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_DIE:
|
||||
{
|
||||
if (e.action.die.milliseconds)
|
||||
{
|
||||
if (me && !me->isDead())
|
||||
{
|
||||
me->m_Events.AddEventAtOffset([&]
|
||||
{
|
||||
// We need to check again to see if we didn't die in the process.
|
||||
if (me && !me->isDead())
|
||||
{
|
||||
me->KillSelf();
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_DIE: Creature {}", me->GetGUID().ToString());
|
||||
}
|
||||
}, Milliseconds(e.action.die.milliseconds));
|
||||
}
|
||||
}
|
||||
else if (me && !me->isDead())
|
||||
{
|
||||
me->KillSelf();
|
||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_DIE: Creature {}", me->GetGUID().ToString());
|
||||
|
||||
@@ -641,7 +641,7 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e)
|
||||
case SMART_ACTION_SET_INST_DATA: return sizeof(SmartAction::setInstanceData);
|
||||
case SMART_ACTION_SET_INST_DATA64: return sizeof(SmartAction::setInstanceData64);
|
||||
case SMART_ACTION_UPDATE_TEMPLATE: return sizeof(SmartAction::updateTemplate);
|
||||
case SMART_ACTION_DIE: return NO_PARAMS;
|
||||
case SMART_ACTION_DIE: return sizeof(SmartAction::die);
|
||||
case SMART_ACTION_SET_IN_COMBAT_WITH_ZONE: return NO_PARAMS;
|
||||
case SMART_ACTION_CALL_FOR_HELP: return sizeof(SmartAction::callHelp);
|
||||
case SMART_ACTION_SET_SHEATH: return sizeof(SmartAction::setSheath);
|
||||
|
||||
@@ -559,7 +559,7 @@ enum SMART_ACTION
|
||||
SMART_ACTION_SET_INST_DATA = 34, // Field, Data
|
||||
SMART_ACTION_SET_INST_DATA64 = 35, // Field,
|
||||
SMART_ACTION_UPDATE_TEMPLATE = 36, // Entry, UpdateLevel
|
||||
SMART_ACTION_DIE = 37, // No Params
|
||||
SMART_ACTION_DIE = 37, // Milliseconds
|
||||
SMART_ACTION_SET_IN_COMBAT_WITH_ZONE = 38, // Range (if outside of dungeon)
|
||||
SMART_ACTION_CALL_FOR_HELP = 39, // Radius, With Emote
|
||||
SMART_ACTION_SET_SHEATH = 40, // Sheath (0-unarmed, 1-melee, 2-ranged)
|
||||
@@ -925,6 +925,11 @@ struct SmartAction
|
||||
SAIBool updateLevel;
|
||||
} updateTemplate;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 milliseconds;
|
||||
} die;
|
||||
|
||||
struct
|
||||
{
|
||||
uint32 range;
|
||||
|
||||
Reference in New Issue
Block a user