Files
AdamuSw/src/Network/Packets/ClientToServer/ClientToServerPackets.cs
Acentech Dev 30b0fd1bc9 Regenerate packet code from merged XML (TvT + chat-command packets)
The ClientToServer/ServerToClient packet .cs/.md are XSL-generated from the .xml
(Network.Packets PreBuild). Regenerated after hand-merging the packet XML so the
generated structs contain BOTH the AdaMu custom TvT (HeykelSavasi FA/FB/FC/FD +
TeamSelect) packets AND the upstream chat-command packets (F5/00 request, F5/01
AvailableChatCommand).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-27 01:19:53 +03:00

17856 lines
605 KiB
C#

// <copyright file="ClientToServerPackets.cs" company="MUnique">
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
// </copyright>
//------------------------------------------------------------------------------
// <auto-generated>
// 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).
// </auto-generated>
//------------------------------------------------------------------------------
namespace MUnique.OpenMU.Network.Packets.ClientToServer;
using System;
using static System.Buffers.Binary.BinaryPrimitives;
/// <summary>
/// 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.
/// </summary>
public readonly struct Ping
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="Ping"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public Ping(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Ping"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private Ping(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x0E;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x00;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 12;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the tick count.
/// </summary>
public uint TickCount
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the attack speed.
/// </summary>
public ushort AttackSpeed
{
get => ReadUInt16LittleEndian(this._data.Span[8..]);
set => WriteUInt16LittleEndian(this._data.Span[8..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="Ping"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator Ping(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="Ping"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(Ping packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct ChecksumResponse
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ChecksumResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ChecksumResponse(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ChecksumResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ChecksumResponse(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x03;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the checksum.
/// </summary>
public uint Checksum
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ChecksumResponse"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ChecksumResponse(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ChecksumResponse"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ChecksumResponse packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct PublicChatMessage
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PublicChatMessage"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PublicChatMessage(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PublicChatMessage"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PublicChatMessage(Memory<byte> data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)data.Length;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x00;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the character.
/// </summary>
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);
}
/// <summary>
/// Gets or sets the message.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PublicChatMessage"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PublicChatMessage(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PublicChatMessage"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PublicChatMessage packet) => packet._data;
/// <summary>
/// Calculates the size of the packet for the specified field content.
/// </summary>
/// <param name="content">The content of the variable 'Message' field from which the size will be calculated.</param>
public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 13;
/// <summary>
/// Calculates the size of the packet for the specified field content.
/// </summary>
/// <param name="contentLength">The content length in bytes of the variable 'Message' field from which the size will be calculated.</param>
public static int GetRequiredSize(int contentLength) => contentLength + 1 + 13;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct WhisperMessage
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="WhisperMessage"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public WhisperMessage(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="WhisperMessage"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private WhisperMessage(Memory<byte> data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)data.Length;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x02;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the receiver name.
/// </summary>
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);
}
/// <summary>
/// Gets or sets the message.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="WhisperMessage"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator WhisperMessage(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="WhisperMessage"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(WhisperMessage packet) => packet._data;
/// <summary>
/// Calculates the size of the packet for the specified field content.
/// </summary>
/// <param name="content">The content of the variable 'Message' field from which the size will be calculated.</param>
public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 13;
/// <summary>
/// Calculates the size of the packet for the specified field content.
/// </summary>
/// <param name="contentLength">The content length in bytes of the variable 'Message' field from which the size will be calculated.</param>
public static int GetRequiredSize(int contentLength) => contentLength + 1 + 13;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct LoginLongPassword
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LoginLongPassword"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LoginLongPassword(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LoginLongPassword"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LoginLongPassword(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF1;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 60;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the user name, "encrypted" with Xor3.
/// </summary>
public Span<byte> Username
{
get => this._data.Slice(4, 10).Span;
}
/// <summary>
/// Gets or sets the password, "encrypted" with Xor3.
/// </summary>
public Span<byte> Password
{
get => this._data.Slice(14, 20).Span;
}
/// <summary>
/// Gets or sets the tick count.
/// </summary>
public uint TickCount
{
get => ReadUInt32BigEndian(this._data.Span[34..]);
set => WriteUInt32BigEndian(this._data.Span[34..], value);
}
/// <summary>
/// Gets or sets the client version.
/// </summary>
public Span<byte> ClientVersion
{
get => this._data.Slice(38, 5).Span;
}
/// <summary>
/// Gets or sets the client serial.
/// </summary>
public Span<byte> ClientSerial
{
get => this._data.Slice(43, 16).Span;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LoginLongPassword"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LoginLongPassword(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LoginLongPassword"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LoginLongPassword packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct LoginShortPassword
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LoginShortPassword"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LoginShortPassword(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LoginShortPassword"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LoginShortPassword(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF1;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 50;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the user name, "encrypted" with Xor3.
/// </summary>
public Span<byte> Username
{
get => this._data.Slice(4, 10).Span;
}
/// <summary>
/// Gets or sets the password, "encrypted" with Xor3.
/// </summary>
public Span<byte> Password
{
get => this._data.Slice(14, 10).Span;
}
/// <summary>
/// Gets or sets the tick count.
/// </summary>
public uint TickCount
{
get => ReadUInt32BigEndian(this._data.Span[24..]);
set => WriteUInt32BigEndian(this._data.Span[24..], value);
}
/// <summary>
/// Gets or sets the client version.
/// </summary>
public Span<byte> ClientVersion
{
get => this._data.Slice(28, 5).Span;
}
/// <summary>
/// Gets or sets the client serial.
/// </summary>
public Span<byte> ClientSerial
{
get => this._data.Slice(33, 16).Span;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LoginShortPassword"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LoginShortPassword(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LoginShortPassword"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LoginShortPassword packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct Login075
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="Login075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public Login075(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Login075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private Login075(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF1;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 48;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the user name, "encrypted" with Xor3.
/// </summary>
public Span<byte> Username
{
get => this._data.Slice(4, 10).Span;
}
/// <summary>
/// Gets or sets the password, "encrypted" with Xor3.
/// </summary>
public Span<byte> Password
{
get => this._data.Slice(14, 10).Span;
}
/// <summary>
/// Gets or sets the tick count.
/// </summary>
public uint TickCount
{
get => ReadUInt32BigEndian(this._data.Span[24..]);
set => WriteUInt32BigEndian(this._data.Span[24..], value);
}
/// <summary>
/// Gets or sets the client version.
/// </summary>
public Span<byte> ClientVersion
{
get => this._data.Slice(28, 3).Span;
}
/// <summary>
/// Gets or sets the client serial.
/// </summary>
public Span<byte> ClientSerial
{
get => this._data.Slice(31, 16).Span;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="Login075"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator Login075(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="Login075"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(Login075 packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct LogOut
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LogOut"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LogOut(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LogOut"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LogOut(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF1;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x02;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the type.
/// </summary>
public LogOutType Type
{
get => (LogOutType)this._data.Span[4];
set => this._data.Span[4] = (byte)value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LogOut"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LogOut(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LogOut"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LogOut packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct LogOutByCheatDetection
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LogOutByCheatDetection"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LogOutByCheatDetection(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LogOutByCheatDetection"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LogOutByCheatDetection(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF1;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x03;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the type.
/// </summary>
public byte Type
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the param.
/// </summary>
public byte Param
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LogOutByCheatDetection"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LogOutByCheatDetection(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LogOutByCheatDetection"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LogOutByCheatDetection packet) => packet._data;
}
/// <summary>
/// Is sent by the client when: Unknown?
/// Causes reaction on server side: Unknown?
/// </summary>
public readonly struct ResetCharacterPointRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ResetCharacterPointRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ResetCharacterPointRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ResetCharacterPointRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ResetCharacterPointRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x00;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ResetCharacterPointRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ResetCharacterPointRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ResetCharacterPointRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ResetCharacterPointRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct PlayerShopSetItemPrice
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PlayerShopSetItemPrice"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PlayerShopSetItemPrice(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PlayerShopSetItemPrice"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PlayerShopSetItemPrice(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x3F;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 9;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the item slot.
/// </summary>
public byte ItemSlot
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the price.
/// </summary>
public uint Price
{
get => ReadUInt32LittleEndian(this._data.Span[5..]);
set => WriteUInt32LittleEndian(this._data.Span[5..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PlayerShopSetItemPrice"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PlayerShopSetItemPrice(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PlayerShopSetItemPrice"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PlayerShopSetItemPrice packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct PlayerShopOpen
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PlayerShopOpen"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PlayerShopOpen(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PlayerShopOpen"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PlayerShopOpen(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x3F;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x02;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 30;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the store name.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PlayerShopOpen"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PlayerShopOpen(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PlayerShopOpen"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PlayerShopOpen packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct PlayerShopClose
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PlayerShopClose"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PlayerShopClose(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PlayerShopClose"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PlayerShopClose(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x3F;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x03;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PlayerShopClose"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PlayerShopClose(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PlayerShopClose"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PlayerShopClose packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct PlayerShopItemListRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PlayerShopItemListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PlayerShopItemListRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PlayerShopItemListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PlayerShopItemListRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x3F;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x05;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 16;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the player id.
/// </summary>
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data.Span[4..]);
set => WriteUInt16BigEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the player name.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PlayerShopItemListRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PlayerShopItemListRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PlayerShopItemListRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PlayerShopItemListRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct PlayerShopItemBuyRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PlayerShopItemBuyRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PlayerShopItemBuyRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PlayerShopItemBuyRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PlayerShopItemBuyRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x3F;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x06;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 17;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the player id.
/// </summary>
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data.Span[4..]);
set => WriteUInt16BigEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the player name.
/// </summary>
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);
}
/// <summary>
/// Gets or sets the item slot.
/// </summary>
public byte ItemSlot
{
get => this._data.Span[16];
set => this._data.Span[16] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PlayerShopItemBuyRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PlayerShopItemBuyRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PlayerShopItemBuyRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PlayerShopItemBuyRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct PlayerShopCloseOther
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PlayerShopCloseOther"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PlayerShopCloseOther(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PlayerShopCloseOther"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PlayerShopCloseOther(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x3F;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x07;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 16;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the player id.
/// </summary>
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data.Span[4..]);
set => WriteUInt16BigEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the player name.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PlayerShopCloseOther"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PlayerShopCloseOther(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PlayerShopCloseOther"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PlayerShopCloseOther packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct PickupItemRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PickupItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PickupItemRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PickupItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PickupItemRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x22;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the item id.
/// </summary>
public ushort ItemId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PickupItemRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PickupItemRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PickupItemRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PickupItemRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct PickupItemRequest075
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PickupItemRequest075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PickupItemRequest075(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PickupItemRequest075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PickupItemRequest075(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x22;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the item id.
/// </summary>
public ushort ItemId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PickupItemRequest075"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PickupItemRequest075(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PickupItemRequest075"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PickupItemRequest075 packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct DropItemRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="DropItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public DropItemRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DropItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private DropItemRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x23;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the target x.
/// </summary>
public byte TargetX
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Gets or sets the target y.
/// </summary>
public byte TargetY
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the item slot.
/// </summary>
public byte ItemSlot
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="DropItemRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator DropItemRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="DropItemRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(DropItemRequest packet) => packet._data;
}
/// <summary>
/// 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:
/// </summary>
public readonly struct ItemMoveRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ItemMoveRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ItemMoveRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ItemMoveRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ItemMoveRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x24;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 19;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the from storage.
/// </summary>
public ItemStorageKind FromStorage
{
get => (ItemStorageKind)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
/// <summary>
/// Gets or sets the from slot.
/// </summary>
public byte FromSlot
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the item data.
/// </summary>
public Span<byte> ItemData
{
get => this._data.Slice(5, 12).Span;
}
/// <summary>
/// Gets or sets the to storage.
/// </summary>
public ItemStorageKind ToStorage
{
get => (ItemStorageKind)this._data.Span[17];
set => this._data.Span[17] = (byte)value;
}
/// <summary>
/// Gets or sets the to slot.
/// </summary>
public byte ToSlot
{
get => this._data.Span[18];
set => this._data.Span[18] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ItemMoveRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ItemMoveRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ItemMoveRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ItemMoveRequest packet) => packet._data;
}
/// <summary>
/// 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:
/// </summary>
public readonly struct ItemMoveRequestExtended
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ItemMoveRequestExtended"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ItemMoveRequestExtended(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ItemMoveRequestExtended"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ItemMoveRequestExtended(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x24;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 7;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the from storage.
/// </summary>
public ItemStorageKind FromStorage
{
get => (ItemStorageKind)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
/// <summary>
/// Gets or sets the from slot.
/// </summary>
public byte FromSlot
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the to storage.
/// </summary>
public ItemStorageKind ToStorage
{
get => (ItemStorageKind)this._data.Span[5];
set => this._data.Span[5] = (byte)value;
}
/// <summary>
/// Gets or sets the to slot.
/// </summary>
public byte ToSlot
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ItemMoveRequestExtended"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ItemMoveRequestExtended(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ItemMoveRequestExtended"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ItemMoveRequestExtended packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct ConsumeItemRequest
{
/// <summary>
/// Defines how the fruit is used. Only applies, if the the item is a fruit.
/// </summary>
public enum FruitUsage
{
/// <summary>
/// Adds 1~3 stat points to the character.
/// </summary>
AddPoints = 0,
/// <summary>
/// Removes 1~9 stat points from the character.
/// </summary>
RemovePoints = 1,
}
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ConsumeItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ConsumeItemRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ConsumeItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ConsumeItemRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x26;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the inventory slot index of the item which should be consumed.
/// </summary>
public byte ItemSlot
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// 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.
/// </summary>
public byte TargetSlot
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets defines how the fruit is used. Only applies, if the the item is a fruit.
/// </summary>
public ConsumeItemRequest.FruitUsage FruitConsumption
{
get => (FruitUsage)this._data.Span[5];
set => this._data.Span[5] = (byte)value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ConsumeItemRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ConsumeItemRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ConsumeItemRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ConsumeItemRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct ConsumeItemRequest075
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ConsumeItemRequest075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ConsumeItemRequest075(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ConsumeItemRequest075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ConsumeItemRequest075(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x26;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the inventory slot index of the item which should be consumed.
/// </summary>
public byte ItemSlot
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// 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.
/// </summary>
public byte TargetSlot
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ConsumeItemRequest075"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ConsumeItemRequest075(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ConsumeItemRequest075"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ConsumeItemRequest075 packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct TalkToNpcRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="TalkToNpcRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public TalkToNpcRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="TalkToNpcRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private TalkToNpcRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x30;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the npc id.
/// </summary>
public ushort NpcId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="TalkToNpcRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator TalkToNpcRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="TalkToNpcRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(TalkToNpcRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CloseNpcRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CloseNpcRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CloseNpcRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CloseNpcRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CloseNpcRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x31;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CloseNpcRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CloseNpcRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CloseNpcRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CloseNpcRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct BuyItemFromNpcRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="BuyItemFromNpcRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public BuyItemFromNpcRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="BuyItemFromNpcRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private BuyItemFromNpcRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x32;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets item Slot (NPC Store)
/// </summary>
public byte ItemSlot
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="BuyItemFromNpcRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator BuyItemFromNpcRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="BuyItemFromNpcRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(BuyItemFromNpcRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct SellItemToNpcRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="SellItemToNpcRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public SellItemToNpcRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SellItemToNpcRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private SellItemToNpcRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x33;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets item Slot (Inventory)
/// </summary>
public byte ItemSlot
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="SellItemToNpcRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator SellItemToNpcRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="SellItemToNpcRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(SellItemToNpcRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct RepairItemRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="RepairItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public RepairItemRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="RepairItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private RepairItemRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x34;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// 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.
/// </summary>
public byte ItemSlot
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// 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.
/// </summary>
public bool IsSelfRepair
{
get => this._data.Span[4..].GetBoolean();
set => this._data.Span[4..].SetBoolean(value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="RepairItemRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator RepairItemRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="RepairItemRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(RepairItemRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct WarpCommandRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="WarpCommandRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public WarpCommandRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="WarpCommandRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private WarpCommandRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x8E;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x02;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 10;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets a command key, which is generated by a 'secret' algorithm. Not considered in OpenMU.
/// </summary>
public uint CommandKey
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the index of the entry in the warp list.
/// </summary>
public ushort WarpInfoIndex
{
get => ReadUInt16LittleEndian(this._data.Span[8..]);
set => WriteUInt16LittleEndian(this._data.Span[8..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="WarpCommandRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator WarpCommandRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="WarpCommandRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(WarpCommandRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct EnterGateRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="EnterGateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public EnterGateRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EnterGateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private EnterGateRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x1C;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the gate number.
/// </summary>
public ushort GateNumber
{
get => ReadUInt16LittleEndian(this._data.Span[4..]);
set => WriteUInt16LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the teleport target x.
/// </summary>
public byte TeleportTargetX
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
/// <summary>
/// Gets or sets the teleport target y.
/// </summary>
public byte TeleportTargetY
{
get => this._data.Span[7];
set => this._data.Span[7] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="EnterGateRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator EnterGateRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="EnterGateRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(EnterGateRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct EnterGateRequest075
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="EnterGateRequest075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public EnterGateRequest075(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EnterGateRequest075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private EnterGateRequest075(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x1C;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the gate number.
/// </summary>
public byte GateNumber
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Gets or sets the teleport target x.
/// </summary>
public byte TeleportTargetX
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the teleport target y.
/// </summary>
public byte TeleportTargetY
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="EnterGateRequest075"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator EnterGateRequest075(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="EnterGateRequest075"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(EnterGateRequest075 packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct TeleportTarget
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="TeleportTarget"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public TeleportTarget(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="TeleportTarget"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private TeleportTarget(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB0;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 7;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the target id.
/// </summary>
public ushort TargetId
{
get => ReadUInt16LittleEndian(this._data.Span[3..]);
set => WriteUInt16LittleEndian(this._data.Span[3..], value);
}
/// <summary>
/// Gets or sets the teleport target x.
/// </summary>
public byte TeleportTargetX
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Gets or sets the teleport target y.
/// </summary>
public byte TeleportTargetY
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="TeleportTarget"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator TeleportTarget(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="TeleportTarget"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(TeleportTarget packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct ServerChangeAuthentication
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ServerChangeAuthentication"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ServerChangeAuthentication(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ServerChangeAuthentication"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ServerChangeAuthentication(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB1;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 69;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the account xor 3.
/// </summary>
public Span<byte> AccountXor3
{
get => this._data.Slice(4, 12).Span;
}
/// <summary>
/// Gets or sets the character name xor 3.
/// </summary>
public Span<byte> CharacterNameXor3
{
get => this._data.Slice(16, 12).Span;
}
/// <summary>
/// Gets or sets the auth code 1.
/// </summary>
public uint AuthCode1
{
get => ReadUInt32LittleEndian(this._data.Span[28..]);
set => WriteUInt32LittleEndian(this._data.Span[28..], value);
}
/// <summary>
/// Gets or sets the auth code 2.
/// </summary>
public uint AuthCode2
{
get => ReadUInt32LittleEndian(this._data.Span[32..]);
set => WriteUInt32LittleEndian(this._data.Span[32..], value);
}
/// <summary>
/// Gets or sets the auth code 3.
/// </summary>
public uint AuthCode3
{
get => ReadUInt32LittleEndian(this._data.Span[36..]);
set => WriteUInt32LittleEndian(this._data.Span[36..], value);
}
/// <summary>
/// Gets or sets the auth code 4.
/// </summary>
public uint AuthCode4
{
get => ReadUInt32LittleEndian(this._data.Span[40..]);
set => WriteUInt32LittleEndian(this._data.Span[40..], value);
}
/// <summary>
/// Gets or sets the tick count.
/// </summary>
public uint TickCount
{
get => ReadUInt32LittleEndian(this._data.Span[44..]);
set => WriteUInt32LittleEndian(this._data.Span[44..], value);
}
/// <summary>
/// Gets or sets the client version.
/// </summary>
public Span<byte> ClientVersion
{
get => this._data.Slice(48, 5).Span;
}
/// <summary>
/// Gets or sets the client serial.
/// </summary>
public Span<byte> ClientSerial
{
get => this._data.Slice(53, 16).Span;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ServerChangeAuthentication"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ServerChangeAuthentication(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ServerChangeAuthentication"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ServerChangeAuthentication packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeStatusRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeStatusRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeStatusRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeStatusRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeStatusRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x00;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeStatusRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeStatusRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeStatusRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeStatusRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeRegistrationRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeRegistrationRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeRegistrationRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeRegistrationRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeRegistrationRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeRegistrationRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeRegistrationRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeRegistrationRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeRegistrationRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeUnregisterRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeUnregisterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeUnregisterRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeUnregisterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeUnregisterRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x02;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the is giving up.
/// </summary>
public bool IsGivingUp
{
get => this._data.Span[4..].GetBoolean();
set => this._data.Span[4..].SetBoolean(value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeUnregisterRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeUnregisterRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeUnregisterRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeUnregisterRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeRegistrationStateRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeRegistrationStateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeRegistrationStateRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeRegistrationStateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeRegistrationStateRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x03;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeRegistrationStateRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeRegistrationStateRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeRegistrationStateRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeRegistrationStateRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeMarkRegistration
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeMarkRegistration"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeMarkRegistration(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeMarkRegistration"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeMarkRegistration(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x04;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the item index.
/// </summary>
public byte ItemIndex
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeMarkRegistration"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeMarkRegistration(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeMarkRegistration"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeMarkRegistration packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeDefenseBuyRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeDefenseBuyRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeDefenseBuyRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeDefenseBuyRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeDefenseBuyRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x05;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 12;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the npc number.
/// </summary>
public uint NpcNumber
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the npc index.
/// </summary>
public uint NpcIndex
{
get => ReadUInt32LittleEndian(this._data.Span[8..]);
set => WriteUInt32LittleEndian(this._data.Span[8..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeDefenseBuyRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeDefenseBuyRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeDefenseBuyRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeDefenseBuyRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeDefenseRepairRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeDefenseRepairRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeDefenseRepairRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeDefenseRepairRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeDefenseRepairRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x06;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 12;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the npc number.
/// </summary>
public uint NpcNumber
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the npc index.
/// </summary>
public uint NpcIndex
{
get => ReadUInt32LittleEndian(this._data.Span[8..]);
set => WriteUInt32LittleEndian(this._data.Span[8..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeDefenseRepairRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeDefenseRepairRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeDefenseRepairRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeDefenseRepairRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeDefenseUpgradeRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeDefenseUpgradeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeDefenseUpgradeRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeDefenseUpgradeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeDefenseUpgradeRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x07;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 20;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the npc number.
/// </summary>
public uint NpcNumber
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the npc index.
/// </summary>
public uint NpcIndex
{
get => ReadUInt32LittleEndian(this._data.Span[8..]);
set => WriteUInt32LittleEndian(this._data.Span[8..], value);
}
/// <summary>
/// Gets or sets the npc upgrade type.
/// </summary>
public uint NpcUpgradeType
{
get => ReadUInt32LittleEndian(this._data.Span[12..]);
set => WriteUInt32LittleEndian(this._data.Span[12..], value);
}
/// <summary>
/// Gets or sets the npc upgrade value.
/// </summary>
public uint NpcUpgradeValue
{
get => ReadUInt32LittleEndian(this._data.Span[16..]);
set => WriteUInt32LittleEndian(this._data.Span[16..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeDefenseUpgradeRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeDefenseUpgradeRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeDefenseUpgradeRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeDefenseUpgradeRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeTaxInfoRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeTaxInfoRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeTaxInfoRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeTaxInfoRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeTaxInfoRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x08;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeTaxInfoRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeTaxInfoRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeTaxInfoRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeTaxInfoRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeTaxChangeRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeTaxChangeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeTaxChangeRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeTaxChangeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeTaxChangeRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x09;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 9;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets 0=Undefined, 1=ChaosMachine, 2 = Normal, 3 = EntranceFeeLandOfTrials
/// </summary>
public byte TaxType
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the tax rate.
/// </summary>
public uint TaxRate
{
get => ReadUInt32BigEndian(this._data.Span[5..]);
set => WriteUInt32BigEndian(this._data.Span[5..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeTaxChangeRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeTaxChangeRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeTaxChangeRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeTaxChangeRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeTaxMoneyWithdraw
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeTaxMoneyWithdraw"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeTaxMoneyWithdraw(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeTaxMoneyWithdraw"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeTaxMoneyWithdraw(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x10;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the amount.
/// </summary>
public uint Amount
{
get => ReadUInt32BigEndian(this._data.Span[4..]);
set => WriteUInt32BigEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeTaxMoneyWithdraw"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeTaxMoneyWithdraw(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeTaxMoneyWithdraw"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeTaxMoneyWithdraw packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct ToggleCastleGateRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ToggleCastleGateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ToggleCastleGateRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ToggleCastleGateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ToggleCastleGateRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x12;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 7;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the close state.
/// </summary>
public bool CloseState
{
get => this._data.Span[4..].GetBoolean();
set => this._data.Span[4..].SetBoolean(value);
}
/// <summary>
/// Gets or sets the gate id.
/// </summary>
public ushort GateId
{
get => ReadUInt16BigEndian(this._data.Span[5..]);
set => WriteUInt16BigEndian(this._data.Span[5..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ToggleCastleGateRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ToggleCastleGateRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ToggleCastleGateRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ToggleCastleGateRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleGuildCommand
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleGuildCommand"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleGuildCommand(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleGuildCommand"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleGuildCommand(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x1D;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets team Number 0 to 7.
/// </summary>
public byte Team
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the position x.
/// </summary>
public byte PositionX
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Gets or sets the position y.
/// </summary>
public byte PositionY
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
/// <summary>
/// Gets or sets 0 = Attack, 1 = Defend, 2 = Wait
/// </summary>
public byte Command
{
get => this._data.Span[7];
set => this._data.Span[7] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleGuildCommand"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleGuildCommand(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleGuildCommand"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleGuildCommand packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeHuntingZoneEntranceSetting
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeHuntingZoneEntranceSetting"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeHuntingZoneEntranceSetting(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeHuntingZoneEntranceSetting"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeHuntingZoneEntranceSetting(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x1F;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the is public.
/// </summary>
public bool IsPublic
{
get => this._data.Span[4..].GetBoolean();
set => this._data.Span[4..].SetBoolean(value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeHuntingZoneEntranceSetting"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeHuntingZoneEntranceSetting(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeHuntingZoneEntranceSetting"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeHuntingZoneEntranceSetting packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeGateListRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeGateListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeGateListRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeGateListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeGateListRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB3;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeGateListRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeGateListRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeGateListRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeGateListRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeStatueListRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeStatueListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeStatueListRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeStatueListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeStatueListRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB3;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x02;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeStatueListRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeStatueListRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeStatueListRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeStatueListRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeRegisteredGuildsListRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeRegisteredGuildsListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeRegisteredGuildsListRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeRegisteredGuildsListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeRegisteredGuildsListRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB4;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeRegisteredGuildsListRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeRegisteredGuildsListRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeRegisteredGuildsListRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeRegisteredGuildsListRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleOwnerListRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleOwnerListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleOwnerListRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleOwnerListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleOwnerListRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB5;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleOwnerListRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleOwnerListRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleOwnerListRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleOwnerListRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct FireCatapultRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="FireCatapultRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public FireCatapultRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FireCatapultRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private FireCatapultRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB7;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 7;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the catapult id.
/// </summary>
public ushort CatapultId
{
get => ReadUInt16BigEndian(this._data.Span[4..]);
set => WriteUInt16BigEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the target area index.
/// </summary>
public byte TargetAreaIndex
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="FireCatapultRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator FireCatapultRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="FireCatapultRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(FireCatapultRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct WeaponExplosionRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="WeaponExplosionRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public WeaponExplosionRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="WeaponExplosionRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private WeaponExplosionRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB7;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x04;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the catapult id.
/// </summary>
public ushort CatapultId
{
get => ReadUInt16BigEndian(this._data.Span[4..]);
set => WriteUInt16BigEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="WeaponExplosionRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator WeaponExplosionRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="WeaponExplosionRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(WeaponExplosionRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GuildLogoOfCastleOwnerRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GuildLogoOfCastleOwnerRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GuildLogoOfCastleOwnerRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GuildLogoOfCastleOwnerRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GuildLogoOfCastleOwnerRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB9;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x02;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GuildLogoOfCastleOwnerRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GuildLogoOfCastleOwnerRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GuildLogoOfCastleOwnerRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GuildLogoOfCastleOwnerRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CastleSiegeHuntingZoneEnterRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeHuntingZoneEnterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CastleSiegeHuntingZoneEnterRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CastleSiegeHuntingZoneEnterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CastleSiegeHuntingZoneEnterRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xB9;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x05;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the money.
/// </summary>
public uint Money
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CastleSiegeHuntingZoneEnterRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CastleSiegeHuntingZoneEnterRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CastleSiegeHuntingZoneEnterRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CastleSiegeHuntingZoneEnterRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CrywolfInfoRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CrywolfInfoRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CrywolfInfoRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CrywolfInfoRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CrywolfInfoRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xBD;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x00;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CrywolfInfoRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CrywolfInfoRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CrywolfInfoRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CrywolfInfoRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CrywolfContractRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CrywolfContractRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CrywolfContractRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CrywolfContractRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CrywolfContractRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xBD;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x03;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the statue id.
/// </summary>
public ushort StatueId
{
get => ReadUInt16BigEndian(this._data.Span[4..]);
set => WriteUInt16BigEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CrywolfContractRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CrywolfContractRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CrywolfContractRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CrywolfContractRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CrywolfChaosRateBenefitRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CrywolfChaosRateBenefitRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CrywolfChaosRateBenefitRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CrywolfChaosRateBenefitRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CrywolfChaosRateBenefitRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xBD;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x09;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CrywolfChaosRateBenefitRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CrywolfChaosRateBenefitRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CrywolfChaosRateBenefitRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CrywolfChaosRateBenefitRequest packet) => packet._data;
}
/// <summary>
/// Is sent by the client when: ?.
/// Causes reaction on server side: ?.
/// </summary>
public readonly struct WhiteAngelItemRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="WhiteAngelItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public WhiteAngelItemRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="WhiteAngelItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private WhiteAngelItemRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD0;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x03;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="WhiteAngelItemRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator WhiteAngelItemRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="WhiteAngelItemRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(WhiteAngelItemRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct EnterOnWerewolfRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="EnterOnWerewolfRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public EnterOnWerewolfRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EnterOnWerewolfRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private EnterOnWerewolfRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD0;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x07;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="EnterOnWerewolfRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator EnterOnWerewolfRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="EnterOnWerewolfRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(EnterOnWerewolfRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct EnterOnGatekeeperRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="EnterOnGatekeeperRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public EnterOnGatekeeperRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EnterOnGatekeeperRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private EnterOnGatekeeperRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD0;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x08;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="EnterOnGatekeeperRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator EnterOnGatekeeperRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="EnterOnGatekeeperRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(EnterOnGatekeeperRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct LeoHelperItemRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LeoHelperItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LeoHelperItemRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LeoHelperItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LeoHelperItemRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD0;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x09;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LeoHelperItemRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LeoHelperItemRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LeoHelperItemRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LeoHelperItemRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct MoveToDeviasBySnowmanRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="MoveToDeviasBySnowmanRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public MoveToDeviasBySnowmanRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="MoveToDeviasBySnowmanRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private MoveToDeviasBySnowmanRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD0;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x0A;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="MoveToDeviasBySnowmanRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator MoveToDeviasBySnowmanRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="MoveToDeviasBySnowmanRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(MoveToDeviasBySnowmanRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct SantaClausItemRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="SantaClausItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public SantaClausItemRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SantaClausItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private SantaClausItemRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD0;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x10;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="SantaClausItemRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator SantaClausItemRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="SantaClausItemRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(SantaClausItemRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct KanturuInfoRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="KanturuInfoRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public KanturuInfoRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="KanturuInfoRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private KanturuInfoRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD1;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x00;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="KanturuInfoRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator KanturuInfoRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="KanturuInfoRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(KanturuInfoRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct KanturuEnterRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="KanturuEnterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public KanturuEnterRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="KanturuEnterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private KanturuEnterRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD1;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="KanturuEnterRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator KanturuEnterRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="KanturuEnterRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(KanturuEnterRequest packet) => packet._data;
}
/// <summary>
/// Is sent by the client when: ?
/// Causes reaction on server side: ?
/// </summary>
public readonly struct RaklionStateInfoRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="RaklionStateInfoRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public RaklionStateInfoRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="RaklionStateInfoRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private RaklionStateInfoRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD1;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x10;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="RaklionStateInfoRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator RaklionStateInfoRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="RaklionStateInfoRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(RaklionStateInfoRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CashShopPointInfoRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CashShopPointInfoRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CashShopPointInfoRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CashShopPointInfoRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CashShopPointInfoRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CashShopPointInfoRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CashShopPointInfoRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CashShopPointInfoRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CashShopPointInfoRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CashShopOpenState
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CashShopOpenState"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CashShopOpenState(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CashShopOpenState"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CashShopOpenState(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x02;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the is closed.
/// </summary>
public bool IsClosed
{
get => this._data.Span[4..].GetBoolean();
set => this._data.Span[4..].SetBoolean(value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CashShopOpenState"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CashShopOpenState(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CashShopOpenState"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CashShopOpenState packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CashShopItemBuyRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CashShopItemBuyRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CashShopItemBuyRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CashShopItemBuyRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CashShopItemBuyRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x03;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 23;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the package main index.
/// </summary>
public uint PackageMainIndex
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the category.
/// </summary>
public uint Category
{
get => ReadUInt32LittleEndian(this._data.Span[8..]);
set => WriteUInt32LittleEndian(this._data.Span[8..], value);
}
/// <summary>
/// Gets or sets the product main index.
/// </summary>
public uint ProductMainIndex
{
get => ReadUInt32LittleEndian(this._data.Span[12..]);
set => WriteUInt32LittleEndian(this._data.Span[12..], value);
}
/// <summary>
/// Gets or sets the item index.
/// </summary>
public ushort ItemIndex
{
get => ReadUInt16LittleEndian(this._data.Span[16..]);
set => WriteUInt16LittleEndian(this._data.Span[16..], value);
}
/// <summary>
/// Gets or sets the coin index.
/// </summary>
public uint CoinIndex
{
get => ReadUInt32LittleEndian(this._data.Span[18..]);
set => WriteUInt32LittleEndian(this._data.Span[18..], value);
}
/// <summary>
/// Gets or sets the mileage flag.
/// </summary>
public byte MileageFlag
{
get => this._data.Span[22];
set => this._data.Span[22] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CashShopItemBuyRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CashShopItemBuyRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CashShopItemBuyRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CashShopItemBuyRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CashShopItemGiftRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CashShopItemGiftRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CashShopItemGiftRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CashShopItemGiftRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CashShopItemGiftRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x04;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 234;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the package main index.
/// </summary>
public uint PackageMainIndex
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the category.
/// </summary>
public uint Category
{
get => ReadUInt32LittleEndian(this._data.Span[8..]);
set => WriteUInt32LittleEndian(this._data.Span[8..], value);
}
/// <summary>
/// Gets or sets the product main index.
/// </summary>
public uint ProductMainIndex
{
get => ReadUInt32LittleEndian(this._data.Span[12..]);
set => WriteUInt32LittleEndian(this._data.Span[12..], value);
}
/// <summary>
/// Gets or sets the item index.
/// </summary>
public ushort ItemIndex
{
get => ReadUInt16LittleEndian(this._data.Span[16..]);
set => WriteUInt16LittleEndian(this._data.Span[16..], value);
}
/// <summary>
/// Gets or sets the coin index.
/// </summary>
public uint CoinIndex
{
get => ReadUInt32LittleEndian(this._data.Span[18..]);
set => WriteUInt32LittleEndian(this._data.Span[18..], value);
}
/// <summary>
/// Gets or sets the mileage flag.
/// </summary>
public byte MileageFlag
{
get => this._data.Span[22];
set => this._data.Span[22] = value;
}
/// <summary>
/// Gets or sets the gift receiver name.
/// </summary>
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);
}
/// <summary>
/// Gets or sets the gift text.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CashShopItemGiftRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CashShopItemGiftRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CashShopItemGiftRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CashShopItemGiftRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CashShopStorageListRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CashShopStorageListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CashShopStorageListRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CashShopStorageListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CashShopStorageListRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x05;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 10;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the page index.
/// </summary>
public uint PageIndex
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the inventory type.
/// </summary>
public byte InventoryType
{
get => this._data.Span[8];
set => this._data.Span[8] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CashShopStorageListRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CashShopStorageListRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CashShopStorageListRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CashShopStorageListRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CashShopDeleteStorageItemRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CashShopDeleteStorageItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CashShopDeleteStorageItemRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CashShopDeleteStorageItemRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CashShopDeleteStorageItemRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x0A;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 234;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the base item code.
/// </summary>
public uint BaseItemCode
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the main item code.
/// </summary>
public uint MainItemCode
{
get => ReadUInt32LittleEndian(this._data.Span[8..]);
set => WriteUInt32LittleEndian(this._data.Span[8..], value);
}
/// <summary>
/// Gets or sets the product type.
/// </summary>
public byte ProductType
{
get => this._data.Span[12];
set => this._data.Span[12] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CashShopDeleteStorageItemRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CashShopDeleteStorageItemRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CashShopDeleteStorageItemRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CashShopDeleteStorageItemRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CashShopStorageItemConsumeRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CashShopStorageItemConsumeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CashShopStorageItemConsumeRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CashShopStorageItemConsumeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CashShopStorageItemConsumeRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x0B;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 15;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the base item code.
/// </summary>
public uint BaseItemCode
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the main item code.
/// </summary>
public uint MainItemCode
{
get => ReadUInt32LittleEndian(this._data.Span[8..]);
set => WriteUInt32LittleEndian(this._data.Span[8..], value);
}
/// <summary>
/// Gets or sets the item index.
/// </summary>
public ushort ItemIndex
{
get => ReadUInt16LittleEndian(this._data.Span[12..]);
set => WriteUInt16LittleEndian(this._data.Span[12..], value);
}
/// <summary>
/// Gets or sets the product type.
/// </summary>
public byte ProductType
{
get => this._data.Span[14];
set => this._data.Span[14] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CashShopStorageItemConsumeRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CashShopStorageItemConsumeRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CashShopStorageItemConsumeRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CashShopStorageItemConsumeRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CashShopEventItemListRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CashShopEventItemListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CashShopEventItemListRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CashShopEventItemListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CashShopEventItemListRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD2;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x13;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the category index.
/// </summary>
public uint CategoryIndex
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CashShopEventItemListRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CashShopEventItemListRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CashShopEventItemListRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CashShopEventItemListRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct UnlockVault
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="UnlockVault"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public UnlockVault(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="UnlockVault"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private UnlockVault(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x83;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x00;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 7;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the pin.
/// </summary>
public ushort Pin
{
get => ReadUInt16LittleEndian(this._data.Span[4..]);
set => WriteUInt16LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="UnlockVault"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator UnlockVault(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="UnlockVault"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(UnlockVault packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct SetVaultPin
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="SetVaultPin"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public SetVaultPin(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SetVaultPin"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private SetVaultPin(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x83;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 27;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the pin.
/// </summary>
public ushort Pin
{
get => ReadUInt16LittleEndian(this._data.Span[4..]);
set => WriteUInt16LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the password of the account, which is required to set a new vault pin.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="SetVaultPin"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator SetVaultPin(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="SetVaultPin"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(SetVaultPin packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct RemoveVaultPin
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="RemoveVaultPin"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public RemoveVaultPin(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="RemoveVaultPin"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private RemoveVaultPin(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x83;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x02;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 27;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the password of the account, which is required to remove the vault pin.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="RemoveVaultPin"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator RemoveVaultPin(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="RemoveVaultPin"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(RemoveVaultPin packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct VaultClosed
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="VaultClosed"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public VaultClosed(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="VaultClosed"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private VaultClosed(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x82;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="VaultClosed"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator VaultClosed(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="VaultClosed"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(VaultClosed packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct VaultMoveMoneyRequest
{
/// <summary>
/// Defines the moving direction of money between inventory and vault.
/// </summary>
public enum VaultMoneyMoveDirection
{
/// <summary>
/// The money is moved from the inventory to the vault.
/// </summary>
InventoryToVault = 0,
/// <summary>
/// The money is moved from the vault to the inventory.
/// </summary>
VaultToInventory = 1,
}
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="VaultMoveMoneyRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public VaultMoveMoneyRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="VaultMoveMoneyRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private VaultMoveMoneyRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x81;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the direction.
/// </summary>
public VaultMoveMoneyRequest.VaultMoneyMoveDirection Direction
{
get => (VaultMoneyMoveDirection)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
/// <summary>
/// Gets or sets the amount.
/// </summary>
public uint Amount
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="VaultMoveMoneyRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator VaultMoveMoneyRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="VaultMoveMoneyRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(VaultMoveMoneyRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct LahapJewelMixRequest
{
/// <summary>
/// Describes what kind of operation is requested.
/// </summary>
public enum MixType
{
/// <summary>
/// The player wants to mix single jewels into a bundle.
/// </summary>
Mix = 0,
/// <summary>
/// The player wants to disband a bundle into single jewels.
/// </summary>
Unmix = 1,
}
/// <summary>
/// Describes the size of a mixed stack.
/// </summary>
public enum StackSize
{
/// <summary>
/// A stack of 10 items.
/// </summary>
Ten = 0,
/// <summary>
/// A stack of 20 items.
/// </summary>
Twenty = 1,
/// <summary>
/// A stack of 30 items.
/// </summary>
Thirty = 2,
}
/// <summary>
/// Describes the type of item which is mixed or unmixed.
/// </summary>
public enum ItemType
{
/// <summary>
/// Jewel of Bless.
/// </summary>
JewelOfBless = 0,
/// <summary>
/// Jewel of Soul.
/// </summary>
JewelOfSoul = 1,
/// <summary>
/// Jewel of Life.
/// </summary>
JewelOfLife = 2,
/// <summary>
/// Jewel of Creation.
/// </summary>
JewelOfCreation = 3,
/// <summary>
/// Jewel of Guardian.
/// </summary>
JewelOfGuardian = 4,
/// <summary>
/// The gemstone.
/// </summary>
Gemstone = 5,
/// <summary>
/// Jewel of Harmony.
/// </summary>
JewelOfHarmony = 6,
/// <summary>
/// Jewel of Chaos.
/// </summary>
JewelOfChaos = 7,
/// <summary>
/// Lower refine stone.
/// </summary>
LowerRefineStone = 8,
/// <summary>
/// Higher refine stone.
/// </summary>
HigherRefineStone = 9,
}
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LahapJewelMixRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LahapJewelMixRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LahapJewelMixRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LahapJewelMixRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xBC;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 7;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the operation.
/// </summary>
public LahapJewelMixRequest.MixType Operation
{
get => (MixType)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
/// <summary>
/// Gets or sets the item.
/// </summary>
public LahapJewelMixRequest.ItemType Item
{
get => (ItemType)this._data.Span[4];
set => this._data.Span[4] = (byte)value;
}
/// <summary>
/// Gets or sets the mixing stack size.
/// </summary>
public LahapJewelMixRequest.StackSize MixingStackSize
{
get => (StackSize)this._data.Span[5];
set => this._data.Span[5] = (byte)value;
}
/// <summary>
/// Gets or sets the unmixing source slot.
/// </summary>
public byte UnmixingSourceSlot
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LahapJewelMixRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LahapJewelMixRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LahapJewelMixRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LahapJewelMixRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct PartyListRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PartyListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PartyListRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PartyListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PartyListRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x42;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PartyListRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PartyListRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PartyListRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PartyListRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct PartyPlayerKickRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PartyPlayerKickRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PartyPlayerKickRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PartyPlayerKickRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PartyPlayerKickRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x43;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the player index.
/// </summary>
public byte PlayerIndex
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PartyPlayerKickRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PartyPlayerKickRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PartyPlayerKickRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PartyPlayerKickRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct PartyInviteRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PartyInviteRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PartyInviteRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PartyInviteRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PartyInviteRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x40;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the target player id.
/// </summary>
public ushort TargetPlayerId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PartyInviteRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PartyInviteRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PartyInviteRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PartyInviteRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct PartyInviteResponse
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PartyInviteResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PartyInviteResponse(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PartyInviteResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PartyInviteResponse(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x41;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the accepted.
/// </summary>
public bool Accepted
{
get => this._data.Span[3..].GetBoolean();
set => this._data.Span[3..].SetBoolean(value);
}
/// <summary>
/// Gets or sets the requester id.
/// </summary>
public ushort RequesterId
{
get => ReadUInt16BigEndian(this._data.Span[4..]);
set => WriteUInt16BigEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PartyInviteResponse"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PartyInviteResponse(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PartyInviteResponse"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PartyInviteResponse packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct WalkRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="WalkRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public WalkRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="WalkRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private WalkRequest(Memory<byte> data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)data.Length;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xD4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the source x.
/// </summary>
public byte SourceX
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Gets or sets the source y.
/// </summary>
public byte SourceY
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the step count.
/// </summary>
public byte StepCount
{
get => this._data.Span[5..].GetByteValue(4, 0);
set => this._data.Span[5..].SetByteValue(value, 4, 0);
}
/// <summary>
/// Gets or sets the target rotation.
/// </summary>
public byte TargetRotation
{
get => this._data.Span[5..].GetByteValue(4, 4);
set => this._data.Span[5..].SetByteValue(value, 4, 4);
}
/// <summary>
/// Gets or sets the directions of the walking path. The target is calculated by taking the source coordinates and applying the directions to it.
/// </summary>
public Span<byte> Directions
{
get => this._data.Slice(6).Span;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="WalkRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator WalkRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="WalkRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(WalkRequest packet) => packet._data;
/// <summary>
/// Calculates the size of the packet for the specified length of <see cref="Directions"/>.
/// </summary>
/// <param name="directionsLength">The length in bytes of <see cref="Directions"/> on which the required size depends.</param>
public static int GetRequiredSize(int directionsLength) => directionsLength + 6;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct WalkRequest075
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="WalkRequest075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public WalkRequest075(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="WalkRequest075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private WalkRequest075(Memory<byte> data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)data.Length;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x10;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the source x.
/// </summary>
public byte SourceX
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Gets or sets the source y.
/// </summary>
public byte SourceY
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the step count.
/// </summary>
public byte StepCount
{
get => this._data.Span[5..].GetByteValue(4, 0);
set => this._data.Span[5..].SetByteValue(value, 4, 0);
}
/// <summary>
/// Gets or sets the target rotation.
/// </summary>
public byte TargetRotation
{
get => this._data.Span[5..].GetByteValue(4, 4);
set => this._data.Span[5..].SetByteValue(value, 4, 4);
}
/// <summary>
/// Gets or sets the directions of the walking path. The target is calculated by taking the source coordinates and applying the directions to it.
/// </summary>
public Span<byte> Directions
{
get => this._data.Slice(6).Span;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="WalkRequest075"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator WalkRequest075(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="WalkRequest075"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(WalkRequest075 packet) => packet._data;
/// <summary>
/// Calculates the size of the packet for the specified length of <see cref="Directions"/>.
/// </summary>
/// <param name="directionsLength">The length in bytes of <see cref="Directions"/> on which the required size depends.</param>
public static int GetRequiredSize(int directionsLength) => directionsLength + 6;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct InstantMoveRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="InstantMoveRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public InstantMoveRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="InstantMoveRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private InstantMoveRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x15;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the target x.
/// </summary>
public byte TargetX
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Gets or sets the target y.
/// </summary>
public byte TargetY
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="InstantMoveRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator InstantMoveRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="InstantMoveRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(InstantMoveRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct AnimationRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="AnimationRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public AnimationRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="AnimationRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private AnimationRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x18;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the rotation.
/// </summary>
public byte Rotation
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Gets or sets the animation number.
/// </summary>
public byte AnimationNumber
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="AnimationRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator AnimationRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="AnimationRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(AnimationRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct RequestCharacterList
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="RequestCharacterList"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public RequestCharacterList(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="RequestCharacterList"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private RequestCharacterList(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF3;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x00;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the language.
/// </summary>
public byte Language
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="RequestCharacterList"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator RequestCharacterList(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="RequestCharacterList"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(RequestCharacterList packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CreateCharacter
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CreateCharacter"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CreateCharacter(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CreateCharacter"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CreateCharacter(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF3;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 15;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the name of the character which should be created.
/// </summary>
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);
}
/// <summary>
/// Gets or sets the character class of the character which should be created.
/// </summary>
public CharacterClassNumber Class
{
get => (CharacterClassNumber)this._data.Span[14..].GetByteValue(6, 2);
set => this._data.Span[14..].SetByteValue((byte)value, 6, 2);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CreateCharacter"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CreateCharacter(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CreateCharacter"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CreateCharacter packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct DeleteCharacter
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="DeleteCharacter"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public DeleteCharacter(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DeleteCharacter"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private DeleteCharacter(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF3;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x02;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 24;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the name of the character which should be deleted.
/// </summary>
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);
}
/// <summary>
/// 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.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="DeleteCharacter"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator DeleteCharacter(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="DeleteCharacter"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(DeleteCharacter packet) => packet._data;
/// <summary>
/// Calculates the size of the packet for the specified field content.
/// </summary>
/// <param name="content">The content of the variable 'SecurityCode' field from which the size will be calculated.</param>
public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 14;
/// <summary>
/// Calculates the size of the packet for the specified field content.
/// </summary>
/// <param name="contentLength">The content length in bytes of the variable 'SecurityCode' field from which the size will be calculated.</param>
public static int GetRequiredSize(int contentLength) => contentLength + 1 + 14;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct SelectCharacter
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="SelectCharacter"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public SelectCharacter(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SelectCharacter"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private SelectCharacter(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF3;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x03;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 14;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the name of the character with which the player wants to join the game world
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="SelectCharacter"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator SelectCharacter(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="SelectCharacter"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(SelectCharacter packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct FocusCharacter
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="FocusCharacter"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public FocusCharacter(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FocusCharacter"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private FocusCharacter(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF3;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x15;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 14;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the name.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="FocusCharacter"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator FocusCharacter(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="FocusCharacter"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(FocusCharacter packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct IncreaseCharacterStatPoint
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="IncreaseCharacterStatPoint"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public IncreaseCharacterStatPoint(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="IncreaseCharacterStatPoint"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private IncreaseCharacterStatPoint(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF3;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x06;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the stat type.
/// </summary>
public CharacterStatAttribute StatType
{
get => (CharacterStatAttribute)this._data.Span[4];
set => this._data.Span[4] = (byte)value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="IncreaseCharacterStatPoint"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator IncreaseCharacterStatPoint(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="IncreaseCharacterStatPoint"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(IncreaseCharacterStatPoint packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct InventoryRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="InventoryRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public InventoryRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="InventoryRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private InventoryRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF3;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x10;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="InventoryRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator InventoryRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="InventoryRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(InventoryRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct ClientReadyAfterMapChange
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ClientReadyAfterMapChange"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ClientReadyAfterMapChange(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ClientReadyAfterMapChange"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ClientReadyAfterMapChange(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF3;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x12;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ClientReadyAfterMapChange"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ClientReadyAfterMapChange(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ClientReadyAfterMapChange"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ClientReadyAfterMapChange packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct SaveKeyConfiguration
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="SaveKeyConfiguration"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public SaveKeyConfiguration(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SaveKeyConfiguration"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private SaveKeyConfiguration(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF3;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x30;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the binary data of the key configuration
/// </summary>
public Span<byte> Configuration
{
get => this._data.Slice(4).Span;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="SaveKeyConfiguration"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator SaveKeyConfiguration(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="SaveKeyConfiguration"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(SaveKeyConfiguration packet) => packet._data;
/// <summary>
/// Calculates the size of the packet for the specified length of <see cref="Configuration"/>.
/// </summary>
/// <param name="configurationLength">The length in bytes of <see cref="Configuration"/> on which the required size depends.</param>
public static int GetRequiredSize(int configurationLength) => configurationLength + 4;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct AddMasterSkillPoint
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="AddMasterSkillPoint"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public AddMasterSkillPoint(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="AddMasterSkillPoint"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private AddMasterSkillPoint(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF3;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x52;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the skill id.
/// </summary>
public ushort SkillId
{
get => ReadUInt16LittleEndian(this._data.Span[4..]);
set => WriteUInt16LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="AddMasterSkillPoint"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator AddMasterSkillPoint(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="AddMasterSkillPoint"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(AddMasterSkillPoint packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct HitRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="HitRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public HitRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="HitRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private HitRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x11;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 7;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the target id.
/// </summary>
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
/// <summary>
/// Gets or sets the attack animation.
/// </summary>
public byte AttackAnimation
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Gets or sets the looking direction.
/// </summary>
public byte LookingDirection
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="HitRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator HitRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="HitRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(HitRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct TargetedSkill
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="TargetedSkill"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public TargetedSkill(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="TargetedSkill"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private TargetedSkill(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x19;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 7;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the skill id.
/// </summary>
public ushort SkillId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
/// <summary>
/// Gets or sets the target id.
/// </summary>
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data.Span[5..]);
set => WriteUInt16BigEndian(this._data.Span[5..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="TargetedSkill"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator TargetedSkill(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="TargetedSkill"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(TargetedSkill packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct TargetedSkill075
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="TargetedSkill075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public TargetedSkill075(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="TargetedSkill075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private TargetedSkill075(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x19;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the index of the skill in the skill list.
/// </summary>
public byte SkillIndex
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Gets or sets the target id.
/// </summary>
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data.Span[4..]);
set => WriteUInt16BigEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="TargetedSkill075"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator TargetedSkill075(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="TargetedSkill075"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(TargetedSkill075 packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct TargetedSkill095
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="TargetedSkill095"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public TargetedSkill095(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="TargetedSkill095"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private TargetedSkill095(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x19;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the index of the skill in the skill list.
/// </summary>
public byte SkillIndex
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Gets or sets the target id.
/// </summary>
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data.Span[4..]);
set => WriteUInt16BigEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="TargetedSkill095"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator TargetedSkill095(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="TargetedSkill095"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(TargetedSkill095 packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct MagicEffectCancelRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="MagicEffectCancelRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public MagicEffectCancelRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="MagicEffectCancelRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private MagicEffectCancelRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x1B;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 7;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the skill id.
/// </summary>
public ushort SkillId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
/// <summary>
/// Gets or sets the player id.
/// </summary>
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data.Span[5..]);
set => WriteUInt16BigEndian(this._data.Span[5..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="MagicEffectCancelRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator MagicEffectCancelRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="MagicEffectCancelRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(MagicEffectCancelRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct AreaSkill
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="AreaSkill"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public AreaSkill(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="AreaSkill"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private AreaSkill(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x1E;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 13;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the skill id.
/// </summary>
public ushort SkillId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
/// <summary>
/// Gets or sets the target x.
/// </summary>
public byte TargetX
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Gets or sets the target y.
/// </summary>
public byte TargetY
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
/// <summary>
/// Gets or sets the rotation.
/// </summary>
public byte Rotation
{
get => this._data.Span[7];
set => this._data.Span[7] = value;
}
/// <summary>
/// Gets or sets the extra target id.
/// </summary>
public ushort ExtraTargetId
{
get => ReadUInt16BigEndian(this._data.Span[10..]);
set => WriteUInt16BigEndian(this._data.Span[10..], value);
}
/// <summary>
/// Gets or sets animation counter which acts as a reference to the previously sent Area Skill Animation packet.
/// </summary>
public byte AnimationCounter
{
get => this._data.Span[12];
set => this._data.Span[12] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="AreaSkill"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator AreaSkill(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="AreaSkill"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(AreaSkill packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct AreaSkillHit
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="AreaSkillHit"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public AreaSkillHit(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="AreaSkillHit"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private AreaSkillHit(Memory<byte> data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)data.Length;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xDB;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the skill id.
/// </summary>
public ushort SkillId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
/// <summary>
/// Gets or sets the target x.
/// </summary>
public byte TargetX
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Gets or sets the target y.
/// </summary>
public byte TargetY
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
/// <summary>
/// Gets or sets a sequential hit counter which should prevent that hits are sent multiple times.
/// </summary>
public byte HitCounter
{
get => this._data.Span[7];
set => this._data.Span[7] = value;
}
/// <summary>
/// Gets or sets number of targets which will follow in the structure.
/// </summary>
public byte TargetCount
{
get => this._data.Span[8];
set => this._data.Span[8] = value;
}
/// <summary>
/// Gets the <see cref="TargetData"/> of the specified index.
/// </summary>
public TargetData this[int index] => new (this._data.Slice(9 + index * TargetData.Length));
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="AreaSkillHit"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator AreaSkillHit(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="AreaSkillHit"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(AreaSkillHit packet) => packet._data;
/// <summary>
/// Calculates the size of the packet for the specified count of <see cref="TargetData"/>.
/// </summary>
/// <param name="targetsCount">The count of <see cref="TargetData"/> from which the size will be calculated.</param>
public static int GetRequiredSize(int targetsCount) => targetsCount * TargetData.Length + 9;
/// <summary>
/// Contains the data of the target.
/// </summary>
public readonly struct TargetData
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="TargetData"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public TargetData(Memory<byte> data)
{
this._data = data;
}
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets or sets the target id.
/// </summary>
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data.Span);
set => WriteUInt16BigEndian(this._data.Span, value);
}
/// <summary>
/// Gets or sets a sequential animation counter which acts as a reference to the previously sent Area Skill Animation packet.
/// </summary>
public byte AnimationCounter
{
get => this._data.Span[2];
set => this._data.Span[2] = value;
}
}
}
/// <summary>
/// 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.
/// </summary>
public readonly struct AreaSkill075
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="AreaSkill075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public AreaSkill075(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="AreaSkill075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private AreaSkill075(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x1E;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 7;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the index of the skill in the skill list.
/// </summary>
public byte SkillIndex
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Gets or sets the target x.
/// </summary>
public byte TargetX
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the target y.
/// </summary>
public byte TargetY
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Gets or sets the rotation.
/// </summary>
public byte Rotation
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="AreaSkill075"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator AreaSkill075(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="AreaSkill075"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(AreaSkill075 packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct AreaSkillHit075
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="AreaSkillHit075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public AreaSkillHit075(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="AreaSkillHit075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private AreaSkillHit075(Memory<byte> data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)data.Length;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x1D;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the index of the skill in the skill list.
/// </summary>
public byte SkillIndex
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Gets or sets the target x.
/// </summary>
public byte TargetX
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the target y.
/// </summary>
public byte TargetY
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Gets or sets the number of targets which are hit.
/// </summary>
public byte TargetCount
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
/// <summary>
/// Gets the <see cref="TargetData"/> of the specified index.
/// </summary>
public TargetData this[int index] => new (this._data.Slice(7 + index * TargetData.Length));
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="AreaSkillHit075"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator AreaSkillHit075(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="AreaSkillHit075"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(AreaSkillHit075 packet) => packet._data;
/// <summary>
/// Calculates the size of the packet for the specified count of <see cref="TargetData"/>.
/// </summary>
/// <param name="targetsCount">The count of <see cref="TargetData"/> from which the size will be calculated.</param>
public static int GetRequiredSize(int targetsCount) => targetsCount * TargetData.Length + 7;
/// <summary>
/// Contains the data of the target.
/// </summary>
public readonly struct TargetData
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="TargetData"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public TargetData(Memory<byte> data)
{
this._data = data;
}
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 2;
/// <summary>
/// Gets or sets the target id.
/// </summary>
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data.Span);
set => WriteUInt16BigEndian(this._data.Span, value);
}
}
}
/// <summary>
/// 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.
/// </summary>
public readonly struct AreaSkill095
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="AreaSkill095"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public AreaSkill095(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="AreaSkill095"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private AreaSkill095(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x1E;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 7;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the index of the skill in the skill list.
/// </summary>
public byte SkillIndex
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Gets or sets the target x.
/// </summary>
public byte TargetX
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the target y.
/// </summary>
public byte TargetY
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Gets or sets the rotation.
/// </summary>
public byte Rotation
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="AreaSkill095"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator AreaSkill095(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="AreaSkill095"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(AreaSkill095 packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct AreaSkillHit095
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="AreaSkillHit095"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public AreaSkillHit095(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="AreaSkillHit095"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private AreaSkillHit095(Memory<byte> data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)data.Length;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x1D;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the index of the skill in the skill list.
/// </summary>
public byte SkillIndex
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Gets or sets the target x.
/// </summary>
public byte TargetX
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the target y.
/// </summary>
public byte TargetY
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Gets or sets the counter.
/// </summary>
public byte Counter
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
/// <summary>
/// Gets or sets the number of targets which are hit.
/// </summary>
public byte TargetCount
{
get => this._data.Span[7];
set => this._data.Span[7] = value;
}
/// <summary>
/// Gets the <see cref="TargetData"/> of the specified index.
/// </summary>
public TargetData this[int index] => new (this._data.Slice(8 + index * TargetData.Length));
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="AreaSkillHit095"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator AreaSkillHit095(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="AreaSkillHit095"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(AreaSkillHit095 packet) => packet._data;
/// <summary>
/// Calculates the size of the packet for the specified count of <see cref="TargetData"/>.
/// </summary>
/// <param name="targetsCount">The count of <see cref="TargetData"/> from which the size will be calculated.</param>
public static int GetRequiredSize(int targetsCount) => targetsCount * TargetData.Length + 8;
/// <summary>
/// Contains the data of the target.
/// </summary>
public readonly struct TargetData
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="TargetData"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public TargetData(Memory<byte> data)
{
this._data = data;
}
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 2;
/// <summary>
/// Gets or sets the target id.
/// </summary>
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data.Span);
set => WriteUInt16BigEndian(this._data.Span, value);
}
}
}
/// <summary>
/// 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.
/// </summary>
public readonly struct RageAttackRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="RageAttackRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public RageAttackRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="RageAttackRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private RageAttackRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x4A;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the skill id.
/// </summary>
public ushort SkillId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
/// <summary>
/// Gets or sets the target id.
/// </summary>
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data.Span[6..]);
set => WriteUInt16BigEndian(this._data.Span[6..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="RageAttackRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator RageAttackRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="RageAttackRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(RageAttackRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct RageAttackRangeRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="RageAttackRangeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public RageAttackRangeRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="RageAttackRangeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private RageAttackRangeRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x4B;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 7;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the skill id.
/// </summary>
public ushort SkillId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
/// <summary>
/// Gets or sets the target id.
/// </summary>
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data.Span[5..]);
set => WriteUInt16BigEndian(this._data.Span[5..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="RageAttackRangeRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator RageAttackRangeRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="RageAttackRangeRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(RageAttackRangeRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct TradeCancel
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="TradeCancel"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public TradeCancel(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="TradeCancel"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private TradeCancel(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x3D;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="TradeCancel"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator TradeCancel(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="TradeCancel"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(TradeCancel packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct TradeButtonStateChange
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="TradeButtonStateChange"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public TradeButtonStateChange(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="TradeButtonStateChange"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private TradeButtonStateChange(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x3C;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the new state.
/// </summary>
public TradeButtonState NewState
{
get => (TradeButtonState)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="TradeButtonStateChange"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator TradeButtonStateChange(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="TradeButtonStateChange"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(TradeButtonStateChange packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct TradeRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="TradeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public TradeRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="TradeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private TradeRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x36;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the player id.
/// </summary>
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="TradeRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator TradeRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="TradeRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(TradeRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct TradeRequestResponse
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="TradeRequestResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public TradeRequestResponse(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="TradeRequestResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private TradeRequestResponse(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x37;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the trade accepted.
/// </summary>
public bool TradeAccepted
{
get => this._data.Span[3..].GetBoolean();
set => this._data.Span[3..].SetBoolean(value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="TradeRequestResponse"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator TradeRequestResponse(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="TradeRequestResponse"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(TradeRequestResponse packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct SetTradeMoney
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="SetTradeMoney"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public SetTradeMoney(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SetTradeMoney"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private SetTradeMoney(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x3A;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the amount.
/// </summary>
public uint Amount
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="SetTradeMoney"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator SetTradeMoney(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="SetTradeMoney"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(SetTradeMoney packet) => packet._data;
}
/// <summary>
/// Is sent by the client when: A player requests to delete a letter.
/// Causes reaction on server side: The letter is getting deleted.
/// </summary>
public readonly struct LetterDeleteRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LetterDeleteRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LetterDeleteRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LetterDeleteRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LetterDeleteRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xC8;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the letter index.
/// </summary>
public ushort LetterIndex
{
get => ReadUInt16LittleEndian(this._data.Span[4..]);
set => WriteUInt16LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LetterDeleteRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LetterDeleteRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LetterDeleteRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LetterDeleteRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct LetterListRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LetterListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LetterListRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LetterListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LetterListRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xC9;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LetterListRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LetterListRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LetterListRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LetterListRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct LetterSendRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LetterSendRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LetterSendRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LetterSendRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LetterSendRequest(Memory<byte> data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (ushort)data.Length;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC4;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xC5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C4Header Header => new (this._data);
/// <summary>
/// Gets or sets the letter id.
/// </summary>
public uint LetterId
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the receiver.
/// </summary>
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);
}
/// <summary>
/// Gets or sets the title.
/// </summary>
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);
}
/// <summary>
/// Gets or sets the rotation.
/// </summary>
public byte Rotation
{
get => this._data.Span[78];
set => this._data.Span[78] = value;
}
/// <summary>
/// Gets or sets the animation.
/// </summary>
public byte Animation
{
get => this._data.Span[79];
set => this._data.Span[79] = value;
}
/// <summary>
/// Gets or sets the message length.
/// </summary>
public ushort MessageLength
{
get => ReadUInt16LittleEndian(this._data.Span[80..]);
set => WriteUInt16LittleEndian(this._data.Span[80..], value);
}
/// <summary>
/// Gets or sets the message.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LetterSendRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LetterSendRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LetterSendRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LetterSendRequest packet) => packet._data;
/// <summary>
/// Calculates the size of the packet for the specified field content.
/// </summary>
/// <param name="content">The content of the variable 'Message' field from which the size will be calculated.</param>
public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 82;
/// <summary>
/// Calculates the size of the packet for the specified field content.
/// </summary>
/// <param name="contentLength">The content length in bytes of the variable 'Message' field from which the size will be calculated.</param>
public static int GetRequiredSize(int contentLength) => contentLength + 1 + 82;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct LetterReadRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LetterReadRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LetterReadRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LetterReadRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LetterReadRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xC7;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the letter index.
/// </summary>
public ushort LetterIndex
{
get => ReadUInt16LittleEndian(this._data.Span[4..]);
set => WriteUInt16LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LetterReadRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LetterReadRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LetterReadRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LetterReadRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GuildKickPlayerRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GuildKickPlayerRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GuildKickPlayerRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GuildKickPlayerRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GuildKickPlayerRequest(Memory<byte> data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)data.Length;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x53;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the player name.
/// </summary>
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);
}
/// <summary>
/// Gets or sets the security code.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GuildKickPlayerRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GuildKickPlayerRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GuildKickPlayerRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GuildKickPlayerRequest packet) => packet._data;
/// <summary>
/// Calculates the size of the packet for the specified field content.
/// </summary>
/// <param name="content">The content of the variable 'SecurityCode' field from which the size will be calculated.</param>
public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 13;
/// <summary>
/// Calculates the size of the packet for the specified field content.
/// </summary>
/// <param name="contentLength">The content length in bytes of the variable 'SecurityCode' field from which the size will be calculated.</param>
public static int GetRequiredSize(int contentLength) => contentLength + 1 + 13;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GuildJoinRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GuildJoinRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GuildJoinRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GuildJoinRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GuildJoinRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x50;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the guild master player id.
/// </summary>
public ushort GuildMasterPlayerId
{
get => ReadUInt16BigEndian(this._data.Span[3..]);
set => WriteUInt16BigEndian(this._data.Span[3..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GuildJoinRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GuildJoinRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GuildJoinRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GuildJoinRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GuildJoinResponse
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GuildJoinResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GuildJoinResponse(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GuildJoinResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GuildJoinResponse(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x51;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the accepted.
/// </summary>
public bool Accepted
{
get => this._data.Span[3..].GetBoolean();
set => this._data.Span[3..].SetBoolean(value);
}
/// <summary>
/// Gets or sets the requester id.
/// </summary>
public ushort RequesterId
{
get => ReadUInt16BigEndian(this._data.Span[4..]);
set => WriteUInt16BigEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GuildJoinResponse"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GuildJoinResponse(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GuildJoinResponse"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GuildJoinResponse packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GuildListRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GuildListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GuildListRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GuildListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GuildListRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x52;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GuildListRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GuildListRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GuildListRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GuildListRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GuildCreateRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GuildCreateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GuildCreateRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GuildCreateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GuildCreateRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x55;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 44;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the guild name.
/// </summary>
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);
}
/// <summary>
/// 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.
/// </summary>
public Span<byte> GuildEmblem
{
get => this._data.Slice(12, 32).Span;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GuildCreateRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GuildCreateRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GuildCreateRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GuildCreateRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GuildCreateRequest075
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GuildCreateRequest075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GuildCreateRequest075(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GuildCreateRequest075"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GuildCreateRequest075(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x55;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 43;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the guild name.
/// </summary>
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);
}
/// <summary>
/// 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.
/// </summary>
public Span<byte> GuildEmblem
{
get => this._data.Slice(11, 32).Span;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GuildCreateRequest075"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GuildCreateRequest075(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GuildCreateRequest075"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GuildCreateRequest075 packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GuildMasterAnswer
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GuildMasterAnswer"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GuildMasterAnswer(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GuildMasterAnswer"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GuildMasterAnswer(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x54;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets a value whether the guild creation dialog should be shown. Otherwise, the guild creation is cancelled and the dialog was closed.
/// </summary>
public bool ShowCreationDialog
{
get => this._data.Span[3..].GetBoolean();
set => this._data.Span[3..].SetBoolean(value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GuildMasterAnswer"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GuildMasterAnswer(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GuildMasterAnswer"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GuildMasterAnswer packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CancelGuildCreation
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CancelGuildCreation"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CancelGuildCreation(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CancelGuildCreation"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CancelGuildCreation(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x57;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CancelGuildCreation"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CancelGuildCreation(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CancelGuildCreation"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CancelGuildCreation packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GuildWarResponse
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GuildWarResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GuildWarResponse(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GuildWarResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GuildWarResponse(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x61;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the accepted.
/// </summary>
public bool Accepted
{
get => this._data.Span[3..].GetBoolean();
set => this._data.Span[3..].SetBoolean(value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GuildWarResponse"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GuildWarResponse(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GuildWarResponse"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GuildWarResponse packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GuildInfoRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GuildInfoRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GuildInfoRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GuildInfoRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GuildInfoRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x66;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the guild id.
/// </summary>
public uint GuildId
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GuildInfoRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GuildInfoRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GuildInfoRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GuildInfoRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GuildRoleAssignRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GuildRoleAssignRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GuildRoleAssignRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GuildRoleAssignRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GuildRoleAssignRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xE1;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 15;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets unknown value between 1 and 3.
/// </summary>
public byte Type
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Gets or sets the role.
/// </summary>
public ServerToClient.GuildMemberRole Role
{
get => (ServerToClient.GuildMemberRole)this._data.Span[4];
set => this._data.Span[4] = (byte)value;
}
/// <summary>
/// Gets or sets the player name.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GuildRoleAssignRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GuildRoleAssignRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GuildRoleAssignRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GuildRoleAssignRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GuildTypeChangeRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GuildTypeChangeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GuildTypeChangeRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GuildTypeChangeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GuildTypeChangeRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xE2;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets 0 = Common, 1 = Guard, FF = None.
/// </summary>
public byte GuildType
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GuildTypeChangeRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GuildTypeChangeRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GuildTypeChangeRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GuildTypeChangeRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GuildRelationshipChangeRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GuildRelationshipChangeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GuildRelationshipChangeRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GuildRelationshipChangeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GuildRelationshipChangeRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xE5;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 7;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the relationship type.
/// </summary>
public GuildRelationshipType RelationshipType
{
get => (GuildRelationshipType)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
/// <summary>
/// Gets or sets the request type.
/// </summary>
public GuildRequestType RequestType
{
get => (GuildRequestType)this._data.Span[4];
set => this._data.Span[4] = (byte)value;
}
/// <summary>
/// Gets or sets the target player id.
/// </summary>
public ushort TargetPlayerId
{
get => ReadUInt16BigEndian(this._data.Span[5..]);
set => WriteUInt16BigEndian(this._data.Span[5..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GuildRelationshipChangeRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GuildRelationshipChangeRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GuildRelationshipChangeRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GuildRelationshipChangeRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GuildRelationshipChangeResponse
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GuildRelationshipChangeResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GuildRelationshipChangeResponse(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GuildRelationshipChangeResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GuildRelationshipChangeResponse(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xE6;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the relationship type.
/// </summary>
public GuildRelationshipType RelationshipType
{
get => (GuildRelationshipType)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
/// <summary>
/// Gets or sets the request type.
/// </summary>
public GuildRequestType RequestType
{
get => (GuildRequestType)this._data.Span[4];
set => this._data.Span[4] = (byte)value;
}
/// <summary>
/// Gets or sets the response.
/// </summary>
public bool Response
{
get => this._data.Span[5..].GetBoolean();
set => this._data.Span[5..].SetBoolean(value);
}
/// <summary>
/// Gets or sets the target player id.
/// </summary>
public ushort TargetPlayerId
{
get => ReadUInt16BigEndian(this._data.Span[6..]);
set => WriteUInt16BigEndian(this._data.Span[6..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GuildRelationshipChangeResponse"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GuildRelationshipChangeResponse(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GuildRelationshipChangeResponse"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GuildRelationshipChangeResponse packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct RequestAllianceList
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="RequestAllianceList"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public RequestAllianceList(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="RequestAllianceList"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private RequestAllianceList(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xE9;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="RequestAllianceList"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator RequestAllianceList(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="RequestAllianceList"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(RequestAllianceList packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct RemoveAllianceGuildRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="RemoveAllianceGuildRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public RemoveAllianceGuildRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="RemoveAllianceGuildRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private RemoveAllianceGuildRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xEB;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 12;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the guild name.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="RemoveAllianceGuildRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator RemoveAllianceGuildRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="RemoveAllianceGuildRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(RemoveAllianceGuildRequest packet) => packet._data;
/// <summary>
/// Calculates the size of the packet for the specified field content.
/// </summary>
/// <param name="content">The content of the variable 'GuildName' field from which the size will be calculated.</param>
public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 4;
/// <summary>
/// Calculates the size of the packet for the specified field content.
/// </summary>
/// <param name="contentLength">The content length in bytes of the variable 'GuildName' field from which the size will be calculated.</param>
public static int GetRequiredSize(int contentLength) => contentLength + 1 + 4;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct PingResponse
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PingResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PingResponse(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PingResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PingResponse(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x71;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PingResponse"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PingResponse(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PingResponse"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PingResponse packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct ItemRepair
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ItemRepair"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ItemRepair(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ItemRepair"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ItemRepair(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x34;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// 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.
/// </summary>
public byte InventoryItemSlot
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ItemRepair"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ItemRepair(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ItemRepair"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ItemRepair packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct ChaosMachineMixRequest
{
/// <summary>
/// This enum describes the possible chaos machine mix type identifiers.
/// </summary>
public enum ChaosMachineMixType
{
/// <summary>
/// Mixes the items to a chaos weapon.
/// </summary>
ChaosWeapon = 1,
/// <summary>
/// Upgrades an item to level 10.
/// </summary>
UpgradeItemLevelTo10 = 3,
/// <summary>
/// Upgrades an item to level 11.
/// </summary>
UpgradeItemLevelTo11 = 4,
/// <summary>
/// Upgrades an item to level 12.
/// </summary>
UpgradeItemLevelTo12 = 22,
/// <summary>
/// Upgrades an item to level 13.
/// </summary>
UpgradeItemLevelTo13 = 23,
/// <summary>
/// Upgrades an item to level 14.
/// </summary>
UpgradeItemLevelTo14 = 49,
/// <summary>
/// Upgrades an item to level 15.
/// </summary>
UpgradeItemLevelTo15 = 50,
/// <summary>
/// Mixes the items to a fruit.
/// </summary>
FruitCreation = 6,
/// <summary>
/// Refines a gemstone to a jewel of harmony.
/// </summary>
GemstoneRefinery = 41,
/// <summary>
/// Refines a Jewel Of Bless to a stack of potions of bless.
/// </summary>
PotionOfBless = 15,
/// <summary>
/// Refines a Jewel Of Soul to a stack of potions of bless.
/// </summary>
PotionOfSoul = 16,
}
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ChaosMachineMixRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ChaosMachineMixRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ChaosMachineMixRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ChaosMachineMixRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x86;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the identifier which tells the server which kind of mix should be executed.
/// </summary>
public ChaosMachineMixRequest.ChaosMachineMixType MixType
{
get => (ChaosMachineMixType)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
/// <summary>
/// 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.
/// </summary>
public byte SocketSlot
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ChaosMachineMixRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ChaosMachineMixRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ChaosMachineMixRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ChaosMachineMixRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct CraftingDialogCloseRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="CraftingDialogCloseRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public CraftingDialogCloseRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CraftingDialogCloseRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private CraftingDialogCloseRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x87;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="CraftingDialogCloseRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator CraftingDialogCloseRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="CraftingDialogCloseRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(CraftingDialogCloseRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct FriendListRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="FriendListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public FriendListRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FriendListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private FriendListRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xC0;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="FriendListRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator FriendListRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="FriendListRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(FriendListRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct FriendAddRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="FriendAddRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public FriendAddRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FriendAddRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private FriendAddRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xC1;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 13;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the friend name.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="FriendAddRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator FriendAddRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="FriendAddRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(FriendAddRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct FriendDelete
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="FriendDelete"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public FriendDelete(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FriendDelete"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private FriendDelete(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xC3;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 13;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the friend name.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="FriendDelete"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator FriendDelete(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="FriendDelete"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(FriendDelete packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct ChatRoomCreateRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ChatRoomCreateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ChatRoomCreateRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ChatRoomCreateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ChatRoomCreateRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xCA;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 13;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the friend name.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ChatRoomCreateRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ChatRoomCreateRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ChatRoomCreateRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ChatRoomCreateRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct FriendAddResponse
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="FriendAddResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public FriendAddResponse(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="FriendAddResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private FriendAddResponse(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xC2;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 14;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the accepted.
/// </summary>
public bool Accepted
{
get => this._data.Span[3..].GetBoolean();
set => this._data.Span[3..].SetBoolean(value);
}
/// <summary>
/// Gets or sets the friend requester name.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="FriendAddResponse"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator FriendAddResponse(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="FriendAddResponse"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(FriendAddResponse packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct SetFriendOnlineState
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="SetFriendOnlineState"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public SetFriendOnlineState(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="SetFriendOnlineState"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private SetFriendOnlineState(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xC4;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the online state.
/// </summary>
public bool OnlineState
{
get => this._data.Span[3..].GetBoolean();
set => this._data.Span[3..].SetBoolean(value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="SetFriendOnlineState"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator SetFriendOnlineState(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="SetFriendOnlineState"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(SetFriendOnlineState packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct ChatRoomInvitationRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ChatRoomInvitationRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ChatRoomInvitationRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ChatRoomInvitationRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ChatRoomInvitationRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xCB;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 19;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the friend name.
/// </summary>
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);
}
/// <summary>
/// Gets or sets the room id.
/// </summary>
public ushort RoomId
{
get => ReadUInt16BigEndian(this._data.Span[13..]);
set => WriteUInt16BigEndian(this._data.Span[13..], value);
}
/// <summary>
/// Gets or sets the request id.
/// </summary>
public uint RequestId
{
get => ReadUInt32BigEndian(this._data.Span[15..]);
set => WriteUInt32BigEndian(this._data.Span[15..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ChatRoomInvitationRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ChatRoomInvitationRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ChatRoomInvitationRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ChatRoomInvitationRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct LegacyQuestStateRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LegacyQuestStateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LegacyQuestStateRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LegacyQuestStateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LegacyQuestStateRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xA0;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LegacyQuestStateRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LegacyQuestStateRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LegacyQuestStateRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LegacyQuestStateRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct LegacyQuestStateSetRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LegacyQuestStateSetRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LegacyQuestStateSetRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LegacyQuestStateSetRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LegacyQuestStateSetRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xA2;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the quest number.
/// </summary>
public byte QuestNumber
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Gets or sets the new state.
/// </summary>
public LegacyQuestState NewState
{
get => (LegacyQuestState)this._data.Span[4];
set => this._data.Span[4] = (byte)value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LegacyQuestStateSetRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LegacyQuestStateSetRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LegacyQuestStateSetRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LegacyQuestStateSetRequest packet) => packet._data;
}
/// <summary>
/// Is sent by the client when: The player wants to command its equipped pet (raven).
/// Causes reaction on server side:
/// </summary>
public readonly struct PetCommandRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PetCommandRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PetCommandRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PetCommandRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PetCommandRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xA7;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 7;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the pet type.
/// </summary>
public PetType PetType
{
get => (PetType)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
/// <summary>
/// Gets or sets the command mode.
/// </summary>
public PetCommandMode CommandMode
{
get => (PetCommandMode)this._data.Span[4];
set => this._data.Span[4] = (byte)value;
}
/// <summary>
/// Gets or sets the target id.
/// </summary>
public ushort TargetId
{
get => ReadUInt16BigEndian(this._data.Span[5..]);
set => WriteUInt16BigEndian(this._data.Span[5..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PetCommandRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PetCommandRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PetCommandRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PetCommandRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct PetInfoRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="PetInfoRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public PetInfoRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="PetInfoRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private PetInfoRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xA9;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the pet.
/// </summary>
public PetType Pet
{
get => (PetType)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
/// <summary>
/// Gets or sets the storage.
/// </summary>
public StorageType Storage
{
get => (StorageType)this._data.Span[4];
set => this._data.Span[4] = (byte)value;
}
/// <summary>
/// Gets or sets the item slot.
/// </summary>
public byte ItemSlot
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="PetInfoRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator PetInfoRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="PetInfoRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(PetInfoRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct IllusionTempleEnterRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="IllusionTempleEnterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public IllusionTempleEnterRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="IllusionTempleEnterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private IllusionTempleEnterRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xBF;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x00;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the map number.
/// </summary>
public byte MapNumber
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the item slot.
/// </summary>
public byte ItemSlot
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="IllusionTempleEnterRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator IllusionTempleEnterRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="IllusionTempleEnterRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(IllusionTempleEnterRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct IllusionTempleSkillRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="IllusionTempleSkillRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public IllusionTempleSkillRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="IllusionTempleSkillRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private IllusionTempleSkillRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xBF;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x02;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the skill number.
/// </summary>
public ushort SkillNumber
{
get => ReadUInt16BigEndian(this._data.Span[4..]);
set => WriteUInt16BigEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the target object index.
/// </summary>
public byte TargetObjectIndex
{
get => this._data.Span[6];
set => this._data.Span[6] = value;
}
/// <summary>
/// Gets or sets the distance.
/// </summary>
public byte Distance
{
get => this._data.Span[7];
set => this._data.Span[7] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="IllusionTempleSkillRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator IllusionTempleSkillRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="IllusionTempleSkillRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(IllusionTempleSkillRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct IllusionTempleRewardRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="IllusionTempleRewardRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public IllusionTempleRewardRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="IllusionTempleRewardRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private IllusionTempleRewardRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xBF;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x05;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="IllusionTempleRewardRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator IllusionTempleRewardRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="IllusionTempleRewardRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(IllusionTempleRewardRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct LuckyCoinCountRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LuckyCoinCountRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LuckyCoinCountRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LuckyCoinCountRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LuckyCoinCountRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xBF;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x0B;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LuckyCoinCountRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LuckyCoinCountRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LuckyCoinCountRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LuckyCoinCountRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct LuckyCoinRegistrationRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LuckyCoinRegistrationRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LuckyCoinRegistrationRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LuckyCoinRegistrationRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LuckyCoinRegistrationRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xBF;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x0C;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LuckyCoinRegistrationRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LuckyCoinRegistrationRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LuckyCoinRegistrationRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LuckyCoinRegistrationRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct LuckyCoinExchangeRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LuckyCoinExchangeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LuckyCoinExchangeRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LuckyCoinExchangeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LuckyCoinExchangeRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xBF;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x0D;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the coin count.
/// </summary>
public uint CoinCount
{
get => ReadUInt32LittleEndian(this._data.Span[4..]);
set => WriteUInt32LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LuckyCoinExchangeRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LuckyCoinExchangeRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LuckyCoinExchangeRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LuckyCoinExchangeRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct DoppelgangerEnterRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="DoppelgangerEnterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public DoppelgangerEnterRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DoppelgangerEnterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private DoppelgangerEnterRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xBF;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x0E;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the ticket item slot.
/// </summary>
public byte TicketItemSlot
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="DoppelgangerEnterRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator DoppelgangerEnterRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="DoppelgangerEnterRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(DoppelgangerEnterRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct EnterMarketPlaceRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="EnterMarketPlaceRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public EnterMarketPlaceRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EnterMarketPlaceRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private EnterMarketPlaceRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xBF;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x17;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="EnterMarketPlaceRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator EnterMarketPlaceRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="EnterMarketPlaceRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(EnterMarketPlaceRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct MuHelperStatusChangeRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="MuHelperStatusChangeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public MuHelperStatusChangeRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="MuHelperStatusChangeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private MuHelperStatusChangeRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xBF;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x51;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the pause status.
/// </summary>
public bool PauseStatus
{
get => this._data.Span[4..].GetBoolean();
set => this._data.Span[4..].SetBoolean(value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="MuHelperStatusChangeRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator MuHelperStatusChangeRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="MuHelperStatusChangeRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(MuHelperStatusChangeRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct MuHelperSaveDataRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="MuHelperSaveDataRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public MuHelperSaveDataRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="MuHelperSaveDataRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private MuHelperSaveDataRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC2;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xAE;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 261;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C2Header Header => new (this._data);
/// <summary>
/// Gets or sets the helper data.
/// </summary>
public Span<byte> HelperData
{
get => this._data.Slice(4, 257).Span;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="MuHelperSaveDataRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator MuHelperSaveDataRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="MuHelperSaveDataRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(MuHelperSaveDataRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct QuestSelectRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="QuestSelectRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public QuestSelectRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="QuestSelectRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private QuestSelectRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF6;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x0A;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 9;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the quest number.
/// </summary>
public ushort QuestNumber
{
get => ReadUInt16LittleEndian(this._data.Span[4..]);
set => WriteUInt16LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the quest group.
/// </summary>
public ushort QuestGroup
{
get => ReadUInt16LittleEndian(this._data.Span[6..]);
set => WriteUInt16LittleEndian(this._data.Span[6..], value);
}
/// <summary>
/// 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.
/// </summary>
public byte SelectedTextIndex
{
get => this._data.Span[8];
set => this._data.Span[8] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="QuestSelectRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator QuestSelectRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="QuestSelectRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(QuestSelectRequest packet) => packet._data;
}
/// <summary>
/// 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).
/// </summary>
public readonly struct QuestProceedRequest
{
/// <summary>
/// Describes how to proceed with the specified quest.
/// </summary>
public enum QuestProceedAction
{
/// <summary>
/// Undefined action.
/// </summary>
Undefined = 0,
/// <summary>
/// The quest is accepted and started.
/// </summary>
AcceptQuest = 1,
/// <summary>
/// The quest is refused and not started.
/// </summary>
RefuseQuest = 2,
}
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="QuestProceedRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public QuestProceedRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="QuestProceedRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private QuestProceedRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF6;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x0B;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 9;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the quest number.
/// </summary>
public ushort QuestNumber
{
get => ReadUInt16LittleEndian(this._data.Span[4..]);
set => WriteUInt16LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the quest group.
/// </summary>
public ushort QuestGroup
{
get => ReadUInt16LittleEndian(this._data.Span[6..]);
set => WriteUInt16LittleEndian(this._data.Span[6..], value);
}
/// <summary>
/// Gets or sets the proceed action.
/// </summary>
public QuestProceedRequest.QuestProceedAction ProceedAction
{
get => (QuestProceedAction)this._data.Span[8];
set => this._data.Span[8] = (byte)value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="QuestProceedRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator QuestProceedRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="QuestProceedRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(QuestProceedRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct QuestCompletionRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="QuestCompletionRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public QuestCompletionRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="QuestCompletionRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private QuestCompletionRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF6;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x0D;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the quest number.
/// </summary>
public ushort QuestNumber
{
get => ReadUInt16LittleEndian(this._data.Span[4..]);
set => WriteUInt16LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the quest group.
/// </summary>
public ushort QuestGroup
{
get => ReadUInt16LittleEndian(this._data.Span[6..]);
set => WriteUInt16LittleEndian(this._data.Span[6..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="QuestCompletionRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator QuestCompletionRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="QuestCompletionRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(QuestCompletionRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct QuestCancelRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="QuestCancelRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public QuestCancelRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="QuestCancelRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private QuestCancelRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF6;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x0F;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the quest number.
/// </summary>
public ushort QuestNumber
{
get => ReadUInt16LittleEndian(this._data.Span[4..]);
set => WriteUInt16LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the quest group.
/// </summary>
public ushort QuestGroup
{
get => ReadUInt16LittleEndian(this._data.Span[6..]);
set => WriteUInt16LittleEndian(this._data.Span[6..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="QuestCancelRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator QuestCancelRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="QuestCancelRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(QuestCancelRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct QuestClientActionRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="QuestClientActionRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public QuestClientActionRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="QuestClientActionRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private QuestClientActionRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF6;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x10;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the quest number.
/// </summary>
public ushort QuestNumber
{
get => ReadUInt16LittleEndian(this._data.Span[4..]);
set => WriteUInt16LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the quest group.
/// </summary>
public ushort QuestGroup
{
get => ReadUInt16LittleEndian(this._data.Span[6..]);
set => WriteUInt16LittleEndian(this._data.Span[6..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="QuestClientActionRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator QuestClientActionRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="QuestClientActionRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(QuestClientActionRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct ActiveQuestListRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ActiveQuestListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ActiveQuestListRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ActiveQuestListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ActiveQuestListRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF6;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x1A;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ActiveQuestListRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ActiveQuestListRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ActiveQuestListRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ActiveQuestListRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct QuestStateRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="QuestStateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public QuestStateRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="QuestStateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private QuestStateRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF6;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x1B;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 8;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the quest number.
/// </summary>
public ushort QuestNumber
{
get => ReadUInt16LittleEndian(this._data.Span[4..]);
set => WriteUInt16LittleEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the quest group.
/// </summary>
public ushort QuestGroup
{
get => ReadUInt16LittleEndian(this._data.Span[6..]);
set => WriteUInt16LittleEndian(this._data.Span[6..], value);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="QuestStateRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator QuestStateRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="QuestStateRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(QuestStateRequest packet) => packet._data;
}
/// <summary>
/// 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).
/// </summary>
public readonly struct EventQuestStateListRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="EventQuestStateListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public EventQuestStateListRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EventQuestStateListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private EventQuestStateListRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF6;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x21;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="EventQuestStateListRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator EventQuestStateListRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="EventQuestStateListRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(EventQuestStateListRequest packet) => packet._data;
}
/// <summary>
/// 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).
/// </summary>
public readonly struct AvailableQuestsRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="AvailableQuestsRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public AvailableQuestsRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="AvailableQuestsRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private AvailableQuestsRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF6;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x30;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="AvailableQuestsRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator AvailableQuestsRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="AvailableQuestsRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(AvailableQuestsRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct NpcBuffRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="NpcBuffRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public NpcBuffRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="NpcBuffRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private NpcBuffRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF6;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x31;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="NpcBuffRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator NpcBuffRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="NpcBuffRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(NpcBuffRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct EnterEmpireGuardianEvent
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="EnterEmpireGuardianEvent"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public EnterEmpireGuardianEvent(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EnterEmpireGuardianEvent"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private EnterEmpireGuardianEvent(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF7;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the item slot of the event ticket. Not used by the server.
/// </summary>
public byte ItemSlot
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="EnterEmpireGuardianEvent"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator EnterEmpireGuardianEvent(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="EnterEmpireGuardianEvent"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(EnterEmpireGuardianEvent packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GensJoinRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GensJoinRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GensJoinRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GensJoinRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GensJoinRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF8;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the gens type.
/// </summary>
public GensType GensType
{
get => (GensType)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GensJoinRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GensJoinRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GensJoinRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GensJoinRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GensLeaveRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GensLeaveRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GensLeaveRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GensLeaveRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GensLeaveRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF8;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x03;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GensLeaveRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GensLeaveRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GensLeaveRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GensLeaveRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GensRewardRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GensRewardRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GensRewardRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GensRewardRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GensRewardRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF8;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x09;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the gens type.
/// </summary>
public GensType GensType
{
get => (GensType)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GensRewardRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GensRewardRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GensRewardRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GensRewardRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct GensRankingRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="GensRankingRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public GensRankingRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GensRankingRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private GensRankingRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF8;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x0B;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="GensRankingRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator GensRankingRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="GensRankingRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(GensRankingRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct DevilSquareEnterRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="DevilSquareEnterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public DevilSquareEnterRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DevilSquareEnterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private DevilSquareEnterRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x90;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the level of the devil square, minus 1.
/// </summary>
public byte SquareLevel
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// 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...
/// </summary>
public byte TicketItemInventoryIndex
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="DevilSquareEnterRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator DevilSquareEnterRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="DevilSquareEnterRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(DevilSquareEnterRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct MiniGameOpeningStateRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="MiniGameOpeningStateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public MiniGameOpeningStateRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="MiniGameOpeningStateRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private MiniGameOpeningStateRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x91;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the event type.
/// </summary>
public MiniGameType EventType
{
get => (MiniGameType)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
/// <summary>
/// Gets or sets the event level.
/// </summary>
public byte EventLevel
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="MiniGameOpeningStateRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator MiniGameOpeningStateRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="MiniGameOpeningStateRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(MiniGameOpeningStateRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct EventChipRegistrationRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="EventChipRegistrationRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public EventChipRegistrationRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EventChipRegistrationRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private EventChipRegistrationRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x95;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the type.
/// </summary>
public byte Type
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Gets or sets the item index.
/// </summary>
public byte ItemIndex
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="EventChipRegistrationRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator EventChipRegistrationRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="EventChipRegistrationRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(EventChipRegistrationRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct MutoNumberRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="MutoNumberRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public MutoNumberRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="MutoNumberRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private MutoNumberRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x96;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="MutoNumberRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator MutoNumberRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="MutoNumberRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(MutoNumberRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct EventChipExitDialog
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="EventChipExitDialog"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public EventChipExitDialog(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EventChipExitDialog"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private EventChipExitDialog(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x97;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 3;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="EventChipExitDialog"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator EventChipExitDialog(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="EventChipExitDialog"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(EventChipExitDialog packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct EventChipExchangeRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="EventChipExchangeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public EventChipExchangeRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="EventChipExchangeRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private EventChipExchangeRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x98;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the type.
/// </summary>
public byte Type
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="EventChipExchangeRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator EventChipExchangeRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="EventChipExchangeRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(EventChipExchangeRequest packet) => packet._data;
}
/// <summary>
/// Is sent by the client when: Unknown?
/// Causes reaction on server side: Unknown?
/// </summary>
public readonly struct ServerImmigrationRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ServerImmigrationRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ServerImmigrationRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ServerImmigrationRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ServerImmigrationRequest(Memory<byte> data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)data.Length;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x99;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3Header Header => new (this._data);
/// <summary>
/// Gets or sets the security code.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ServerImmigrationRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ServerImmigrationRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ServerImmigrationRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ServerImmigrationRequest packet) => packet._data;
/// <summary>
/// Calculates the size of the packet for the specified field content.
/// </summary>
/// <param name="content">The content of the variable 'SecurityCode' field from which the size will be calculated.</param>
public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 3;
/// <summary>
/// Calculates the size of the packet for the specified field content.
/// </summary>
/// <param name="contentLength">The content length in bytes of the variable 'SecurityCode' field from which the size will be calculated.</param>
public static int GetRequiredSize(int contentLength) => contentLength + 1 + 3;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct LuckyNumberRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="LuckyNumberRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public LuckyNumberRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="LuckyNumberRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private LuckyNumberRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x9D;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 18;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the serial 1.
/// </summary>
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);
}
/// <summary>
/// Gets or sets the serial 2.
/// </summary>
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);
}
/// <summary>
/// Gets or sets the serial 3.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="LuckyNumberRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator LuckyNumberRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="LuckyNumberRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(LuckyNumberRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct BloodCastleEnterRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="BloodCastleEnterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public BloodCastleEnterRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="BloodCastleEnterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private BloodCastleEnterRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x9A;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the level of the battle square.
/// </summary>
public byte CastleLevel
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// 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...
/// </summary>
public byte TicketItemInventoryIndex
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="BloodCastleEnterRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator BloodCastleEnterRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="BloodCastleEnterRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(BloodCastleEnterRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct MiniGameEventCountRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="MiniGameEventCountRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public MiniGameEventCountRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="MiniGameEventCountRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private MiniGameEventCountRequest(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0x9F;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets the mini game.
/// </summary>
public MiniGameType MiniGame
{
get => (MiniGameType)this._data.Span[3];
set => this._data.Span[3] = (byte)value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="MiniGameEventCountRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator MiniGameEventCountRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="MiniGameEventCountRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(MiniGameEventCountRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct ChaosCastleEnterRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ChaosCastleEnterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ChaosCastleEnterRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ChaosCastleEnterRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ChaosCastleEnterRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xAF;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the level of the chaos castle. Appears to always be 0.
/// </summary>
public byte CastleLevel
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the index of the ticket item in the inventory.
/// </summary>
public byte TicketItemInventoryIndex
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ChaosCastleEnterRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ChaosCastleEnterRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ChaosCastleEnterRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ChaosCastleEnterRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct ChaosCastlePositionSet
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ChaosCastlePositionSet"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ChaosCastlePositionSet(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ChaosCastlePositionSet"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ChaosCastlePositionSet(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xAF;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x02;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 6;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the position x.
/// </summary>
public byte PositionX
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Gets or sets the position y.
/// </summary>
public byte PositionY
{
get => this._data.Span[5];
set => this._data.Span[5] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ChaosCastlePositionSet"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ChaosCastlePositionSet(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ChaosCastlePositionSet"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ChaosCastlePositionSet packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct DuelStartRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="DuelStartRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public DuelStartRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DuelStartRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private DuelStartRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xAA;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x01;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 16;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the player id.
/// </summary>
public ushort PlayerId
{
get => ReadUInt16BigEndian(this._data.Span[4..]);
set => WriteUInt16BigEndian(this._data.Span[4..], value);
}
/// <summary>
/// Gets or sets the player name.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="DuelStartRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator DuelStartRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="DuelStartRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(DuelStartRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct DuelStartResponse
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="DuelStartResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public DuelStartResponse(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DuelStartResponse"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private DuelStartResponse(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xAA;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x02;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 17;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the response.
/// </summary>
public bool Response
{
get => this._data.Span[4..].GetBoolean();
set => this._data.Span[4..].SetBoolean(value);
}
/// <summary>
/// Gets or sets the player id.
/// </summary>
public ushort PlayerId
{
get => ReadUInt16LittleEndian(this._data.Span[5..]);
set => WriteUInt16LittleEndian(this._data.Span[5..], value);
}
/// <summary>
/// Gets or sets the player name.
/// </summary>
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);
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="DuelStartResponse"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator DuelStartResponse(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="DuelStartResponse"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(DuelStartResponse packet) => packet._data;
}
/// <summary>
/// Is sent by the client when: A player requested to stop the duel.
/// Causes reaction on server side: The server stops the duel.
/// </summary>
public readonly struct DuelStopRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="DuelStopRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public DuelStopRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DuelStopRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private DuelStopRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xAA;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x03;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="DuelStopRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator DuelStopRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="DuelStopRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(DuelStopRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct DuelChannelJoinRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="DuelChannelJoinRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public DuelChannelJoinRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DuelChannelJoinRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private DuelChannelJoinRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xAA;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x07;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 5;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Gets or sets the channel id.
/// </summary>
public byte ChannelId
{
get => this._data.Span[4];
set => this._data.Span[4] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="DuelChannelJoinRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator DuelChannelJoinRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="DuelChannelJoinRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(DuelChannelJoinRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct DuelChannelQuitRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="DuelChannelQuitRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public DuelChannelQuitRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="DuelChannelQuitRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private DuelChannelQuitRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC3;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xAA;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x09;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C3HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="DuelChannelQuitRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator DuelChannelQuitRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="DuelChannelQuitRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(DuelChannelQuitRequest packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct HeykelSavasiTeamSelect
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="HeykelSavasiTeamSelect"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public HeykelSavasiTeamSelect(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="HeykelSavasiTeamSelect"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private HeykelSavasiTeamSelect(Memory<byte> 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);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xFA;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets 1 = Red team, 2 = Blue team.
/// </summary>
public byte Team
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="HeykelSavasiTeamSelect"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator HeykelSavasiTeamSelect(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="HeykelSavasiTeamSelect"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(HeykelSavasiTeamSelect packet) => packet._data;
}
/// <summary>
/// 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.
/// </summary>
public readonly struct ChatCommandListRequest
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="ChatCommandListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public ChatCommandListRequest(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ChatCommandListRequest"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private ChatCommandListRequest(Memory<byte> 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;
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xF5;
/// <summary>
/// Gets the operation sub-code of this data packet.
/// The <see cref="Code" /> is used as a grouping key.
/// </summary>
public static byte SubCode => 0x00;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderWithSubCode Header => new (this._data);
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="ChatCommandListRequest"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator ChatCommandListRequest(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="ChatCommandListRequest"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(ChatCommandListRequest packet) => packet._data;
}
/// <summary>
/// The state of the trade button.
/// </summary>
public enum TradeButtonState
{
/// <summary>
/// Trade button is not pressed. It means that the trade is not yet accepted by the trader.
/// </summary>
Unchecked = 0,
/// <summary>
/// Trade Button is pressed. It means that the trade is accepted by the trader.
/// </summary>
Checked = 1,
/// <summary>
/// This state is only sent to the client. After some seconds the client is changing back to normal Unchecked.
/// </summary>
Red = 2,
}
/// <summary>
/// Describes the type of storage.
/// </summary>
public enum StorageType
{
/// <summary>
/// The inventory of the player.
/// </summary>
Inventory = 0,
/// <summary>
/// The vault of the player.
/// </summary>
Vault = 1,
/// <summary>
/// The own trading storage.
/// </summary>
TradeOwn = 2,
/// <summary>
/// The trading storage of the other player.
/// </summary>
TradeOther = 3,
/// <summary>
/// The crafting storage of the player.
/// </summary>
Crafting = 4,
/// <summary>
/// The shop storage of another player.
/// </summary>
PersonalShop = 5,
/// <summary>
/// The shop storage of an NPC (merchant).
/// </summary>
NpcShop = 6,
/// <summary>
/// The inventory slot of the pet. That's used when a pet leveled up.
/// </summary>
InventoryPetSlot = 254,
}
/// <summary>
/// Describes the type of pet.
/// </summary>
public enum PetType
{
/// <summary>
/// The dark raven pet.
/// </summary>
DarkRaven = 0,
/// <summary>
/// The dark horse pet.
/// </summary>
DarkHorse = 1,
}
/// <summary>
/// Describes the pet command mode.
/// </summary>
public enum PetCommandMode
{
/// <summary>
/// The pet is in a normal mode, where it doesn't attack.
/// </summary>
Normal = 0,
/// <summary>
/// The pet attacks random targets.
/// </summary>
AttackRandom = 1,
/// <summary>
/// The pet attacks the same targets as the owner.
/// </summary>
AttackWithOwner = 2,
/// <summary>
/// The pet attacks a specific target until it's dead.
/// </summary>
AttackTarget = 3,
}
/// <summary>
/// Describes the gens type.
/// </summary>
public enum GensType
{
/// <summary>
/// The undefined gens type.
/// </summary>
Undefined = 0,
/// <summary>
/// The Duprian gens.
/// </summary>
Duprian = 1,
/// <summary>
/// The Vanert gens.
/// </summary>
Vanert = 2,
}
/// <summary>
/// Describes the relationship type between guilds.
/// </summary>
public enum GuildRelationshipType
{
/// <summary>
/// The undefined relationship type.
/// </summary>
Undefined = 0,
/// <summary>
/// The alliance relationship type.
/// </summary>
Alliance = 1,
/// <summary>
/// The hostility relationship type.
/// </summary>
Hostility = 2,
}
/// <summary>
/// Describes the request type.
/// </summary>
public enum GuildRequestType
{
/// <summary>
/// The undefined request type.
/// </summary>
Undefined = 0,
/// <summary>
/// The join type.
/// </summary>
Join = 1,
/// <summary>
/// The leave type.
/// </summary>
Leave = 2,
}