Skip to content
This repository was archived by the owner on Jan 18, 2024. It is now read-only.

Core/SmartScripts: add a way to use Jump With Gravity in SmartScripts #390

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/server/game/AI/SmartScripts/SmartScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1912,8 +1912,24 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
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?
if (!e.action.jump.useGravity)
{
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?
}
else
{
if (Creature* creature = target->ToCreature())
{
Position pos;
pos.m_positionX = e.target.x;
pos.m_positionY = e.target.y;
pos.m_positionZ = e.target.z;
pos.SetOrientation(e.target.o);

creature->GetMotionMaster()->MoveJumpWithGravity(pos, (float)e.action.jump.speedxy, (float)e.action.jump.speedz);
}
}
}

break;
Expand Down
4 changes: 3 additions & 1 deletion src/server/game/AI/SmartScripts/SmartScriptMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

class WorldObject;
enum SpellEffIndex : uint8;
typedef uint32 SAIBool;

enum eSmartAI
{
Expand Down Expand Up @@ -1009,7 +1010,8 @@ struct SmartAction
struct
{
uint32 speedxy;
uint32 speedz;
uint32 speedz; // If useGravity true, speedZ is gravity
SAIBool useGravity;
} jump;

struct
Expand Down