//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
//------------------------------------------------------------------------------
//
// This source code was auto-generated by an XSL transformation.
// Do not change this file. Instead, change the XML data which contains
// the packet definitions and re-run the transformation (rebuild this project).
//
//------------------------------------------------------------------------------
namespace MUnique.OpenMU.Network.Packets.ServerToClient;
using System;
using static System.Buffers.Binary.BinaryPrimitives;
///
/// The structure for a stored item, e.g. in the inventory or vault..
///
public readonly ref struct StoredItemRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public StoredItemRef(Span data)
{
this._data = data;
}
///
/// Gets or sets the item slot.
///
public byte ItemSlot
{
get => this._data[0];
set => this._data[0] = value;
}
///
/// Gets or sets the item data.
///
public Span ItemData
{
get => this._data.Slice(1);
}
///
/// Calculates the size of the packet for the specified length of .
///
/// The length in bytes of on which the required size depends.
public static int GetRequiredSize(int itemDataLength) => itemDataLength + 1;
}
///
/// Data of an item in a player shop..
///
public readonly ref struct PlayerShopItemRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PlayerShopItemRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 20;
///
/// Gets or sets the item slot.
///
public byte ItemSlot
{
get => this._data[0];
set => this._data[0] = value;
}
///
/// Gets or sets the item data.
///
public Span ItemData
{
get => this._data.Slice(1, 12);
}
///
/// Gets or sets the price.
///
public uint Price
{
get => ReadUInt32LittleEndian(this._data[16..]);
set => WriteUInt32LittleEndian(this._data[16..], value);
}
}
///
/// Data of an item in a player shop, which allows for dynamic item sizes and trades for specific kind of items (e.g. jewels), too..
///
public readonly ref struct PlayerShopItemExtendedRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PlayerShopItemExtendedRef(Span data)
{
this._data = data;
}
///
/// Gets or sets the money price.
///
public uint MoneyPrice
{
get => ReadUInt32LittleEndian(this._data);
set => WriteUInt32LittleEndian(this._data, value);
}
///
/// Gets or sets contains the item group in the highest 4 bits, and the item number in the remaining ones.
///
public ushort PriceItemType
{
get => ReadUInt16LittleEndian(this._data[4..]);
set => WriteUInt16LittleEndian(this._data[4..], value);
}
///
/// Gets or sets the required item amount.
///
public ushort RequiredItemAmount
{
get => ReadUInt16LittleEndian(this._data[6..]);
set => WriteUInt16LittleEndian(this._data[6..], value);
}
///
/// Gets or sets the item slot.
///
public byte ItemSlot
{
get => this._data[8];
set => this._data[8] = value;
}
///
/// Gets or sets the item data.
///
public Span ItemData
{
get => this._data.Slice(9);
}
///
/// Calculates the size of the packet for the specified length of .
///
/// The length in bytes of on which the required size depends.
public static int GetRequiredSize(int itemDataLength) => itemDataLength + 9;
}
///
/// Defines the information which identifies a quest..
///
public readonly ref struct QuestIdentificationRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public QuestIdentificationRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 4;
///
/// Gets or sets the number.
///
public ushort Number
{
get => ReadUInt16LittleEndian(this._data);
set => WriteUInt16LittleEndian(this._data, value);
}
///
/// Gets or sets the group.
///
public ushort Group
{
get => ReadUInt16LittleEndian(this._data[2..]);
set => WriteUInt16LittleEndian(this._data[2..], value);
}
}
///
/// Defines a condition which must be fulfilled to complete the quest..
///
public readonly ref struct QuestConditionRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public QuestConditionRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 26;
///
/// Gets or sets the type.
///
public ConditionType Type
{
get => (ConditionType)this._data[0];
set => this._data[0] = (byte)value;
}
///
/// Gets or sets depending on the condition type, this field contains the identifier of the required thing, e.g. Monster Number, Item Id, Level.
///
public ushort RequirementId
{
get => ReadUInt16LittleEndian(this._data[4..]);
set => WriteUInt16LittleEndian(this._data[4..], value);
}
///
/// Gets or sets the required count.
///
public uint RequiredCount
{
get => ReadUInt32LittleEndian(this._data[6..]);
set => WriteUInt32LittleEndian(this._data[6..], value);
}
///
/// Gets or sets the current count.
///
public uint CurrentCount
{
get => ReadUInt32LittleEndian(this._data[10..]);
set => WriteUInt32LittleEndian(this._data[10..], value);
}
///
/// Gets or sets if the condition type is 'Item', this field contains the item data, excluding the item id. The item id can be found in the RequirementId field.
///
public Span RequiredItemData
{
get => this._data.Slice(14, 12);
}
}
///
/// Defines a reward which is given when the quest is completed..
///
public readonly ref struct QuestRewardRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public QuestRewardRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 22;
///
/// Gets or sets the type.
///
public RewardType Type
{
get => (RewardType)this._data[0];
set => this._data[0] = (byte)value;
}
///
/// Gets or sets depending on the condition type, this field contains the identifier of the required thing, e.g. Monster Number, Item Id, Level.
///
public ushort RewardId
{
get => ReadUInt16LittleEndian(this._data[4..]);
set => WriteUInt16LittleEndian(this._data[4..], value);
}
///
/// Gets or sets the reward count.
///
public uint RewardCount
{
get => ReadUInt32LittleEndian(this._data[6..]);
set => WriteUInt32LittleEndian(this._data[6..], value);
}
///
/// Gets or sets if the reward type is 'Item', this field contains its item data.
///
public Span RewardedItemData
{
get => this._data.Slice(10, 12);
}
}
///
/// Defines a condition which must be fulfilled to complete the quest..
///
public readonly ref struct QuestConditionExtendedRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public QuestConditionExtendedRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 28;
///
/// Gets or sets the type.
///
public ConditionType Type
{
get => (ConditionType)this._data[0];
set => this._data[0] = (byte)value;
}
///
/// Gets or sets depending on the condition type, this field contains the identifier of the required thing, e.g. Monster Number, Item Id, Level.
///
public ushort RequirementId
{
get => ReadUInt16LittleEndian(this._data[2..]);
set => WriteUInt16LittleEndian(this._data[2..], value);
}
///
/// Gets or sets the required count.
///
public uint RequiredCount
{
get => ReadUInt32LittleEndian(this._data[4..]);
set => WriteUInt32LittleEndian(this._data[4..], value);
}
///
/// Gets or sets the current count.
///
public uint CurrentCount
{
get => ReadUInt32LittleEndian(this._data[8..]);
set => WriteUInt32LittleEndian(this._data[8..], value);
}
///
/// Gets or sets if the condition type is 'Item', this field contains the item data, excluding the item id. The item id can be found in the RequirementId field.
///
public Span RequiredItemData
{
get => this._data.Slice(12, 15);
}
}
///
/// Defines a reward which is given when the quest is completed..
///
public readonly ref struct QuestRewardExtendedRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public QuestRewardExtendedRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 24;
///
/// Gets or sets the type.
///
public RewardType Type
{
get => (RewardType)this._data[0];
set => this._data[0] = (byte)value;
}
///
/// Gets or sets depending on the condition type, this field contains the identifier of the required thing, e.g. Monster Number, Item Id, Level.
///
public ushort RewardId
{
get => ReadUInt16LittleEndian(this._data[2..]);
set => WriteUInt16LittleEndian(this._data[2..], value);
}
///
/// Gets or sets the reward count.
///
public uint RewardCount
{
get => ReadUInt32LittleEndian(this._data[4..]);
set => WriteUInt32LittleEndian(this._data[4..], value);
}
///
/// Gets or sets if the reward type is 'Item', this field contains its item data.
///
public Span RewardedItemData
{
get => this._data.Slice(8, 15);
}
}
///
/// Is sent by the server when: After a game client has connected to the game.
/// Causes reaction on client side: It shows the login dialog.
///
public readonly ref struct GameServerEnteredRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public GameServerEnteredRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private GameServerEnteredRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
header.SubCode = SubCode;
this.Success = true;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0xF1;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x00;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 12;
///
/// Gets the header of this packet.
///
public C1HeaderWithSubCodeRef Header => new (this._data);
///
/// Gets or sets the success.
///
public bool Success
{
get => this._data[4..].GetBoolean();
set => this._data[4..].SetBoolean(value);
}
///
/// Gets or sets the player id.
///
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data[5..]);
set => WriteUInt16BigEndian(this._data[5..], value);
}
///
/// Gets or sets the version string.
///
public string VersionString
{
get => this._data.ExtractString(7, 5, System.Text.Encoding.UTF8);
set => this._data.Slice(7, 5).WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Gets or sets the version.
///
public Span Version
{
get => this._data.Slice(7, 5);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator GameServerEnteredRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(GameServerEnteredRef packet) => packet._data;
}
///
/// Is sent by the server when: A magic effect was added or removed to the own or another player.
/// Causes reaction on client side: The user interface updates itself. If it's the effect of the own player, it's shown as icon at the top of the interface.
///
public readonly ref struct MagicEffectStatusRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public MagicEffectStatusRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private MagicEffectStatusRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x07;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 7;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the is active.
///
public bool IsActive
{
get => this._data[3..].GetBoolean();
set => this._data[3..].SetBoolean(value);
}
///
/// Gets or sets the player id.
///
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data[4..]);
set => WriteUInt16BigEndian(this._data[4..], value);
}
///
/// Gets or sets the effect id.
///
public byte EffectId
{
get => this._data[6];
set => this._data[6] = value;
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator MagicEffectStatusRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(MagicEffectStatusRef packet) => packet._data;
}
///
/// Is sent by the server when: The weather on the current map has been changed or the player entered the map.
/// Causes reaction on client side: The game client updates the weather effects.
///
public readonly ref struct WeatherStatusUpdateRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public WeatherStatusUpdateRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private WeatherStatusUpdateRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x0F;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 4;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets a random value between 0 and 2 (inclusive).
///
public byte Weather
{
get => this._data[3..].GetByteValue(4, 4);
set => this._data[3..].SetByteValue(value, 4, 4);
}
///
/// Gets or sets a random value between 0 and 9 (inclusive).
///
public byte Variation
{
get => this._data[3..].GetByteValue(4, 0);
set => this._data[3..].SetByteValue(value, 4, 0);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator WeatherStatusUpdateRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(WeatherStatusUpdateRef packet) => packet._data;
}
///
/// Is sent by the server when: One or more character got into the observed scope of the player.
/// Causes reaction on client side: The client adds the character to the shown map.
///
public readonly ref struct AddCharacterToScopeExtendedRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public AddCharacterToScopeExtendedRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private AddCharacterToScopeExtendedRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (ushort)data.Length;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC2;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x12;
///
/// Gets the header of this packet.
///
public C2HeaderRef Header => new (this._data);
///
/// Gets or sets the id.
///
public ushort Id
{
get => ReadUInt16LittleEndian(this._data[4..]);
set => WriteUInt16LittleEndian(this._data[4..], value);
}
///
/// Gets or sets the current position x.
///
public byte CurrentPositionX
{
get => this._data[6];
set => this._data[6] = value;
}
///
/// Gets or sets the current position y.
///
public byte CurrentPositionY
{
get => this._data[7];
set => this._data[7] = value;
}
///
/// Gets or sets the target position x.
///
public byte TargetPositionX
{
get => this._data[8];
set => this._data[8] = value;
}
///
/// Gets or sets the target position y.
///
public byte TargetPositionY
{
get => this._data[9];
set => this._data[9] = value;
}
///
/// Gets or sets the rotation.
///
public byte Rotation
{
get => this._data[10..].GetByteValue(4, 4);
set => this._data[10..].SetByteValue(value, 4, 4);
}
///
/// Gets or sets the hero state.
///
public CharacterHeroState HeroState
{
get => (CharacterHeroState)this._data[10..].GetByteValue(4, 0);
set => this._data[10..].SetByteValue((byte)value, 4, 0);
}
///
/// Gets or sets the attack speed.
///
public ushort AttackSpeed
{
get => ReadUInt16LittleEndian(this._data[12..]);
set => WriteUInt16LittleEndian(this._data[12..], value);
}
///
/// Gets or sets the magic speed.
///
public ushort MagicSpeed
{
get => ReadUInt16LittleEndian(this._data[14..]);
set => WriteUInt16LittleEndian(this._data[14..], value);
}
///
/// Gets or sets the name.
///
public string Name
{
get => this._data.ExtractString(16, 10, System.Text.Encoding.UTF8);
set => this._data.Slice(16, 10).WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Gets or sets the appearance and effects.
///
public Span AppearanceAndEffects
{
get => this._data.Slice(26);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator AddCharacterToScopeExtendedRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(AddCharacterToScopeExtendedRef packet) => packet._data;
///
/// Calculates the size of the packet for the specified length of .
///
/// The length in bytes of on which the required size depends.
public static int GetRequiredSize(int appearanceAndEffectsLength) => appearanceAndEffectsLength + 26;
}
///
/// Is sent by the server when: One or more character got into the observed scope of the player.
/// Causes reaction on client side: The client adds the character to the shown map.
///
public readonly ref partial struct AddCharactersToScopeRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public AddCharactersToScopeRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private AddCharactersToScopeRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (ushort)data.Length;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC2;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x12;
///
/// Gets the header of this packet.
///
public C2HeaderRef Header => new (this._data);
///
/// Gets or sets the character count.
///
public byte CharacterCount
{
get => this._data[4];
set => this._data[4] = value;
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator AddCharactersToScopeRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(AddCharactersToScopeRef packet) => packet._data;
///
/// Calculates the size of the packet for the specified count of and it's size.
///
/// The count of from which the size will be calculated.
/// The length of from which the size will be calculated.
public static int GetRequiredSize(int charactersCount, int structLength) => charactersCount * structLength + 5;
///
/// Contains the data of an NPC..
///
public readonly ref struct CharacterDataRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CharacterDataRef(Span data)
{
this._data = data;
}
///
/// Gets or sets the id.
///
public ushort Id
{
get => ReadUInt16BigEndian(this._data);
set => WriteUInt16BigEndian(this._data, value);
}
///
/// Gets or sets the current position x.
///
public byte CurrentPositionX
{
get => this._data[2];
set => this._data[2] = value;
}
///
/// Gets or sets the current position y.
///
public byte CurrentPositionY
{
get => this._data[3];
set => this._data[3] = value;
}
///
/// Gets or sets the appearance.
///
public Span Appearance
{
get => this._data.Slice(4, 18);
}
///
/// Gets or sets the name.
///
public string Name
{
get => this._data.ExtractString(22, 10, System.Text.Encoding.UTF8);
set => this._data.Slice(22, 10).WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Gets or sets the target position x.
///
public byte TargetPositionX
{
get => this._data[32];
set => this._data[32] = value;
}
///
/// Gets or sets the target position y.
///
public byte TargetPositionY
{
get => this._data[33];
set => this._data[33] = value;
}
///
/// Gets or sets the rotation.
///
public byte Rotation
{
get => this._data[34..].GetByteValue(4, 4);
set => this._data[34..].SetByteValue(value, 4, 4);
}
///
/// Gets or sets the hero state.
///
public CharacterHeroState HeroState
{
get => (CharacterHeroState)this._data[34..].GetByteValue(4, 0);
set => this._data[34..].SetByteValue((byte)value, 4, 0);
}
///
/// Gets or sets defines the number of effects which would be sent after this field.
///
public byte EffectCount
{
get => this._data[35];
set => this._data[35] = value;
}
///
/// Gets the of the specified index.
///
public EffectIdRef this[int index] => new (this._data[(36 + index * EffectIdRef.Length)..]);
///
/// Calculates the size of the packet for the specified count of .
///
/// The count of from which the size will be calculated.
public static int GetRequiredSize(int effectsCount) => effectsCount * EffectIdRef.Length + 36;
}
///
/// Contains the id of a magic effect..
///
public readonly ref struct EffectIdRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public EffectIdRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 1;
///
/// Gets or sets the id.
///
public byte Id
{
get => this._data[0];
set => this._data[0] = value;
}
}
}
///
/// Is sent by the server when: One or more character got into the observed scope of the player.
/// Causes reaction on client side: The client adds the character to the shown map.
///
public readonly ref struct AddCharactersToScope075Ref
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public AddCharactersToScope075Ref(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private AddCharactersToScope075Ref(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (ushort)data.Length;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC2;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x12;
///
/// Gets the header of this packet.
///
public C2HeaderRef Header => new (this._data);
///
/// Gets or sets the character count.
///
public byte CharacterCount
{
get => this._data[4];
set => this._data[4] = value;
}
///
/// Gets the of the specified index.
///
public CharacterDataRef this[int index] => new (this._data[(5 + index * CharacterDataRef.Length)..]);
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator AddCharactersToScope075Ref(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(AddCharactersToScope075Ref packet) => packet._data;
///
/// Calculates the size of the packet for the specified count of .
///
/// The count of from which the size will be calculated.
public static int GetRequiredSize(int charactersCount) => charactersCount * CharacterDataRef.Length + 5;
///
/// Contains the data of an NPC..
///
public readonly ref struct CharacterDataRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CharacterDataRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 27;
///
/// Gets or sets the id.
///
public ushort Id
{
get => ReadUInt16BigEndian(this._data);
set => WriteUInt16BigEndian(this._data, value);
}
///
/// Gets or sets the current position x.
///
public byte CurrentPositionX
{
get => this._data[2];
set => this._data[2] = value;
}
///
/// Gets or sets the current position y.
///
public byte CurrentPositionY
{
get => this._data[3];
set => this._data[3] = value;
}
///
/// Gets or sets the appearance.
///
public Span Appearance
{
get => this._data.Slice(4, 9);
}
///
/// Gets or sets the is poisoned.
///
public bool IsPoisoned
{
get => this._data[13..].GetBoolean(0);
set => this._data[13..].SetBoolean(value, 0);
}
///
/// Gets or sets the is iced.
///
public bool IsIced
{
get => this._data[13..].GetBoolean(1);
set => this._data[13..].SetBoolean(value, 1);
}
///
/// Gets or sets the is damage buffed.
///
public bool IsDamageBuffed
{
get => this._data[13..].GetBoolean(2);
set => this._data[13..].SetBoolean(value, 2);
}
///
/// Gets or sets the is defense buffed.
///
public bool IsDefenseBuffed
{
get => this._data[13..].GetBoolean(3);
set => this._data[13..].SetBoolean(value, 3);
}
///
/// Gets or sets the name.
///
public string Name
{
get => this._data.ExtractString(14, 10, System.Text.Encoding.UTF8);
set => this._data.Slice(14, 10).WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Gets or sets the target position x.
///
public byte TargetPositionX
{
get => this._data[24];
set => this._data[24] = value;
}
///
/// Gets or sets the target position y.
///
public byte TargetPositionY
{
get => this._data[25];
set => this._data[25] = value;
}
///
/// Gets or sets the rotation.
///
public byte Rotation
{
get => this._data[26..].GetByteValue(4, 4);
set => this._data[26..].SetByteValue(value, 4, 4);
}
///
/// Gets or sets the hero state.
///
public CharacterHeroState HeroState
{
get => (CharacterHeroState)this._data[26..].GetByteValue(4, 0);
set => this._data[26..].SetByteValue((byte)value, 4, 0);
}
}
}
///
/// Is sent by the server when: One or more character got into the observed scope of the player.
/// Causes reaction on client side: The client adds the character to the shown map.
///
public readonly ref struct AddCharactersToScope095Ref
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public AddCharactersToScope095Ref(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private AddCharactersToScope095Ref(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (ushort)data.Length;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC2;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x12;
///
/// Gets the header of this packet.
///
public C2HeaderRef Header => new (this._data);
///
/// Gets or sets the character count.
///
public byte CharacterCount
{
get => this._data[4];
set => this._data[4] = value;
}
///
/// Gets the of the specified index.
///
public CharacterDataRef this[int index] => new (this._data[(5 + index * CharacterDataRef.Length)..]);
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator AddCharactersToScope095Ref(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(AddCharactersToScope095Ref packet) => packet._data;
///
/// Calculates the size of the packet for the specified count of .
///
/// The count of from which the size will be calculated.
public static int GetRequiredSize(int charactersCount) => charactersCount * CharacterDataRef.Length + 5;
///
/// Contains the data of an NPC..
///
public readonly ref struct CharacterDataRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CharacterDataRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 31;
///
/// Gets or sets the id.
///
public ushort Id
{
get => ReadUInt16BigEndian(this._data);
set => WriteUInt16BigEndian(this._data, value);
}
///
/// Gets or sets the current position x.
///
public byte CurrentPositionX
{
get => this._data[2];
set => this._data[2] = value;
}
///
/// Gets or sets the current position y.
///
public byte CurrentPositionY
{
get => this._data[3];
set => this._data[3] = value;
}
///
/// Gets or sets the appearance.
///
public Span Appearance
{
get => this._data.Slice(4, 13);
}
///
/// Gets or sets the is poisoned.
///
public bool IsPoisoned
{
get => this._data[17..].GetBoolean(0);
set => this._data[17..].SetBoolean(value, 0);
}
///
/// Gets or sets the is iced.
///
public bool IsIced
{
get => this._data[17..].GetBoolean(1);
set => this._data[17..].SetBoolean(value, 1);
}
///
/// Gets or sets the is damage buffed.
///
public bool IsDamageBuffed
{
get => this._data[17..].GetBoolean(2);
set => this._data[17..].SetBoolean(value, 2);
}
///
/// Gets or sets the is defense buffed.
///
public bool IsDefenseBuffed
{
get => this._data[17..].GetBoolean(3);
set => this._data[17..].SetBoolean(value, 3);
}
///
/// Gets or sets the name.
///
public string Name
{
get => this._data.ExtractString(18, 10, System.Text.Encoding.UTF8);
set => this._data.Slice(18, 10).WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Gets or sets the target position x.
///
public byte TargetPositionX
{
get => this._data[28];
set => this._data[28] = value;
}
///
/// Gets or sets the target position y.
///
public byte TargetPositionY
{
get => this._data[29];
set => this._data[29] = value;
}
///
/// Gets or sets the rotation.
///
public byte Rotation
{
get => this._data[30..].GetByteValue(4, 4);
set => this._data[30..].SetByteValue(value, 4, 4);
}
///
/// Gets or sets the hero state.
///
public CharacterHeroState HeroState
{
get => (CharacterHeroState)this._data[30..].GetByteValue(4, 0);
set => this._data[30..].SetByteValue((byte)value, 4, 0);
}
}
}
///
/// Is sent by the server when: One or more NPCs got into the observed scope of the player.
/// Causes reaction on client side: The client adds the NPCs to the shown map.
///
public readonly ref struct AddNpcsToScopeRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public AddNpcsToScopeRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private AddNpcsToScopeRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (ushort)data.Length;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC2;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x13;
///
/// Gets the header of this packet.
///
public C2HeaderRef Header => new (this._data);
///
/// Gets or sets the npc count.
///
public byte NpcCount
{
get => this._data[4];
set => this._data[4] = value;
}
///
/// Gets the of the specified index.
///
public NpcDataRef this[int index] => new (this._data[(5 + index * NpcDataRef.Length)..]);
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator AddNpcsToScopeRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(AddNpcsToScopeRef packet) => packet._data;
///
/// Calculates the size of the packet for the specified count of .
///
/// The count of from which the size will be calculated.
public static int GetRequiredSize(int nPCsCount) => nPCsCount * NpcDataRef.Length + 5;
///
/// Contains the data of an NPC..
///
public readonly ref struct NpcDataRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public NpcDataRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 10;
///
/// Gets or sets the id.
///
public ushort Id
{
get => ReadUInt16BigEndian(this._data);
set => WriteUInt16BigEndian(this._data, value);
}
///
/// Gets or sets the type number.
///
public ushort TypeNumber
{
get => ReadUInt16BigEndian(this._data[2..]);
set => WriteUInt16BigEndian(this._data[2..], value);
}
///
/// Gets or sets the current position x.
///
public byte CurrentPositionX
{
get => this._data[4];
set => this._data[4] = value;
}
///
/// Gets or sets the current position y.
///
public byte CurrentPositionY
{
get => this._data[5];
set => this._data[5] = value;
}
///
/// Gets or sets the target position x.
///
public byte TargetPositionX
{
get => this._data[6];
set => this._data[6] = value;
}
///
/// Gets or sets the target position y.
///
public byte TargetPositionY
{
get => this._data[7];
set => this._data[7] = value;
}
///
/// Gets or sets the rotation.
///
public byte Rotation
{
get => this._data[8..].GetByteValue(4, 4);
set => this._data[8..].SetByteValue(value, 4, 4);
}
///
/// Gets or sets defines the number of effects which would be sent after this field. This is currently not supported.
///
public byte EffectCount
{
get => this._data[9];
set => this._data[9] = value;
}
}
}
///
/// Is sent by the server when: One or more NPCs got into the observed scope of the player.
/// Causes reaction on client side: The client adds the NPCs to the shown map.
///
public readonly ref struct AddNpcsToScope075Ref
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public AddNpcsToScope075Ref(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private AddNpcsToScope075Ref(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (ushort)data.Length;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC2;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x13;
///
/// Gets the header of this packet.
///
public C2HeaderRef Header => new (this._data);
///
/// Gets or sets the npc count.
///
public byte NpcCount
{
get => this._data[4];
set => this._data[4] = value;
}
///
/// Gets the of the specified index.
///
public NpcDataRef this[int index] => new (this._data[(5 + index * NpcDataRef.Length)..]);
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator AddNpcsToScope075Ref(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(AddNpcsToScope075Ref packet) => packet._data;
///
/// Calculates the size of the packet for the specified count of .
///
/// The count of from which the size will be calculated.
public static int GetRequiredSize(int nPCsCount) => nPCsCount * NpcDataRef.Length + 5;
///
/// Contains the data of an NPC..
///
public readonly ref struct NpcDataRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public NpcDataRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 9;
///
/// Gets or sets the id.
///
public ushort Id
{
get => ReadUInt16BigEndian(this._data);
set => WriteUInt16BigEndian(this._data, value);
}
///
/// Gets or sets the type number.
///
public byte TypeNumber
{
get => this._data[2];
set => this._data[2] = value;
}
///
/// Gets or sets the is poisoned.
///
public bool IsPoisoned
{
get => this._data[3..].GetBoolean(0);
set => this._data[3..].SetBoolean(value, 0);
}
///
/// Gets or sets the is iced.
///
public bool IsIced
{
get => this._data[3..].GetBoolean(1);
set => this._data[3..].SetBoolean(value, 1);
}
///
/// Gets or sets the is damage buffed.
///
public bool IsDamageBuffed
{
get => this._data[3..].GetBoolean(2);
set => this._data[3..].SetBoolean(value, 2);
}
///
/// Gets or sets the is defense buffed.
///
public bool IsDefenseBuffed
{
get => this._data[3..].GetBoolean(3);
set => this._data[3..].SetBoolean(value, 3);
}
///
/// Gets or sets the current position x.
///
public byte CurrentPositionX
{
get => this._data[4];
set => this._data[4] = value;
}
///
/// Gets or sets the current position y.
///
public byte CurrentPositionY
{
get => this._data[5];
set => this._data[5] = value;
}
///
/// Gets or sets the target position x.
///
public byte TargetPositionX
{
get => this._data[6];
set => this._data[6] = value;
}
///
/// Gets or sets the target position y.
///
public byte TargetPositionY
{
get => this._data[7];
set => this._data[7] = value;
}
///
/// Gets or sets the rotation.
///
public byte Rotation
{
get => this._data[8..].GetByteValue(4, 4);
set => this._data[8..].SetByteValue(value, 4, 4);
}
}
}
///
/// Is sent by the server when: One or more NPCs got into the observed scope of the player.
/// Causes reaction on client side: The client adds the NPCs to the shown map.
///
public readonly ref struct AddNpcsToScope095Ref
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public AddNpcsToScope095Ref(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private AddNpcsToScope095Ref(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (ushort)data.Length;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC2;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x13;
///
/// Gets the header of this packet.
///
public C2HeaderRef Header => new (this._data);
///
/// Gets or sets the npc count.
///
public byte NpcCount
{
get => this._data[4];
set => this._data[4] = value;
}
///
/// Gets the of the specified index.
///
public NpcDataRef this[int index] => new (this._data[(5 + index * NpcDataRef.Length)..]);
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator AddNpcsToScope095Ref(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(AddNpcsToScope095Ref packet) => packet._data;
///
/// Calculates the size of the packet for the specified count of .
///
/// The count of from which the size will be calculated.
public static int GetRequiredSize(int nPCsCount) => nPCsCount * NpcDataRef.Length + 5;
///
/// Contains the data of an NPC..
///
public readonly ref struct NpcDataRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public NpcDataRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 12;
///
/// Gets or sets the id.
///
public ushort Id
{
get => ReadUInt16BigEndian(this._data);
set => WriteUInt16BigEndian(this._data, value);
}
///
/// Gets or sets the type number.
///
public byte TypeNumber
{
get => this._data[2];
set => this._data[2] = value;
}
///
/// Gets or sets the is poisoned.
///
public bool IsPoisoned
{
get => this._data[4..].GetBoolean(0);
set => this._data[4..].SetBoolean(value, 0);
}
///
/// Gets or sets the is iced.
///
public bool IsIced
{
get => this._data[4..].GetBoolean(1);
set => this._data[4..].SetBoolean(value, 1);
}
///
/// Gets or sets the is damage buffed.
///
public bool IsDamageBuffed
{
get => this._data[4..].GetBoolean(2);
set => this._data[4..].SetBoolean(value, 2);
}
///
/// Gets or sets the is defense buffed.
///
public bool IsDefenseBuffed
{
get => this._data[4..].GetBoolean(3);
set => this._data[4..].SetBoolean(value, 3);
}
///
/// Gets or sets the current position x.
///
public byte CurrentPositionX
{
get => this._data[6];
set => this._data[6] = value;
}
///
/// Gets or sets the current position y.
///
public byte CurrentPositionY
{
get => this._data[7];
set => this._data[7] = value;
}
///
/// Gets or sets the target position x.
///
public byte TargetPositionX
{
get => this._data[8];
set => this._data[8] = value;
}
///
/// Gets or sets the target position y.
///
public byte TargetPositionY
{
get => this._data[9];
set => this._data[9] = value;
}
///
/// Gets or sets the rotation.
///
public byte Rotation
{
get => this._data[10..].GetByteValue(4, 4);
set => this._data[10..].SetByteValue(value, 4, 4);
}
}
}
///
/// Is sent by the server when: One or more summoned monsters got into the observed scope of the player.
/// Causes reaction on client side: The client adds the monsters to the shown map.
///
public readonly ref partial struct AddSummonedMonstersToScopeRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public AddSummonedMonstersToScopeRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private AddSummonedMonstersToScopeRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (ushort)data.Length;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC2;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x1F;
///
/// Gets the header of this packet.
///
public C2HeaderRef Header => new (this._data);
///
/// Gets or sets the monster count.
///
public byte MonsterCount
{
get => this._data[4];
set => this._data[4] = value;
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator AddSummonedMonstersToScopeRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(AddSummonedMonstersToScopeRef packet) => packet._data;
///
/// Calculates the size of the packet for the specified count of and it's size.
///
/// The count of from which the size will be calculated.
/// The length of from which the size will be calculated.
public static int GetRequiredSize(int summonedMonstersCount, int structLength) => summonedMonstersCount * structLength + 5;
///
/// Contains the data of an NPC..
///
public readonly ref struct SummonedMonsterDataRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public SummonedMonsterDataRef(Span data)
{
this._data = data;
}
///
/// Gets or sets the id.
///
public ushort Id
{
get => ReadUInt16BigEndian(this._data);
set => WriteUInt16BigEndian(this._data, value);
}
///
/// Gets or sets the type number.
///
public ushort TypeNumber
{
get => ReadUInt16BigEndian(this._data[2..]);
set => WriteUInt16BigEndian(this._data[2..], value);
}
///
/// Gets or sets the current position x.
///
public byte CurrentPositionX
{
get => this._data[4];
set => this._data[4] = value;
}
///
/// Gets or sets the current position y.
///
public byte CurrentPositionY
{
get => this._data[5];
set => this._data[5] = value;
}
///
/// Gets or sets the target position x.
///
public byte TargetPositionX
{
get => this._data[6];
set => this._data[6] = value;
}
///
/// Gets or sets the target position y.
///
public byte TargetPositionY
{
get => this._data[7];
set => this._data[7] = value;
}
///
/// Gets or sets the rotation.
///
public byte Rotation
{
get => this._data[8..].GetByteValue(4, 4);
set => this._data[8..].SetByteValue(value, 4, 4);
}
///
/// Gets or sets the owner character name.
///
public string OwnerCharacterName
{
get => this._data.ExtractString(9, 10, System.Text.Encoding.UTF8);
set => this._data.Slice(9, 10).WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Gets or sets defines the number of effects which would be sent after this field. This is currently not supported.
///
public byte EffectCount
{
get => this._data[19];
set => this._data[19] = value;
}
///
/// Gets the of the specified index.
///
public EffectIdRef this[int index] => new (this._data[(20 + index * EffectIdRef.Length)..]);
///
/// Calculates the size of the packet for the specified count of .
///
/// The count of from which the size will be calculated.
public static int GetRequiredSize(int effectsCount) => effectsCount * EffectIdRef.Length + 20;
}
///
/// Contains the id of a magic effect..
///
public readonly ref struct EffectIdRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public EffectIdRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 1;
///
/// Gets or sets the id.
///
public byte Id
{
get => this._data[0];
set => this._data[0] = value;
}
}
}
///
/// Is sent by the server when: One or more summoned monsters got into the observed scope of the player.
/// Causes reaction on client side: The client adds the monsters to the shown map.
///
public readonly ref struct AddSummonedMonstersToScope075Ref
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public AddSummonedMonstersToScope075Ref(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private AddSummonedMonstersToScope075Ref(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (ushort)data.Length;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC2;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x1F;
///
/// Gets the header of this packet.
///
public C2HeaderRef Header => new (this._data);
///
/// Gets or sets the monster count.
///
public byte MonsterCount
{
get => this._data[4];
set => this._data[4] = value;
}
///
/// Gets the of the specified index.
///
public SummonedMonsterDataRef this[int index] => new (this._data[(5 + index * SummonedMonsterDataRef.Length)..]);
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator AddSummonedMonstersToScope075Ref(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(AddSummonedMonstersToScope075Ref packet) => packet._data;
///
/// Calculates the size of the packet for the specified count of .
///
/// The count of from which the size will be calculated.
public static int GetRequiredSize(int summonedMonstersCount) => summonedMonstersCount * SummonedMonsterDataRef.Length + 5;
///
/// Contains the data of an NPC..
///
public readonly ref struct SummonedMonsterDataRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public SummonedMonsterDataRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 19;
///
/// Gets or sets the id.
///
public ushort Id
{
get => ReadUInt16BigEndian(this._data);
set => WriteUInt16BigEndian(this._data, value);
}
///
/// Gets or sets the type number.
///
public byte TypeNumber
{
get => this._data[2];
set => this._data[2] = value;
}
///
/// Gets or sets the is poisoned.
///
public bool IsPoisoned
{
get => this._data[3..].GetBoolean(0);
set => this._data[3..].SetBoolean(value, 0);
}
///
/// Gets or sets the is iced.
///
public bool IsIced
{
get => this._data[3..].GetBoolean(1);
set => this._data[3..].SetBoolean(value, 1);
}
///
/// Gets or sets the is damage buffed.
///
public bool IsDamageBuffed
{
get => this._data[3..].GetBoolean(2);
set => this._data[3..].SetBoolean(value, 2);
}
///
/// Gets or sets the is defense buffed.
///
public bool IsDefenseBuffed
{
get => this._data[3..].GetBoolean(3);
set => this._data[3..].SetBoolean(value, 3);
}
///
/// Gets or sets the current position x.
///
public byte CurrentPositionX
{
get => this._data[4];
set => this._data[4] = value;
}
///
/// Gets or sets the current position y.
///
public byte CurrentPositionY
{
get => this._data[5];
set => this._data[5] = value;
}
///
/// Gets or sets the target position x.
///
public byte TargetPositionX
{
get => this._data[6];
set => this._data[6] = value;
}
///
/// Gets or sets the target position y.
///
public byte TargetPositionY
{
get => this._data[7];
set => this._data[7] = value;
}
///
/// Gets or sets the rotation.
///
public byte Rotation
{
get => this._data[8..].GetByteValue(4, 4);
set => this._data[8..].SetByteValue(value, 4, 4);
}
///
/// Gets or sets the owner character name.
///
public string OwnerCharacterName
{
get => this._data.ExtractString(9, 10, System.Text.Encoding.UTF8);
set => this._data.Slice(9, 10).WriteString(value, System.Text.Encoding.UTF8);
}
}
}
///
/// Is sent by the server when: One or more summoned monsters got into the observed scope of the player.
/// Causes reaction on client side: The client adds the monsters to the shown map.
///
public readonly ref struct AddSummonedMonstersToScope095Ref
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public AddSummonedMonstersToScope095Ref(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private AddSummonedMonstersToScope095Ref(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (ushort)data.Length;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC2;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x1F;
///
/// Gets the header of this packet.
///
public C2HeaderRef Header => new (this._data);
///
/// Gets or sets the monster count.
///
public byte MonsterCount
{
get => this._data[4];
set => this._data[4] = value;
}
///
/// Gets the of the specified index.
///
public SummonedMonsterDataRef this[int index] => new (this._data[(5 + index * SummonedMonsterDataRef.Length)..]);
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator AddSummonedMonstersToScope095Ref(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(AddSummonedMonstersToScope095Ref packet) => packet._data;
///
/// Calculates the size of the packet for the specified count of .
///
/// The count of from which the size will be calculated.
public static int GetRequiredSize(int summonedMonstersCount) => summonedMonstersCount * SummonedMonsterDataRef.Length + 5;
///
/// Contains the data of an NPC..
///
public readonly ref struct SummonedMonsterDataRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public SummonedMonsterDataRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 20;
///
/// Gets or sets the id.
///
public ushort Id
{
get => ReadUInt16BigEndian(this._data);
set => WriteUInt16BigEndian(this._data, value);
}
///
/// Gets or sets the type number.
///
public byte TypeNumber
{
get => this._data[2];
set => this._data[2] = value;
}
///
/// Gets or sets the is poisoned.
///
public bool IsPoisoned
{
get => this._data[4..].GetBoolean(0);
set => this._data[4..].SetBoolean(value, 0);
}
///
/// Gets or sets the is iced.
///
public bool IsIced
{
get => this._data[4..].GetBoolean(1);
set => this._data[4..].SetBoolean(value, 1);
}
///
/// Gets or sets the is damage buffed.
///
public bool IsDamageBuffed
{
get => this._data[4..].GetBoolean(2);
set => this._data[4..].SetBoolean(value, 2);
}
///
/// Gets or sets the is defense buffed.
///
public bool IsDefenseBuffed
{
get => this._data[4..].GetBoolean(3);
set => this._data[4..].SetBoolean(value, 3);
}
///
/// Gets or sets the current position x.
///
public byte CurrentPositionX
{
get => this._data[5];
set => this._data[5] = value;
}
///
/// Gets or sets the current position y.
///
public byte CurrentPositionY
{
get => this._data[6];
set => this._data[6] = value;
}
///
/// Gets or sets the target position x.
///
public byte TargetPositionX
{
get => this._data[7];
set => this._data[7] = value;
}
///
/// Gets or sets the target position y.
///
public byte TargetPositionY
{
get => this._data[8];
set => this._data[8] = value;
}
///
/// Gets or sets the rotation.
///
public byte Rotation
{
get => this._data[9..].GetByteValue(4, 4);
set => this._data[9..].SetByteValue(value, 4, 4);
}
///
/// Gets or sets the owner character name.
///
public string OwnerCharacterName
{
get => this._data.ExtractString(10, 10, System.Text.Encoding.UTF8);
set => this._data.Slice(10, 10).WriteString(value, System.Text.Encoding.UTF8);
}
}
}
///
/// Is sent by the server when: One or more objects (player, npc, etc.) on the map got out of scope, e.g. when the own player moved away from it/them or the object itself moved.
/// Causes reaction on client side: The game client removes the objects from the game map.
///
public readonly ref struct MapObjectOutOfScopeRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public MapObjectOutOfScopeRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private MapObjectOutOfScopeRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)data.Length;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x14;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the object count.
///
public byte ObjectCount
{
get => this._data[3];
set => this._data[3] = value;
}
///
/// Gets the of the specified index.
///
public ObjectIdRef this[int index] => new (this._data[(4 + index * ObjectIdRef.Length)..]);
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator MapObjectOutOfScopeRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(MapObjectOutOfScopeRef packet) => packet._data;
///
/// Calculates the size of the packet for the specified count of .
///
/// The count of from which the size will be calculated.
public static int GetRequiredSize(int objectsCount) => objectsCount * ObjectIdRef.Length + 4;
///
/// Contains the id of a object..
///
public readonly ref struct ObjectIdRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public ObjectIdRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 2;
///
/// Gets or sets the id.
///
public ushort Id
{
get => ReadUInt16BigEndian(this._data);
set => WriteUInt16BigEndian(this._data, value);
}
}
}
///
/// Is sent by the server when: An observed object was killed.
/// Causes reaction on client side: The object is shown as dead.
///
public readonly ref struct ObjectGotKilledRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public ObjectGotKilledRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private ObjectGotKilledRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x17;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 9;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the killed id.
///
public ushort KilledId
{
get => ReadUInt16BigEndian(this._data[3..]);
set => WriteUInt16BigEndian(this._data[3..], value);
}
///
/// Gets or sets the skill id.
///
public ushort SkillId
{
get => ReadUInt16BigEndian(this._data[5..]);
set => WriteUInt16BigEndian(this._data[5..], value);
}
///
/// Gets or sets the killer id.
///
public ushort KillerId
{
get => ReadUInt16BigEndian(this._data[7..]);
set => WriteUInt16BigEndian(this._data[7..], value);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator ObjectGotKilledRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(ObjectGotKilledRef packet) => packet._data;
}
///
/// Is sent by the server when: An object performs an animation.
/// Causes reaction on client side: The animation is shown for the specified object.
///
public readonly ref struct ObjectAnimationRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public ObjectAnimationRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private ObjectAnimationRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x18;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 9;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the object id.
///
public ushort ObjectId
{
get => ReadUInt16BigEndian(this._data[3..]);
set => WriteUInt16BigEndian(this._data[3..], value);
}
///
/// Gets or sets the direction.
///
public byte Direction
{
get => this._data[5];
set => this._data[5] = value;
}
///
/// Gets or sets the animation.
///
public byte Animation
{
get => this._data[6];
set => this._data[6] = value;
}
///
/// Gets or sets the target id.
///
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data[7..]);
set => WriteUInt16BigEndian(this._data[7..], value);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator ObjectAnimationRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(ObjectAnimationRef packet) => packet._data;
}
///
/// Is sent by the server when: An object performs a skill which has effect on an area.
/// Causes reaction on client side: The animation is shown on the user interface.
///
public readonly ref struct AreaSkillAnimationRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public AreaSkillAnimationRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private AreaSkillAnimationRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC3;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x1E;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 10;
///
/// Gets the header of this packet.
///
public C3HeaderRef Header => new (this._data);
///
/// Gets or sets the skill id.
///
public ushort SkillId
{
get => ReadUInt16BigEndian(this._data[3..]);
set => WriteUInt16BigEndian(this._data[3..], value);
}
///
/// Gets or sets the player id.
///
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data[5..]);
set => WriteUInt16BigEndian(this._data[5..], value);
}
///
/// Gets or sets the point x.
///
public byte PointX
{
get => this._data[7];
set => this._data[7] = value;
}
///
/// Gets or sets the point y.
///
public byte PointY
{
get => this._data[8];
set => this._data[8] = value;
}
///
/// Gets or sets the rotation.
///
public byte Rotation
{
get => this._data[9];
set => this._data[9] = value;
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator AreaSkillAnimationRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(AreaSkillAnimationRef packet) => packet._data;
}
///
/// Is sent by the server when: An object performs a skill which is directly targeted to another object.
/// Causes reaction on client side: The animation is shown on the user interface.
///
public readonly ref struct SkillAnimationRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public SkillAnimationRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private SkillAnimationRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC3;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x19;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 9;
///
/// Gets the header of this packet.
///
public C3HeaderRef Header => new (this._data);
///
/// Gets or sets the skill id.
///
public ushort SkillId
{
get => ReadUInt16BigEndian(this._data[3..]);
set => WriteUInt16BigEndian(this._data[3..], value);
}
///
/// Gets or sets the player id.
///
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data[5..]);
set => WriteUInt16BigEndian(this._data[5..], value);
}
///
/// Gets or sets the target id.
///
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data[7..]);
set => WriteUInt16BigEndian(this._data[7..], value);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator SkillAnimationRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(SkillAnimationRef packet) => packet._data;
}
///
/// Is sent by the server when: An object performs a skill which has effect on an area.
/// Causes reaction on client side: The animation is shown on the user interface.
///
public readonly ref struct AreaSkillAnimation075Ref
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public AreaSkillAnimation075Ref(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private AreaSkillAnimation075Ref(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x1E;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 9;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the skill id.
///
public byte SkillId
{
get => this._data[3];
set => this._data[3] = value;
}
///
/// Gets or sets the player id.
///
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data[4..]);
set => WriteUInt16BigEndian(this._data[4..], value);
}
///
/// Gets or sets the point x.
///
public byte PointX
{
get => this._data[6];
set => this._data[6] = value;
}
///
/// Gets or sets the point y.
///
public byte PointY
{
get => this._data[7];
set => this._data[7] = value;
}
///
/// Gets or sets the rotation.
///
public byte Rotation
{
get => this._data[8];
set => this._data[8] = value;
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator AreaSkillAnimation075Ref(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(AreaSkillAnimation075Ref packet) => packet._data;
}
///
/// Is sent by the server when: An object performs a skill which has effect on an area.
/// Causes reaction on client side: The animation is shown on the user interface.
///
public readonly ref struct AreaSkillAnimation095Ref
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public AreaSkillAnimation095Ref(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private AreaSkillAnimation095Ref(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC3;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x1E;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 9;
///
/// Gets the header of this packet.
///
public C3HeaderRef Header => new (this._data);
///
/// Gets or sets the skill id.
///
public byte SkillId
{
get => this._data[3];
set => this._data[3] = value;
}
///
/// Gets or sets the player id.
///
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data[4..]);
set => WriteUInt16BigEndian(this._data[4..], value);
}
///
/// Gets or sets the point x.
///
public byte PointX
{
get => this._data[6];
set => this._data[6] = value;
}
///
/// Gets or sets the point y.
///
public byte PointY
{
get => this._data[7];
set => this._data[7] = value;
}
///
/// Gets or sets the rotation.
///
public byte Rotation
{
get => this._data[8];
set => this._data[8] = value;
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator AreaSkillAnimation095Ref(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(AreaSkillAnimation095Ref packet) => packet._data;
}
///
/// Is sent by the server when: An object performs a skill which is directly targeted to another object.
/// Causes reaction on client side: The animation is shown on the user interface.
///
public readonly ref struct SkillAnimation075Ref
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public SkillAnimation075Ref(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private SkillAnimation075Ref(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x19;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 8;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the skill id.
///
public byte SkillId
{
get => this._data[3];
set => this._data[3] = value;
}
///
/// Gets or sets the player id.
///
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data[4..]);
set => WriteUInt16BigEndian(this._data[4..], value);
}
///
/// Gets or sets the target id.
///
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data[6..]);
set => WriteUInt16BigEndian(this._data[6..], value);
}
///
/// Gets or sets the effect applied.
///
public bool EffectApplied
{
get => this._data[6..].GetBoolean(7);
set => this._data[6..].SetBoolean(value, 7);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator SkillAnimation075Ref(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(SkillAnimation075Ref packet) => packet._data;
}
///
/// Is sent by the server when: An object performs a skill which is directly targeted to another object.
/// Causes reaction on client side: The animation is shown on the user interface.
///
public readonly ref struct SkillAnimation095Ref
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public SkillAnimation095Ref(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private SkillAnimation095Ref(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC3;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x19;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 8;
///
/// Gets the header of this packet.
///
public C3HeaderRef Header => new (this._data);
///
/// Gets or sets the skill id.
///
public byte SkillId
{
get => this._data[3];
set => this._data[3] = value;
}
///
/// Gets or sets the player id.
///
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data[4..]);
set => WriteUInt16BigEndian(this._data[4..], value);
}
///
/// Gets or sets the target id.
///
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data[6..]);
set => WriteUInt16BigEndian(this._data[6..], value);
}
///
/// Gets or sets the effect applied.
///
public bool EffectApplied
{
get => this._data[6..].GetBoolean(7);
set => this._data[6..].SetBoolean(value, 7);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator SkillAnimation095Ref(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(SkillAnimation095Ref packet) => packet._data;
}
///
/// Is sent by the server when: A player cancelled a specific magic effect of a skill (Infinity Arrow, Wizardry Enhance), or an effect was removed due a timeout (Ice, Poison) or antidote.
/// Causes reaction on client side: The effect is removed from the target object.
///
public readonly ref struct MagicEffectCancelledRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public MagicEffectCancelledRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private MagicEffectCancelledRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x1B;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 7;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the skill id.
///
public ushort SkillId
{
get => ReadUInt16BigEndian(this._data[3..]);
set => WriteUInt16BigEndian(this._data[3..], value);
}
///
/// Gets or sets the target id.
///
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data[5..]);
set => WriteUInt16BigEndian(this._data[5..], value);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator MagicEffectCancelledRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(MagicEffectCancelledRef packet) => packet._data;
}
///
/// Is sent by the server when: A player cancelled a specific magic effect of a skill (Infinity Arrow, Wizardry Enhance), or an effect was removed due a timeout (Ice, Poison) or antidote.
/// Causes reaction on client side: The effect is removed from the target object.
///
public readonly ref struct MagicEffectCancelled075Ref
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public MagicEffectCancelled075Ref(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private MagicEffectCancelled075Ref(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x1B;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 6;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the skill id.
///
public byte SkillId
{
get => this._data[3];
set => this._data[3] = value;
}
///
/// Gets or sets the target id.
///
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data[4..]);
set => WriteUInt16BigEndian(this._data[4..], value);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator MagicEffectCancelled075Ref(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(MagicEffectCancelled075Ref packet) => packet._data;
}
///
/// Is sent by the server when: A player (rage fighter) performs the dark side skill on a target and sent a RageAttackRangeRequest.
/// Causes reaction on client side: The targets are attacked with visual effects.
///
public readonly ref struct RageAttackRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public RageAttackRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private RageAttackRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC3;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x4A;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 9;
///
/// Gets the header of this packet.
///
public C3HeaderRef Header => new (this._data);
///
/// Gets or sets the skill id.
///
public ushort SkillId
{
get => ReadUInt16BigEndian(this._data[3..]);
set => WriteUInt16BigEndian(this._data[3..], value);
}
///
/// Gets or sets the source id.
///
public ushort SourceId
{
get => ReadUInt16BigEndian(this._data[5..]);
set => WriteUInt16BigEndian(this._data[5..], value);
}
///
/// Gets or sets the target id.
///
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data[7..]);
set => WriteUInt16BigEndian(this._data[7..], value);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator RageAttackRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(RageAttackRef packet) => packet._data;
}
///
/// Is sent by the server when: A player (rage fighter) performs the dark side skill on a target and sent a RageAttackRangeRequest.
/// Causes reaction on client side: The targets are attacked with visual effects.
///
public readonly ref struct RageAttackRangeResponseRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public RageAttackRangeResponseRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private RageAttackRangeResponseRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x4B;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 16;
///
/// Gets the header of this packet.
///
public C1HeaderWithSubCodeRef Header => new (this._data);
///
/// Gets or sets the skill id.
///
public ushort SkillId
{
get => ReadUInt16LittleEndian(this._data[4..]);
set => WriteUInt16LittleEndian(this._data[4..], value);
}
///
/// Gets the of the specified index.
///
public RageTargetRef this[int index] => new (this._data[(6 + index * RageTargetRef.Length)..]);
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator RageAttackRangeResponseRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(RageAttackRangeResponseRef packet) => packet._data;
///
/// Calculates the size of the packet for the specified count of .
///
/// The count of from which the size will be calculated.
public static int GetRequiredSize(int targetsCount) => targetsCount * RageTargetRef.Length + 6;
///
/// Contains the target identifier..
///
public readonly ref struct RageTargetRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public RageTargetRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 2;
///
/// Gets or sets the target id.
///
public ushort TargetId
{
get => ReadUInt16LittleEndian(this._data);
set => WriteUInt16LittleEndian(this._data, value);
}
}
}
///
/// Is sent by the server when: The appearance of a player changed, all surrounding players are informed about it.
/// Causes reaction on client side: The appearance of the player is updated.
///
public readonly ref struct AppearanceChangedRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public AppearanceChangedRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private AppearanceChangedRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)data.Length;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x25;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the changed player id.
///
public ushort ChangedPlayerId
{
get => ReadUInt16BigEndian(this._data[3..]);
set => WriteUInt16BigEndian(this._data[3..], value);
}
///
/// Gets or sets the item data.
///
public Span ItemData
{
get => this._data.Slice(5);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator AppearanceChangedRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(AppearanceChangedRef packet) => packet._data;
///
/// Calculates the size of the packet for the specified length of .
///
/// The length in bytes of on which the required size depends.
public static int GetRequiredSize(int itemDataLength) => itemDataLength + 5;
}
///
/// Is sent by the server when: The appearance of a player changed, all surrounding players are informed about it.
/// Causes reaction on client side: The appearance of the player is updated.
///
public readonly ref struct AppearanceChangedExtendedRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public AppearanceChangedExtendedRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private AppearanceChangedExtendedRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x25;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 14;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the changed player id.
///
public ushort ChangedPlayerId
{
get => ReadUInt16LittleEndian(this._data[4..]);
set => WriteUInt16LittleEndian(this._data[4..], value);
}
///
/// Gets or sets the item slot.
///
public byte ItemSlot
{
get => this._data[6];
set => this._data[6] = value;
}
///
/// Gets or sets the item group.
///
public byte ItemGroup
{
get => this._data[7];
set => this._data[7] = value;
}
///
/// Gets or sets the item number.
///
public ushort ItemNumber
{
get => ReadUInt16LittleEndian(this._data[8..]);
set => WriteUInt16LittleEndian(this._data[8..], value);
}
///
/// Gets or sets the item level.
///
public byte ItemLevel
{
get => this._data[10];
set => this._data[10] = value;
}
///
/// Gets or sets the excellent flags.
///
public byte ExcellentFlags
{
get => this._data[11];
set => this._data[11] = value;
}
///
/// Gets or sets the ancient discriminator.
///
public byte AncientDiscriminator
{
get => this._data[12];
set => this._data[12] = value;
}
///
/// Gets or sets the is ancient set complete.
///
public bool IsAncientSetComplete
{
get => this._data[13..].GetBoolean();
set => this._data[13..].SetBoolean(value);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator AppearanceChangedExtendedRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(AppearanceChangedExtendedRef packet) => packet._data;
}
///
/// Is sent by the server when: The server wants to show a message above any kind of character, even NPCs.
/// Causes reaction on client side: The message is shown above the character.
///
public readonly ref struct ObjectMessageRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public ObjectMessageRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private ObjectMessageRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)data.Length;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x01;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the object id.
///
public ushort ObjectId
{
get => ReadUInt16BigEndian(this._data[3..]);
set => WriteUInt16BigEndian(this._data[3..], value);
}
///
/// Gets or sets the message.
///
public string Message
{
get => this._data.ExtractString(5, this._data.Length - 5, System.Text.Encoding.UTF8);
set => this._data.Slice(5).WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator ObjectMessageRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(ObjectMessageRef packet) => packet._data;
///
/// Calculates the size of the packet for the specified field content.
///
/// The content of the variable 'Message' field from which the size will be calculated.
public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 5;
///
/// Calculates the size of the packet for the specified field content.
///
/// The content length in bytes of the variable 'Message' field from which the size will be calculated.
public static int GetRequiredSize(int contentLength) => contentLength + 1 + 5;
}
///
/// Is sent by the server when: Another player requests party from the receiver of this message.
/// Causes reaction on client side: The party request is shown.
///
public readonly ref struct PartyRequestRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PartyRequestRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private PartyRequestRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x40;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 5;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the requester id.
///
public ushort RequesterId
{
get => ReadUInt16BigEndian(this._data[3..]);
set => WriteUInt16BigEndian(this._data[3..], value);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator PartyRequestRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(PartyRequestRef packet) => packet._data;
}
///
/// Is sent by the server when: A player joined a party or requested the current party list by opening the party dialog.
/// Causes reaction on client side: The party list is updated.
///
public readonly ref struct PartyListRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PartyListRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private PartyListRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)data.Length;
header.SubCode = SubCode;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x42;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x01;
///
/// Gets the header of this packet.
///
public C1HeaderWithSubCodeRef Header => new (this._data);
///
/// Gets or sets the count.
///
public byte Count
{
get => this._data[4];
set => this._data[4] = value;
}
///
/// Gets the of the specified index.
///
public PartyMemberRef this[int index] => new (this._data[(5 + index * PartyMemberRef.Length)..]);
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator PartyListRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(PartyListRef packet) => packet._data;
///
/// Calculates the size of the packet for the specified count of .
///
/// The count of from which the size will be calculated.
public static int GetRequiredSize(int membersCount) => membersCount * PartyMemberRef.Length + 5;
///
/// Data about a party member..
///
public readonly ref struct PartyMemberRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PartyMemberRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 24;
///
/// Gets or sets the name.
///
public string Name
{
get => this._data.ExtractString(0, 10, System.Text.Encoding.UTF8);
set => this._data.Slice(0, 10).WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Gets or sets the index.
///
public byte Index
{
get => this._data[10];
set => this._data[10] = value;
}
///
/// Gets or sets the map id.
///
public byte MapId
{
get => this._data[11];
set => this._data[11] = value;
}
///
/// Gets or sets the position x.
///
public byte PositionX
{
get => this._data[12];
set => this._data[12] = value;
}
///
/// Gets or sets the position y.
///
public byte PositionY
{
get => this._data[13];
set => this._data[13] = value;
}
///
/// Gets or sets the current health.
///
public uint CurrentHealth
{
get => ReadUInt32LittleEndian(this._data[16..]);
set => WriteUInt32LittleEndian(this._data[16..], value);
}
///
/// Gets or sets the maximum health.
///
public uint MaximumHealth
{
get => ReadUInt32LittleEndian(this._data[20..]);
set => WriteUInt32LittleEndian(this._data[20..], value);
}
}
}
///
/// Is sent by the server when: A player joined a party or requested the current party list by opening the party dialog.
/// Causes reaction on client side: The party list is updated.
///
public readonly ref struct PartyList075Ref
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PartyList075Ref(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private PartyList075Ref(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)data.Length;
header.SubCode = SubCode;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x42;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x01;
///
/// Gets the header of this packet.
///
public C1HeaderWithSubCodeRef Header => new (this._data);
///
/// Gets or sets the count.
///
public byte Count
{
get => this._data[4];
set => this._data[4] = value;
}
///
/// Gets the of the specified index.
///
public PartyMemberRef this[int index] => new (this._data[(5 + index * PartyMemberRef.Length)..]);
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator PartyList075Ref(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(PartyList075Ref packet) => packet._data;
///
/// Calculates the size of the packet for the specified count of .
///
/// The count of from which the size will be calculated.
public static int GetRequiredSize(int membersCount) => membersCount * PartyMemberRef.Length + 5;
///
/// Data about a party member..
///
public readonly ref struct PartyMemberRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PartyMemberRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 14;
///
/// Gets or sets the name.
///
public string Name
{
get => this._data.ExtractString(0, 10, System.Text.Encoding.UTF8);
set => this._data.Slice(0, 10).WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Gets or sets the index.
///
public byte Index
{
get => this._data[10];
set => this._data[10] = value;
}
///
/// Gets or sets the map id.
///
public byte MapId
{
get => this._data[11];
set => this._data[11] = value;
}
///
/// Gets or sets the position x.
///
public byte PositionX
{
get => this._data[12];
set => this._data[12] = value;
}
///
/// Gets or sets the position y.
///
public byte PositionY
{
get => this._data[13];
set => this._data[13] = value;
}
}
}
///
/// Is sent by the server when: A party member got removed from a party in which the player is in.
/// Causes reaction on client side: The party member with the specified index is removed from the party list on the user interface.
///
public readonly ref struct RemovePartyMemberRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public RemovePartyMemberRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private RemovePartyMemberRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x43;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 4;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the index.
///
public byte Index
{
get => this._data[3];
set => this._data[3] = value;
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator RemovePartyMemberRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(RemovePartyMemberRef packet) => packet._data;
}
///
/// Is sent by the server when: Periodically, when the health state of the party changed.
/// Causes reaction on client side: The party health list is updated.
///
public readonly ref struct PartyHealthUpdateRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PartyHealthUpdateRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private PartyHealthUpdateRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)data.Length;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x44;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the count.
///
public byte Count
{
get => this._data[3];
set => this._data[3] = value;
}
///
/// Gets the of the specified index.
///
public PartyMemberHealthRef this[int index] => new (this._data[(4 + index * PartyMemberHealthRef.Length)..]);
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator PartyHealthUpdateRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(PartyHealthUpdateRef packet) => packet._data;
///
/// Calculates the size of the packet for the specified count of .
///
/// The count of from which the size will be calculated.
public static int GetRequiredSize(int membersCount) => membersCount * PartyMemberHealthRef.Length + 4;
///
/// Health of a party member.
///
public readonly ref struct PartyMemberHealthRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PartyMemberHealthRef(Span data)
{
this._data = data;
}
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 1;
///
/// Gets or sets the index.
///
public byte Index
{
get => this._data.GetByteValue(4, 4);
set => this._data.SetByteValue(value, 4, 4);
}
///
/// Gets or sets a value from 0 to 10 about the health of a player. 10 means the current health is 100% of the maximum health.
///
public byte Value
{
get => this._data.GetByteValue(4, 0);
set => this._data.SetByteValue(value, 4, 0);
}
}
}
///
/// Is sent by the server when: After the player requested to open his shop and this request was successful.
/// Causes reaction on client side: The own player shop is shown as open.
///
public readonly ref struct PlayerShopOpenSuccessfulRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PlayerShopOpenSuccessfulRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private PlayerShopOpenSuccessfulRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
header.SubCode = SubCode;
this.Success = true;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x3F;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x2;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 5;
///
/// Gets the header of this packet.
///
public C1HeaderWithSubCodeRef Header => new (this._data);
///
/// Gets or sets the success.
///
public bool Success
{
get => this._data[4..].GetBoolean();
set => this._data[4..].SetBoolean(value);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator PlayerShopOpenSuccessfulRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(PlayerShopOpenSuccessfulRef packet) => packet._data;
}
///
/// Is sent by the server when: After the trading partner checked or unchecked the trade accept button.
/// Causes reaction on client side: The game client updates the trade button state accordingly.
///
public readonly ref struct TradeButtonStateChangedRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public TradeButtonStateChangedRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private TradeButtonStateChangedRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x3C;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 4;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the state.
///
public TradeButtonStateChanged.TradeButtonState State
{
get => (TradeButtonStateChanged.TradeButtonState)this._data[3];
set => this._data[3] = (byte)value;
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator TradeButtonStateChangedRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(TradeButtonStateChangedRef packet) => packet._data;
}
///
/// Is sent by the server when: The trade money has been set by a previous request of the player.
/// Causes reaction on client side: The money which was set into the trade by the player is updated on the UI.
///
public readonly ref struct TradeMoneySetResponseRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public TradeMoneySetResponseRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private TradeMoneySetResponseRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
header.SubCode = SubCode;
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x3A;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x01;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 4;
///
/// Gets the header of this packet.
///
public C1HeaderWithSubCodeRef Header => new (this._data);
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator TradeMoneySetResponseRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(TradeMoneySetResponseRef packet) => packet._data;
}
///
/// Is sent by the server when: This message is sent when the trading partner put a certain amount of money (also 0) into the trade.
/// Causes reaction on client side: It overrides all previous sent money values.
///
public readonly ref struct TradeMoneyUpdateRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public TradeMoneyUpdateRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
/// If set to true, the header data is automatically initialized and written to the underlying span.
private TradeMoneyUpdateRef(Span data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
///
/// Gets the header type of this data packet.
///
public static byte HeaderType => 0xC1;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x3B;
///
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
///
public static int Length => 8;
///
/// Gets the header of this packet.
///
public C1HeaderRef Header => new (this._data);
///
/// Gets or sets the money amount.
///
public uint MoneyAmount
{
get => ReadUInt32LittleEndian(this._data[4..]);
set => WriteUInt32LittleEndian(this._data[4..], value);
}
///
/// Performs an implicit conversion from a Span of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator TradeMoneyUpdateRef(Span packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Span of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Span(TradeMoneyUpdateRef packet) => packet._data;
}
///
/// Is sent by the server when: The player which receives this message, sent a trade request to another player. This message is sent when the other player responded to this request.
/// Causes reaction on client side: If the trade was accepted, a trade dialog is opened. Otherwise, a message is shown.
///
public readonly ref struct TradeRequestAnswerRef
{
private readonly Span _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public TradeRequestAnswerRef(Span data)
: this(data, true)
{
}
///
/// Initializes a new instance of the