ace/Source/ACE.Server/Network/Motion/MovementInvalid.cs
gmriggs 7622d272fd
Fixing jump in multiplayer, refactoring movement and animation systems for network and game layers (#1070)
* Fixing jump in multiplayer, refactoring movement and animation systems for network and game layers

* Fixing stamina dropping to 0 while running

* Fixing some monsters getting stuck if they wakeup during idle emote

* Reverting position

* Fixing magic aftercast speed
2018-10-23 00:16:53 -04:00

49 lines
1.5 KiB
C#

using System.IO;
using ACE.Entity;
using ACE.Entity.Enum;
using ACE.Server.Entity;
namespace ACE.Server.Network.Structure
{
public class MovementInvalid
{
public MovementData MovementData;
public InterpretedMotionState State; // set of movement / animation data
public ObjectGuid StickyObject; // choose valid sections by masking against MotionFlags: 0x1 - object to stick to
public MovementInvalid(MovementData movementData)
{
MovementData = movementData;
State = new InterpretedMotionState(movementData);
}
public MovementInvalid(MovementData movementData, Motion motion)
{
MovementData = movementData;
State = new InterpretedMotionState(movementData, motion);
if ((motion.MotionFlags & MotionFlags.StickToObject) != 0)
StickyObject = motion.TargetGuid;
}
public MovementInvalid(MovementData movementData, InterpretedMotionState state)
{
MovementData = movementData;
State = state;
state.BuildMovementFlags();
}
}
public static class MovementInvalidExtensions
{
public static void Write(this BinaryWriter writer, MovementInvalid movement)
{
writer.Write(movement.State);
if ((movement.MovementData.MotionFlags & MotionFlags.StickToObject) != 0)
writer.WriteGuid(movement.StickyObject);
}
}
}