From 92b74d6bdcff0f23aa1e1b8c76889ed5aacd4a5b Mon Sep 17 00:00:00 2001 From: MitchesD Date: Thu, 3 Mar 2016 23:16:59 +0100 Subject: [PATCH] Merge pull request #16523 from tkrokli/smart_action_set_corpse_delay [3.3.5][6.x]Core/SmartScript: create SMART_ACTION_SET_CORPSE_DELAY (cherry picked from commit 8e152e0d4a553bdc215d2c7fda41083b5382b235) --- src/server/game/AI/SmartScripts/SmartScript.cpp | 15 +++++++++++++++ .../game/AI/SmartScripts/SmartScriptMgr.cpp | 1 + src/server/game/AI/SmartScripts/SmartScriptMgr.h | 8 +++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 01b467fc4420c..da1e633049052 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2362,6 +2362,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 " 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 6a9f64c3fee1c..6a0ee3b11e256 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -1263,6 +1263,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_REMOVE_GO_FLAG: case SMART_ACTION_SUMMON_CREATURE_GROUP: case SMART_ACTION_RISE_UP: + case SMART_ACTION_SET_CORPSE_DELAY: break; default: TC_LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry " SI64FMTD " SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id); diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index ea0c01df63b4b..85c5e2f017af6 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -552,8 +552,9 @@ 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, soundId5, onlySelf + SMART_ACTION_SET_CORPSE_DELAY = 116, // timer - SMART_ACTION_END = 116 + SMART_ACTION_END = 117 }; struct SmartAction @@ -1042,6 +1043,11 @@ struct SmartAction uint32 onlySelf; } randomSound; + struct + { + uint32 timer; + } corpseDelay; + //! Note for any new future actions //! All parameters must have type uint32