From 072ea761c6dc9891d0e929f0e618b7ae2327c421 Mon Sep 17 00:00:00 2001 From: Kittnz Date: Tue, 27 Dec 2016 19:00:57 +0100 Subject: Core/SmartScript: update ACTION_GO_SET_GO_STATE GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open) GO_STATE_READY = 1, // show in world as ready (closed door close) GO_STATE_ACTIVE_ALTERNATIVE = 2 // show in world as used in alt way and not reset (closed door open by cannon fire) Credits to Sunwell --- src/server/game/AI/SmartScripts/SmartScript.cpp | 14 ++++++++++++++ src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 1 + src/server/game/AI/SmartScripts/SmartScriptMgr.h | 8 +++++++- 3 files changed, 22 insertions(+), 1 deletion(-) (limited to 'src/server') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 6f0a71007c4..ce14b8eecaa 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2054,6 +2054,20 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsGameObject(*itr)) (*itr)->ToGameObject()->SetLootState((LootState)e.action.setGoLootState.state); + delete targets; + break; + } + case SMART_ACTION_GO_SET_GO_STATE: + { + ObjectList* targets = GetTargets(e, unit); + + if (!targets) + break; + + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + if (IsGameObject(*itr)) + (*itr)->ToGameObject()->SetGoState((GOState)e.action.goState.state); + delete targets; break; } diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 0d54bfad0f7..3c4995d101a 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -1223,6 +1223,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) case SMART_ACTION_JUMP_TO_POS: case SMART_ACTION_SEND_GOSSIP_MENU: case SMART_ACTION_GO_SET_LOOT_STATE: + case SMART_ACTION_GO_SET_GO_STATE: case SMART_ACTION_SEND_TARGET_TO_TARGET: case SMART_ACTION_SET_HOME_POS: case SMART_ACTION_SET_HEALTH_REGEN: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 0a13f31f2ac..58cb6c1bd95 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_RANDOM_SOUND = 115, // soundId1, soundId2, soundId3, soundId4, soundId5, onlySelf 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, // state - SMART_ACTION_END = 118 + SMART_ACTION_END = 119 }; struct SmartAction @@ -1012,6 +1013,11 @@ struct SmartAction uint32 flag; } goFlag; + struct + { + uint32 state; + } goState; + struct { uint32 group; -- cgit v1.2.3