diff options
author | Discover- <amort11@hotmail.com> | 2013-12-13 09:45:58 +0100 |
---|---|---|
committer | Discover- <amort11@hotmail.com> | 2013-12-13 09:45:58 +0100 |
commit | 4ca63412c85c55c6174a360b9e12840ab5edc9dc (patch) | |
tree | 88434c4220b02fabeff4dbdfa863f104e3f8b63a /src | |
parent | c045d4c7f4d53b495a95c78ba7fde0af4103013f (diff) |
Core/SmartAI: SMART_ACTION_UPDATE_TEMPLATE will no longer ignore the target type and force the source creature (creature only) to be updated; from now on it updates the given targets to the given entry (actionparam1)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 17 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index ecfe35345f2..2b56d427efb 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -973,12 +973,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_UPDATE_TEMPLATE: { - if (!me || me->GetEntry() == e.action.updateTemplate.creature) + ObjectList* targets = GetTargets(e, unit); + + if (!targets) break; - me->UpdateEntry(e.action.updateTemplate.creature, e.action.updateTemplate.team ? HORDE : ALLIANCE); - TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction: SMART_ACTION_UPDATE_TEMPLATE: Creature %u, Template: %u, Team: %u", - me->GetGUIDLow(), me->GetEntry(), e.action.updateTemplate.team ? HORDE : ALLIANCE); + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + if (IsCreature(*itr)) + (*itr)->ToCreature()->UpdateEntry(e.action.updateTemplate.creature, e.action.updateTemplate.team ? HORDE : ALLIANCE); + + delete targets; break; } case SMART_ACTION_DIE: @@ -1042,8 +1046,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_SET_INGAME_PHASE_MASK: { - if (GetBaseObject()) - GetBaseObject()->SetPhaseMask(e.action.ingamePhaseMask.mask, true); + if (WorldObject* baseObj = GetBaseObject()) + baseObj->SetPhaseMask(e.action.ingamePhaseMask.mask, true); + break; } case SMART_ACTION_MOUNT_TO_ENTRY_OR_MODEL: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 3835220b453..414e204ad5a 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -805,7 +805,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) break; } case SMART_ACTION_UPDATE_TEMPLATE: - if (e.action.updateTemplate.creature && !IsCreatureValid(e, e.action.updateTemplate.creature)) + if (!IsCreatureValid(e, e.action.updateTemplate.creature)) return false; break; case SMART_ACTION_SET_SHEATH: |