Core/SAI: Improved SMART_ACTION_JUMP_TO_POS to mirror behavior similar to SMART_ACTION_MOVE_TO_POS
Port From (https://github.com/TrinityCore/TrinityCore/commit/f291ca97962e087f9d87077b1ee6fa5b386937ed)
This commit is contained in:
@@ -344,7 +344,7 @@ namespace Framework.Constants
|
|||||||
SetDynamicFlag = 94, // UNUSED, DO NOT REUSE
|
SetDynamicFlag = 94, // UNUSED, DO NOT REUSE
|
||||||
AddDynamicFlag = 95, // UNUSED, DO NOT REUSE
|
AddDynamicFlag = 95, // UNUSED, DO NOT REUSE
|
||||||
RemoveDynamicFlag = 96, // UNUSED, DO NOT REUSE
|
RemoveDynamicFlag = 96, // UNUSED, DO NOT REUSE
|
||||||
JumpToPos = 97, // Speedxy, Speedz, Targetx, Targety, Targetz
|
JumpToPos = 97, // SpeedXY, SpeedZ, Gravity, UseDefaultGravity, PointId, ContactDistance
|
||||||
SendGossipMenu = 98, // Menuid, optionIndex
|
SendGossipMenu = 98, // Menuid, optionIndex
|
||||||
GoSetLootState = 99, // State
|
GoSetLootState = 99, // State
|
||||||
SendTargetToTarget = 100, // Id
|
SendTargetToTarget = 100, // Id
|
||||||
|
|||||||
@@ -3483,8 +3483,12 @@ namespace Game.AI
|
|||||||
}
|
}
|
||||||
public struct Jump
|
public struct Jump
|
||||||
{
|
{
|
||||||
public uint speedxy;
|
public uint SpeedXY;
|
||||||
public uint speedz;
|
public uint SpeedZ;
|
||||||
|
public uint Gravity;
|
||||||
|
public uint UseDefaultGravity;
|
||||||
|
public uint PointId;
|
||||||
|
public uint ContactDistance;
|
||||||
}
|
}
|
||||||
public struct FleeAssist
|
public struct FleeAssist
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using Game.Entities;
|
|||||||
using Game.Groups;
|
using Game.Groups;
|
||||||
using Game.Maps;
|
using Game.Maps;
|
||||||
using Game.Misc;
|
using Game.Misc;
|
||||||
|
using Game.Movement;
|
||||||
using Game.Spells;
|
using Game.Spells;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -1824,12 +1825,28 @@ namespace Game.AI
|
|||||||
}
|
}
|
||||||
case SmartActions.JumpToPos:
|
case SmartActions.JumpToPos:
|
||||||
{
|
{
|
||||||
foreach (var target in targets)
|
WorldObject target = null;
|
||||||
|
|
||||||
|
if (!targets.Empty())
|
||||||
|
target = targets.SelectRandom();
|
||||||
|
|
||||||
|
Position pos = new(e.Target.x, e.Target.y, e.Target.z);
|
||||||
|
if (target)
|
||||||
{
|
{
|
||||||
Creature creature = target.ToCreature();
|
float x, y, z;
|
||||||
if (creature != null)
|
target.GetPosition(out x, out y, out z);
|
||||||
creature.GetMotionMaster().MoveJump(e.Target.x, e.Target.y, e.Target.z, 0.0f, e.Action.jump.speedxy, e.Action.jump.speedz);
|
if (e.Action.jump.ContactDistance > 0)
|
||||||
|
target.GetContactPoint(_me, out x, out y, out z, e.Action.jump.ContactDistance);
|
||||||
|
pos = new Position(x + e.Target.x, y + e.Target.y, z + e.Target.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.Action.jump.Gravity != 0 || e.Action.jump.UseDefaultGravity != 0)
|
||||||
|
{
|
||||||
|
float gravity = e.Action.jump.UseDefaultGravity != 0 ? (float)MotionMaster.gravity : e.Action.jump.Gravity;
|
||||||
|
_me.GetMotionMaster().MoveJumpWithGravity(pos, e.Action.jump.SpeedXY, gravity, e.Action.jump.PointId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_me.GetMotionMaster().MoveJump(pos, e.Action.jump.SpeedXY, e.Action.jump.SpeedZ, e.Action.jump.PointId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SmartActions.GoSetLootState:
|
case SmartActions.GoSetLootState:
|
||||||
|
|||||||
Reference in New Issue
Block a user