Core/Movement: Allow passing tier transition id (db2 id) to land/takeoff movement
Port From (https://github.com/TrinityCore/TrinityCore/commit/8bf3bc071ba0de9405f9e573541251d5fcd63cf3)
This commit is contained in:
@@ -632,12 +632,24 @@ namespace Game.Movement
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveLand(uint id, Position pos, float? velocity = null)
|
||||
public void MoveLand(uint id, Position pos, uint? tierTransitionId = null, float? velocity = null, MovementWalkRunSpeedSelectionMode speedSelectionMode = MovementWalkRunSpeedSelectionMode.Default)
|
||||
{
|
||||
var initializer = (MoveSplineInit init) =>
|
||||
{
|
||||
init.MoveTo(pos, false);
|
||||
init.SetAnimation(AnimTier.Ground);
|
||||
init.SetAnimation(AnimTier.Ground, tierTransitionId.GetValueOrDefault(0));
|
||||
switch (speedSelectionMode)
|
||||
{
|
||||
case MovementWalkRunSpeedSelectionMode.ForceRun:
|
||||
init.SetWalk(false);
|
||||
break;
|
||||
case MovementWalkRunSpeedSelectionMode.ForceWalk:
|
||||
init.SetWalk(true);
|
||||
break;
|
||||
case MovementWalkRunSpeedSelectionMode.Default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (velocity.HasValue)
|
||||
init.SetVelocity(velocity.Value);
|
||||
};
|
||||
@@ -645,12 +657,24 @@ namespace Game.Movement
|
||||
Add(new GenericMovementGenerator(initializer, MovementGeneratorType.Effect, id));
|
||||
}
|
||||
|
||||
public void MoveTakeoff(uint id, Position pos, float? velocity = null)
|
||||
public void MoveTakeoff(uint id, Position pos, uint? tierTransitionId = null, float? velocity = null, MovementWalkRunSpeedSelectionMode speedSelectionMode = MovementWalkRunSpeedSelectionMode.Default)
|
||||
{
|
||||
var initializer = (MoveSplineInit init) =>
|
||||
{
|
||||
init.MoveTo(pos, false);
|
||||
init.SetAnimation(AnimTier.Hover);
|
||||
init.SetAnimation(AnimTier.Hover, tierTransitionId.GetValueOrDefault(0));
|
||||
switch (speedSelectionMode)
|
||||
{
|
||||
case MovementWalkRunSpeedSelectionMode.ForceRun:
|
||||
init.SetWalk(false);
|
||||
break;
|
||||
case MovementWalkRunSpeedSelectionMode.ForceWalk:
|
||||
init.SetWalk(true);
|
||||
break;
|
||||
case MovementWalkRunSpeedSelectionMode.Default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (velocity.HasValue)
|
||||
init.SetVelocity(velocity.Value);
|
||||
};
|
||||
|
||||
@@ -55,12 +55,16 @@ namespace Game.Movement
|
||||
// spline initialized, duration known and i able to compute parabolic acceleration
|
||||
if (args.flags.HasFlag(SplineFlag.Parabolic | SplineFlag.Animation | SplineFlag.FadeObject))
|
||||
{
|
||||
effect_start_time = (int)(Duration() * args.time_perc);
|
||||
if (args.flags.HasFlag(SplineFlag.Parabolic) && effect_start_time < Duration())
|
||||
int spline_duration = Duration();
|
||||
effect_start_time = (int)(spline_duration * args.effect_start_time_percent + args.effect_start_time.TotalMilliseconds);
|
||||
if (effect_start_time > spline_duration)
|
||||
effect_start_time = spline_duration;
|
||||
|
||||
if (args.flags.HasFlag(SplineFlag.Parabolic) && effect_start_time < spline_duration)
|
||||
{
|
||||
if (args.parabolic_amplitude != 0.0f)
|
||||
{
|
||||
float f_duration = MSToSec((uint)(Duration() - effect_start_time));
|
||||
float f_duration = MSToSec((uint)(spline_duration - effect_start_time));
|
||||
vertical_acceleration = args.parabolic_amplitude * 8.0f / (f_duration * f_duration);
|
||||
}
|
||||
else if (args.vertical_acceleration != 0.0f)
|
||||
|
||||
@@ -300,7 +300,7 @@ namespace Game.Movement
|
||||
|
||||
public void SetParabolic(float amplitude, float time_shift)
|
||||
{
|
||||
args.time_perc = time_shift;
|
||||
args.effect_start_time_percent = time_shift;
|
||||
args.parabolic_amplitude = amplitude;
|
||||
args.vertical_acceleration = 0.0f;
|
||||
args.flags.EnableParabolic();
|
||||
@@ -308,16 +308,18 @@ namespace Game.Movement
|
||||
|
||||
public void SetParabolicVerticalAcceleration(float vertical_acceleration, float time_shift)
|
||||
{
|
||||
args.time_perc = time_shift;
|
||||
args.effect_start_time_percent = time_shift;
|
||||
args.parabolic_amplitude = 0.0f;
|
||||
args.vertical_acceleration = vertical_acceleration;
|
||||
args.flags.EnableParabolic();
|
||||
}
|
||||
|
||||
public void SetAnimation(AnimTier anim)
|
||||
public void SetAnimation(AnimTier anim, uint tierTransitionId = 0, TimeSpan transitionStartTime = default)
|
||||
{
|
||||
args.time_perc = 0.0f;
|
||||
args.effect_start_time_percent = 0.0f;
|
||||
args.effect_start_time = transitionStartTime;
|
||||
args.animTier = new();
|
||||
args.animTier.TierTransitionId = tierTransitionId;
|
||||
args.animTier.AnimTier = (byte)anim;
|
||||
args.flags.EnableAnimation();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Framework.Dynamic;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Game.Movement
|
||||
path_Idx_offset = 0;
|
||||
velocity = 0.0f;
|
||||
parabolic_amplitude = 0.0f;
|
||||
time_perc = 0.0f;
|
||||
effect_start_time_percent = 0.0f;
|
||||
splineId = 0;
|
||||
initialOrientation = 0.0f;
|
||||
HasVelocity = false;
|
||||
@@ -30,7 +30,8 @@ namespace Game.Movement
|
||||
public float velocity;
|
||||
public float parabolic_amplitude;
|
||||
public float vertical_acceleration;
|
||||
public float time_perc;
|
||||
public float effect_start_time_percent; // fraction of total spline duration
|
||||
public TimeSpan effect_start_time; // absolute value
|
||||
public uint splineId;
|
||||
public float initialOrientation;
|
||||
public SpellEffectExtraData spellEffectExtra;
|
||||
@@ -59,7 +60,7 @@ namespace Game.Movement
|
||||
return false;
|
||||
if (!CHECK(velocity >= 0.01f, true))
|
||||
return false;
|
||||
if (!CHECK(time_perc >= 0.0f && time_perc <= 1.0f, true))
|
||||
if (!CHECK(effect_start_time_percent >= 0.0f && effect_start_time_percent <= 1.0f, true))
|
||||
return false;
|
||||
if (!CHECK(_checkPathLengths(), false))
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user