diff options
author | Lopfest <lopfest@gmail.com> | 2019-08-22 13:45:11 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2019-08-22 13:45:11 +0200 |
commit | a778f757836f7173eff4674fca94ce081f62d8e8 (patch) | |
tree | f1118768a553123a6ec6c47dbb58a027647db98a | |
parent | 70721a9414151021ae33d8a810002991aa1f608e (diff) |
Core/SAI: Restore SMART_ACTION_SET_DATA accidentally deleted in cherry-picks (#23731)
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index f0fee07e8ba..f058c59d434 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1363,6 +1363,23 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u delete targets; break; } + case SMART_ACTION_SET_DATA: + { + ObjectList* targets = GetTargets(e, unit); + if (!targets) + break; + + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + { + if (IsCreature(*itr)) + (*itr)->ToCreature()->AI()->SetData(e.action.setData.field, e.action.setData.data); + else if (IsGameObject(*itr)) + (*itr)->ToGameObject()->AI()->SetData(e.action.setData.field, e.action.setData.data); + } + + delete targets; + break; + } case SMART_ACTION_MOVE_OFFSET: { if (ObjectList* targets = GetTargets(e, unit)) |