feat(Core/SmartScripts): SMART_ACTION_SET_CORPSE_DELAY

This commit is contained in:
IntelligentQuantum
2022-01-04 13:11:19 +03:30
committed by GitHub
parent 0d6b8dba18
commit 9faec8ef1b
3 changed files with 26 additions and 1 deletions

View File

@@ -3275,6 +3275,25 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
CAST_AI(SmartAI, me->AI())->SetEvadeDisabled(e.action.disableEvade.disable != 0);
break;
}
case SMART_ACTION_SET_CORPSE_DELAY:
{
ObjectList* targets = GetTargets(e, unit);
if (!targets)
{
break;
}
for (auto const& target : *targets)
{
if (IsCreature(target))
{
target->ToCreature()->SetCorpseDelay(e.action.corpseDelay.timer);
}
}
delete targets;
break;
}
default:
LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
break;

View File

@@ -1267,6 +1267,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_PLAYER_TALK:
case SMART_ACTION_CU_ENCOUNTER_START:
case SMART_ACTION_DO_ACTION:
case SMART_ACTION_SET_CORPSE_DELAY:
break;
default:
LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);

View File

@@ -586,7 +586,7 @@ enum SMART_ACTION
SMART_ACTION_START_CLOSEST_WAYPOINT = 113, // wp1, wp2, wp3, wp4, wp5, wp6, wp7
SMART_ACTION_RISE_UP = 114, // distance
SMART_ACTION_RANDOM_SOUND = 115, // SoundId1, SoundId2, SoundId3, SoundId4, onlySelf
SMART_ACTION_SET_CORPSE_DELAY = 116, // TODO: NOT SUPPORTED YET
SMART_ACTION_SET_CORPSE_DELAY = 116, // timer
SMART_ACTION_DISABLE_EVADE = 117, // 0/1 (1 = disabled, 0 = enabled)
SMART_ACTION_GO_SET_GO_STATE = 118, // TODO: NOT SUPPORTED YET
SMART_ACTION_SET_CAN_FLY = 119, // TODO: NOT SUPPORTED YET
@@ -1281,6 +1281,11 @@ struct SmartAction
{
uint32 disable;
} disableEvade;
struct
{
uint32 timer;
} corpseDelay;
//! Note for any new future actions
//! All parameters must have type uint32