diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 27 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.h | 10 |
2 files changed, 31 insertions, 6 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index a3f20b9856b..5bd3d704a7a 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -32,6 +32,7 @@ #include "Log.h" #include "Map.h" #include "MotionMaster.h" +#include "MovementTypedefs.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "PhasingHandler.h" @@ -1850,9 +1851,29 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_JUMP_TO_POS: { - for (WorldObject* target : targets) - if (Creature* creature = target->ToCreature()) - creature->GetMotionMaster()->MoveJump(e.target.x, e.target.y, e.target.z, 0.0f, float(e.action.jump.speedxy), float(e.action.jump.speedz)); // @todo add optional jump orientation support? + WorldObject* target = nullptr; + + if (!targets.empty()) + target = Trinity::Containers::SelectRandomContainerElement(targets); + + Position pos(e.target.x, e.target.y, e.target.z); + if (target) + { + float x, y, z; + target->GetPosition(x, y, z); + if (e.action.jump.ContactDistance > 0) + target->GetContactPoint(me, x, y, z, e.action.jump.ContactDistance); + pos = Position(x + e.target.x, y + e.target.y, z + e.target.z); + } + + if (e.action.jump.Gravity || e.action.jump.UseDefaultGravity) + { + float gravity = e.action.jump.UseDefaultGravity ? Movement::gravity : e.action.jump.Gravity; + me->GetMotionMaster()->MoveJumpWithGravity(pos, float(e.action.jump.SpeedXY), gravity, e.action.jump.PointId); + } + else + me->GetMotionMaster()->MoveJump(pos, float(e.action.jump.SpeedXY), float(e.action.jump.SpeedZ), e.action.jump.PointId); + break; } case SMART_ACTION_GO_SET_LOOT_STATE: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 858b3043c77..d4af11f7dad 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -551,7 +551,7 @@ enum SMART_ACTION SMART_ACTION_SET_DYNAMIC_FLAG = 94, // UNUSED, DO NOT REUSE SMART_ACTION_ADD_DYNAMIC_FLAG = 95, // UNUSED, DO NOT REUSE SMART_ACTION_REMOVE_DYNAMIC_FLAG = 96, // UNUSED, DO NOT REUSE - SMART_ACTION_JUMP_TO_POS = 97, // speedXY, speedZ, targetX, targetY, targetZ + SMART_ACTION_JUMP_TO_POS = 97, // SpeedXY, SpeedZ, Gravity, UseDefaultGravity, PointId, ContactDistance SMART_ACTION_SEND_GOSSIP_MENU = 98, // menuId, optionId SMART_ACTION_GO_SET_LOOT_STATE = 99, // state SMART_ACTION_SEND_TARGET_TO_TARGET = 100, // id @@ -986,8 +986,12 @@ struct SmartAction struct { - uint32 speedxy; - uint32 speedz; + uint32 SpeedXY; + uint32 SpeedZ; + uint32 Gravity; + SAIBool UseDefaultGravity; + uint32 PointId; + uint32 ContactDistance; } jump; struct |