// // 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 struct. /// /// The underlying data. public CastleSiegeGateListRequest(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 CastleSiegeGateListRequest(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 => 0xB3; /// /// 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 CastleSiegeGateListRequest(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(CastleSiegeGateListRequest packet) => packet._data; } /// /// Is sent by the client when: The guild master opened the castle npc and the client needs a list of all statues. /// Causes reaction on server side: The server returns the list of statues and their status. /// public readonly struct CastleSiegeStatueListRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CastleSiegeStatueListRequest(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 CastleSiegeStatueListRequest(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 => 0xB3; /// /// 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 => 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 CastleSiegeStatueListRequest(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(CastleSiegeStatueListRequest packet) => packet._data; } /// /// Is sent by the client when: The guild master opened an npc and needs the list of registered guilds for the next siege. /// Causes reaction on server side: The server returns the list of guilds for the next siege. /// public readonly struct CastleSiegeRegisteredGuildsListRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CastleSiegeRegisteredGuildsListRequest(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 CastleSiegeRegisteredGuildsListRequest(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 => 0xB4; /// /// 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 CastleSiegeRegisteredGuildsListRequest(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(CastleSiegeRegisteredGuildsListRequest packet) => packet._data; } /// /// Is sent by the client when: The guild master opened an npc and needs the list of current guilds which are the castle owners. /// Causes reaction on server side: The server returns the list of guilds which are the castle owners. /// public readonly struct CastleOwnerListRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CastleOwnerListRequest(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 CastleOwnerListRequest(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 => 0xB5; /// /// 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 CastleOwnerListRequest(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(CastleOwnerListRequest packet) => packet._data; } /// /// Is sent by the client when: A player wants to fire a catapult during the castle siege event. /// Causes reaction on server side: The server fires the catapult. /// public readonly struct FireCatapultRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public FireCatapultRequest(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 FireCatapultRequest(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 => 0xB7; /// /// 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 => 7; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the catapult id. /// public ushort CatapultId { get => ReadUInt16BigEndian(this._data.Span[4..]); set => WriteUInt16BigEndian(this._data.Span[4..], value); } /// /// Gets or sets the target area index. /// public byte TargetAreaIndex { 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 FireCatapultRequest(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(FireCatapultRequest packet) => packet._data; } /// /// Is sent by the client when: After the player fired a catapult and hit another catapult. /// Causes reaction on server side: The server damages the other catapult. /// public readonly struct WeaponExplosionRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public WeaponExplosionRequest(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 WeaponExplosionRequest(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 => 0xB7; /// /// 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 => 6; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the catapult id. /// public ushort CatapultId { get => ReadUInt16BigEndian(this._data.Span[4..]); set => WriteUInt16BigEndian(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 WeaponExplosionRequest(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(WeaponExplosionRequest packet) => packet._data; } /// /// Is sent by the client when: The client requests the guild logo of the current castle owner guild. /// Causes reaction on server side: The server returns the guild logo. /// public readonly struct GuildLogoOfCastleOwnerRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildLogoOfCastleOwnerRequest(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 GuildLogoOfCastleOwnerRequest(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 => 0xB9; /// /// 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 => 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 GuildLogoOfCastleOwnerRequest(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(GuildLogoOfCastleOwnerRequest 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 takes the entrance money, puts it into the tax wallet and warps the player to the hunting zone. /// public readonly struct CastleSiegeHuntingZoneEnterRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CastleSiegeHuntingZoneEnterRequest(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 CastleSiegeHuntingZoneEnterRequest(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 => 0xB9; /// /// 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 => 8; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the money. /// public uint Money { 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 CastleSiegeHuntingZoneEnterRequest(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(CastleSiegeHuntingZoneEnterRequest packet) => packet._data; } /// /// Is sent by the client when: A player enters the crywolf map. /// Causes reaction on server side: The server returns data about the state of the crywolf map. /// public readonly struct CrywolfInfoRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CrywolfInfoRequest(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 CrywolfInfoRequest(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 => 0xBD; /// /// 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 CrywolfInfoRequest(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(CrywolfInfoRequest packet) => packet._data; } /// /// Is sent by the client when: A player wants to make a contract at the crywolf statue for the crywolf event. /// Causes reaction on server side: The server tries to enter a contract with the player and the specified statue. /// public readonly struct CrywolfContractRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CrywolfContractRequest(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 CrywolfContractRequest(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 => 0xBD; /// /// 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 C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the statue id. /// public ushort StatueId { get => ReadUInt16BigEndian(this._data.Span[4..]); set => WriteUInt16BigEndian(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 CrywolfContractRequest(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(CrywolfContractRequest packet) => packet._data; } /// /// Is sent by the client when: A player opens an item crafting dialog, e.g. the chaos machine. /// Causes reaction on server side: The server returns data about the state of the benefit of the crywolf event. If it was won before, the chaos rate wents up a few percent. /// public readonly struct CrywolfChaosRateBenefitRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CrywolfChaosRateBenefitRequest(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 CrywolfChaosRateBenefitRequest(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 => 0xBD; /// /// 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 => 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 CrywolfChaosRateBenefitRequest(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(CrywolfChaosRateBenefitRequest packet) => packet._data; } /// /// Is sent by the client when: ?. /// Causes reaction on server side: ?. /// public readonly struct WhiteAngelItemRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public WhiteAngelItemRequest(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 WhiteAngelItemRequest(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 => 0xD0; /// /// 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 WhiteAngelItemRequest(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(WhiteAngelItemRequest packet) => packet._data; } /// /// Is sent by the client when: A player is running the quest "Infiltrate The Barracks of Balgass" (nr. 5), talking to the Werewolf npc in Crywolf. /// Causes reaction on server side: It will warp the player to the map 'Barracks of Balgass' where the required monsters have to be killed to proceed with the quest. /// public readonly struct EnterOnWerewolfRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public EnterOnWerewolfRequest(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 EnterOnWerewolfRequest(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 => 0xD0; /// /// 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 => 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 EnterOnWerewolfRequest(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(EnterOnWerewolfRequest packet) => packet._data; } /// /// Is sent by the client when: A player is running the quest "Into the 'Darkness' Zone" (nr. 6), talking to the gatekeeper npc in 'Barracks of Balgass'. /// Causes reaction on server side: It will warp the player to the map 'Balgass Refuge' where the required monsters have to be killed to proceed with the quest. /// public readonly struct EnterOnGatekeeperRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public EnterOnGatekeeperRequest(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 EnterOnGatekeeperRequest(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 => 0xD0; /// /// 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 EnterOnGatekeeperRequest(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(EnterOnGatekeeperRequest packet) => packet._data; } /// /// Is sent by the client when: The player talks to the npc "Leo the Helper" and requests an item. /// Causes reaction on server side: The item will drop on the ground. /// public readonly struct LeoHelperItemRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LeoHelperItemRequest(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 LeoHelperItemRequest(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 => 0xD0; /// /// 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 => 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 LeoHelperItemRequest(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(LeoHelperItemRequest packet) => packet._data; } /// /// Is sent by the client when: The player talks to the npc "Snowman" in Santa Village and requests to warp back to devias. /// Causes reaction on server side: The player will be warped back to Devias. /// public readonly struct MoveToDeviasBySnowmanRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MoveToDeviasBySnowmanRequest(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 MoveToDeviasBySnowmanRequest(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 => 0xD0; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0A; /// /// 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 MoveToDeviasBySnowmanRequest(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(MoveToDeviasBySnowmanRequest packet) => packet._data; } /// /// Is sent by the client when: The player talks to the npc "Santa Claus" and requests an item. /// Causes reaction on server side: The item will drop on the ground. /// public readonly struct SantaClausItemRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SantaClausItemRequest(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 SantaClausItemRequest(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 => 0xD0; /// /// 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 => 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 SantaClausItemRequest(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(SantaClausItemRequest packet) => packet._data; } /// /// Is sent by the client when: A player talks with the kanturu entrance npc, and shows the enter dialog. /// Causes reaction on server side: The server returns data about the state of the kanturu event map. /// public readonly struct KanturuInfoRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public KanturuInfoRequest(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 KanturuInfoRequest(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 => 0xD1; /// /// 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 KanturuInfoRequest(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(KanturuInfoRequest packet) => packet._data; } /// /// Is sent by the client when: A player requests to enter the kanturu event map. /// Causes reaction on server side: The server checks, if entrance is possible and acts accordingly. /// public readonly struct KanturuEnterRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public KanturuEnterRequest(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 KanturuEnterRequest(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 => 0xD1; /// /// 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 KanturuEnterRequest(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(KanturuEnterRequest packet) => packet._data; } /// /// Is sent by the client when: ? /// Causes reaction on server side: ? /// public readonly struct RaklionStateInfoRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RaklionStateInfoRequest(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 RaklionStateInfoRequest(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 => 0xD1; /// /// 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 => 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 RaklionStateInfoRequest(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(RaklionStateInfoRequest packet) => packet._data; } /// /// Is sent by the client when: The client needs information about how many cash shop points (WCoinC, WCoinP, GoblinPoints) are available to the player. /// Causes reaction on server side: The server returns the cash shop points information. /// public readonly struct CashShopPointInfoRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CashShopPointInfoRequest(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 CashShopPointInfoRequest(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 => 0xD2; /// /// 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 CashShopPointInfoRequest(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(CashShopPointInfoRequest packet) => packet._data; } /// /// Is sent by the client when: The player opens or closes the cash shop dialog. /// Causes reaction on server side: In case of opening, the server returns if the cash shop is available. If the player is in the safezone, it's not. /// public readonly struct CashShopOpenState { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CashShopOpenState(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 CashShopOpenState(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 => 0xD2; /// /// 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 closed. /// public bool IsClosed { 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 CashShopOpenState(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(CashShopOpenState packet) => packet._data; } /// /// Is sent by the client when: The player wants to buy an item in the cash shop. /// Causes reaction on server side: The item is bought and added to the cash shop item storage of the player. /// public readonly struct CashShopItemBuyRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CashShopItemBuyRequest(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 CashShopItemBuyRequest(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 => 0xD2; /// /// 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 => 23; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the package main index. /// public uint PackageMainIndex { get => ReadUInt32LittleEndian(this._data.Span[4..]); set => WriteUInt32LittleEndian(this._data.Span[4..], value); } /// /// Gets or sets the category. /// public uint Category { get => ReadUInt32LittleEndian(this._data.Span[8..]); set => WriteUInt32LittleEndian(this._data.Span[8..], value); } /// /// Gets or sets the product main index. /// public uint ProductMainIndex { get => ReadUInt32LittleEndian(this._data.Span[12..]); set => WriteUInt32LittleEndian(this._data.Span[12..], value); } /// /// Gets or sets the item index. /// public ushort ItemIndex { get => ReadUInt16LittleEndian(this._data.Span[16..]); set => WriteUInt16LittleEndian(this._data.Span[16..], value); } /// /// Gets or sets the coin index. /// public uint CoinIndex { get => ReadUInt32LittleEndian(this._data.Span[18..]); set => WriteUInt32LittleEndian(this._data.Span[18..], value); } /// /// Gets or sets the mileage flag. /// public byte MileageFlag { get => this._data.Span[22]; set => this._data.Span[22] = value; } /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CashShopItemBuyRequest(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(CashShopItemBuyRequest packet) => packet._data; } /// /// Is sent by the client when: The player wants to send a gift to another player. /// Causes reaction on server side: The server buys the item with the credits of the player and sends it as gift to the other player. /// public readonly struct CashShopItemGiftRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CashShopItemGiftRequest(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 CashShopItemGiftRequest(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 => 0xD2; /// /// 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 => 234; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the package main index. /// public uint PackageMainIndex { get => ReadUInt32LittleEndian(this._data.Span[4..]); set => WriteUInt32LittleEndian(this._data.Span[4..], value); } /// /// Gets or sets the category. /// public uint Category { get => ReadUInt32LittleEndian(this._data.Span[8..]); set => WriteUInt32LittleEndian(this._data.Span[8..], value); } /// /// Gets or sets the product main index. /// public uint ProductMainIndex { get => ReadUInt32LittleEndian(this._data.Span[12..]); set => WriteUInt32LittleEndian(this._data.Span[12..], value); } /// /// Gets or sets the item index. /// public ushort ItemIndex { get => ReadUInt16LittleEndian(this._data.Span[16..]); set => WriteUInt16LittleEndian(this._data.Span[16..], value); } /// /// Gets or sets the coin index. /// public uint CoinIndex { get => ReadUInt32LittleEndian(this._data.Span[18..]); set => WriteUInt32LittleEndian(this._data.Span[18..], value); } /// /// Gets or sets the mileage flag. /// public byte MileageFlag { get => this._data.Span[22]; set => this._data.Span[22] = value; } /// /// Gets or sets the gift receiver name. /// public string GiftReceiverName { get => this._data.Span.ExtractString(23, 11, System.Text.Encoding.UTF8); set => this._data.Slice(23, 11).Span.WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the gift text. /// public string GiftText { get => this._data.Span.ExtractString(34, 200, System.Text.Encoding.UTF8); set => this._data.Slice(34, 200).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 CashShopItemGiftRequest(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(CashShopItemGiftRequest packet) => packet._data; } /// /// Is sent by the client when: The player opened the cash shop dialog or used paging of the storage. /// Causes reaction on server side: In case of opening, the server returns if the cash shop is available. If the player is in the safezone, it's not. /// public readonly struct CashShopStorageListRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CashShopStorageListRequest(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 CashShopStorageListRequest(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 => 0xD2; /// /// 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 => 10; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the page index. /// public uint PageIndex { get => ReadUInt32LittleEndian(this._data.Span[4..]); set => WriteUInt32LittleEndian(this._data.Span[4..], value); } /// /// Gets or sets the inventory type. /// public byte InventoryType { get => this._data.Span[8]; set => 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 CashShopStorageListRequest(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(CashShopStorageListRequest packet) => packet._data; } /// /// Is sent by the client when: The player wants to delete an item of the cash shop storage. /// Causes reaction on server side: The server removes the item from cash shop storage. /// public readonly struct CashShopDeleteStorageItemRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CashShopDeleteStorageItemRequest(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 CashShopDeleteStorageItemRequest(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 => 0xD2; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0A; /// /// 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 => 234; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the base item code. /// public uint BaseItemCode { get => ReadUInt32LittleEndian(this._data.Span[4..]); set => WriteUInt32LittleEndian(this._data.Span[4..], value); } /// /// Gets or sets the main item code. /// public uint MainItemCode { get => ReadUInt32LittleEndian(this._data.Span[8..]); set => WriteUInt32LittleEndian(this._data.Span[8..], value); } /// /// Gets or sets the product type. /// public byte ProductType { get => this._data.Span[12]; set => this._data.Span[12] = value; } /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CashShopDeleteStorageItemRequest(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(CashShopDeleteStorageItemRequest packet) => packet._data; } /// /// Is sent by the client when: The player wants to get or consume an item which is in the cash shop storage. /// Causes reaction on server side: The item is applied or added to the inventory. /// public readonly struct CashShopStorageItemConsumeRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CashShopStorageItemConsumeRequest(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 CashShopStorageItemConsumeRequest(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 => 0xD2; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0B; /// /// 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 => 15; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the base item code. /// public uint BaseItemCode { get => ReadUInt32LittleEndian(this._data.Span[4..]); set => WriteUInt32LittleEndian(this._data.Span[4..], value); } /// /// Gets or sets the main item code. /// public uint MainItemCode { get => ReadUInt32LittleEndian(this._data.Span[8..]); set => WriteUInt32LittleEndian(this._data.Span[8..], value); } /// /// Gets or sets the item index. /// public ushort ItemIndex { get => ReadUInt16LittleEndian(this._data.Span[12..]); set => WriteUInt16LittleEndian(this._data.Span[12..], value); } /// /// Gets or sets the product type. /// public byte ProductType { get => this._data.Span[14]; set => this._data.Span[14] = value; } /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CashShopStorageItemConsumeRequest(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(CashShopStorageItemConsumeRequest packet) => packet._data; } /// /// Is sent by the client when: When the player wants to see through the event item list. /// Causes reaction on server side: The server sends a list with event items back. /// public readonly struct CashShopEventItemListRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CashShopEventItemListRequest(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 CashShopEventItemListRequest(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 => 0xD2; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x13; /// /// 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 category index. /// public uint CategoryIndex { 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 CashShopEventItemListRequest(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(CashShopEventItemListRequest packet) => packet._data; } /// /// Is sent by the client when: The player wants to unlock the protected vault with a pin. /// Causes reaction on server side: The vault lock state on the server is updated. VaultProtectionInformation is sent as response. /// public readonly struct UnlockVault { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public UnlockVault(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 UnlockVault(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 => 0x83; /// /// 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 => 7; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the pin. /// public ushort Pin { get => ReadUInt16LittleEndian(this._data.Span[4..]); set => WriteUInt16LittleEndian(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 UnlockVault(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(UnlockVault packet) => packet._data; } /// /// Is sent by the client when: The player wants to set a new pin for the vault when it's in unlocked state. /// Causes reaction on server side: The vault pin is set. VaultProtectionInformation is sent as response. /// public readonly struct SetVaultPin { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SetVaultPin(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 SetVaultPin(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 => 0x83; /// /// 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 => 27; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the pin. /// public ushort Pin { get => ReadUInt16LittleEndian(this._data.Span[4..]); set => WriteUInt16LittleEndian(this._data.Span[4..], value); } /// /// Gets or sets the password of the account, which is required to set a new vault pin. /// public string Password { get => this._data.Span.ExtractString(6, 20, System.Text.Encoding.UTF8); set => this._data.Slice(6, 20).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 SetVaultPin(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(SetVaultPin packet) => packet._data; } /// /// Is sent by the client when: The player wants to remove the pin for the vault when it's in unlocked state. /// Causes reaction on server side: The vault pin is removed. VaultProtectionInformation is sent as response. /// public readonly struct RemoveVaultPin { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RemoveVaultPin(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 RemoveVaultPin(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 => 0x83; /// /// 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 => 27; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the password of the account, which is required to remove the vault pin. /// public string Password { get => this._data.Span.ExtractString(6, 20, System.Text.Encoding.UTF8); set => this._data.Slice(6, 20).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 RemoveVaultPin(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(RemoveVaultPin packet) => packet._data; } /// /// Is sent by the client when: The player closed an opened vault dialog. /// Causes reaction on server side: The state on the server is updated. /// public readonly struct VaultClosed { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public VaultClosed(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 VaultClosed(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 => 0x82; /// /// 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 VaultClosed(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(VaultClosed packet) => packet._data; } /// /// Is sent by the client when: The player wants to move money from or to the vault storage. /// Causes reaction on server side: The money is moved, if possible. /// public readonly struct VaultMoveMoneyRequest { /// /// Defines the moving direction of money between inventory and vault. /// public enum VaultMoneyMoveDirection { /// /// The money is moved from the inventory to the vault. /// InventoryToVault = 0, /// /// The money is moved from the vault to the inventory. /// VaultToInventory = 1, } private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public VaultMoveMoneyRequest(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 VaultMoveMoneyRequest(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 => 0x81; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the direction. /// public VaultMoveMoneyRequest.VaultMoneyMoveDirection Direction { get => (VaultMoneyMoveDirection)this._data.Span[3]; set => this._data.Span[3] = (byte)value; } /// /// Gets or sets the amount. /// public uint Amount { 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 VaultMoveMoneyRequest(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(VaultMoveMoneyRequest packet) => packet._data; } /// /// Is sent by the client when: When a player has the Lahap npc dialog open and wants to combine or disband jewel stacks. /// Causes reaction on server side: If successful, the inventory is updated and the game client gets corresponding responses. /// public readonly struct LahapJewelMixRequest { /// /// Describes what kind of operation is requested. /// public enum MixType { /// /// The player wants to mix single jewels into a bundle. /// Mix = 0, /// /// The player wants to disband a bundle into single jewels. /// Unmix = 1, } /// /// Describes the size of a mixed stack. /// public enum StackSize { /// /// A stack of 10 items. /// Ten = 0, /// /// A stack of 20 items. /// Twenty = 1, /// /// A stack of 30 items. /// Thirty = 2, } /// /// Describes the type of item which is mixed or unmixed. /// public enum ItemType { /// /// Jewel of Bless. /// JewelOfBless = 0, /// /// Jewel of Soul. /// JewelOfSoul = 1, /// /// Jewel of Life. /// JewelOfLife = 2, /// /// Jewel of Creation. /// JewelOfCreation = 3, /// /// Jewel of Guardian. /// JewelOfGuardian = 4, /// /// The gemstone. /// Gemstone = 5, /// /// Jewel of Harmony. /// JewelOfHarmony = 6, /// /// Jewel of Chaos. /// JewelOfChaos = 7, /// /// Lower refine stone. /// LowerRefineStone = 8, /// /// Higher refine stone. /// HigherRefineStone = 9, } private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LahapJewelMixRequest(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 LahapJewelMixRequest(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 => 0xBC; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the operation. /// public LahapJewelMixRequest.MixType Operation { get => (MixType)this._data.Span[3]; set => this._data.Span[3] = (byte)value; } /// /// Gets or sets the item. /// public LahapJewelMixRequest.ItemType Item { get => (ItemType)this._data.Span[4]; set => this._data.Span[4] = (byte)value; } /// /// Gets or sets the mixing stack size. /// public LahapJewelMixRequest.StackSize MixingStackSize { get => (StackSize)this._data.Span[5]; set => this._data.Span[5] = (byte)value; } /// /// Gets or sets the unmixing source slot. /// public byte UnmixingSourceSlot { 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 LahapJewelMixRequest(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(LahapJewelMixRequest packet) => packet._data; } /// /// Is sent by the client when: When the player opens the party menu in the game client. /// Causes reaction on server side: If the player is in a party, the server sends back a list with information about all players of the party. /// public readonly struct PartyListRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PartyListRequest(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 PartyListRequest(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 => 0x42; /// /// 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 PartyListRequest(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(PartyListRequest packet) => packet._data; } /// /// Is sent by the client when: A party master wants to kick another player from his party, or when a player wants to kick himself from his party. /// Causes reaction on server side: If the sending player is the party master, or the player wants to kick himself, the target player is removed from the party. /// public readonly struct PartyPlayerKickRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PartyPlayerKickRequest(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 PartyPlayerKickRequest(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 => 0x43; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the player index. /// public byte PlayerIndex { 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 PartyPlayerKickRequest(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(PartyPlayerKickRequest packet) => packet._data; } /// /// Is sent by the client when: A party master wants to invite another player to his party. /// Causes reaction on server side: If the requesting player has no party, or is the party master, a request is sent to the target player. /// public readonly struct PartyInviteRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PartyInviteRequest(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 PartyInviteRequest(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 => 0x40; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the target player id. /// public ushort TargetPlayerId { 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 PartyInviteRequest(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(PartyInviteRequest packet) => packet._data; } /// /// Is sent by the client when: A player was invited by another player to join a party and this player sent the response back. /// Causes reaction on server side: If the sender accepts the request, it's added to the party. /// public readonly struct PartyInviteResponse { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PartyInviteResponse(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 PartyInviteResponse(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 => 0x41; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the accepted. /// public bool Accepted { get => this._data.Span[3..].GetBoolean(); set => this._data.Span[3..].SetBoolean(value); } /// /// Gets or sets the requester id. /// public ushort RequesterId { get => ReadUInt16BigEndian(this._data.Span[4..]); set => WriteUInt16BigEndian(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 PartyInviteResponse(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(PartyInviteResponse packet) => packet._data; } /// /// Is sent by the client when: A player wants to walk on the game map. /// Causes reaction on server side: The player gets moved on the map, visible for other surrounding players. /// public readonly struct WalkRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public WalkRequest(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 WalkRequest(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 => 0xD4; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the source x. /// public byte SourceX { get => this._data.Span[3]; set => this._data.Span[3] = value; } /// /// Gets or sets the source y. /// public byte SourceY { get => this._data.Span[4]; set => this._data.Span[4] = value; } /// /// Gets or sets the step count. /// public byte StepCount { get => this._data.Span[5..].GetByteValue(4, 0); set => this._data.Span[5..].SetByteValue(value, 4, 0); } /// /// Gets or sets the target rotation. /// public byte TargetRotation { get => this._data.Span[5..].GetByteValue(4, 4); set => this._data.Span[5..].SetByteValue(value, 4, 4); } /// /// Gets or sets the directions of the walking path. The target is calculated by taking the source coordinates and applying the directions to it. /// public Span Directions { get => this._data.Slice(6).Span; } /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator WalkRequest(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(WalkRequest packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int directionsLength) => directionsLength + 6; } /// /// Is sent by the client when: A player wants to walk on the game map. /// Causes reaction on server side: The player gets moved on the map, visible for other surrounding players. /// public readonly struct WalkRequest075 { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public WalkRequest075(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 WalkRequest075(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 => 0x10; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the source x. /// public byte SourceX { get => this._data.Span[3]; set => this._data.Span[3] = value; } /// /// Gets or sets the source y. /// public byte SourceY { get => this._data.Span[4]; set => this._data.Span[4] = value; } /// /// Gets or sets the step count. /// public byte StepCount { get => this._data.Span[5..].GetByteValue(4, 0); set => this._data.Span[5..].SetByteValue(value, 4, 0); } /// /// Gets or sets the target rotation. /// public byte TargetRotation { get => this._data.Span[5..].GetByteValue(4, 4); set => this._data.Span[5..].SetByteValue(value, 4, 4); } /// /// Gets or sets the directions of the walking path. The target is calculated by taking the source coordinates and applying the directions to it. /// public Span Directions { get => this._data.Slice(6).Span; } /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator WalkRequest075(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(WalkRequest075 packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int directionsLength) => directionsLength + 6; } /// /// Is sent by the client when: It's sent when the player performs specific skills. /// Causes reaction on server side: Usually, the player is moved instantly to the specified coordinates on the current map. In OpenMU, this request is not handled, because it allows hackers to "teleport" to any coordinates. /// public readonly struct InstantMoveRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public InstantMoveRequest(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 InstantMoveRequest(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 => 0x15; /// /// 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 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; } /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator InstantMoveRequest(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(InstantMoveRequest packet) => packet._data; } /// /// Is sent by the client when: A player does any kind of animation. /// Causes reaction on server side: The animation number and rotation is forwarded to all surrounding players. /// public readonly struct AnimationRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AnimationRequest(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 AnimationRequest(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 => 0x18; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data.Span[3]; set => this._data.Span[3] = value; } /// /// Gets or sets the animation number. /// public byte AnimationNumber { 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 AnimationRequest(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(AnimationRequest packet) => packet._data; } /// /// Is sent by the client when: After a successful login or after the player decided to leave the game world to go back to the character selection screen. /// Causes reaction on server side: The server sends the character list with all available characters. /// public readonly struct RequestCharacterList { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RequestCharacterList(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 RequestCharacterList(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 => 0xF3; /// /// 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 => 5; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the language. /// public byte Language { 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 RequestCharacterList(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(RequestCharacterList packet) => packet._data; } /// /// Is sent by the client when: The game client is at the character selection screen and the player requests to add a new character. /// Causes reaction on server side: The server checks if the player is allowed to create the character and sends a response back. /// public readonly struct CreateCharacter { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CreateCharacter(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 CreateCharacter(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 => 0xF3; /// /// 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 => 15; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the name of the character which should be created. /// public string Name { get => this._data.Span.ExtractString(4, 10, System.Text.Encoding.UTF8); set => this._data.Slice(4, 10).Span.WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the character class of the character which should be created. /// public CharacterClassNumber Class { get => (CharacterClassNumber)this._data.Span[14..].GetByteValue(6, 2); set => this._data.Span[14..].SetByteValue((byte)value, 6, 2); } /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CreateCharacter(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(CreateCharacter packet) => packet._data; } /// /// Is sent by the client when: The game client is at the character selection screen and the player requests to delete an existing character. /// Causes reaction on server side: The server checks if the player transmitted the correct security code and if the character actually exists. If all is valid, it deletes the character from the account. It then sends a response with a result code back to the game client. /// public readonly struct DeleteCharacter { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DeleteCharacter(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 DeleteCharacter(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 => 0xF3; /// /// 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 => 24; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the name of the character which should be deleted. /// public string Name { get => this._data.Span.ExtractString(4, 10, System.Text.Encoding.UTF8); set => this._data.Slice(4, 10).Span.WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets a security code (7 bytes long). Some game clients/servers also expect to transmit the account password (up to 20 bytes long) here. In OpenMU, we work with the security here, but are not limiting to a length of 7 bytes. /// public string SecurityCode { get => this._data.Span.ExtractString(14, this._data.Length - 14, System.Text.Encoding.UTF8); set => this._data.Slice(14).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 DeleteCharacter(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(DeleteCharacter packet) => packet._data; /// /// Calculates the size of the packet for the specified field content. /// /// The content of the variable 'SecurityCode' field from which the size will be calculated. public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 14; /// /// Calculates the size of the packet for the specified field content. /// /// The content length in bytes of the variable 'SecurityCode' field from which the size will be calculated. public static int GetRequiredSize(int contentLength) => contentLength + 1 + 14; } /// /// Is sent by the client when: The player selects a character to enter the game world on the character selection screen. /// Causes reaction on server side: The player joins the game world with the specified character. /// public readonly struct SelectCharacter { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SelectCharacter(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 SelectCharacter(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 => 0xF3; /// /// 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 => 14; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the name of the character with which the player wants to join the game world /// public string Name { get => this._data.Span.ExtractString(4, 10, System.Text.Encoding.UTF8); set => this._data.Slice(4, 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 SelectCharacter(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(SelectCharacter packet) => packet._data; } /// /// Is sent by the client when: The player focuses (clicks on it) a character with which he plans to enter the game world on the character selection screen. /// Causes reaction on server side: The server checks if this character exists and sends a response back. If successful, the game client highlights the focused character. /// public readonly struct FocusCharacter { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public FocusCharacter(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 FocusCharacter(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 => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x15; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 14; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the name. /// public string Name { get => this._data.Span.ExtractString(4, 10, System.Text.Encoding.UTF8); set => this._data.Slice(4, 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 FocusCharacter(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(FocusCharacter packet) => packet._data; } /// /// Is sent by the client when: The player decides to add a stat point to a specific stat type, by pressing a plus-button in the character info menu. /// Causes reaction on server side: The server checks if a level-up-point is available. If yes, it adds the point to the specified stat type. It sends a response back to the client. /// public readonly struct IncreaseCharacterStatPoint { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public IncreaseCharacterStatPoint(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 IncreaseCharacterStatPoint(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 => 0xF3; /// /// 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 => 5; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the stat type. /// public CharacterStatAttribute StatType { get => (CharacterStatAttribute)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 IncreaseCharacterStatPoint(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(IncreaseCharacterStatPoint packet) => packet._data; } /// /// Is sent by the client when: The player bought or sold an item through his personal shop. /// Causes reaction on server side: The server sends the inventory list back to the client. /// public readonly struct InventoryRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public InventoryRequest(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 InventoryRequest(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 => 0xF3; /// /// 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 => 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 InventoryRequest(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(InventoryRequest packet) => packet._data; } /// /// Is sent by the client when: After the server sent a map change message and the client has initialized the game map visualization. /// Causes reaction on server side: The character is added to the internal game map and ready to interact with other entities. /// public readonly struct ClientReadyAfterMapChange { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ClientReadyAfterMapChange(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 ClientReadyAfterMapChange(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 => 0xF3; /// /// 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 => 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 ClientReadyAfterMapChange(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(ClientReadyAfterMapChange packet) => packet._data; } /// /// Is sent by the client when: When leaving the game world with a character. /// Causes reaction on server side: The server saves this configuration in its database. /// public readonly struct SaveKeyConfiguration { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SaveKeyConfiguration(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 SaveKeyConfiguration(Memory data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x30; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the binary data of the key configuration /// public Span Configuration { get => this._data.Slice(4).Span; } /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator SaveKeyConfiguration(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(SaveKeyConfiguration packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int configurationLength) => configurationLength + 4; } /// /// Is sent by the client when: The player wants to add or increase the level of a specific master skill of the master skill tree. /// Causes reaction on server side: Adds or increases the master skill level of the specified skill, if the character is allowed to do that. A response is sent back to the client. /// public readonly struct AddMasterSkillPoint { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AddMasterSkillPoint(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 AddMasterSkillPoint(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 => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x52; /// /// 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 C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the skill id. /// public ushort SkillId { get => ReadUInt16LittleEndian(this._data.Span[4..]); set => WriteUInt16LittleEndian(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 AddMasterSkillPoint(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(AddMasterSkillPoint packet) => packet._data; } /// /// Is sent by the client when: A player attacks a target without using a skill. /// Causes reaction on server side: Damage is calculated and the target is hit, if the attack was successful. A response is sent back with the caused damage, and all surrounding players get an animation message. /// public readonly struct HitRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public HitRequest(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 HitRequest(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 => 0x11; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data.Span[3..]); set => WriteUInt16BigEndian(this._data.Span[3..], value); } /// /// Gets or sets the attack animation. /// public byte AttackAnimation { get => this._data.Span[5]; set => this._data.Span[5] = value; } /// /// Gets or sets the looking direction. /// public byte LookingDirection { 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 HitRequest(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(HitRequest packet) => packet._data; } /// /// Is sent by the client when: A player performs a skill with a target, e.g. attacking or buffing. /// Causes reaction on server side: Damage is calculated and the target is hit, if the attack was successful. A response is sent back with the caused damage, and all surrounding players get an animation message. /// public readonly struct TargetedSkill { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TargetedSkill(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 TargetedSkill(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 => 0x19; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C3Header Header => new (this._data); /// /// Gets or sets the skill id. /// public ushort SkillId { get => ReadUInt16BigEndian(this._data.Span[3..]); set => WriteUInt16BigEndian(this._data.Span[3..], value); } /// /// Gets or sets the target id. /// public ushort TargetId { 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 TargetedSkill(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(TargetedSkill packet) => packet._data; } /// /// Is sent by the client when: A player performs a skill with a target, e.g. attacking or buffing. /// Causes reaction on server side: Damage is calculated and the target is hit, if the attack was successful. A response is sent back with the caused damage, and all surrounding players get an animation message. /// public readonly struct TargetedSkill075 { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TargetedSkill075(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 TargetedSkill075(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 => 0x19; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 6; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the index of the skill in the skill list. /// public byte SkillIndex { get => this._data.Span[3]; set => this._data.Span[3] = value; } /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data.Span[4..]); set => WriteUInt16BigEndian(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 TargetedSkill075(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(TargetedSkill075 packet) => packet._data; } /// /// Is sent by the client when: A player performs a skill with a target, e.g. attacking or buffing. /// Causes reaction on server side: Damage is calculated and the target is hit, if the attack was successful. A response is sent back with the caused damage, and all surrounding players get an animation message. /// public readonly struct TargetedSkill095 { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TargetedSkill095(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 TargetedSkill095(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 => 0x19; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 6; /// /// Gets the header of this packet. /// public C3Header Header => new (this._data); /// /// Gets or sets the index of the skill in the skill list. /// public byte SkillIndex { get => this._data.Span[3]; set => this._data.Span[3] = value; } /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data.Span[4..]); set => WriteUInt16BigEndian(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 TargetedSkill095(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(TargetedSkill095 packet) => packet._data; } /// /// Is sent by the client when: A player cancels a specific magic effect of a skill, usually 'Infinity Arrow' and 'Wizardry Enhance'. /// Causes reaction on server side: The effect is cancelled and an update is sent to the player and all surrounding players. /// public readonly struct MagicEffectCancelRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MagicEffectCancelRequest(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 MagicEffectCancelRequest(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 => 0x1B; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the skill id. /// public ushort SkillId { get => ReadUInt16BigEndian(this._data.Span[3..]); set => WriteUInt16BigEndian(this._data.Span[3..], value); } /// /// Gets or sets the player id. /// public ushort PlayerId { 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 MagicEffectCancelRequest(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(MagicEffectCancelRequest packet) => packet._data; } /// /// Is sent by the client when: A player is performing an skill which affects an area of the map. /// Causes reaction on server side: It's forwarded to all surrounding players, so that the animation is visible. In the original server implementation, no damage is done yet for attack skills - there are separate hit packets. /// public readonly struct AreaSkill { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AreaSkill(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 AreaSkill(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 => 0x1E; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 13; /// /// Gets the header of this packet. /// public C3Header Header => new (this._data); /// /// Gets or sets the skill id. /// public ushort SkillId { get => ReadUInt16BigEndian(this._data.Span[3..]); set => WriteUInt16BigEndian(this._data.Span[3..], value); } /// /// Gets or sets the target x. /// public byte TargetX { get => this._data.Span[5]; set => this._data.Span[5] = value; } /// /// Gets or sets the target y. /// public byte TargetY { get => this._data.Span[6]; set => this._data.Span[6] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data.Span[7]; set => this._data.Span[7] = value; } /// /// Gets or sets the extra target id. /// public ushort ExtraTargetId { get => ReadUInt16BigEndian(this._data.Span[10..]); set => WriteUInt16BigEndian(this._data.Span[10..], value); } /// /// Gets or sets animation counter which acts as a reference to the previously sent Area Skill Animation packet. /// public byte AnimationCounter { get => this._data.Span[12]; set => this._data.Span[12] = value; } /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AreaSkill(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(AreaSkill packet) => packet._data; } /// /// Is sent by the client when: An area skill was performed and the client decided to hit a target. /// Causes reaction on server side: The server is calculating the damage and applying it to the target. The attacker gets a response back with the caused damage. /// public readonly struct AreaSkillHit { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AreaSkillHit(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 AreaSkillHit(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 => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xDB; /// /// Gets the header of this packet. /// public C3Header Header => new (this._data); /// /// Gets or sets the skill id. /// public ushort SkillId { get => ReadUInt16BigEndian(this._data.Span[3..]); set => WriteUInt16BigEndian(this._data.Span[3..], value); } /// /// Gets or sets the target x. /// public byte TargetX { get => this._data.Span[5]; set => this._data.Span[5] = value; } /// /// Gets or sets the target y. /// public byte TargetY { get => this._data.Span[6]; set => this._data.Span[6] = value; } /// /// Gets or sets a sequential hit counter which should prevent that hits are sent multiple times. /// public byte HitCounter { get => this._data.Span[7]; set => this._data.Span[7] = value; } /// /// Gets or sets number of targets which will follow in the structure. /// public byte TargetCount { get => this._data.Span[8]; set => this._data.Span[8] = value; } /// /// Gets the of the specified index. /// public TargetData this[int index] => new (this._data.Slice(9 + index * TargetData.Length)); /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AreaSkillHit(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(AreaSkillHit packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int targetsCount) => targetsCount * TargetData.Length + 9; /// /// Contains the data of the target. /// public readonly struct TargetData { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TargetData(Memory data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 3; /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data.Span); set => WriteUInt16BigEndian(this._data.Span, value); } /// /// Gets or sets a sequential animation counter which acts as a reference to the previously sent Area Skill Animation packet. /// public byte AnimationCounter { get => this._data.Span[2]; set => this._data.Span[2] = value; } } } /// /// Is sent by the client when: A player is performing an skill which affects an area of the map. /// Causes reaction on server side: It's forwarded to all surrounding players, so that the animation is visible. In the original server implementation, no damage is done yet for attack skills - there are separate hit packets. /// public readonly struct AreaSkill075 { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AreaSkill075(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 AreaSkill075(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 => 0x1E; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the index of the skill in the skill list. /// public byte SkillIndex { get => this._data.Span[3]; set => this._data.Span[3] = value; } /// /// Gets or sets the target x. /// public byte TargetX { get => this._data.Span[4]; set => this._data.Span[4] = value; } /// /// Gets or sets the target y. /// public byte TargetY { get => this._data.Span[5]; set => this._data.Span[5] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { 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 AreaSkill075(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(AreaSkill075 packet) => packet._data; } /// /// Is sent by the client when: An area skill was performed and the client decided to hit one or more targets. /// Causes reaction on server side: The server is calculating the damage and applying it to the targets. The attacker gets a response back with the caused damage. /// public readonly struct AreaSkillHit075 { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AreaSkillHit075(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 AreaSkillHit075(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 => 0x1D; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the index of the skill in the skill list. /// public byte SkillIndex { get => this._data.Span[3]; set => this._data.Span[3] = value; } /// /// Gets or sets the target x. /// public byte TargetX { get => this._data.Span[4]; set => this._data.Span[4] = value; } /// /// Gets or sets the target y. /// public byte TargetY { get => this._data.Span[5]; set => this._data.Span[5] = value; } /// /// Gets or sets the number of targets which are hit. /// public byte TargetCount { get => this._data.Span[6]; set => this._data.Span[6] = value; } /// /// Gets the of the specified index. /// public TargetData this[int index] => new (this._data.Slice(7 + index * TargetData.Length)); /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AreaSkillHit075(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(AreaSkillHit075 packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int targetsCount) => targetsCount * TargetData.Length + 7; /// /// Contains the data of the target. /// public readonly struct TargetData { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TargetData(Memory data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 2; /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data.Span); set => WriteUInt16BigEndian(this._data.Span, value); } } } /// /// Is sent by the client when: A player is performing an skill which affects an area of the map. /// Causes reaction on server side: It's forwarded to all surrounding players, so that the animation is visible. In the original server implementation, no damage is done yet for attack skills - there are separate hit packets. /// public readonly struct AreaSkill095 { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AreaSkill095(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 AreaSkill095(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 => 0x1E; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C3Header Header => new (this._data); /// /// Gets or sets the index of the skill in the skill list. /// public byte SkillIndex { get => this._data.Span[3]; set => this._data.Span[3] = value; } /// /// Gets or sets the target x. /// public byte TargetX { get => this._data.Span[4]; set => this._data.Span[4] = value; } /// /// Gets or sets the target y. /// public byte TargetY { get => this._data.Span[5]; set => this._data.Span[5] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { 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 AreaSkill095(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(AreaSkill095 packet) => packet._data; } /// /// Is sent by the client when: An area skill was performed and the client decided to hit one or more targets. /// Causes reaction on server side: The server is calculating the damage and applying it to the targets. The attacker gets a response back with the caused damage. /// public readonly struct AreaSkillHit095 { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AreaSkillHit095(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 AreaSkillHit095(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 => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x1D; /// /// Gets the header of this packet. /// public C3Header Header => new (this._data); /// /// Gets or sets the index of the skill in the skill list. /// public byte SkillIndex { get => this._data.Span[3]; set => this._data.Span[3] = value; } /// /// Gets or sets the target x. /// public byte TargetX { get => this._data.Span[4]; set => this._data.Span[4] = value; } /// /// Gets or sets the target y. /// public byte TargetY { get => this._data.Span[5]; set => this._data.Span[5] = value; } /// /// Gets or sets the counter. /// public byte Counter { get => this._data.Span[6]; set => this._data.Span[6] = value; } /// /// Gets or sets the number of targets which are hit. /// public byte TargetCount { get => this._data.Span[7]; set => this._data.Span[7] = value; } /// /// Gets the of the specified index. /// public TargetData this[int index] => new (this._data.Slice(8 + index * TargetData.Length)); /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AreaSkillHit095(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(AreaSkillHit095 packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int targetsCount) => targetsCount * TargetData.Length + 8; /// /// Contains the data of the target. /// public readonly struct TargetData { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TargetData(Memory data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 2; /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data.Span); set => WriteUInt16BigEndian(this._data.Span, value); } } } /// /// Is sent by the client when: A player performs a skill with a target, e.g. attacking or buffing. /// Causes reaction on server side: Damage is calculated and the target is hit, if the attack was successful. A response is sent back with the caused damage, and all surrounding players get an animation message. /// public readonly struct RageAttackRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RageAttackRequest(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 RageAttackRequest(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 => 0x4A; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C3Header Header => new (this._data); /// /// Gets or sets the skill id. /// public ushort SkillId { get => ReadUInt16BigEndian(this._data.Span[3..]); set => WriteUInt16BigEndian(this._data.Span[3..], value); } /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data.Span[6..]); set => WriteUInt16BigEndian(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 RageAttackRequest(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(RageAttackRequest packet) => packet._data; } /// /// Is sent by the client when: A player (rage fighter) performs the dark side skill on a target. /// Causes reaction on server side: The targets (up to 5) are determined and sent back to the player with the RageAttackRangeResponse. /// public readonly struct RageAttackRangeRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RageAttackRangeRequest(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 RageAttackRangeRequest(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 => 0x4B; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the skill id. /// public ushort SkillId { get => ReadUInt16BigEndian(this._data.Span[3..]); set => WriteUInt16BigEndian(this._data.Span[3..], value); } /// /// Gets or sets the target id. /// public ushort TargetId { 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 RageAttackRangeRequest(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(RageAttackRangeRequest packet) => packet._data; } /// /// Is sent by the client when: The player wants to cancel the trade. /// Causes reaction on server side: The trade is cancelled and the previous inventory state is restored. /// public readonly struct TradeCancel { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TradeCancel(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 TradeCancel(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 => 0x3D; /// /// 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 TradeCancel(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(TradeCancel packet) => packet._data; } /// /// Is sent by the client when: The player presses the trade button. /// Causes reaction on server side: The state change is forwarded to the trade partner. If both players press the trade button at the same time, the server will try to complete the trade by exchanging the items and money. /// public readonly struct TradeButtonStateChange { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TradeButtonStateChange(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 TradeButtonStateChange(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 => 0x3C; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the new state. /// public TradeButtonState NewState { get => (TradeButtonState)this._data.Span[3]; set => this._data.Span[3] = (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 TradeButtonStateChange(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(TradeButtonStateChange packet) => packet._data; } /// /// Is sent by the client when: The player requests to open a trade with another player. /// Causes reaction on server side: The request is forwarded to the requested player. /// public readonly struct TradeRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TradeRequest(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 TradeRequest(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 => 0x36; /// /// 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 player id. /// public ushort PlayerId { 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 TradeRequest(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(TradeRequest packet) => packet._data; } /// /// Is sent by the client when: A requested player responded to a trade request of another player. /// Causes reaction on server side: When the trade request was accepted, the server tries to open a new trade and sends corresponding responses to both players. /// public readonly struct TradeRequestResponse { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TradeRequestResponse(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 TradeRequestResponse(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 => 0x37; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the trade accepted. /// public bool TradeAccepted { get => this._data.Span[3..].GetBoolean(); set => this._data.Span[3..].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 TradeRequestResponse(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(TradeRequestResponse packet) => packet._data; } /// /// Is sent by the client when: A player requests to set an amount of money in the trade. /// Causes reaction on server side: It's taken from the available money of the inventory. If the new money amount is lower than the amount which was set before, it's added back to the inventory. The trade partner is informed about any change. /// public readonly struct SetTradeMoney { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SetTradeMoney(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 SetTradeMoney(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 => 0x3A; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the amount. /// public uint Amount { 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 SetTradeMoney(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(SetTradeMoney packet) => packet._data; } /// /// Is sent by the client when: A player requests to delete a letter. /// Causes reaction on server side: The letter is getting deleted. /// public readonly struct LetterDeleteRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LetterDeleteRequest(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 LetterDeleteRequest(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 => 0xC8; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the letter index. /// public ushort LetterIndex { get => ReadUInt16LittleEndian(this._data.Span[4..]); set => WriteUInt16LittleEndian(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 LetterDeleteRequest(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(LetterDeleteRequest packet) => packet._data; } /// /// Is sent by the client when: The game client requests the current list of letters. /// Causes reaction on server side: The server sends the list of available letters to the client. /// public readonly struct LetterListRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LetterListRequest(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 LetterListRequest(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 => 0xC9; /// /// 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 LetterListRequest(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(LetterListRequest packet) => packet._data; } /// /// Is sent by the client when: A player wants to send a letter to another players character. /// Causes reaction on server side: The letter is sent to the other character, if it exists and the player has the required money. /// public readonly struct LetterSendRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LetterSendRequest(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 LetterSendRequest(Memory data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC4; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xC5; /// /// Gets the header of this packet. /// public C4Header Header => new (this._data); /// /// Gets or sets the letter id. /// public uint LetterId { get => ReadUInt32LittleEndian(this._data.Span[4..]); set => WriteUInt32LittleEndian(this._data.Span[4..], value); } /// /// Gets or sets the receiver. /// public string Receiver { get => this._data.Span.ExtractString(8, 10, System.Text.Encoding.UTF8); set => this._data.Slice(8, 10).Span.WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the title. /// public string Title { get => this._data.Span.ExtractString(18, 60, System.Text.Encoding.UTF8); set => this._data.Slice(18, 60).Span.WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data.Span[78]; set => this._data.Span[78] = value; } /// /// Gets or sets the animation. /// public byte Animation { get => this._data.Span[79]; set => this._data.Span[79] = value; } /// /// Gets or sets the message length. /// public ushort MessageLength { get => ReadUInt16LittleEndian(this._data.Span[80..]); set => WriteUInt16LittleEndian(this._data.Span[80..], value); } /// /// Gets or sets the message. /// public string Message { get => this._data.Span.ExtractString(82, this._data.Length - 82, System.Text.Encoding.UTF8); set => this._data.Slice(82).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 LetterSendRequest(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(LetterSendRequest 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 + 82; /// /// 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 + 82; } /// /// Is sent by the client when: A player requests to read a specific letter of his letter list. /// Causes reaction on server side: The server sends the requested letter content back to the game client. /// public readonly struct LetterReadRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LetterReadRequest(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 LetterReadRequest(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 => 0xC7; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the letter index. /// public ushort LetterIndex { get => ReadUInt16LittleEndian(this._data.Span[4..]); set => WriteUInt16LittleEndian(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 LetterReadRequest(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(LetterReadRequest packet) => packet._data; } /// /// Is sent by the client when: A guild member wants to kick himself or a guild master wants to kick another player from its guild. /// Causes reaction on server side: If the player is allowed to kick the player, it's removed from the guild. If the guild master kicks himself, the guild is disbanded. Corresponding responses are sent to all involved players. /// public readonly struct GuildKickPlayerRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildKickPlayerRequest(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 GuildKickPlayerRequest(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 => 0x53; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the player name. /// public string PlayerName { 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 security code. /// public string SecurityCode { 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 GuildKickPlayerRequest(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(GuildKickPlayerRequest packet) => packet._data; /// /// Calculates the size of the packet for the specified field content. /// /// The content of the variable 'SecurityCode' 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 'SecurityCode' 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 (non-guild member) requests to join a guild. /// Causes reaction on server side: The request is forwarded to the guild master. There can only be one request at a time. If the guild master already has an open request, a corresponding response is directly sent back to the requesting player. /// public readonly struct GuildJoinRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildJoinRequest(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 GuildJoinRequest(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 => 0x50; /// /// 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 guild master player id. /// public ushort GuildMasterPlayerId { 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 GuildJoinRequest(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(GuildJoinRequest packet) => packet._data; } /// /// Is sent by the client when: A guild master responded to a previously sent request. /// Causes reaction on server side: If the request was accepted by the guild master, the previously requesting player is added to the guild. /// public readonly struct GuildJoinResponse { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildJoinResponse(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 GuildJoinResponse(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 => 0x51; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the accepted. /// public bool Accepted { get => this._data.Span[3..].GetBoolean(); set => this._data.Span[3..].SetBoolean(value); } /// /// Gets or sets the requester id. /// public ushort RequesterId { get => ReadUInt16BigEndian(this._data.Span[4..]); set => WriteUInt16BigEndian(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 GuildJoinResponse(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(GuildJoinResponse packet) => packet._data; } /// /// Is sent by the client when: A guild player opens its guild menu in the game client. /// Causes reaction on server side: A list of all guild members and their state is sent back as response. /// public readonly struct GuildListRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildListRequest(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 GuildListRequest(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 => 0x52; /// /// 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 GuildListRequest(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(GuildListRequest packet) => packet._data; } /// /// Is sent by the client when: When a player wants to create a guild. /// Causes reaction on server side: The guild is created and the player is set as the new guild master of the guild. /// public readonly struct GuildCreateRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildCreateRequest(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 GuildCreateRequest(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 => 0x55; /// /// 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 => 44; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the guild name. /// public string GuildName { get => this._data.Span.ExtractString(4, 8, System.Text.Encoding.UTF8); set => this._data.Slice(4, 8).Span.WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the guild emblem in a custom bitmap format. It supports 16 colors (one transparent) per pixel and has a size of 8 * 8 pixel. /// public Span GuildEmblem { get => this._data.Slice(12, 32).Span; } /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildCreateRequest(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(GuildCreateRequest packet) => packet._data; } /// /// Is sent by the client when: When a player wants to create a guild. /// Causes reaction on server side: The guild is created and the player is set as the new guild master of the guild. /// public readonly struct GuildCreateRequest075 { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildCreateRequest075(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 GuildCreateRequest075(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 => 0x55; /// /// 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 => 43; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the guild name. /// public string GuildName { get => this._data.Span.ExtractString(3, 8, System.Text.Encoding.UTF8); set => this._data.Slice(3, 8).Span.WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the guild emblem in a custom bitmap format. It supports 16 colors (one transparent) per pixel and has a size of 8 * 8 pixel. /// public Span GuildEmblem { get => this._data.Slice(11, 32).Span; } /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildCreateRequest075(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(GuildCreateRequest075 packet) => packet._data; } /// /// Is sent by the client when: The player has the dialog of the guild master NPC opened and decided about its next step. /// Causes reaction on server side: It either cancels the guild creation or proceeds with the guild creation dialog where the player can enter the guild name and symbol. /// public readonly struct GuildMasterAnswer { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildMasterAnswer(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 GuildMasterAnswer(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 => 0x54; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets a value whether the guild creation dialog should be shown. Otherwise, the guild creation is cancelled and the dialog was closed. /// public bool ShowCreationDialog { get => this._data.Span[3..].GetBoolean(); set => this._data.Span[3..].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 GuildMasterAnswer(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(GuildMasterAnswer packet) => packet._data; } /// /// Is sent by the client when: The player has the dialog of the guild creation dialog opened and decided against creating a guild. /// Causes reaction on server side: It either cancels the guild creation. /// public readonly struct CancelGuildCreation { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CancelGuildCreation(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 CancelGuildCreation(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 => 0x57; /// /// 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 CancelGuildCreation(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(CancelGuildCreation packet) => packet._data; } /// /// Is sent by the client when: A guild master requested a guild war against another guild. /// Causes reaction on server side: If the guild master confirms, the war is declared. /// public readonly struct GuildWarResponse { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildWarResponse(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 GuildWarResponse(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 => 0x61; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the accepted. /// public bool Accepted { get => this._data.Span[3..].GetBoolean(); set => this._data.Span[3..].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 GuildWarResponse(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(GuildWarResponse packet) => packet._data; } /// /// Is sent by the client when: A player gets another player into view range which is in a guild, and the guild identifier is unknown (=not cached yet by previous requests) to him. /// Causes reaction on server side: The server sends a response which includes the guild name and emblem. /// public readonly struct GuildInfoRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildInfoRequest(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 GuildInfoRequest(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 => 0x66; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the guild id. /// public uint GuildId { 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 GuildInfoRequest(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(GuildInfoRequest packet) => packet._data; } /// /// Is sent by the client when: A guild master wants to change the role of a guild member. /// Causes reaction on server side: The server changes the role of the guild member. /// public readonly struct GuildRoleAssignRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildRoleAssignRequest(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 GuildRoleAssignRequest(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); this.Type = 1; } } /// /// 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 => 0xE1; /// /// 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 => 15; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets unknown value between 1 and 3. /// public byte Type { get => this._data.Span[3]; set => this._data.Span[3] = value; } /// /// Gets or sets the role. /// public ServerToClient.GuildMemberRole Role { get => (ServerToClient.GuildMemberRole)this._data.Span[4]; set => this._data.Span[4] = (byte)value; } /// /// Gets or sets the player name. /// public string PlayerName { get => this._data.Span.ExtractString(5, 10, System.Text.Encoding.UTF8); set => this._data.Slice(5, 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 GuildRoleAssignRequest(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(GuildRoleAssignRequest packet) => packet._data; } /// /// Is sent by the client when: A guild master wants to change the type of its guild. Didn't find any place in the client where this is sent. /// Causes reaction on server side: The server changes the kind of the guild. We assume it's whether the guild should be the main guild of an alliance, or not. Shouldn't be handled, because this is constant for the lifetime of an alliance. /// public readonly struct GuildTypeChangeRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildTypeChangeRequest(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 GuildTypeChangeRequest(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 => 0xE2; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets 0 = Common, 1 = Guard, FF = None. /// public byte GuildType { 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 GuildTypeChangeRequest(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(GuildTypeChangeRequest packet) => packet._data; } /// /// Is sent by the client when: A guild master sends a request to another guild master about changing the relationship between their guilds. /// Causes reaction on server side: The server sends a response with the result. /// public readonly struct GuildRelationshipChangeRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildRelationshipChangeRequest(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 GuildRelationshipChangeRequest(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 => 0xE5; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the relationship type. /// public GuildRelationshipType RelationshipType { get => (GuildRelationshipType)this._data.Span[3]; set => this._data.Span[3] = (byte)value; } /// /// Gets or sets the request type. /// public GuildRequestType RequestType { get => (GuildRequestType)this._data.Span[4]; set => this._data.Span[4] = (byte)value; } /// /// Gets or sets the target player id. /// public ushort TargetPlayerId { 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 GuildRelationshipChangeRequest(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(GuildRelationshipChangeRequest packet) => packet._data; } /// /// Is sent by the client when: A guild master answered the request to another guild master about changing the relationship between their guilds. /// Causes reaction on server side: The server sends a response back to the requester. If the guild master agreed, it takes the necessary actions. /// public readonly struct GuildRelationshipChangeResponse { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildRelationshipChangeResponse(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 GuildRelationshipChangeResponse(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 => 0xE6; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the relationship type. /// public GuildRelationshipType RelationshipType { get => (GuildRelationshipType)this._data.Span[3]; set => this._data.Span[3] = (byte)value; } /// /// Gets or sets the request type. /// public GuildRequestType RequestType { get => (GuildRequestType)this._data.Span[4]; set => this._data.Span[4] = (byte)value; } /// /// Gets or sets the response. /// public bool Response { get => this._data.Span[5..].GetBoolean(); set => this._data.Span[5..].SetBoolean(value); } /// /// Gets or sets the target player id. /// public ushort TargetPlayerId { get => ReadUInt16BigEndian(this._data.Span[6..]); set => WriteUInt16BigEndian(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 GuildRelationshipChangeResponse(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(GuildRelationshipChangeResponse packet) => packet._data; } /// /// Is sent by the client when: The player opens the alliance list dialog. /// Causes reaction on server side: The server answers with the list of the guilds of the alliance. /// public readonly struct RequestAllianceList { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RequestAllianceList(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 RequestAllianceList(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 => 0xE9; /// /// 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 RequestAllianceList(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(RequestAllianceList packet) => packet._data; } /// /// Is sent by the client when: An alliance guild master wants to remove a guild from the alliance. /// Causes reaction on server side: The server removes the guild from the alliance. /// public readonly struct RemoveAllianceGuildRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RemoveAllianceGuildRequest(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 RemoveAllianceGuildRequest(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 => 0xEB; /// /// 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 => 12; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the guild name. /// public string GuildName { get => this._data.Span.ExtractString(4, this._data.Length - 4, System.Text.Encoding.UTF8); set => this._data.Slice(4).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 RemoveAllianceGuildRequest(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(RemoveAllianceGuildRequest packet) => packet._data; /// /// Calculates the size of the packet for the specified field content. /// /// The content of the variable 'GuildName' field from which the size will be calculated. public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 4; /// /// Calculates the size of the packet for the specified field content. /// /// The content length in bytes of the variable 'GuildName' field from which the size will be calculated. public static int GetRequiredSize(int contentLength) => contentLength + 1 + 4; } /// /// Is sent by the client when: After the server sent a ping request. /// Causes reaction on server side: The server knows the latency between server and client. /// public readonly struct PingResponse { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PingResponse(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 PingResponse(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 => 0x71; /// /// 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 PingResponse(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(PingResponse packet) => packet._data; } /// /// Is sent by the client when: A player wants to repair an item of his inventory, either himself or with the usage of an NPC. /// Causes reaction on server side: If the item is damaged and repairable, the durability of the item is maximized and corresponding responses are sent back to the client. /// public readonly struct ItemRepair { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ItemRepair(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 ItemRepair(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 => 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 => 4; /// /// Gets the header of this packet. /// public C3Header Header => new (this._data); /// /// Gets or sets the inventory slot of the target item. If it's 0xFF, the player requests to repair all items with the help of an NPC. If it's 8 (Pet slot), using the pet trainer NPC is mandatory, too. /// public byte InventoryItemSlot { 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 ItemRepair(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(ItemRepair packet) => packet._data; } /// /// Is sent by the client when: The player has the dialog of the chaos machine open and decided to mix (craft) the items which he put into the chaos machine dialog. /// Causes reaction on server side: Based on the type of mix and it's corresponding success rate, the mix succeeds or fails. The client gets a corresponding response with the created, changed or lost items. /// public readonly struct ChaosMachineMixRequest { /// /// This enum describes the possible chaos machine mix type identifiers. /// public enum ChaosMachineMixType { /// /// Mixes the items to a chaos weapon. /// ChaosWeapon = 1, /// /// Upgrades an item to level 10. /// UpgradeItemLevelTo10 = 3, /// /// Upgrades an item to level 11. /// UpgradeItemLevelTo11 = 4, /// /// Upgrades an item to level 12. /// UpgradeItemLevelTo12 = 22, /// /// Upgrades an item to level 13. /// UpgradeItemLevelTo13 = 23, /// /// Upgrades an item to level 14. /// UpgradeItemLevelTo14 = 49, /// /// Upgrades an item to level 15. /// UpgradeItemLevelTo15 = 50, /// /// Mixes the items to a fruit. /// FruitCreation = 6, /// /// Refines a gemstone to a jewel of harmony. /// GemstoneRefinery = 41, /// /// Refines a Jewel Of Bless to a stack of potions of bless. /// PotionOfBless = 15, /// /// Refines a Jewel Of Soul to a stack of potions of bless. /// PotionOfSoul = 16, } private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ChaosMachineMixRequest(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 ChaosMachineMixRequest(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 => 0x86; /// /// 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 identifier which tells the server which kind of mix should be executed. /// public ChaosMachineMixRequest.ChaosMachineMixType MixType { get => (ChaosMachineMixType)this._data.Span[3]; set => this._data.Span[3] = (byte)value; } /// /// Gets or sets the 0-based slot index of the socket at which a seed sphere should be mounted or removed. May only be available for the corresponding mixes, so access with care. /// public byte SocketSlot { 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 ChaosMachineMixRequest(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(ChaosMachineMixRequest packet) => packet._data; } /// /// Is sent by the client when: A player closes the dialog which was opened by an interaction with the chaos machine goblin. /// Causes reaction on server side: The server updates the state of the player accordingly. /// public readonly struct CraftingDialogCloseRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CraftingDialogCloseRequest(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 CraftingDialogCloseRequest(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 => 0x87; /// /// 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 CraftingDialogCloseRequest(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(CraftingDialogCloseRequest packet) => packet._data; } /// /// Is sent by the client when: The client requests the current friend list. /// Causes reaction on server side: The server sends the friend list to the client. /// public readonly struct FriendListRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public FriendListRequest(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 FriendListRequest(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 => 0xC0; /// /// 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 FriendListRequest(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(FriendListRequest packet) => packet._data; } /// /// Is sent by the client when: A player wants to add another players character into his friend list of the messenger. /// Causes reaction on server side: A request is sent to the other player. If the player is currently offline, the request will be sent as soon as he is online again. /// public readonly struct FriendAddRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public FriendAddRequest(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 FriendAddRequest(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 => 0xC1; /// /// 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 => 13; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the friend name. /// public string FriendName { get => this._data.Span.ExtractString(3, 10, System.Text.Encoding.UTF8); set => this._data.Slice(3, 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 FriendAddRequest(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(FriendAddRequest packet) => packet._data; } /// /// Is sent by the client when: A player wants to delete another players character from his friend list of the messenger. /// Causes reaction on server side: The entry in the friend list is removed. The player is shown as offline in the other players friends list. /// public readonly struct FriendDelete { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public FriendDelete(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 FriendDelete(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 => 0xC3; /// /// 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 => 13; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the friend name. /// public string FriendName { get => this._data.Span.ExtractString(3, 10, System.Text.Encoding.UTF8); set => this._data.Slice(3, 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 FriendDelete(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(FriendDelete packet) => packet._data; } /// /// Is sent by the client when: A player wants to open a chat with another player of his friend list. /// Causes reaction on server side: If both players are online, a chat room is created on the chat server. Authentication data is sent to both game clients, which will then try to connect to the chat server using this data. /// public readonly struct ChatRoomCreateRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ChatRoomCreateRequest(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 ChatRoomCreateRequest(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 => 0xCA; /// /// 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 => 13; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the friend name. /// public string FriendName { get => this._data.Span.ExtractString(3, 10, System.Text.Encoding.UTF8); set => this._data.Slice(3, 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 ChatRoomCreateRequest(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(ChatRoomCreateRequest packet) => packet._data; } /// /// Is sent by the client when: A player received a friend request from another player and responded to it. /// Causes reaction on server side: If the player accepted, the friend is added to the players friend list and both players get subscribed about each others online status. /// public readonly struct FriendAddResponse { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public FriendAddResponse(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 FriendAddResponse(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 => 0xC2; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 14; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the accepted. /// public bool Accepted { get => this._data.Span[3..].GetBoolean(); set => this._data.Span[3..].SetBoolean(value); } /// /// Gets or sets the friend requester name. /// public string FriendRequesterName { get => this._data.Span.ExtractString(4, 10, System.Text.Encoding.UTF8); set => this._data.Slice(4, 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 FriendAddResponse(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(FriendAddResponse packet) => packet._data; } /// /// Is sent by the client when: A player wants to set himself on- or offline. /// Causes reaction on server side: Depending on the state, the player is shown as offline or online in all friend lists of his friends. /// public readonly struct SetFriendOnlineState { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SetFriendOnlineState(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 SetFriendOnlineState(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 => 0xC4; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the online state. /// public bool OnlineState { get => this._data.Span[3..].GetBoolean(); set => this._data.Span[3..].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 SetFriendOnlineState(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(SetFriendOnlineState packet) => packet._data; } /// /// Is sent by the client when: A player wants to invite additional players from his friend list to an existing chat room. /// Causes reaction on server side: The player additional gets authentication data sent to his game client. It then connects to the chat server and joins the chat room. /// public readonly struct ChatRoomInvitationRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ChatRoomInvitationRequest(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 ChatRoomInvitationRequest(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 => 0xCB; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the friend name. /// public string FriendName { 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 room id. /// public ushort RoomId { get => ReadUInt16BigEndian(this._data.Span[13..]); set => WriteUInt16BigEndian(this._data.Span[13..], value); } /// /// Gets or sets the request id. /// public uint RequestId { get => ReadUInt32BigEndian(this._data.Span[15..]); set => WriteUInt32BigEndian(this._data.Span[15..], value); } /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ChatRoomInvitationRequest(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(ChatRoomInvitationRequest packet) => packet._data; } /// /// Is sent by the client when: After the player entered the game world with a character. /// Causes reaction on server side: The quest state is sent back as response. /// public readonly struct LegacyQuestStateRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LegacyQuestStateRequest(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 LegacyQuestStateRequest(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 => 0xA0; /// /// 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 LegacyQuestStateRequest(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(LegacyQuestStateRequest packet) => packet._data; } /// /// Is sent by the client when: The player wants to change the state of a quest, e.g. to start or to finish a quest. /// Causes reaction on server side: Depending on the requested new state, a response is sent back. /// public readonly struct LegacyQuestStateSetRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LegacyQuestStateSetRequest(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 LegacyQuestStateSetRequest(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 => 0xA2; /// /// 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 quest number. /// public byte QuestNumber { get => this._data.Span[3]; set => this._data.Span[3] = value; } /// /// Gets or sets the new state. /// public LegacyQuestState NewState { get => (LegacyQuestState)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 LegacyQuestStateSetRequest(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(LegacyQuestStateSetRequest packet) => packet._data; } /// /// Is sent by the client when: The player wants to command its equipped pet (raven). /// Causes reaction on server side: /// public readonly struct PetCommandRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PetCommandRequest(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 PetCommandRequest(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 => 0xA7; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the pet type. /// public PetType PetType { get => (PetType)this._data.Span[3]; set => this._data.Span[3] = (byte)value; } /// /// Gets or sets the command mode. /// public PetCommandMode CommandMode { get => (PetCommandMode)this._data.Span[4]; set => this._data.Span[4] = (byte)value; } /// /// Gets or sets the target id. /// public ushort TargetId { 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 PetCommandRequest(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(PetCommandRequest packet) => packet._data; } /// /// Is sent by the client when: The player hovers over a pet. The client sends this request to retrieve information (level, experience) of the pet (dark raven, horse). /// Causes reaction on server side: The server sends a PetInfoResponse. /// public readonly struct PetInfoRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PetInfoRequest(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 PetInfoRequest(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 => 0xA9; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the pet. /// public PetType Pet { get => (PetType)this._data.Span[3]; set => this._data.Span[3] = (byte)value; } /// /// Gets or sets the storage. /// public StorageType Storage { get => (StorageType)this._data.Span[4]; set => this._data.Span[4] = (byte)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 PetInfoRequest(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(PetInfoRequest packet) => packet._data; } /// /// Is sent by the client when: The client has the NPC dialog for the illusion temple opened, and wants to enter the event map. /// Causes reaction on server side: The server checks if the player has the required ticket and moves the player to the event map. /// public readonly struct IllusionTempleEnterRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public IllusionTempleEnterRequest(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 IllusionTempleEnterRequest(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 => 0xBF; /// /// 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 => 6; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the map number. /// public byte MapNumber { 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 IllusionTempleEnterRequest(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(IllusionTempleEnterRequest packet) => packet._data; } /// /// Is sent by the client when: The player is in the illusion temple event and wants to perform a special skill (210 - 213), Order of Protection, Restraint, Tracking or Weaken. /// Causes reaction on server side: The server checks if the player is inside the event etc. and performs the skills accordingly. /// public readonly struct IllusionTempleSkillRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public IllusionTempleSkillRequest(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 IllusionTempleSkillRequest(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 => 0xBF; /// /// 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 => 8; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the skill number. /// public ushort SkillNumber { get => ReadUInt16BigEndian(this._data.Span[4..]); set => WriteUInt16BigEndian(this._data.Span[4..], value); } /// /// Gets or sets the target object index. /// public byte TargetObjectIndex { get => this._data.Span[6]; set => this._data.Span[6] = value; } /// /// Gets or sets the distance. /// public byte Distance { 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 IllusionTempleSkillRequest(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(IllusionTempleSkillRequest packet) => packet._data; } /// /// Is sent by the client when: The player requests the reward of the event. /// Causes reaction on server side: The server checks if the player is in the winning game and returns a reward, usually as item drop. /// public readonly struct IllusionTempleRewardRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public IllusionTempleRewardRequest(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 IllusionTempleRewardRequest(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 => 0xBF; /// /// 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 => 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 IllusionTempleRewardRequest(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(IllusionTempleRewardRequest packet) => packet._data; } /// /// Is sent by the client when: The player has the lucky coin dialog open and requests the current count of the registered coins. /// Causes reaction on server side: The server returns the count of the registered coins. /// public readonly struct LuckyCoinCountRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LuckyCoinCountRequest(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 LuckyCoinCountRequest(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 => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0B; /// /// 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 LuckyCoinCountRequest(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(LuckyCoinCountRequest packet) => packet._data; } /// /// Is sent by the client when: The player has the lucky coin dialog open and requests to register one lucky coin, which is in his inventory. /// Causes reaction on server side: The server returns the result of the registration increases the coin count and decreases the coin durability by one. /// public readonly struct LuckyCoinRegistrationRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LuckyCoinRegistrationRequest(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 LuckyCoinRegistrationRequest(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 => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0C; /// /// 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 LuckyCoinRegistrationRequest(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(LuckyCoinRegistrationRequest packet) => packet._data; } /// /// Is sent by the client when: The player has the lucky coin dialog open and requests an exchange for the specified number of registered coins. /// Causes reaction on server side: The server adds an item to the inventory of the character and sends a response with a result code. /// public readonly struct LuckyCoinExchangeRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LuckyCoinExchangeRequest(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 LuckyCoinExchangeRequest(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 => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0D; /// /// 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 coin count. /// public uint CoinCount { 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 LuckyCoinExchangeRequest(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(LuckyCoinExchangeRequest packet) => packet._data; } /// /// Is sent by the client when: The player wants to enter the doppelganger event. /// Causes reaction on server side: The server checks the event ticket and moves the player to the event map. /// public readonly struct DoppelgangerEnterRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DoppelgangerEnterRequest(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 DoppelgangerEnterRequest(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 => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0E; /// /// 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 ticket item slot. /// public byte TicketItemSlot { 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 DoppelgangerEnterRequest(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(DoppelgangerEnterRequest packet) => packet._data; } /// /// Is sent by the client when: The player wants to enter the market place map. /// Causes reaction on server side: The server moves the player to the market place map. /// public readonly struct EnterMarketPlaceRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public EnterMarketPlaceRequest(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 EnterMarketPlaceRequest(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 => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x17; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 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 EnterMarketPlaceRequest(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(EnterMarketPlaceRequest packet) => packet._data; } /// /// Is sent by the client when: The client clicked on MU Helper play or pause button. /// Causes reaction on server side: The server validates, if user can use the helper and sends the status back. /// public readonly struct MuHelperStatusChangeRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MuHelperStatusChangeRequest(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 MuHelperStatusChangeRequest(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 => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x51; /// /// 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 pause status. /// public bool PauseStatus { 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 MuHelperStatusChangeRequest(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(MuHelperStatusChangeRequest packet) => packet._data; } /// /// Is sent by the client when: The client want to save current MU Helper data. /// Causes reaction on server side: The server should save supplied MU Helper data. /// public readonly struct MuHelperSaveDataRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MuHelperSaveDataRequest(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 MuHelperSaveDataRequest(Memory data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xAE; /// /// 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 => 261; /// /// Gets the header of this packet. /// public C2Header Header => new (this._data); /// /// Gets or sets the helper data. /// public Span HelperData { get => this._data.Slice(4, 257).Span; } /// /// Performs an implicit conversion from a Memory of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MuHelperSaveDataRequest(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(MuHelperSaveDataRequest packet) => packet._data; } /// /// Is sent by the client when: The client opened an quest NPC dialog and selected an available quests. /// Causes reaction on server side: If the quest is already active, it responds with the QuestProgress. If the quest is inactive, the server decides if the character can start the quest and responds with a QuestStepInfo with the StartingNumber. A character can run up to 3 concurrent quests at a time. /// public readonly struct QuestSelectRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestSelectRequest(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 QuestSelectRequest(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 => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0A; /// /// 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 the quest number. /// public ushort QuestNumber { get => ReadUInt16LittleEndian(this._data.Span[4..]); set => WriteUInt16LittleEndian(this._data.Span[4..], value); } /// /// Gets or sets the quest group. /// public ushort QuestGroup { get => ReadUInt16LittleEndian(this._data.Span[6..]); set => WriteUInt16LittleEndian(this._data.Span[6..], value); } /// /// Gets or sets a 1-based index of the selected index in the dialog. It's 0 when no text has been selected. It's not clear yet, when we need that. /// public byte SelectedTextIndex { get => this._data.Span[8]; set => 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 QuestSelectRequest(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(QuestSelectRequest packet) => packet._data; } /// /// Is sent by the client when: After the server started a quest (and sent a F60B message) the game client requests to proceed with the quest. /// Causes reaction on server side: The quest state is set accordingly on the server. The next response seems to depend on the quest configuration. Depending on the action of the next quest state, the server will send either a quest progress message (F60C) or again a quest start message (F60B). /// public readonly struct QuestProceedRequest { /// /// Describes how to proceed with the specified quest. /// public enum QuestProceedAction { /// /// Undefined action. /// Undefined = 0, /// /// The quest is accepted and started. /// AcceptQuest = 1, /// /// The quest is refused and not started. /// RefuseQuest = 2, } private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestProceedRequest(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 QuestProceedRequest(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 => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0B; /// /// 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 the quest number. /// public ushort QuestNumber { get => ReadUInt16LittleEndian(this._data.Span[4..]); set => WriteUInt16LittleEndian(this._data.Span[4..], value); } /// /// Gets or sets the quest group. /// public ushort QuestGroup { get => ReadUInt16LittleEndian(this._data.Span[6..]); set => WriteUInt16LittleEndian(this._data.Span[6..], value); } /// /// Gets or sets the proceed action. /// public QuestProceedRequest.QuestProceedAction ProceedAction { get => (QuestProceedAction)this._data.Span[8]; set => this._data.Span[8] = (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 QuestProceedRequest(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(QuestProceedRequest packet) => packet._data; } /// /// Is sent by the client when: The game client requests to complete an active quest. /// Causes reaction on server side: The server checks the conditions to complete the quest. If this fails, nothing happens. If all conditions are met, the reward is given to the player and the quest state is set accordingly, so that the player can select to start the next quest. Additionally, the quest completion response message (F60D) is sent to the client. /// public readonly struct QuestCompletionRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestCompletionRequest(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 QuestCompletionRequest(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 => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0D; /// /// 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 quest number. /// public ushort QuestNumber { get => ReadUInt16LittleEndian(this._data.Span[4..]); set => WriteUInt16LittleEndian(this._data.Span[4..], value); } /// /// Gets or sets the quest group. /// public ushort QuestGroup { get => ReadUInt16LittleEndian(this._data.Span[6..]); set => WriteUInt16LittleEndian(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 QuestCompletionRequest(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(QuestCompletionRequest packet) => packet._data; } /// /// Is sent by the client when: The game client requests to cancel an active quest. /// Causes reaction on server side: The server checks if the quest is currently in progress. In this case, the quest state is reset and a response (F60F) is sent back to the client. /// public readonly struct QuestCancelRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestCancelRequest(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 QuestCancelRequest(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 => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0F; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the quest number. /// public ushort QuestNumber { get => ReadUInt16LittleEndian(this._data.Span[4..]); set => WriteUInt16LittleEndian(this._data.Span[4..], value); } /// /// Gets or sets the quest group. /// public ushort QuestGroup { get => ReadUInt16LittleEndian(this._data.Span[6..]); set => WriteUInt16LittleEndian(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 QuestCancelRequest(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(QuestCancelRequest packet) => packet._data; } /// /// Is sent by the client when: The game client requests to complete a client action, e.g. completing a tutorial. /// Causes reaction on server side: The server checks if the specified quest is currently in progress. If the quest got a Condition (condition type 0x10) for this flag, the condition is flagged as fulfilled. /// public readonly struct QuestClientActionRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestClientActionRequest(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 QuestClientActionRequest(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 => 0xF6; /// /// 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 quest number. /// public ushort QuestNumber { get => ReadUInt16LittleEndian(this._data.Span[4..]); set => WriteUInt16LittleEndian(this._data.Span[4..], value); } /// /// Gets or sets the quest group. /// public ushort QuestGroup { get => ReadUInt16LittleEndian(this._data.Span[6..]); set => WriteUInt16LittleEndian(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 QuestClientActionRequest(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(QuestClientActionRequest packet) => packet._data; } /// /// Is sent by the client when: The clients requests the states of all quests, usually after entering the game. /// Causes reaction on server side: The list of active quests is sent back (F61A) without changing any state. This list just contains all running or completed quests for each group. /// public readonly struct ActiveQuestListRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ActiveQuestListRequest(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 ActiveQuestListRequest(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 => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x1A; /// /// 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 ActiveQuestListRequest(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(ActiveQuestListRequest packet) => packet._data; } /// /// Is sent by the client when: The game client requests the state of a specific active quests. /// Causes reaction on server side: The quest state is sent back (F61B) without changing any state, if the quest is currently in progress. /// public readonly struct QuestStateRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestStateRequest(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 QuestStateRequest(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 => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x1B; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the quest number. /// public ushort QuestNumber { get => ReadUInt16LittleEndian(this._data.Span[4..]); set => WriteUInt16LittleEndian(this._data.Span[4..], value); } /// /// Gets or sets the quest group. /// public ushort QuestGroup { get => ReadUInt16LittleEndian(this._data.Span[6..]); set => WriteUInt16LittleEndian(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 QuestStateRequest(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(QuestStateRequest packet) => packet._data; } /// /// Is sent by the client when: The game client requests the list of event quests, usually after entering the game. /// Causes reaction on server side: The server may answer with a response which seems to depend if the character is member of a Gen or not. If it's not in a gen, it sends a response (F603). /// public readonly struct EventQuestStateListRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public EventQuestStateListRequest(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 EventQuestStateListRequest(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 => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x21; /// /// 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 EventQuestStateListRequest(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(EventQuestStateListRequest packet) => packet._data; } /// /// Is sent by the client when: The client opened an quest NPC dialog and requests a list of available quests. /// Causes reaction on server side: The list of available quests of this NPC is sent back (F60A). /// public readonly struct AvailableQuestsRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AvailableQuestsRequest(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 AvailableQuestsRequest(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 => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 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 => 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 AvailableQuestsRequest(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(AvailableQuestsRequest packet) => packet._data; } /// /// Is sent by the client when: The game client requests to get a buff from the currently interacting quest npc. As far as we know, only the Elf Soldier NPC offers such a buff until a certain character level (150 or 220). /// Causes reaction on server side: The server should check if the correct Quest NPC (e.g. Elf Soldier) dialog is opened and the player didn't reach the level limit yet. If that's both the case, it adds a defined buff (MagicEffect) to the player; Otherwise, a message is sent to the player. /// public readonly struct NpcBuffRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public NpcBuffRequest(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 NpcBuffRequest(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 => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 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 => 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 NpcBuffRequest(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(NpcBuffRequest packet) => packet._data; } /// /// Is sent by the client when: The player wants to enter the empire guardian event due an npc dialog. /// Causes reaction on server side: The checks if the player can enter the event, and moves it to the event, if possible. /// public readonly struct EnterEmpireGuardianEvent { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public EnterEmpireGuardianEvent(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 EnterEmpireGuardianEvent(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.ItemSlot = 01; } } /// /// 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 => 0xF7; /// /// 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 => 5; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the item slot of the event ticket. Not used by the server. /// public byte ItemSlot { 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 EnterEmpireGuardianEvent(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(EnterEmpireGuardianEvent packet) => packet._data; } /// /// Is sent by the client when: The player has opened one of the gens NPCs and requests to join it. /// Causes reaction on server side: The server checks if the player is not in a gens already and joins the player to the selected gens. /// public readonly struct GensJoinRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GensJoinRequest(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 GensJoinRequest(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 => 0xF8; /// /// 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 => 5; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the gens type. /// public GensType GensType { get => (GensType)this._data.Span[3]; set => this._data.Span[3] = (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 GensJoinRequest(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(GensJoinRequest packet) => packet._data; } /// /// Is sent by the client when: The player wants to leave the current gens. /// Causes reaction on server side: The server the player from the gens. /// public readonly struct GensLeaveRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GensLeaveRequest(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 GensLeaveRequest(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 => 0xF8; /// /// 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 GensLeaveRequest(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(GensLeaveRequest packet) => packet._data; } /// /// Is sent by the client when: The game client requests to get a reward from the gens npc. /// Causes reaction on server side: The server checks if the player has enough points to get the reward, and sends a response. /// public readonly struct GensRewardRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GensRewardRequest(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 GensRewardRequest(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 => 0xF8; /// /// 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 => 5; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the gens type. /// public GensType GensType { get => (GensType)this._data.Span[3]; set => this._data.Span[3] = (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 GensRewardRequest(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(GensRewardRequest packet) => packet._data; } /// /// Is sent by the client when: The game client requests information about the current gens ranking. /// Causes reaction on server side: The server returns the current gens rankinginformation. /// public readonly struct GensRankingRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GensRankingRequest(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 GensRankingRequest(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 => 0xF8; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0B; /// /// 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 GensRankingRequest(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(GensRankingRequest packet) => packet._data; } /// /// Is sent by the client when: The player requests to enter the devil square through the Charon NPC. /// Causes reaction on server side: The server checks if the player can enter the event and sends a response (Code 0x90) back to the client. If it was successful, the character gets moved to the event map. /// public readonly struct DevilSquareEnterRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DevilSquareEnterRequest(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 DevilSquareEnterRequest(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 => 0x90; /// /// 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 level of the devil square, minus 1. /// public byte SquareLevel { get => this._data.Span[3]; set => this._data.Span[3] = value; } /// /// Gets or sets the index of the ticket item in the inventory. Be aware, that the value is 12 higher than it should be - it makes no sense, but it is what it is... /// public byte TicketItemInventoryIndex { 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 DevilSquareEnterRequest(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(DevilSquareEnterRequest packet) => packet._data; } /// /// Is sent by the client when: The player requests to get the remaining time of the currently entered event. /// Causes reaction on server side: The remaining time is sent back to the client. /// public readonly struct MiniGameOpeningStateRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MiniGameOpeningStateRequest(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 MiniGameOpeningStateRequest(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 => 0x91; /// /// 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 event type. /// public MiniGameType EventType { get => (MiniGameType)this._data.Span[3]; set => this._data.Span[3] = (byte)value; } /// /// Gets or sets the event level. /// public byte EventLevel { 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 MiniGameOpeningStateRequest(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(MiniGameOpeningStateRequest packet) => packet._data; } /// /// Is sent by the client when: The player registers an event item at an NPC, usually the golden archer. /// Causes reaction on server side: A response is sent back to the client with the current event chip count. /// public readonly struct EventChipRegistrationRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public EventChipRegistrationRequest(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 EventChipRegistrationRequest(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 => 0x95; /// /// 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 type. /// public byte Type { get => this._data.Span[3]; set => this._data.Span[3] = value; } /// /// 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 EventChipRegistrationRequest(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(EventChipRegistrationRequest packet) => packet._data; } /// /// Is sent by the client when: The player requests information about the Muto number. Unused. /// Causes reaction on server side: A response is sent back to the client with the current Muto number. /// public readonly struct MutoNumberRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MutoNumberRequest(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 MutoNumberRequest(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 => 0x96; /// /// 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 MutoNumberRequest(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(MutoNumberRequest packet) => packet._data; } /// /// Is sent by the client when: The player requests to close the event chip dialog. /// Causes reaction on server side: The event chip dialog will be closed. /// public readonly struct EventChipExitDialog { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public EventChipExitDialog(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 EventChipExitDialog(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 => 0x97; /// /// 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 EventChipExitDialog(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(EventChipExitDialog packet) => packet._data; } /// /// Is sent by the client when: The player requests to exchange the event chips to something else. /// Causes reaction on server side: A response is sent back to the client with the exchange result. /// public readonly struct EventChipExchangeRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public EventChipExchangeRequest(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 EventChipExchangeRequest(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 => 0x98; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the type. /// public byte Type { 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 EventChipExchangeRequest(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(EventChipExchangeRequest packet) => packet._data; } /// /// Is sent by the client when: Unknown? /// Causes reaction on server side: Unknown? /// public readonly struct ServerImmigrationRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ServerImmigrationRequest(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 ServerImmigrationRequest(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 => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x99; /// /// Gets the header of this packet. /// public C3Header Header => new (this._data); /// /// Gets or sets the security code. /// public string SecurityCode { get => this._data.Span.ExtractString(3, this._data.Length - 3, System.Text.Encoding.UTF8); set => this._data.Slice(3).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 ServerImmigrationRequest(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(ServerImmigrationRequest packet) => packet._data; /// /// Calculates the size of the packet for the specified field content. /// /// The content of the variable 'SecurityCode' field from which the size will be calculated. public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 3; /// /// Calculates the size of the packet for the specified field content. /// /// The content length in bytes of the variable 'SecurityCode' field from which the size will be calculated. public static int GetRequiredSize(int contentLength) => contentLength + 1 + 3; } /// /// Is sent by the client when: The player requests to redeem a coupon code (lucky number) which is 12 alphanumeric digits long. /// Causes reaction on server side: A response is sent back to the client with the result. An item could be rewarded to the inventory. /// public readonly struct LuckyNumberRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LuckyNumberRequest(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 LuckyNumberRequest(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 => 0x9D; /// /// 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 => 18; /// /// Gets the header of this packet. /// public C1Header Header => new (this._data); /// /// Gets or sets the serial 1. /// public string Serial1 { get => this._data.Span.ExtractString(3, 4, System.Text.Encoding.UTF8); set => this._data.Slice(3, 4).Span.WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the serial 2. /// public string Serial2 { get => this._data.Span.ExtractString(8, 4, System.Text.Encoding.UTF8); set => this._data.Slice(8, 4).Span.WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the serial 3. /// public string Serial3 { get => this._data.Span.ExtractString(13, 4, System.Text.Encoding.UTF8); set => this._data.Slice(13, 4).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 LuckyNumberRequest(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(LuckyNumberRequest packet) => packet._data; } /// /// Is sent by the client when: The player requests to enter the blood castle through the Archangel Messenger NPC. /// Causes reaction on server side: The server checks if the player can enter the event and sends a response (Code 0x9A) back to the client. If it was successful, the character gets moved to the event map. /// public readonly struct BloodCastleEnterRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public BloodCastleEnterRequest(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 BloodCastleEnterRequest(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 => 0x9A; /// /// 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 level of the battle square. /// public byte CastleLevel { get => this._data.Span[3]; set => this._data.Span[3] = value; } /// /// Gets or sets the index of the ticket item in the inventory. Be aware, that the value is 12 higher than it should be - it makes no sense, but it is what it is... /// public byte TicketItemInventoryIndex { 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 BloodCastleEnterRequest(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(BloodCastleEnterRequest packet) => packet._data; } /// /// Is sent by the client when: The player requests to get the entering count of the specified mini game. /// Causes reaction on server side: The remaining time is sent back to the client. However, it's not really handled on the known server sources. /// public readonly struct MiniGameEventCountRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MiniGameEventCountRequest(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 MiniGameEventCountRequest(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 => 0x9F; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets the mini game. /// public MiniGameType MiniGame { get => (MiniGameType)this._data.Span[3]; set => this._data.Span[3] = (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 MiniGameEventCountRequest(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(MiniGameEventCountRequest packet) => packet._data; } /// /// Is sent by the client when: The player requests to enter the chaos castle by using the 'Armor of Guardsman' item. /// Causes reaction on server side: The server checks if the player can enter the event and sends a response (Code 0xAF) back to the client. If it was successful, the character gets moved to the event map. /// public readonly struct ChaosCastleEnterRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ChaosCastleEnterRequest(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 ChaosCastleEnterRequest(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 => 0xAF; /// /// 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 => 6; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the level of the chaos castle. Appears to always be 0. /// public byte CastleLevel { get => this._data.Span[4]; set => this._data.Span[4] = value; } /// /// Gets or sets the index of the ticket item in the inventory. /// public byte TicketItemInventoryIndex { 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 ChaosCastleEnterRequest(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(ChaosCastleEnterRequest packet) => packet._data; } /// /// Is sent by the client when: The game client noticed, that the coordinates of the player is not on the ground anymore. It requests to set the specified coordinates. /// Causes reaction on server side: The server sets the player on the new coordinates. Not handled on OpenMU. /// public readonly struct ChaosCastlePositionSet { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ChaosCastlePositionSet(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 ChaosCastlePositionSet(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 => 0xAF; /// /// 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 => 6; /// /// Gets the header of this packet. /// public C1HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the position x. /// public byte PositionX { get => this._data.Span[4]; set => this._data.Span[4] = value; } /// /// Gets or sets the position y. /// public byte PositionY { 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 ChaosCastlePositionSet(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(ChaosCastlePositionSet packet) => packet._data; } /// /// Is sent by the client when: The player requests to start a duel with another player. /// Causes reaction on server side: The server sends a request to the other player. /// public readonly struct DuelStartRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelStartRequest(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 DuelStartRequest(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 => 0xAA; /// /// 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 => 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 DuelStartRequest(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(DuelStartRequest packet) => packet._data; } /// /// Is sent by the client when: A player requested to start a duel with the sending player. /// Causes reaction on server side: Depending on the response, the server starts the duel, or not. /// public readonly struct DuelStartResponse { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelStartResponse(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 DuelStartResponse(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 => 0xAA; /// /// 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 => 17; /// /// Gets the header of this packet. /// public C3HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the response. /// public bool Response { get => this._data.Span[4..].GetBoolean(); set => this._data.Span[4..].SetBoolean(value); } /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16LittleEndian(this._data.Span[5..]); set => WriteUInt16LittleEndian(this._data.Span[5..], value); } /// /// Gets or sets the player name. /// public string PlayerName { get => this._data.Span.ExtractString(7, 10, System.Text.Encoding.UTF8); set => this._data.Slice(7, 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 DuelStartResponse(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(DuelStartResponse packet) => packet._data; } /// /// Is sent by the client when: A player requested to stop the duel. /// Causes reaction on server side: The server stops the duel. /// public readonly struct DuelStopRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelStopRequest(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 DuelStopRequest(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 => 0xAA; /// /// 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 DuelStopRequest(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(DuelStopRequest packet) => packet._data; } /// /// Is sent by the client when: A player requested to join the duel as a spectator. /// Causes reaction on server side: The server will add the player as spectator. /// public readonly struct DuelChannelJoinRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelChannelJoinRequest(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 DuelChannelJoinRequest(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 => 0xAA; /// /// 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 => 5; /// /// Gets the header of this packet. /// public C3HeaderWithSubCode Header => new (this._data); /// /// Gets or sets the channel id. /// public byte ChannelId { 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 DuelChannelJoinRequest(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(DuelChannelJoinRequest packet) => packet._data; } /// /// Is sent by the client when: A player requested to quit the duel as a spectator. /// Causes reaction on server side: The server will remove the player as spectator. /// public readonly struct DuelChannelQuitRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelChannelQuitRequest(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 DuelChannelQuitRequest(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 => 0xAA; /// /// 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 => 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 DuelChannelQuitRequest(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(DuelChannelQuitRequest packet) => packet._data; } /// /// Is sent by the client when: A player selects a team (Red or Blue) in the Heykel Savasi (Statue War) team selection panel. /// Causes reaction on server side: The server assigns the player to the requested team, if possible, and updates the event state accordingly. /// public readonly struct HeykelSavasiTeamSelect { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public HeykelSavasiTeamSelect(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 HeykelSavasiTeamSelect(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 => 0xFA; /// /// 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 C1Header Header => new (this._data); /// /// Gets or sets 1 = Red team, 2 = Blue team. /// public byte Team { 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 HeykelSavasiTeamSelect(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(HeykelSavasiTeamSelect packet) => packet._data; } /// /// Is sent by the client when: A client which supports a user interface for chat commands requests the list of commands which are available to the player. It's usually sent after the character entered the game world. /// Causes reaction on server side: The server sends an AvailableChatCommand message for each available chat command. /// public readonly struct ChatCommandListRequest { private readonly Memory _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ChatCommandListRequest(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 ChatCommandListRequest(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 => 0xF5; /// /// 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 ChatCommandListRequest(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(ChatCommandListRequest packet) => packet._data; } /// /// The state of the trade button. /// public enum TradeButtonState { /// /// Trade button is not pressed. It means that the trade is not yet accepted by the trader. /// Unchecked = 0, /// /// Trade Button is pressed. It means that the trade is accepted by the trader. /// Checked = 1, /// /// This state is only sent to the client. After some seconds the client is changing back to normal Unchecked. /// Red = 2, } /// /// Describes the type of storage. /// public enum StorageType { /// /// The inventory of the player. /// Inventory = 0, /// /// The vault of the player. /// Vault = 1, /// /// The own trading storage. /// TradeOwn = 2, /// /// The trading storage of the other player. /// TradeOther = 3, /// /// The crafting storage of the player. /// Crafting = 4, /// /// The shop storage of another player. /// PersonalShop = 5, /// /// The shop storage of an NPC (merchant). /// NpcShop = 6, /// /// The inventory slot of the pet. That's used when a pet leveled up. /// InventoryPetSlot = 254, } /// /// Describes the type of pet. /// public enum PetType { /// /// The dark raven pet. /// DarkRaven = 0, /// /// The dark horse pet. /// DarkHorse = 1, } /// /// Describes the pet command mode. /// public enum PetCommandMode { /// /// The pet is in a normal mode, where it doesn't attack. /// Normal = 0, /// /// The pet attacks random targets. /// AttackRandom = 1, /// /// The pet attacks the same targets as the owner. /// AttackWithOwner = 2, /// /// The pet attacks a specific target until it's dead. /// AttackTarget = 3, } /// /// Describes the gens type. /// public enum GensType { /// /// The undefined gens type. /// Undefined = 0, /// /// The Duprian gens. /// Duprian = 1, /// /// The Vanert gens. /// Vanert = 2, } /// /// Describes the relationship type between guilds. /// public enum GuildRelationshipType { /// /// The undefined relationship type. /// Undefined = 0, /// /// The alliance relationship type. /// Alliance = 1, /// /// The hostility relationship type. /// Hostility = 2, } /// /// Describes the request type. /// public enum GuildRequestType { /// /// The undefined request type. /// Undefined = 0, /// /// The join type. /// Join = 1, /// /// The leave type. /// Leave = 2, }