Core/Movement: Defined and implemented new spline flag - JumpOrientationFixed
Port From (https://github.com/TrinityCore/TrinityCore/commit/bd9fb4a56303e2bd8046e77d425250b9757aa74c)
This commit is contained in:
@@ -20,14 +20,14 @@ namespace Framework.Constants
|
|||||||
Unknown_0x1 = 0x00000001, // NOT VERIFIED
|
Unknown_0x1 = 0x00000001, // NOT VERIFIED
|
||||||
Unknown_0x2 = 0x00000002, // NOT VERIFIED
|
Unknown_0x2 = 0x00000002, // NOT VERIFIED
|
||||||
Unknown_0x4 = 0x00000004, // NOT VERIFIED
|
Unknown_0x4 = 0x00000004, // NOT VERIFIED
|
||||||
Unknown_0x8 = 0x00000008, // NOT VERIFIED - does someting related to falling/fixed orientation
|
JumpOrientationFixed = 0x00000008, // NOT VERIFIED - does someting related to falling/fixed orientation
|
||||||
FallingSlow = 0x00000010,
|
FallingSlow = 0x00000010,
|
||||||
Done = 0x00000020,
|
Done = 0x00000020,
|
||||||
Falling = 0x00000040, // Affects elevation computation, can't be combined with Parabolic flag
|
Falling = 0x00000040, // Affects elevation computation, can't be combined with Parabolic flag
|
||||||
NoSpline = 0x00000080,
|
NoSpline = 0x00000080,
|
||||||
Unknown_0x100 = 0x00000100, // NOT VERIFIED
|
Unknown_0x100 = 0x00000100, // NOT VERIFIED
|
||||||
Flying = 0x00000200, // Smooth movement(Catmullrom interpolation mode), flying animation
|
Flying = 0x00000200, // Smooth movement(Catmullrom interpolation mode), flying animation
|
||||||
OrientationFixed = 0x00000400, // Model orientation fixed
|
OrientationFixed = 0x00000400, // Model orientation fixed (knockback animation)
|
||||||
Catmullrom = 0x00000800, // Used Catmullrom interpolation mode
|
Catmullrom = 0x00000800, // Used Catmullrom interpolation mode
|
||||||
Cyclic = 0x00001000, // Movement by cycled spline
|
Cyclic = 0x00001000, // Movement by cycled spline
|
||||||
EnterCycle = 0x00002000, // Everytimes appears with cyclic flag in monster move packet, erases first spline vertex after first cycle done
|
EnterCycle = 0x00002000, // Everytimes appears with cyclic flag in monster move packet, erases first spline vertex after first cycle done
|
||||||
@@ -53,7 +53,7 @@ namespace Framework.Constants
|
|||||||
// flags that shouldn't be appended into SMSG_MONSTER_MOVE\SMSG_MONSTER_MOVE_TRANSPORT packet, should be more probably
|
// flags that shouldn't be appended into SMSG_MONSTER_MOVE\SMSG_MONSTER_MOVE_TRANSPORT packet, should be more probably
|
||||||
MaskNoMonsterMove = Done,
|
MaskNoMonsterMove = Done,
|
||||||
// Unused, not suported flags
|
// Unused, not suported flags
|
||||||
MaskUnused = NoSpline | EnterCycle | Frozen | Unknown_0x8 | Unknown_0x100 | Unknown_0x20000 | Unknown_0x40000
|
MaskUnused = NoSpline | EnterCycle | Frozen | Unknown_0x100 | Unknown_0x20000 | Unknown_0x40000
|
||||||
| Unknown_0x800000 | FadeObject | UnlimitedSpeed | Unknown_0x40000000 | Unknown_0x80000000
|
| Unknown_0x800000 | FadeObject | UnlimitedSpeed | Unknown_0x40000000 | Unknown_0x80000000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1909,10 +1909,10 @@ namespace Game.AI
|
|||||||
if (e.Action.jump.Gravity != 0 || e.Action.jump.UseDefaultGravity != 0)
|
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;
|
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, null, null, null, actionResultSetter);
|
_me.GetMotionMaster().MoveJumpWithGravity(pos, e.Action.jump.SpeedXY, gravity, e.Action.jump.PointId, null, false, null, null, actionResultSetter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_me.GetMotionMaster().MoveJump(pos, e.Action.jump.SpeedXY, e.Action.jump.SpeedZ, e.Action.jump.PointId, null, null, null, actionResultSetter);
|
_me.GetMotionMaster().MoveJump(pos, e.Action.jump.SpeedXY, e.Action.jump.SpeedZ, e.Action.jump.PointId, null, false, null, null, actionResultSetter);
|
||||||
|
|
||||||
mTimedActionWaitEvent = waitEvent;
|
mTimedActionWaitEvent = waitEvent;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -771,12 +771,12 @@ namespace Game.Movement
|
|||||||
MoveJump(x, y, z, speedXY, speedZ);
|
MoveJump(x, y, z, speedXY, speedZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MoveJump(Position pos, float speedXY, float speedZ, uint id = EventId.Jump, object facing = null, JumpArrivalCastArgs arrivalCast = null, SpellEffectExtraData spellEffectExtraData = null, ActionResultSetter<MovementStopReason> scriptResult = null)
|
public void MoveJump(Position pos, float speedXY, float speedZ, uint id = EventId.Jump, object facing = null, bool orientationFixed = false, JumpArrivalCastArgs arrivalCast = null, SpellEffectExtraData spellEffectExtraData = null, ActionResultSetter<MovementStopReason> scriptResult = null)
|
||||||
{
|
{
|
||||||
MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), speedXY, speedZ, id, facing, arrivalCast, spellEffectExtraData, scriptResult);
|
MoveJump(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), speedXY, speedZ, id, facing, orientationFixed, arrivalCast, spellEffectExtraData, scriptResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MoveJump(float x, float y, float z, float speedXY, float speedZ, uint id = EventId.Jump, object facing = null, JumpArrivalCastArgs arrivalCast = null, SpellEffectExtraData spellEffectExtraData = null, ActionResultSetter<MovementStopReason> scriptResult = null)
|
public void MoveJump(float x, float y, float z, float speedXY, float speedZ, uint id = EventId.Jump, object facing = null, bool orientationFixed = false, JumpArrivalCastArgs arrivalCast = null, SpellEffectExtraData spellEffectExtraData = null, ActionResultSetter<MovementStopReason> scriptResult = null)
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Server, "Unit ({0}) jump to point (X: {1} Y: {2} Z: {3})", _owner.GetGUID().ToString(), x, y, z);
|
Log.outDebug(LogFilter.Server, "Unit ({0}) jump to point (X: {1} Y: {2} Z: {3})", _owner.GetGUID().ToString(), x, y, z);
|
||||||
if (speedXY < 0.01f)
|
if (speedXY < 0.01f)
|
||||||
@@ -795,6 +795,7 @@ namespace Game.Movement
|
|||||||
init.SetParabolic(max_height, 0);
|
init.SetParabolic(max_height, 0);
|
||||||
init.SetVelocity(speedXY);
|
init.SetVelocity(speedXY);
|
||||||
MoveSplineInitFacingVisitor(init, facing);
|
MoveSplineInitFacingVisitor(init, facing);
|
||||||
|
init.SetJumpOrientationFixed(orientationFixed);
|
||||||
if (spellEffectExtraData != null)
|
if (spellEffectExtraData != null)
|
||||||
init.SetSpellEffectExtraData(spellEffectExtraData);
|
init.SetSpellEffectExtraData(spellEffectExtraData);
|
||||||
};
|
};
|
||||||
@@ -813,7 +814,7 @@ namespace Game.Movement
|
|||||||
Add(movement);
|
Add(movement);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MoveJumpWithGravity(Position pos, float speedXY, float gravity, uint id = EventId.Jump, object facing = null, JumpArrivalCastArgs arrivalCast = null, SpellEffectExtraData spellEffectExtraData = null, ActionResultSetter<MovementStopReason> scriptResult = null)
|
public void MoveJumpWithGravity(Position pos, float speedXY, float gravity, uint id = EventId.Jump, object facing = null, bool orientationFixed = false, JumpArrivalCastArgs arrivalCast = null, SpellEffectExtraData spellEffectExtraData = null, ActionResultSetter<MovementStopReason> scriptResult = null)
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Movement, $"MotionMaster.MoveJumpWithGravity: '{_owner.GetGUID()}', jumps to point Id: {id} ({pos})");
|
Log.outDebug(LogFilter.Movement, $"MotionMaster.MoveJumpWithGravity: '{_owner.GetGUID()}', jumps to point Id: {id} ({pos})");
|
||||||
if (speedXY < 0.01f)
|
if (speedXY < 0.01f)
|
||||||
@@ -831,6 +832,7 @@ namespace Game.Movement
|
|||||||
init.SetVelocity(speedXY);
|
init.SetVelocity(speedXY);
|
||||||
init.SetUnlimitedSpeed();
|
init.SetUnlimitedSpeed();
|
||||||
MoveSplineInitFacingVisitor(init, facing);
|
MoveSplineInitFacingVisitor(init, facing);
|
||||||
|
init.SetJumpOrientationFixed(orientationFixed);
|
||||||
if (spellEffectExtraData != null)
|
if (spellEffectExtraData != null)
|
||||||
init.SetSpellEffectExtraData(spellEffectExtraData);
|
init.SetSpellEffectExtraData(spellEffectExtraData);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ namespace Game.Movement
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!splineflags.HasFlag(MoveSplineFlagEnum.OrientationFixed | MoveSplineFlagEnum.Falling | MoveSplineFlagEnum.Unknown_0x8))
|
if (!splineflags.HasFlag(MoveSplineFlagEnum.OrientationFixed | MoveSplineFlagEnum.Falling | MoveSplineFlagEnum.JumpOrientationFixed))
|
||||||
{
|
{
|
||||||
Vector3 hermite;
|
Vector3 hermite;
|
||||||
spline.Evaluate_Derivative(point_Idx, u, out hermite);
|
spline.Evaluate_Derivative(point_Idx, u, out hermite);
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ namespace Game.Movement
|
|||||||
|
|
||||||
public void SetVelocity(float vel) { args.velocity = vel; args.HasVelocity = true; }
|
public void SetVelocity(float vel) { args.velocity = vel; args.HasVelocity = true; }
|
||||||
|
|
||||||
void SetBackward() { args.flags.SetUnsetFlag(MoveSplineFlagEnum.Backward); }
|
public void SetBackward() { args.flags.SetUnsetFlag(MoveSplineFlagEnum.Backward); }
|
||||||
|
|
||||||
public void SetTransportEnter() { args.flags.EnableTransportEnter(); }
|
public void SetTransportEnter() { args.flags.EnableTransportEnter(); }
|
||||||
|
|
||||||
@@ -282,6 +282,8 @@ namespace Game.Movement
|
|||||||
|
|
||||||
public void SetOrientationFixed(bool enable) { args.flags.SetUnsetFlag(MoveSplineFlagEnum.OrientationFixed, enable); }
|
public void SetOrientationFixed(bool enable) { args.flags.SetUnsetFlag(MoveSplineFlagEnum.OrientationFixed, enable); }
|
||||||
|
|
||||||
|
public void SetJumpOrientationFixed(bool enable) { args.flags.SetUnsetFlag(MoveSplineFlagEnum.JumpOrientationFixed, enable); }
|
||||||
|
|
||||||
public void SetSteering() { args.flags.EnableSteering(); }
|
public void SetSteering() { args.flags.EnableSteering(); }
|
||||||
|
|
||||||
public void SetUnlimitedSpeed() { args.flags.SetUnsetFlag(MoveSplineFlagEnum.UnlimitedSpeed, true); }
|
public void SetUnlimitedSpeed() { args.flags.SetUnsetFlag(MoveSplineFlagEnum.UnlimitedSpeed, true); }
|
||||||
|
|||||||
@@ -540,7 +540,7 @@ namespace Game.Spells
|
|||||||
JumpArrivalCastArgs arrivalCast = new();
|
JumpArrivalCastArgs arrivalCast = new();
|
||||||
arrivalCast.SpellId = effectInfo.TriggerSpell;
|
arrivalCast.SpellId = effectInfo.TriggerSpell;
|
||||||
arrivalCast.Target = unitTarget.GetGUID();
|
arrivalCast.Target = unitTarget.GetGUID();
|
||||||
unitCaster.GetMotionMaster().MoveJump(unitTarget, speedXY, speedZ, EventId.Jump, facing, arrivalCast);
|
unitCaster.GetMotionMaster().MoveJump(unitTarget, speedXY, speedZ, EventId.Jump, facing, false, arrivalCast);
|
||||||
}
|
}
|
||||||
|
|
||||||
[SpellEffectHandler(SpellEffectName.JumpDest)]
|
[SpellEffectHandler(SpellEffectName.JumpDest)]
|
||||||
@@ -571,7 +571,7 @@ namespace Game.Spells
|
|||||||
|
|
||||||
JumpArrivalCastArgs arrivalCast = new();
|
JumpArrivalCastArgs arrivalCast = new();
|
||||||
arrivalCast.SpellId = effectInfo.TriggerSpell;
|
arrivalCast.SpellId = effectInfo.TriggerSpell;
|
||||||
unitCaster.GetMotionMaster().MoveJump(destTarget, speedXY, speedZ, EventId.Jump, facing, arrivalCast);
|
unitCaster.GetMotionMaster().MoveJump(destTarget, speedXY, speedZ, EventId.Jump, facing, false, arrivalCast);
|
||||||
}
|
}
|
||||||
|
|
||||||
TeleportToOptions GetTeleportOptions(WorldObject caster, Unit unitTarget, SpellDestination targetDest)
|
TeleportToOptions GetTeleportOptions(WorldObject caster, Unit unitTarget, SpellDestination targetDest)
|
||||||
@@ -5604,7 +5604,7 @@ namespace Game.Spells
|
|||||||
effectExtra.ParabolicCurveId = jumpParams.ParabolicCurveId.Value;
|
effectExtra.ParabolicCurveId = jumpParams.ParabolicCurveId.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
unitCaster.GetMotionMaster().MoveJumpWithGravity(destTarget, speed, jumpParams.JumpGravity, EventId.Jump, facing, arrivalCast, effectExtra);
|
unitCaster.GetMotionMaster().MoveJumpWithGravity(destTarget, speed, jumpParams.JumpGravity, EventId.Jump, facing, false, arrivalCast, effectExtra);
|
||||||
}
|
}
|
||||||
|
|
||||||
[SpellEffectHandler(SpellEffectName.LearnTransmogSet)]
|
[SpellEffectHandler(SpellEffectName.LearnTransmogSet)]
|
||||||
|
|||||||
Reference in New Issue
Block a user