aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRushor <PBienati@web.de>2016-02-09 18:16:11 +0100
committertkrokli <tkrokli@hotmail.com>2016-02-09 18:56:08 +0100
commit0d6b8c0d3a8141b61a2413c46131ca85fb44bf38 (patch)
tree13f31eb520fe135a6426ccfcfb0d886169c4329c
parent93718e5b3d504c2a64acf5b04cd0cdc9aac74624 (diff)
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.
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp15
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp1
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h8
3 files changed, 23 insertions, 1 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 808491495a9..01f47582926 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -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;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index 977847e60c9..6f424003006 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -1214,6 +1214,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 %d 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 c0ea648462d..d60834c9fef 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -551,8 +551,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
@@ -1034,6 +1035,11 @@ struct SmartAction
uint32 onlySelf;
} randomSound;
+ struct
+ {
+ uint32 timer;
+ } corpseDelay;
+
//! Note for any new future actions
//! All parameters must have type uint32