Core/SmartScript: create SMART_ACTION_SET_CORPSE_DELAY

by Vincent-Michael, updates #16488

New smart action SMART_ACTION_SET_CORPSE_DELAY:
- Allows setting the delay of corpse decay time in SmartScript

(PR opened on request from Rushor)
Constructive feedback is welcome.
This commit is contained in:
Rushor authored and tkrokli committed 2016-02-09 18:56:08 +01:00
1 parent 93718e5b3d
commit 0d6b8c0d3a
3 files changed
+23 -1

No files matched your search

@@ -2330,6 +2330,21 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
}
}
case SMART_ACTION_SET_CORPSE_DELAY:
{
ObjectList* targets = GetTargets(e, unit);
if (!targets)
break;
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
{
if (IsCreature(*itr))
(*itr)->ToCreature()->SetCorpseDelay(e.action.corpseDelay.timer);
}
delete targets;
break;
}
default:
TC_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;