Adds models for the random bitsbyte data received in packet 13 - player update

This commit is contained in:
Chris 2020-05-18 14:42:29 +09:30
parent 51fadf406f
commit db84a9fc8f
7 changed files with 360 additions and 34 deletions

View file

@ -0,0 +1,88 @@
using Terraria;
namespace TShockAPI.Models.PlayerUpdate
{
/// <summary>
/// Model for a control event sent with a player update packet
/// </summary>
public struct ControlSet
{
/// <summary>
/// Backing BitsByte field
/// </summary>
public BitsByte bitsbyte;
/// <summary>
/// Gets or Sets the Up flag on the backing field
/// </summary>
public bool MoveUp
{
get => bitsbyte[0];
set => bitsbyte[0] = value;
}
/// <summary>
/// Gets or Sets the Down flag on the backing field
/// </summary>
public bool MoveDown
{
get => bitsbyte[1];
set => bitsbyte[1] = value;
}
/// <summary>
/// Gets or Sets the Left flag on the backing field
/// </summary>
public bool MoveLeft
{
get => bitsbyte[2];
set => bitsbyte[2] = value;
}
/// <summary>
/// Gets or Sets the Right flag on the backing field
/// </summary>
public bool MoveRight
{
get => bitsbyte[3];
set => bitsbyte[3] = value;
}
/// <summary>
/// Gets or Sets the Jump flag on the backing field
/// </summary>
public bool Jump
{
get => bitsbyte[4];
set => bitsbyte[4] = value;
}
/// <summary>
/// Gets or Sets the ControlUseItem flag on the backing field
/// </summary>
public bool IsUsingItem
{
get => bitsbyte[5];
set => bitsbyte[5] = value;
}
/// <summary>
/// Gets or Sets the Direction flag on the backing field. True = 1, false = -1
/// </summary>
public bool FaceDirection
{
get => bitsbyte[6];
set => bitsbyte[6] = value;
}
/// <summary>
/// Constructs a new instance of ControlsModel with the given backing bitsbyte
/// </summary>
/// <param name="bitsbyte"></param>
public ControlSet(BitsByte bitsbyte)
{
this.bitsbyte = bitsbyte;
}
}
}

View file

@ -0,0 +1,87 @@
using Terraria;
namespace TShockAPI.Models.PlayerUpdate
{
/// <summary>
/// Model for the first set of misc data sent with a player update packet
/// </summary>
public struct MiscDataSet1
{
/// <summary>
/// Backing BitsByte field
/// </summary>
public BitsByte bitsbyte;
/// <summary>
/// Gets or Sets the Pulley flag on the backing field
/// </summary>
public bool IsUsingPulley
{
get => bitsbyte[0];
set => bitsbyte[0] = value;
}
/// <summary>
/// Gets or Sets the Pulley Direction flag on the backing field. True = 2, false = 1
/// </summary>
public bool PulleyDirection
{
get => bitsbyte[1];
set => bitsbyte[1] = value;
}
/// <summary>
/// Gets or Sets the Velocity > 0 flag on the backing field
/// </summary>
public bool HasVelocity
{
get => bitsbyte[2];
set => bitsbyte[2] = value;
}
/// <summary>
/// Gets or Sets the Vortex Stealth flag on the backing field
/// </summary>
public bool IsVortexStealthActive
{
get => bitsbyte[3];
set => bitsbyte[3] = value;
}
/// <summary>
/// Gets or Sets the Gravity Direction flag on the backing field. True = 1, False = -1
/// </summary>
public bool GravityDirection
{
get => bitsbyte[4];
set => bitsbyte[4] = value;
}
/// <summary>
/// Gets or Sets the Shield Raised flag on the backing field
/// </summary>
public bool IsShieldRaised
{
get => bitsbyte[5];
set => bitsbyte[5] = value;
}
/// <summary>
/// Gets or Sets the Ghost flag on the backing field
/// </summary>
public bool IsGhosted
{
get => bitsbyte[6];
set => bitsbyte[6] = value;
}
/// <summary>
/// Constructs a new instance of MiscDataSet1 with the given backing BitsByte
/// </summary>
/// <param name="bitsbyte"></param>
public MiscDataSet1(BitsByte bitsbyte)
{
this.bitsbyte = bitsbyte;
}
}
}

View file

@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
namespace TShockAPI.Models.PlayerUpdate
{
/// <summary>
/// Model for the second set of misc data sent with a player update packet
/// </summary>
public struct MiscDataSet2
{
/// <summary>
/// Backing BitsByte field
/// </summary>
public BitsByte bitsbyte;
/// <summary>
/// Gets or Sets the keepTryingHoverUp flag on the backing field
/// </summary>
public bool TryHoveringUp
{
get => bitsbyte[0];
set => bitsbyte[0] = value;
}
/// <summary>
/// Gets or Sets the Void Vault Enabled flag on the backing field
/// </summary>
public bool IsVoidVaultEnabled
{
get => bitsbyte[1];
set => bitsbyte[1] = value;
}
/// <summary>
/// Gets or Sets the Sitting flag on the backing field
/// </summary>
public bool IsSitting
{
get => bitsbyte[2];
set => bitsbyte[2] = value;
}
/// <summary>
/// Gets or Sets the Downed DD2 Event (any difficulty) flag on the backing field
/// </summary>
public bool HasDownedDd2Event
{
get => bitsbyte[3];
set => bitsbyte[3] = value;
}
/// <summary>
/// Gets or Sets the Petting Animal flag on the backing field
/// </summary>
public bool IsPettingAnimal
{
get => bitsbyte[4];
set => bitsbyte[4] = value;
}
/// <summary>
/// Gets or Sets the Is Petted Animal Small flag on the backing field
/// </summary>
public bool IsPettedAnimalSmall
{
get => bitsbyte[5];
set => bitsbyte[5] = value;
}
/// <summary>
/// Gets or Sets the Can Return with Potion of Return flag on the backing field
/// </summary>
public bool CanReturnWithPotionOfReturn
{
get => bitsbyte[6];
set => bitsbyte[6] = value;
}
/// <summary>
/// Gets or Sets the keepTryingHoverDown flag on the backing field
/// </summary>
public bool TryHoveringDown
{
get => bitsbyte[7];
set => bitsbyte[7] = value;
}
/// <summary>
/// Constructs a new instance of MiscDataSet2 with the given backing BitsByte
/// </summary>
/// <param name="bitsbyte"></param>
public MiscDataSet2(BitsByte bitsbyte)
{
this.bitsbyte = bitsbyte;
}
}
}

View file

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
namespace TShockAPI.Models.PlayerUpdate
{
/// <summary>
/// Model for the third set of misc data sent with a player update packet
/// </summary>
public struct MiscDataSet3
{
public BitsByte bitsbyte;
public bool IsSleeping
{
get => bitsbyte[0];
set => bitsbyte[0] = value;
}
/// <summary>
/// Constructs a new instance of MiscDataSet3 with the given backing BitsByte
/// </summary>
/// <param name="bitsbyte"></param>
public MiscDataSet3(BitsByte bitsbyte)
{
this.bitsbyte = bitsbyte;
}
}
}