//
// 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.ClientToServer;
using System;
using static System.Buffers.Binary.BinaryPrimitives;
///
/// Is sent by the client when: This packet is sent by the client every few seconds. It contains the current "TickCount" of the client operating system and the attack speed of the selected character.
/// Causes reaction on server side: By the original server this is used to detect speed hacks.
///
public readonly struct Ping
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public Ping(Memory 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 Ping(Memory 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 => 0xC3;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0x0E;
///
/// 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 C3HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the tick count.
///
public uint TickCount
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
///
/// Gets or sets the attack speed.
///
public ushort AttackSpeed
{
get => ReadUInt16LittleEndian(this._data.Span[8..]);
set => WriteUInt16LittleEndian(this._data.Span[8..], value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator Ping(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(Ping packet) => packet._data;
}
///
/// Is sent by the client when: This packet is sent by the client as a response to a request with a challenge value.
/// Causes reaction on server side: By the original server, this is used to detect a modified client.
///
public readonly struct ChecksumResponse
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public ChecksumResponse(Memory 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 ChecksumResponse(Memory 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 => 0x03;
///
/// 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 C3Header Header => new (this._data);
///
/// Gets or sets the checksum.
///
public uint Checksum
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator ChecksumResponse(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(ChecksumResponse packet) => packet._data;
}
///
/// Is sent by the client when: A player sends a public chat message.
/// Causes reaction on server side: The message is forwarded to all surrounding players, including the sender.
///
public readonly struct PublicChatMessage
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PublicChatMessage(Memory 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 PublicChatMessage(Memory 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 => 0x00;
///
/// Gets the header of this packet.
///
public C1Header Header => new (this._data);
///
/// Gets or sets the character.
///
public string Character
{
get => this._data.Span.ExtractString(3, 10, System.Text.Encoding.UTF8);
set => this._data.Slice(3, 10).Span.WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Gets or sets the message.
///
public string Message
{
get => this._data.Span.ExtractString(13, this._data.Length - 13, System.Text.Encoding.UTF8);
set => this._data.Slice(13).Span.WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator PublicChatMessage(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(PublicChatMessage 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 + 13;
///
/// 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 + 13;
}
///
/// Is sent by the client when: A player sends a private chat message to a specific target player.
/// Causes reaction on server side: The message is forwarded to the target player.
///
public readonly struct WhisperMessage
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public WhisperMessage(Memory 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 WhisperMessage(Memory 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 => 0x02;
///
/// Gets the header of this packet.
///
public C1Header Header => new (this._data);
///
/// Gets or sets the receiver name.
///
public string ReceiverName
{
get => this._data.Span.ExtractString(3, 10, System.Text.Encoding.UTF8);
set => this._data.Slice(3, 10).Span.WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Gets or sets the message.
///
public string Message
{
get => this._data.Span.ExtractString(13, this._data.Length - 13, System.Text.Encoding.UTF8);
set => this._data.Slice(13).Span.WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator WhisperMessage(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(WhisperMessage 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 + 13;
///
/// 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 + 13;
}
///
/// Is sent by the client when: The player tries to log into the game.
/// Causes reaction on server side: The server is authenticating the sent login name and password. If it's correct, the state of the player is proceeding to be logged in.
///
public readonly struct LoginLongPassword
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public LoginLongPassword(Memory 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 LoginLongPassword(Memory 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 => 0xC3;
///
/// 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 => 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 => 60;
///
/// Gets the header of this packet.
///
public C3HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the user name, "encrypted" with Xor3.
///
public Span Username
{
get => this._data.Slice(4, 10).Span;
}
///
/// Gets or sets the password, "encrypted" with Xor3.
///
public Span Password
{
get => this._data.Slice(14, 20).Span;
}
///
/// Gets or sets the tick count.
///
public uint TickCount
{
get => ReadUInt32BigEndian(this._data.Span[34..]);
set => WriteUInt32BigEndian(this._data.Span[34..], value);
}
///
/// Gets or sets the client version.
///
public Span ClientVersion
{
get => this._data.Slice(38, 5).Span;
}
///
/// Gets or sets the client serial.
///
public Span ClientSerial
{
get => this._data.Slice(43, 16).Span;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator LoginLongPassword(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(LoginLongPassword packet) => packet._data;
}
///
/// Is sent by the client when: The player tries to log into the game.
/// Causes reaction on server side: The server is authenticating the sent login name and password. If it's correct, the state of the player is proceeding to be logged in.
///
public readonly struct LoginShortPassword
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public LoginShortPassword(Memory 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 LoginShortPassword(Memory 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 => 0xC3;
///
/// 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 => 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 => 50;
///
/// Gets the header of this packet.
///
public C3HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the user name, "encrypted" with Xor3.
///
public Span Username
{
get => this._data.Slice(4, 10).Span;
}
///
/// Gets or sets the password, "encrypted" with Xor3.
///
public Span Password
{
get => this._data.Slice(14, 10).Span;
}
///
/// Gets or sets the tick count.
///
public uint TickCount
{
get => ReadUInt32BigEndian(this._data.Span[24..]);
set => WriteUInt32BigEndian(this._data.Span[24..], value);
}
///
/// Gets or sets the client version.
///
public Span ClientVersion
{
get => this._data.Slice(28, 5).Span;
}
///
/// Gets or sets the client serial.
///
public Span ClientSerial
{
get => this._data.Slice(33, 16).Span;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator LoginShortPassword(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(LoginShortPassword packet) => packet._data;
}
///
/// Is sent by the client when: The player tries to log into the game.
/// Causes reaction on server side: The server is authenticating the sent login name and password. If it's correct, the state of the player is proceeding to be logged in.
///
public readonly struct Login075
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public Login075(Memory 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 Login075(Memory 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 => 0xC3;
///
/// 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 => 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 => 48;
///
/// Gets the header of this packet.
///
public C3HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the user name, "encrypted" with Xor3.
///
public Span Username
{
get => this._data.Slice(4, 10).Span;
}
///
/// Gets or sets the password, "encrypted" with Xor3.
///
public Span Password
{
get => this._data.Slice(14, 10).Span;
}
///
/// Gets or sets the tick count.
///
public uint TickCount
{
get => ReadUInt32BigEndian(this._data.Span[24..]);
set => WriteUInt32BigEndian(this._data.Span[24..], value);
}
///
/// Gets or sets the client version.
///
public Span ClientVersion
{
get => this._data.Slice(28, 3).Span;
}
///
/// Gets or sets the client serial.
///
public Span ClientSerial
{
get => this._data.Slice(31, 16).Span;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator Login075(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(Login075 packet) => packet._data;
}
///
/// Is sent by the client when: When the client wants to leave the game in various ways.
/// Causes reaction on server side: Depending on the LogOutType, the game server does several checks and sends a response back to the client. If the request was successful, the game client either closes the game, goes back to server or character selection.
///
public readonly struct LogOut
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public LogOut(Memory 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 LogOut(Memory 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 => 0xC3;
///
/// 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 => 0x02;
///
/// 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 C3HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the type.
///
public LogOutType Type
{
get => (LogOutType)this._data.Span[4];
set => this._data.Span[4] = (byte)value;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator LogOut(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(LogOut packet) => packet._data;
}
///
/// Is sent by the client when: When the client wants to leave the game in various ways.
/// Causes reaction on server side: Depending on the LogOutType, the game server does several checks and sends a response back to the client. If the request was successful, the game client either closes the game, goes back to server or character selection.
///
public readonly struct LogOutByCheatDetection
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public LogOutByCheatDetection(Memory 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 LogOutByCheatDetection(Memory 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.Type = 4;
}
}
///
/// 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 => 0xF1;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x03;
///
/// 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 C3HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the type.
///
public byte Type
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
///
/// Gets or sets the param.
///
public byte Param
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator LogOutByCheatDetection(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(LogOutByCheatDetection packet) => packet._data;
}
///
/// Is sent by the client when: Unknown?
/// Causes reaction on server side: Unknown?
///
public readonly struct ResetCharacterPointRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public ResetCharacterPointRequest(Memory 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 ResetCharacterPointRequest(Memory 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 => 0xF2;
///
/// 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 => 4;
///
/// Gets the header of this packet.
///
public C1HeaderWithSubCode Header => new (this._data);
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator ResetCharacterPointRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(ResetCharacterPointRequest packet) => packet._data;
}
///
/// Is sent by the client when: The player wants to set a price of an item which is inside his personal item shop.
/// Causes reaction on server side: The price is set for the specified item. Works only if the shop is currently closed.
///
public readonly struct PlayerShopSetItemPrice
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PlayerShopSetItemPrice(Memory 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 PlayerShopSetItemPrice(Memory 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 => 0xC3;
///
/// 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 => 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 => 9;
///
/// Gets the header of this packet.
///
public C3HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the item slot.
///
public byte ItemSlot
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
///
/// Gets or sets the price.
///
public uint Price
{
get => ReadUInt32LittleEndian(this._data.Span[5..]);
set => WriteUInt32LittleEndian(this._data.Span[5..], value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator PlayerShopSetItemPrice(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(PlayerShopSetItemPrice packet) => packet._data;
}
///
/// Is sent by the client when: The player wants to open his personal item shop.
/// Causes reaction on server side: The personal item shop is opened and the surrounding players are informed about it, including the own player.
///
public readonly struct PlayerShopOpen
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PlayerShopOpen(Memory 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 PlayerShopOpen(Memory 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 => 0xC3;
///
/// 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 => 0x02;
///
/// 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 => 30;
///
/// Gets the header of this packet.
///
public C3HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the store name.
///
public string StoreName
{
get => this._data.Span.ExtractString(4, 26, System.Text.Encoding.UTF8);
set => this._data.Slice(4, 26).Span.WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator PlayerShopOpen(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(PlayerShopOpen packet) => packet._data;
}
///
/// Is sent by the client when: The player wants to close his personal item shop.
/// Causes reaction on server side: The personal item shop is closed and the surrounding players are informed about it, including the own player.
///
public readonly struct PlayerShopClose
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PlayerShopClose(Memory 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 PlayerShopClose(Memory 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 => 0xC3;
///
/// 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 => 0x03;
///
/// 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 C3HeaderWithSubCode Header => new (this._data);
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator PlayerShopClose(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(PlayerShopClose packet) => packet._data;
}
///
/// Is sent by the client when: A player opens a shop of another player.
/// Causes reaction on server side: The list of items is sent back, if the shop of the player is currently open.
///
public readonly struct PlayerShopItemListRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PlayerShopItemListRequest(Memory 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 PlayerShopItemListRequest(Memory 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 => 0xC3;
///
/// 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 => 0x05;
///
/// 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 C3HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the player id.
///
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data.Span[4..]);
set => WriteUInt16BigEndian(this._data.Span[4..], value);
}
///
/// Gets or sets the player name.
///
public string PlayerName
{
get => this._data.Span.ExtractString(6, 10, System.Text.Encoding.UTF8);
set => this._data.Slice(6, 10).Span.WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator PlayerShopItemListRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(PlayerShopItemListRequest packet) => packet._data;
}
///
/// Is sent by the client when: A player wants to buy the item of another players shop.
/// Causes reaction on server side: If the buyer has enough money, the item is sold to the player. Both players will get notifications about that.
///
public readonly struct PlayerShopItemBuyRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PlayerShopItemBuyRequest(Memory 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 PlayerShopItemBuyRequest(Memory 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 => 0xC3;
///
/// 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 => 0x06;
///
/// 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 => 17;
///
/// Gets the header of this packet.
///
public C3HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the player id.
///
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data.Span[4..]);
set => WriteUInt16BigEndian(this._data.Span[4..], value);
}
///
/// Gets or sets the player name.
///
public string PlayerName
{
get => this._data.Span.ExtractString(6, 10, System.Text.Encoding.UTF8);
set => this._data.Slice(6, 10).Span.WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Gets or sets the item slot.
///
public byte ItemSlot
{
get => this._data.Span[16];
set => this._data.Span[16] = value;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator PlayerShopItemBuyRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(PlayerShopItemBuyRequest packet) => packet._data;
}
///
/// Is sent by the client when: A player closes the dialog of another players shop.
/// Causes reaction on server side: The server handles that by unsubscribing the player from changes of the shop.
///
public readonly struct PlayerShopCloseOther
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PlayerShopCloseOther(Memory 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 PlayerShopCloseOther(Memory 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 => 0xC3;
///
/// 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 => 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 => 16;
///
/// Gets the header of this packet.
///
public C3HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the player id.
///
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data.Span[4..]);
set => WriteUInt16BigEndian(this._data.Span[4..], value);
}
///
/// Gets or sets the player name.
///
public string PlayerName
{
get => this._data.Span.ExtractString(6, 10, System.Text.Encoding.UTF8);
set => this._data.Slice(6, 10).Span.WriteString(value, System.Text.Encoding.UTF8);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator PlayerShopCloseOther(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(PlayerShopCloseOther packet) => packet._data;
}
///
/// Is sent by the client when: A player requests to pick up an item which is laying on the ground in the near of the players character.
/// Causes reaction on server side: If the player is allowed to pick the item up, and is the first player which tried that, it tries to add the item to the inventory. The server sends a response about the result of the request.
///
public readonly struct PickupItemRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PickupItemRequest(Memory 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 PickupItemRequest(Memory 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 => 0x22;
///
/// 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 C3Header Header => new (this._data);
///
/// Gets or sets the item id.
///
public ushort ItemId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator PickupItemRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(PickupItemRequest packet) => packet._data;
}
///
/// Is sent by the client when: A player requests to pick up an item which is laying on the ground in the near of the players character.
/// Causes reaction on server side: If the player is allowed to pick the item up, and is the first player which tried that, it tries to add the item to the inventory. The server sends a response about the result of the request.
///
public readonly struct PickupItemRequest075
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public PickupItemRequest075(Memory 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 PickupItemRequest075(Memory 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 => 0x22;
///
/// 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 C1Header Header => new (this._data);
///
/// Gets or sets the item id.
///
public ushort ItemId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator PickupItemRequest075(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(PickupItemRequest075 packet) => packet._data;
}
///
/// Is sent by the client when: A player requests to drop on item of his inventory on the ground.
/// Causes reaction on server side: When the specified coordinates are valid, and the item is allowed to be dropped, it will be dropped on the ground and the surrounding players are notified.
///
public readonly struct DropItemRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public DropItemRequest(Memory 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 DropItemRequest(Memory 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 => 0x23;
///
/// 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 C3Header Header => new (this._data);
///
/// Gets or sets the target x.
///
public byte TargetX
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
///
/// Gets or sets the target y.
///
public byte TargetY
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
///
/// Gets or sets the item slot.
///
public byte ItemSlot
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator DropItemRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(DropItemRequest packet) => packet._data;
}
///
/// Is sent by the client when: A player requests to move an item within or between his available item storage, such as inventory, vault, trade or chaos machine.
/// Causes reaction on server side:
///
public readonly struct ItemMoveRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public ItemMoveRequest(Memory 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 ItemMoveRequest(Memory 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 => 0x24;
///
/// 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 the header of this packet.
///
public C3Header Header => new (this._data);
///
/// Gets or sets the from storage.
///
public ItemStorageKind FromStorage
{
get => (ItemStorageKind)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
///
/// Gets or sets the from slot.
///
public byte FromSlot
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
///
/// Gets or sets the item data.
///
public Span ItemData
{
get => this._data.Slice(5, 12).Span;
}
///
/// Gets or sets the to storage.
///
public ItemStorageKind ToStorage
{
get => (ItemStorageKind)this._data.Span[17];
set => this._data.Span[17] = (byte)value;
}
///
/// Gets or sets the to slot.
///
public byte ToSlot
{
get => this._data.Span[18];
set => this._data.Span[18] = value;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator ItemMoveRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(ItemMoveRequest packet) => packet._data;
}
///
/// Is sent by the client when: A player requests to move an item within or between his available item storage, such as inventory, vault, trade or chaos machine.
/// Causes reaction on server side:
///
public readonly struct ItemMoveRequestExtended
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public ItemMoveRequestExtended(Memory 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 ItemMoveRequestExtended(Memory 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 => 0x24;
///
/// 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 C3Header Header => new (this._data);
///
/// Gets or sets the from storage.
///
public ItemStorageKind FromStorage
{
get => (ItemStorageKind)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
///
/// Gets or sets the from slot.
///
public byte FromSlot
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
///
/// Gets or sets the to storage.
///
public ItemStorageKind ToStorage
{
get => (ItemStorageKind)this._data.Span[5];
set => this._data.Span[5] = (byte)value;
}
///
/// Gets or sets the to slot.
///
public byte ToSlot
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator ItemMoveRequestExtended(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(ItemMoveRequestExtended packet) => packet._data;
}
///
/// Is sent by the client when: A player requests to 'consume' an item. This can be a potion which recovers some kind of attribute, or a jewel to upgrade a target item.
/// Causes reaction on server side: The server tries to 'consume' the specified item and responses accordingly.
///
public readonly struct ConsumeItemRequest
{
///
/// Defines how the fruit is used. Only applies, if the the item is a fruit.
///
public enum FruitUsage
{
///
/// Adds 1~3 stat points to the character.
///
AddPoints = 0,
///
/// Removes 1~9 stat points from the character.
///
RemovePoints = 1,
}
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public ConsumeItemRequest(Memory 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 ConsumeItemRequest(Memory 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 => 0x26;
///
/// 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 C3Header Header => new (this._data);
///
/// Gets or sets the inventory slot index of the item which should be consumed.
///
public byte ItemSlot
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
///
/// Gets or sets if the item has an effect on another item, e.g. upgrading it, this field contains the inventory slot index of the target item.
///
public byte TargetSlot
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
///
/// Gets or sets defines how the fruit is used. Only applies, if the the item is a fruit.
///
public ConsumeItemRequest.FruitUsage FruitConsumption
{
get => (FruitUsage)this._data.Span[5];
set => this._data.Span[5] = (byte)value;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator ConsumeItemRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(ConsumeItemRequest packet) => packet._data;
}
///
/// Is sent by the client when: A player requests to 'consume' an item. This can be a potion which recovers some kind of attribute, or a jewel to upgrade a target item.
/// Causes reaction on server side: The server tries to 'consume' the specified item and responses accordingly.
///
public readonly struct ConsumeItemRequest075
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public ConsumeItemRequest075(Memory 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 ConsumeItemRequest075(Memory 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 => 0x26;
///
/// 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 C1Header Header => new (this._data);
///
/// Gets or sets the inventory slot index of the item which should be consumed.
///
public byte ItemSlot
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
///
/// Gets or sets if the item has an effect on another item, e.g. upgrading it, this field contains the inventory slot index of the target item.
///
public byte TargetSlot
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator ConsumeItemRequest075(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(ConsumeItemRequest075 packet) => packet._data;
}
///
/// Is sent by the client when: A player wants to talk to an NPC.
/// Causes reaction on server side: Based on the NPC type, the server sends a response back to the game client. For example, if it's a merchant NPC, it sends back that a merchant dialog should be opened and which items are offered by this NPC.
///
public readonly struct TalkToNpcRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public TalkToNpcRequest(Memory 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 TalkToNpcRequest(Memory 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 => 0x30;
///
/// 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 C3Header Header => new (this._data);
///
/// Gets or sets the npc id.
///
public ushort NpcId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator TalkToNpcRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(TalkToNpcRequest packet) => packet._data;
}
///
/// Is sent by the client when: A player closes the dialog which was opened by an interaction with a NPC.
/// Causes reaction on server side: The server updates the state of the player accordingly.
///
public readonly struct CloseNpcRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CloseNpcRequest(Memory 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 CloseNpcRequest(Memory 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 => 0x31;
///
/// 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 => 3;
///
/// Gets the header of this packet.
///
public C1Header Header => new (this._data);
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator CloseNpcRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(CloseNpcRequest packet) => packet._data;
}
///
/// Is sent by the client when: A player wants to buy an item from an opened NPC merchant.
/// Causes reaction on server side: If the player has enough money, the item is added to the inventory and money is removed. Corresponding messages are sent back to the game client.
///
public readonly struct BuyItemFromNpcRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public BuyItemFromNpcRequest(Memory 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 BuyItemFromNpcRequest(Memory 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 => 0x32;
///
/// 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 C3Header Header => new (this._data);
///
/// Gets or sets item Slot (NPC Store)
///
public byte ItemSlot
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator BuyItemFromNpcRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(BuyItemFromNpcRequest packet) => packet._data;
}
///
/// Is sent by the client when: A player wants to sell an item of his inventory to the opened NPC merchant.
/// Causes reaction on server side: The item is sold for money to the NPC. The item is removed from the inventory and money is added. Corresponding messages are sent back to the game client.
///
public readonly struct SellItemToNpcRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public SellItemToNpcRequest(Memory 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 SellItemToNpcRequest(Memory 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 => 0x33;
///
/// 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 C3Header Header => new (this._data);
///
/// Gets or sets item Slot (Inventory)
///
public byte ItemSlot
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator SellItemToNpcRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(SellItemToNpcRequest packet) => packet._data;
}
///
/// Is sent by the client when: A player wants to repair an item of his inventory.
/// Causes reaction on server side: The item is repaired if the player has enough money in its inventory. A corresponding response is sent.
///
public readonly struct RepairItemRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public RepairItemRequest(Memory 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 RepairItemRequest(Memory 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 => 0x34;
///
/// 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 C1Header Header => new (this._data);
///
/// Gets or sets inventory item slot of the target item. If it's 0xFF, the player wants to repair all items - this is only possible with some opened NPC dialogs. Repairing the pet item slot (8) is only possible when the pet trainer npc is opened.
///
public byte ItemSlot
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
///
/// Gets or sets if the player repairs it over his inventory, it's true. However, a server should never rely on this flag and do his own checks.
///
public bool IsSelfRepair
{
get => this._data.Span[4..].GetBoolean();
set => this._data.Span[4..].SetBoolean(value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator RepairItemRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(RepairItemRequest packet) => packet._data;
}
///
/// Is sent by the client when: A player selected to warp by selecting an entry in the warp list (configured in game client files).
/// Causes reaction on server side: If the player has enough money and is allowed to enter the map, it's getting moved to there.
///
public readonly struct WarpCommandRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public WarpCommandRequest(Memory 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 WarpCommandRequest(Memory 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 => 0x8E;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x02;
///
/// 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 C1HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets a command key, which is generated by a 'secret' algorithm. Not considered in OpenMU.
///
public uint CommandKey
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
///
/// Gets or sets the index of the entry in the warp list.
///
public ushort WarpInfoIndex
{
get => ReadUInt16LittleEndian(this._data.Span[8..]);
set => WriteUInt16LittleEndian(this._data.Span[8..], value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator WarpCommandRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(WarpCommandRequest packet) => packet._data;
}
///
/// Is sent by the client when: Usually: When the player enters an area on the game map which is configured as gate at the client data files. In the special case of wizards, this packet is also used for the teleport skill. When this is the case, GateNumber is 0 and the target coordinates are specified.
/// Causes reaction on server side: If the player is allowed to enter the "gate", it's moved to the corresponding exit gate area.
///
public readonly struct EnterGateRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public EnterGateRequest(Memory 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 EnterGateRequest(Memory 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 => 0x1C;
///
/// 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 C3Header Header => new (this._data);
///
/// Gets or sets the gate number.
///
public ushort GateNumber
{
get => ReadUInt16LittleEndian(this._data.Span[4..]);
set => WriteUInt16LittleEndian(this._data.Span[4..], value);
}
///
/// Gets or sets the teleport target x.
///
public byte TeleportTargetX
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
///
/// Gets or sets the teleport target y.
///
public byte TeleportTargetY
{
get => this._data.Span[7];
set => this._data.Span[7] = value;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator EnterGateRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(EnterGateRequest packet) => packet._data;
}
///
/// Is sent by the client when: Usually: When the player enters an area on the game map which is configured as gate at the client data files. In the special case of wizards, this packet is also used for the teleport skill. When this is the case, GateNumber is 0 and the target coordinates are specified.
/// Causes reaction on server side: If the player is allowed to enter the "gate", it's moved to the corresponding exit gate area.
///
public readonly struct EnterGateRequest075
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public EnterGateRequest075(Memory 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 EnterGateRequest075(Memory 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 => 0x1C;
///
/// 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 C3Header Header => new (this._data);
///
/// Gets or sets the gate number.
///
public byte GateNumber
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
///
/// Gets or sets the teleport target x.
///
public byte TeleportTargetX
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
///
/// Gets or sets the teleport target y.
///
public byte TeleportTargetY
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator EnterGateRequest075(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(EnterGateRequest075 packet) => packet._data;
}
///
/// Is sent by the client when: A wizard uses the 'Teleport Ally' skill to teleport a party member of his view range to a nearby coordinate.
/// Causes reaction on server side: If the target player is in the same party and in the range, it will teleported to the specified coordinates.
///
public readonly struct TeleportTarget
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public TeleportTarget(Memory 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 TeleportTarget(Memory 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 => 0xB0;
///
/// 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 C3Header Header => new (this._data);
///
/// Gets or sets the target id.
///
public ushort TargetId
{
get => ReadUInt16LittleEndian(this._data.Span[3..]);
set => WriteUInt16LittleEndian(this._data.Span[3..], value);
}
///
/// Gets or sets the teleport target x.
///
public byte TeleportTargetX
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
///
/// Gets or sets the teleport target y.
///
public byte TeleportTargetY
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator TeleportTarget(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(TeleportTarget packet) => packet._data;
}
///
/// Is sent by the client when: After the client connected to another server due map change.
/// Causes reaction on server side: The player spawns on the new server.
///
public readonly struct ServerChangeAuthentication
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public ServerChangeAuthentication(Memory 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 ServerChangeAuthentication(Memory 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 => 0xC3;
///
/// Gets the operation code of this data packet.
///
public static byte Code => 0xB1;
///
/// 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 => 69;
///
/// Gets the header of this packet.
///
public C3HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the account xor 3.
///
public Span AccountXor3
{
get => this._data.Slice(4, 12).Span;
}
///
/// Gets or sets the character name xor 3.
///
public Span CharacterNameXor3
{
get => this._data.Slice(16, 12).Span;
}
///
/// Gets or sets the auth code 1.
///
public uint AuthCode1
{
get => ReadUInt32LittleEndian(this._data.Span[28..]);
set => WriteUInt32LittleEndian(this._data.Span[28..], value);
}
///
/// Gets or sets the auth code 2.
///
public uint AuthCode2
{
get => ReadUInt32LittleEndian(this._data.Span[32..]);
set => WriteUInt32LittleEndian(this._data.Span[32..], value);
}
///
/// Gets or sets the auth code 3.
///
public uint AuthCode3
{
get => ReadUInt32LittleEndian(this._data.Span[36..]);
set => WriteUInt32LittleEndian(this._data.Span[36..], value);
}
///
/// Gets or sets the auth code 4.
///
public uint AuthCode4
{
get => ReadUInt32LittleEndian(this._data.Span[40..]);
set => WriteUInt32LittleEndian(this._data.Span[40..], value);
}
///
/// Gets or sets the tick count.
///
public uint TickCount
{
get => ReadUInt32LittleEndian(this._data.Span[44..]);
set => WriteUInt32LittleEndian(this._data.Span[44..], value);
}
///
/// Gets or sets the client version.
///
public Span ClientVersion
{
get => this._data.Slice(48, 5).Span;
}
///
/// Gets or sets the client serial.
///
public Span ClientSerial
{
get => this._data.Slice(53, 16).Span;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator ServerChangeAuthentication(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(ServerChangeAuthentication packet) => packet._data;
}
///
/// Is sent by the client when: The player opened a castle siege npc and requests the current castle siege status information.
/// Causes reaction on server side: The server returns the status of the castle siege event.
///
public readonly struct CastleSiegeStatusRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CastleSiegeStatusRequest(Memory 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 CastleSiegeStatusRequest(Memory 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 => 0xB2;
///
/// 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 => 4;
///
/// Gets the header of this packet.
///
public C1HeaderWithSubCode Header => new (this._data);
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator CastleSiegeStatusRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(CastleSiegeStatusRequest packet) => packet._data;
}
///
/// Is sent by the client when: The player opened a castle siege npc to register his guild alliance.
/// Causes reaction on server side: The server returns the result of the castle siege registration.
///
public readonly struct CastleSiegeRegistrationRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CastleSiegeRegistrationRequest(Memory 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 CastleSiegeRegistrationRequest(Memory 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 => 0xB2;
///
/// 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 C1HeaderWithSubCode Header => new (this._data);
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator CastleSiegeRegistrationRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(CastleSiegeRegistrationRequest packet) => packet._data;
}
///
/// Is sent by the client when: The player opened a castle siege npc to un-register his guild alliance.
/// Causes reaction on server side: The server returns the result of the castle siege un-registration.
///
public readonly struct CastleSiegeUnregisterRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CastleSiegeUnregisterRequest(Memory 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 CastleSiegeUnregisterRequest(Memory 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.IsGivingUp = 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 => 0xB2;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x02;
///
/// 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 C1HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the is giving up.
///
public bool IsGivingUp
{
get => this._data.Span[4..].GetBoolean();
set => this._data.Span[4..].SetBoolean(value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator CastleSiegeUnregisterRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(CastleSiegeUnregisterRequest packet) => packet._data;
}
///
/// Is sent by the client when: The player opened a castle siege npc and requests the state about the own registration.
/// Causes reaction on server side: The server returns the state of the castle siege registration, which includes the number of submitted guild marks.
///
public readonly struct CastleSiegeRegistrationStateRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CastleSiegeRegistrationStateRequest(Memory 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 CastleSiegeRegistrationStateRequest(Memory 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 => 0xB2;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x03;
///
/// 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 C1HeaderWithSubCode Header => new (this._data);
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator CastleSiegeRegistrationStateRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(CastleSiegeRegistrationStateRequest packet) => packet._data;
}
///
/// Is sent by the client when: The player opened a castle siege npc and adds a guild mark to his guilds registration.
/// Causes reaction on server side: The server returns a response, which includes the number of submitted guild marks.
///
public readonly struct CastleSiegeMarkRegistration
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CastleSiegeMarkRegistration(Memory 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 CastleSiegeMarkRegistration(Memory 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 => 0xB2;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x04;
///
/// 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 C1HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the item index.
///
public byte ItemIndex
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator CastleSiegeMarkRegistration(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(CastleSiegeMarkRegistration packet) => packet._data;
}
///
/// Is sent by the client when: The player opened a castle siege npc and requests to buy a gate or statue for a specific position (index)..
/// Causes reaction on server side: The server returns a response.
///
public readonly struct CastleSiegeDefenseBuyRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CastleSiegeDefenseBuyRequest(Memory 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 CastleSiegeDefenseBuyRequest(Memory 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 => 0xB2;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x05;
///
/// 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 C1HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the npc number.
///
public uint NpcNumber
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
///
/// Gets or sets the npc index.
///
public uint NpcIndex
{
get => ReadUInt32LittleEndian(this._data.Span[8..]);
set => WriteUInt32LittleEndian(this._data.Span[8..], value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator CastleSiegeDefenseBuyRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(CastleSiegeDefenseBuyRequest packet) => packet._data;
}
///
/// Is sent by the client when: The player opened a castle siege npc and requests to repair a gate or statue at a specific position (index)..
/// Causes reaction on server side: The server returns a response.
///
public readonly struct CastleSiegeDefenseRepairRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CastleSiegeDefenseRepairRequest(Memory 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 CastleSiegeDefenseRepairRequest(Memory 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 => 0xB2;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x06;
///
/// 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 C1HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the npc number.
///
public uint NpcNumber
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
///
/// Gets or sets the npc index.
///
public uint NpcIndex
{
get => ReadUInt32LittleEndian(this._data.Span[8..]);
set => WriteUInt32LittleEndian(this._data.Span[8..], value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator CastleSiegeDefenseRepairRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(CastleSiegeDefenseRepairRequest packet) => packet._data;
}
///
/// Is sent by the client when: The player opened a castle siege npc and requests to upgrade a gate or statue at a specific position (index)..
/// Causes reaction on server side: The server returns a response.
///
public readonly struct CastleSiegeDefenseUpgradeRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CastleSiegeDefenseUpgradeRequest(Memory 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 CastleSiegeDefenseUpgradeRequest(Memory 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 => 0xB2;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 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 => 20;
///
/// Gets the header of this packet.
///
public C1HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the npc number.
///
public uint NpcNumber
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
///
/// Gets or sets the npc index.
///
public uint NpcIndex
{
get => ReadUInt32LittleEndian(this._data.Span[8..]);
set => WriteUInt32LittleEndian(this._data.Span[8..], value);
}
///
/// Gets or sets the npc upgrade type.
///
public uint NpcUpgradeType
{
get => ReadUInt32LittleEndian(this._data.Span[12..]);
set => WriteUInt32LittleEndian(this._data.Span[12..], value);
}
///
/// Gets or sets the npc upgrade value.
///
public uint NpcUpgradeValue
{
get => ReadUInt32LittleEndian(this._data.Span[16..]);
set => WriteUInt32LittleEndian(this._data.Span[16..], value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator CastleSiegeDefenseUpgradeRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(CastleSiegeDefenseUpgradeRequest packet) => packet._data;
}
///
/// Is sent by the client when: The guild master opened a castle siege npc to manage the castle.
/// Causes reaction on server side: The server returns the tax information.
///
public readonly struct CastleSiegeTaxInfoRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CastleSiegeTaxInfoRequest(Memory 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 CastleSiegeTaxInfoRequest(Memory 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 => 0xB2;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x08;
///
/// 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 C1HeaderWithSubCode Header => new (this._data);
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator CastleSiegeTaxInfoRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(CastleSiegeTaxInfoRequest packet) => packet._data;
}
///
/// Is sent by the client when: The guild master wants to change the tax rate in the castle npc.
/// Causes reaction on server side: The server changes the tax rates accordingly.
///
public readonly struct CastleSiegeTaxChangeRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CastleSiegeTaxChangeRequest(Memory 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 CastleSiegeTaxChangeRequest(Memory 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 => 0xB2;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x09;
///
/// 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 C1HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets 0=Undefined, 1=ChaosMachine, 2 = Normal, 3 = EntranceFeeLandOfTrials
///
public byte TaxType
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
///
/// Gets or sets the tax rate.
///
public uint TaxRate
{
get => ReadUInt32BigEndian(this._data.Span[5..]);
set => WriteUInt32BigEndian(this._data.Span[5..], value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator CastleSiegeTaxChangeRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(CastleSiegeTaxChangeRequest packet) => packet._data;
}
///
/// Is sent by the client when: The guild master wants to withdraw the tax money from the castle npc.
/// Causes reaction on server side: The server moves the money into the inventory of the guild master.
///
public readonly struct CastleSiegeTaxMoneyWithdraw
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CastleSiegeTaxMoneyWithdraw(Memory 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 CastleSiegeTaxMoneyWithdraw(Memory 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 => 0xB2;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x10;
///
/// 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 C1HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the amount.
///
public uint Amount
{
get => ReadUInt32BigEndian(this._data.Span[4..]);
set => WriteUInt32BigEndian(this._data.Span[4..], value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator CastleSiegeTaxMoneyWithdraw(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(CastleSiegeTaxMoneyWithdraw packet) => packet._data;
}
///
/// Is sent by the client when: The guild member of the castle owner wants to toggle the gate switch.
/// Causes reaction on server side: The castle gate is getting opened or closed.
///
public readonly struct ToggleCastleGateRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public ToggleCastleGateRequest(Memory 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 ToggleCastleGateRequest(Memory 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 => 0xB2;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x12;
///
/// 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 C1HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the close state.
///
public bool CloseState
{
get => this._data.Span[4..].GetBoolean();
set => this._data.Span[4..].SetBoolean(value);
}
///
/// Gets or sets the gate id.
///
public ushort GateId
{
get => ReadUInt16BigEndian(this._data.Span[5..]);
set => WriteUInt16BigEndian(this._data.Span[5..], value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator ToggleCastleGateRequest(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(ToggleCastleGateRequest packet) => packet._data;
}
///
/// Is sent by the client when: The guild master sent a command to his guild during the castle siege event.
/// Causes reaction on server side: The command is shown on the mini map of the guild members.
///
public readonly struct CastleGuildCommand
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CastleGuildCommand(Memory 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 CastleGuildCommand(Memory 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 => 0xB2;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x1D;
///
/// 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 C1HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets team Number 0 to 7.
///
public byte Team
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
///
/// Gets or sets the position x.
///
public byte PositionX
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
///
/// Gets or sets the position y.
///
public byte PositionY
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
///
/// Gets or sets 0 = Attack, 1 = Defend, 2 = Wait
///
public byte Command
{
get => this._data.Span[7];
set => this._data.Span[7] = value;
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator CastleGuildCommand(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(CastleGuildCommand packet) => packet._data;
}
///
/// Is sent by the client when: A guild member of the castle owners wants to enter the hunting zone (e.g. Land of Trials).
/// Causes reaction on server side: The server changes the entrance setting of the hunting zone.
///
public readonly struct CastleSiegeHuntingZoneEntranceSetting
{
private readonly Memory _data;
///
/// Initializes a new instance of the struct.
///
/// The underlying data.
public CastleSiegeHuntingZoneEntranceSetting(Memory 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 CastleSiegeHuntingZoneEntranceSetting(Memory 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 => 0xB2;
///
/// Gets the operation sub-code of this data packet.
/// The is used as a grouping key.
///
public static byte SubCode => 0x1F;
///
/// 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 C1HeaderWithSubCode Header => new (this._data);
///
/// Gets or sets the is public.
///
public bool IsPublic
{
get => this._data.Span[4..].GetBoolean();
set => this._data.Span[4..].SetBoolean(value);
}
///
/// Performs an implicit conversion from a Memory of bytes to a .
///
/// The packet as span.
/// The packet as struct.
public static implicit operator CastleSiegeHuntingZoneEntranceSetting(Memory packet) => new (packet, false);
///
/// Performs an implicit conversion from to a Memory of bytes.
///
/// The packet as struct.
/// The packet as byte span.
public static implicit operator Memory(CastleSiegeHuntingZoneEntranceSetting packet) => packet._data;
}
///
/// Is sent by the client when: The guild master opened the castle npc and the client needs a list of all gates.
/// Causes reaction on server side: The server returns the list of gates and their status.
///
public readonly struct CastleSiegeGateListRequest
{
private readonly Memory _data;
///
/// Initializes a new instance of the