diff options
author | Treeston <treeston.mmoc@gmail.com> | 2018-02-24 02:26:35 +0100 |
---|---|---|
committer | Treeston <treeston.mmoc@gmail.com> | 2018-02-24 02:26:35 +0100 |
commit | 0850b5ff39b187d8a1adb032dfd7900d4474cfaf (patch) | |
tree | 5a10be358e26781416529c0f0e64ed8b094ba99d | |
parent | 9f92896c52dfdaaad3a7eb66a780a7415dc12546 (diff) |
Core/SmartScripts: Rename SMART_ACTION_RESPAWN_TARGET -> SMART_ACTION_ENABLE_TEMP_GOBJ, since that's the only thing it still does in the dynspawn model. Adjust body accordingly to warn on misuse.
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 9 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 7 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.h | 6 |
3 files changed, 13 insertions, 9 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index a9451caeee4..ba62da0fc12 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1454,19 +1454,18 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } break; } - case SMART_ACTION_RESPAWN_TARGET: + case SMART_ACTION_ENABLE_TEMP_GOBJ: { for (WorldObject* target : targets) { if (IsCreature(target)) - target->ToCreature()->Respawn(); + TC_LOG_WARN("sql.sql", "Invalid creature target '%s' (entry %u, spawnId %u) specified for SMART_ACTION_ENABLE_TEMP_GOBJ", target->GetName().c_str(), target->GetEntry(), target->ToCreature()->GetSpawnId()); else if (IsGameObject(target)) { - // do not modify respawndelay of already spawned gameobjects if (target->ToGameObject()->isSpawnedByDefault()) - target->ToGameObject()->Respawn(); + TC_LOG_WARN("sql.sql", "Invalid gameobject target '%s' (entry %u, spawnId %u) for SMART_ACTION_ENABLE_TEMP_GOBJ - the object is spawned by default", target->GetName().c_str(), target->GetEntry(), target->ToGameObject()->GetSpawnId()); else - target->ToGameObject()->SetRespawnTime(e.action.RespawnTarget.goRespawnTime); + target->ToGameObject()->SetRespawnTime(e.action.enableTempGO.duration); } } break; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 43a072342ec..6e9a6a6623a 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -1487,6 +1487,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) return false; } break; + case SMART_ACTION_ENABLE_TEMP_GOBJ: + if (!e.action.enableTempGO.duration) + { + TC_LOG_ERROR("sql.sql", "Entry %u SourceType %u Event %u Action %u does not specify duration", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType()); + return false; + } case SMART_ACTION_FOLLOW: case SMART_ACTION_SET_ORIENTATION: case SMART_ACTION_STORE_TARGET_LIST: @@ -1520,7 +1526,6 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_REMOVE_UNIT_FLAG: case SMART_ACTION_PLAYMOVIE: case SMART_ACTION_MOVE_TO_POS: - case SMART_ACTION_RESPAWN_TARGET: case SMART_ACTION_CLOSE_GOSSIP: case SMART_ACTION_TRIGGER_TIMED_EVENT: case SMART_ACTION_REMOVE_TIMED_EVENT: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 9b829c2666f..859dc0da01c 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -516,7 +516,7 @@ enum SMART_ACTION SMART_ACTION_CREATE_TIMED_EVENT = 67, // id, InitialMin, InitialMax, RepeatMin(only if it repeats), RepeatMax(only if it repeats), chance SMART_ACTION_PLAYMOVIE = 68, // entry SMART_ACTION_MOVE_TO_POS = 69, // PointId, transport, disablePathfinding, ContactDistance - SMART_ACTION_RESPAWN_TARGET = 70, // + SMART_ACTION_ENABLE_TEMP_GOBJ = 70, // despawnTimer (sec) SMART_ACTION_EQUIP = 71, // entry, slotmask slot1, slot2, slot3 , only slots with mask set will be sent to client, bits are 1, 2, 4, leaving mask 0 is defaulted to mask 7 (send all), slots1-3 are only used if no entry is set SMART_ACTION_CLOSE_GOSSIP = 72, // none SMART_ACTION_TRIGGER_TIMED_EVENT = 73, // id(>1) @@ -993,8 +993,8 @@ struct SmartAction struct { - uint32 goRespawnTime; - } RespawnTarget; + uint32 duration; + } enableTempGO; struct { |