aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRushor <Rushor@users.noreply.github.com>2020-09-11 21:16:35 +0200
committerShauren <shauren.trinity@gmail.com>2022-02-05 22:51:52 +0100
commitdfeb8c267f94f6a2b2ebe717fd43c5d4fd36a549 (patch)
tree4ca5d32b3ba8516168ba25eed1bc80a74364ba96 /src
parent9fe5a7297dd74bebd05672ff7a029725257c5bac (diff)
Game/AI: Implement option to move a creature back to Homeposition on Evade. (#24492)
* Game/AI: Implement option to move a creature back to Homeposition on Evade. * If ToHomePosition (action param 1) is 1 > Move to last stored position * If ToHomePosition (action param 1) is 0 > Move to homeposition * Ref: https://github.com/TrinityCore/TrinityCore/issues/24226 * Add parameter for walkmode * Game/AI: SAI SMART_ACTION_EVADE - Rename ToHomePosition to ToRespawnPosition and store point from GetRespawnPosition. * Game/AI: SAI SMART_ACTION_EVADE - Rename ToHomePosition to ToRespawnPosition * Remove broken bits, simplify the code * Update comments * Code cleanup Co-authored-by: jackpoz <giacomopoz@gmail.com> (cherry picked from commit 02fca032e1d497be08681de0bfd7bca979f0dafd)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp8
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h7
2 files changed, 14 insertions, 1 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index f4843715a33..69090caae06 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -836,6 +836,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!me)
break;
+ // Reset home position to respawn position if specified in the parameters
+ if (e.action.evade.toRespawnPosition == 0)
+ {
+ float homeX, homeY, homeZ, homeO;
+ me->GetRespawnPosition(homeX, homeY, homeZ, &homeO);
+ me->SetHomePosition(homeX, homeY, homeZ, homeO);
+ }
+
me->AI()->EnterEvadeMode();
TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_EVADE: Creature %s EnterEvadeMode", me->GetGUID().ToString().c_str());
break;
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 4a4c7b562f1..1ba17a99dc4 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -493,7 +493,7 @@ enum SMART_ACTION
SMART_ACTION_ALLOW_COMBAT_MOVEMENT = 21, // AllowCombatMovement (0 = stop combat based movement, anything else continue attacking)
SMART_ACTION_SET_EVENT_PHASE = 22, // Phase
SMART_ACTION_INC_EVENT_PHASE = 23, // Value (may be negative to decrement phase, should not be 0)
- SMART_ACTION_EVADE = 24, // No Params
+ SMART_ACTION_EVADE = 24, // toRespawnPosition (0 = Move to RespawnPosition, 1 = Move to last stored home position)
SMART_ACTION_FLEE_FOR_ASSIST = 25, // With Emote
SMART_ACTION_CALL_GROUPEVENTHAPPENS = 26, // QuestID
SMART_ACTION_COMBAT_STOP = 27, //
@@ -1236,6 +1236,11 @@ struct SmartAction
struct
{
+ uint32 toRespawnPosition;
+ } evade;
+
+ struct
+ {
uint32 id;
} conversation;