diff options
author | Discover- <amort11@hotmail.com> | 2013-12-17 11:10:23 +0100 |
---|---|---|
committer | Discover- <amort11@hotmail.com> | 2013-12-17 11:10:23 +0100 |
commit | 154ee466eb74c9b5d00a7838c7c6231f2786469b (patch) | |
tree | 963a1fb6d2af0b722e6acf2e433acefea76cf30a /src | |
parent | 1f4d585bef865747994d5358f95f06dc86e59a37 (diff) |
Core/SAI: Using the action_type SMART_ACTION_SET_REACT_STATE now sets the react state of the target_type. Won't break any scripts as all current cases of this action_type have target_type 1 (SMART_TARGET_SELF).
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index e72d9af160d..f0a469496bd 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -367,12 +367,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { if (IsPlayer(*itr)) + { if (Quest const* q = sObjectMgr->GetQuestTemplate(e.action.quest.quest)) { (*itr)->ToPlayer()->AddQuestAndCheckCompletion(q, NULL); TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_ADD_QUEST: Player guidLow %u add quest %u", (*itr)->GetGUIDLow(), e.action.quest.quest); } + } } delete targets; @@ -380,12 +382,18 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_SET_REACT_STATE: { - if (!me) + ObjectList* targets = GetTargets(e, unit); + if (!targets) break; - me->SetReactState(ReactStates(e.action.react.state)); - TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_REACT_STATE: Creature guidLow %u set reactstate %u", - me->GetGUIDLow(), e.action.react.state); + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + { + if (!IsUnit(*itr)) + continue; + + (*itr)->ToUnit()->SetReactState(ReactStates(e.action.react.state)); + } + break; } case SMART_ACTION_RANDOM_EMOTE: |