// // Licensed under the MIT License. See LICENSE file in the project root for full license information. // //------------------------------------------------------------------------------ // // This source code was auto-generated by an XSL transformation. // Do not change this file. Instead, change the XML data which contains // the packet definitions and re-run the transformation (rebuild this project). // //------------------------------------------------------------------------------ namespace MUnique.OpenMU.Network.Packets.ServerToClient; using System; using static System.Buffers.Binary.BinaryPrimitives; /// /// The structure for a stored item, e.g. in the inventory or vault.. /// public readonly ref struct StoredItemRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public StoredItemRef(Span data) { this._data = data; } /// /// Gets or sets the item slot. /// public byte ItemSlot { get => this._data[0]; set => this._data[0] = value; } /// /// Gets or sets the item data. /// public Span ItemData { get => this._data.Slice(1); } /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int itemDataLength) => itemDataLength + 1; } /// /// Data of an item in a player shop.. /// public readonly ref struct PlayerShopItemRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PlayerShopItemRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 20; /// /// Gets or sets the item slot. /// public byte ItemSlot { get => this._data[0]; set => this._data[0] = value; } /// /// Gets or sets the item data. /// public Span ItemData { get => this._data.Slice(1, 12); } /// /// Gets or sets the price. /// public uint Price { get => ReadUInt32LittleEndian(this._data[16..]); set => WriteUInt32LittleEndian(this._data[16..], value); } } /// /// Data of an item in a player shop, which allows for dynamic item sizes and trades for specific kind of items (e.g. jewels), too.. /// public readonly ref struct PlayerShopItemExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PlayerShopItemExtendedRef(Span data) { this._data = data; } /// /// Gets or sets the money price. /// public uint MoneyPrice { get => ReadUInt32LittleEndian(this._data); set => WriteUInt32LittleEndian(this._data, value); } /// /// Gets or sets contains the item group in the highest 4 bits, and the item number in the remaining ones. /// public ushort PriceItemType { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the required item amount. /// public ushort RequiredItemAmount { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the item slot. /// public byte ItemSlot { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the item data. /// public Span ItemData { get => this._data.Slice(9); } /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int itemDataLength) => itemDataLength + 9; } /// /// Defines the information which identifies a quest.. /// public readonly ref struct QuestIdentificationRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestIdentificationRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets or sets the number. /// public ushort Number { get => ReadUInt16LittleEndian(this._data); set => WriteUInt16LittleEndian(this._data, value); } /// /// Gets or sets the group. /// public ushort Group { get => ReadUInt16LittleEndian(this._data[2..]); set => WriteUInt16LittleEndian(this._data[2..], value); } } /// /// Defines a condition which must be fulfilled to complete the quest.. /// public readonly ref struct QuestConditionRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestConditionRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 26; /// /// Gets or sets the type. /// public ConditionType Type { get => (ConditionType)this._data[0]; set => this._data[0] = (byte)value; } /// /// Gets or sets depending on the condition type, this field contains the identifier of the required thing, e.g. Monster Number, Item Id, Level. /// public ushort RequirementId { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the required count. /// public uint RequiredCount { get => ReadUInt32LittleEndian(this._data[6..]); set => WriteUInt32LittleEndian(this._data[6..], value); } /// /// Gets or sets the current count. /// public uint CurrentCount { get => ReadUInt32LittleEndian(this._data[10..]); set => WriteUInt32LittleEndian(this._data[10..], value); } /// /// Gets or sets if the condition type is 'Item', this field contains the item data, excluding the item id. The item id can be found in the RequirementId field. /// public Span RequiredItemData { get => this._data.Slice(14, 12); } } /// /// Defines a reward which is given when the quest is completed.. /// public readonly ref struct QuestRewardRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestRewardRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 22; /// /// Gets or sets the type. /// public RewardType Type { get => (RewardType)this._data[0]; set => this._data[0] = (byte)value; } /// /// Gets or sets depending on the condition type, this field contains the identifier of the required thing, e.g. Monster Number, Item Id, Level. /// public ushort RewardId { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the reward count. /// public uint RewardCount { get => ReadUInt32LittleEndian(this._data[6..]); set => WriteUInt32LittleEndian(this._data[6..], value); } /// /// Gets or sets if the reward type is 'Item', this field contains its item data. /// public Span RewardedItemData { get => this._data.Slice(10, 12); } } /// /// Defines a condition which must be fulfilled to complete the quest.. /// public readonly ref struct QuestConditionExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestConditionExtendedRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 28; /// /// Gets or sets the type. /// public ConditionType Type { get => (ConditionType)this._data[0]; set => this._data[0] = (byte)value; } /// /// Gets or sets depending on the condition type, this field contains the identifier of the required thing, e.g. Monster Number, Item Id, Level. /// public ushort RequirementId { get => ReadUInt16LittleEndian(this._data[2..]); set => WriteUInt16LittleEndian(this._data[2..], value); } /// /// Gets or sets the required count. /// public uint RequiredCount { get => ReadUInt32LittleEndian(this._data[4..]); set => WriteUInt32LittleEndian(this._data[4..], value); } /// /// Gets or sets the current count. /// public uint CurrentCount { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets or sets if the condition type is 'Item', this field contains the item data, excluding the item id. The item id can be found in the RequirementId field. /// public Span RequiredItemData { get => this._data.Slice(12, 15); } } /// /// Defines a reward which is given when the quest is completed.. /// public readonly ref struct QuestRewardExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestRewardExtendedRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 24; /// /// Gets or sets the type. /// public RewardType Type { get => (RewardType)this._data[0]; set => this._data[0] = (byte)value; } /// /// Gets or sets depending on the condition type, this field contains the identifier of the required thing, e.g. Monster Number, Item Id, Level. /// public ushort RewardId { get => ReadUInt16LittleEndian(this._data[2..]); set => WriteUInt16LittleEndian(this._data[2..], value); } /// /// Gets or sets the reward count. /// public uint RewardCount { get => ReadUInt32LittleEndian(this._data[4..]); set => WriteUInt32LittleEndian(this._data[4..], value); } /// /// Gets or sets if the reward type is 'Item', this field contains its item data. /// public Span RewardedItemData { get => this._data.Slice(8, 15); } } /// /// Is sent by the server when: After a game client has connected to the game. /// Causes reaction on client side: It shows the login dialog. /// public readonly ref struct GameServerEnteredRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GameServerEnteredRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GameServerEnteredRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.Success = true; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF1; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x00; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 12; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the success. /// public bool Success { get => this._data[4..].GetBoolean(); set => this._data[4..].SetBoolean(value); } /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Gets or sets the version string. /// public string VersionString { get => this._data.ExtractString(7, 5, System.Text.Encoding.UTF8); set => this._data.Slice(7, 5).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the version. /// public Span Version { get => this._data.Slice(7, 5); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GameServerEnteredRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GameServerEnteredRef packet) => packet._data; } /// /// Is sent by the server when: A magic effect was added or removed to the own or another player. /// Causes reaction on client side: The user interface updates itself. If it's the effect of the own player, it's shown as icon at the top of the interface. /// public readonly ref struct MagicEffectStatusRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MagicEffectStatusRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MagicEffectStatusRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x07; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the is active. /// public bool IsActive { get => this._data[3..].GetBoolean(); set => this._data[3..].SetBoolean(value); } /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the effect id. /// public byte EffectId { get => this._data[6]; set => this._data[6] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MagicEffectStatusRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MagicEffectStatusRef packet) => packet._data; } /// /// Is sent by the server when: The weather on the current map has been changed or the player entered the map. /// Causes reaction on client side: The game client updates the weather effects. /// public readonly ref struct WeatherStatusUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public WeatherStatusUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private WeatherStatusUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x0F; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets a random value between 0 and 2 (inclusive). /// public byte Weather { get => this._data[3..].GetByteValue(4, 4); set => this._data[3..].SetByteValue(value, 4, 4); } /// /// Gets or sets a random value between 0 and 9 (inclusive). /// public byte Variation { get => this._data[3..].GetByteValue(4, 0); set => this._data[3..].SetByteValue(value, 4, 0); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator WeatherStatusUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(WeatherStatusUpdateRef packet) => packet._data; } /// /// Is sent by the server when: One or more character got into the observed scope of the player. /// Causes reaction on client side: The client adds the character to the shown map. /// public readonly ref struct AddCharacterToScopeExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AddCharacterToScopeExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AddCharacterToScopeExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x12; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the current position x. /// public byte CurrentPositionX { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the current position y. /// public byte CurrentPositionY { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the target position x. /// public byte TargetPositionX { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the target position y. /// public byte TargetPositionY { get => this._data[9]; set => this._data[9] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[10..].GetByteValue(4, 4); set => this._data[10..].SetByteValue(value, 4, 4); } /// /// Gets or sets the hero state. /// public CharacterHeroState HeroState { get => (CharacterHeroState)this._data[10..].GetByteValue(4, 0); set => this._data[10..].SetByteValue((byte)value, 4, 0); } /// /// Gets or sets the attack speed. /// public ushort AttackSpeed { get => ReadUInt16LittleEndian(this._data[12..]); set => WriteUInt16LittleEndian(this._data[12..], value); } /// /// Gets or sets the magic speed. /// public ushort MagicSpeed { get => ReadUInt16LittleEndian(this._data[14..]); set => WriteUInt16LittleEndian(this._data[14..], value); } /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(16, 10, System.Text.Encoding.UTF8); set => this._data.Slice(16, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the appearance and effects. /// public Span AppearanceAndEffects { get => this._data.Slice(26); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AddCharacterToScopeExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AddCharacterToScopeExtendedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int appearanceAndEffectsLength) => appearanceAndEffectsLength + 26; } /// /// Is sent by the server when: One or more character got into the observed scope of the player. /// Causes reaction on client side: The client adds the character to the shown map. /// public readonly ref partial struct AddCharactersToScopeRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AddCharactersToScopeRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AddCharactersToScopeRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x12; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the character count. /// public byte CharacterCount { get => this._data[4]; set => this._data[4] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AddCharactersToScopeRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AddCharactersToScopeRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of and it's size. /// /// The count of from which the size will be calculated. /// The length of from which the size will be calculated. public static int GetRequiredSize(int charactersCount, int structLength) => charactersCount * structLength + 5; /// /// Contains the data of an NPC.. /// public readonly ref struct CharacterDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterDataRef(Span data) { this._data = data; } /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets the current position x. /// public byte CurrentPositionX { get => this._data[2]; set => this._data[2] = value; } /// /// Gets or sets the current position y. /// public byte CurrentPositionY { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the appearance. /// public Span Appearance { get => this._data.Slice(4, 18); } /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(22, 10, System.Text.Encoding.UTF8); set => this._data.Slice(22, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the target position x. /// public byte TargetPositionX { get => this._data[32]; set => this._data[32] = value; } /// /// Gets or sets the target position y. /// public byte TargetPositionY { get => this._data[33]; set => this._data[33] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[34..].GetByteValue(4, 4); set => this._data[34..].SetByteValue(value, 4, 4); } /// /// Gets or sets the hero state. /// public CharacterHeroState HeroState { get => (CharacterHeroState)this._data[34..].GetByteValue(4, 0); set => this._data[34..].SetByteValue((byte)value, 4, 0); } /// /// Gets or sets defines the number of effects which would be sent after this field. /// public byte EffectCount { get => this._data[35]; set => this._data[35] = value; } /// /// Gets the of the specified index. /// public EffectIdRef this[int index] => new (this._data[(36 + index * EffectIdRef.Length)..]); /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int effectsCount) => effectsCount * EffectIdRef.Length + 36; } /// /// Contains the id of a magic effect.. /// public readonly ref struct EffectIdRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public EffectIdRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 1; /// /// Gets or sets the id. /// public byte Id { get => this._data[0]; set => this._data[0] = value; } } } /// /// Is sent by the server when: One or more character got into the observed scope of the player. /// Causes reaction on client side: The client adds the character to the shown map. /// public readonly ref struct AddCharactersToScope075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AddCharactersToScope075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AddCharactersToScope075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x12; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the character count. /// public byte CharacterCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public CharacterDataRef this[int index] => new (this._data[(5 + index * CharacterDataRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AddCharactersToScope075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AddCharactersToScope075Ref packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int charactersCount) => charactersCount * CharacterDataRef.Length + 5; /// /// Contains the data of an NPC.. /// public readonly ref struct CharacterDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterDataRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 27; /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets the current position x. /// public byte CurrentPositionX { get => this._data[2]; set => this._data[2] = value; } /// /// Gets or sets the current position y. /// public byte CurrentPositionY { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the appearance. /// public Span Appearance { get => this._data.Slice(4, 9); } /// /// Gets or sets the is poisoned. /// public bool IsPoisoned { get => this._data[13..].GetBoolean(0); set => this._data[13..].SetBoolean(value, 0); } /// /// Gets or sets the is iced. /// public bool IsIced { get => this._data[13..].GetBoolean(1); set => this._data[13..].SetBoolean(value, 1); } /// /// Gets or sets the is damage buffed. /// public bool IsDamageBuffed { get => this._data[13..].GetBoolean(2); set => this._data[13..].SetBoolean(value, 2); } /// /// Gets or sets the is defense buffed. /// public bool IsDefenseBuffed { get => this._data[13..].GetBoolean(3); set => this._data[13..].SetBoolean(value, 3); } /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(14, 10, System.Text.Encoding.UTF8); set => this._data.Slice(14, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the target position x. /// public byte TargetPositionX { get => this._data[24]; set => this._data[24] = value; } /// /// Gets or sets the target position y. /// public byte TargetPositionY { get => this._data[25]; set => this._data[25] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[26..].GetByteValue(4, 4); set => this._data[26..].SetByteValue(value, 4, 4); } /// /// Gets or sets the hero state. /// public CharacterHeroState HeroState { get => (CharacterHeroState)this._data[26..].GetByteValue(4, 0); set => this._data[26..].SetByteValue((byte)value, 4, 0); } } } /// /// Is sent by the server when: One or more character got into the observed scope of the player. /// Causes reaction on client side: The client adds the character to the shown map. /// public readonly ref struct AddCharactersToScope095Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AddCharactersToScope095Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AddCharactersToScope095Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x12; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the character count. /// public byte CharacterCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public CharacterDataRef this[int index] => new (this._data[(5 + index * CharacterDataRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AddCharactersToScope095Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AddCharactersToScope095Ref packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int charactersCount) => charactersCount * CharacterDataRef.Length + 5; /// /// Contains the data of an NPC.. /// public readonly ref struct CharacterDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterDataRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 31; /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets the current position x. /// public byte CurrentPositionX { get => this._data[2]; set => this._data[2] = value; } /// /// Gets or sets the current position y. /// public byte CurrentPositionY { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the appearance. /// public Span Appearance { get => this._data.Slice(4, 13); } /// /// Gets or sets the is poisoned. /// public bool IsPoisoned { get => this._data[17..].GetBoolean(0); set => this._data[17..].SetBoolean(value, 0); } /// /// Gets or sets the is iced. /// public bool IsIced { get => this._data[17..].GetBoolean(1); set => this._data[17..].SetBoolean(value, 1); } /// /// Gets or sets the is damage buffed. /// public bool IsDamageBuffed { get => this._data[17..].GetBoolean(2); set => this._data[17..].SetBoolean(value, 2); } /// /// Gets or sets the is defense buffed. /// public bool IsDefenseBuffed { get => this._data[17..].GetBoolean(3); set => this._data[17..].SetBoolean(value, 3); } /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(18, 10, System.Text.Encoding.UTF8); set => this._data.Slice(18, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the target position x. /// public byte TargetPositionX { get => this._data[28]; set => this._data[28] = value; } /// /// Gets or sets the target position y. /// public byte TargetPositionY { get => this._data[29]; set => this._data[29] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[30..].GetByteValue(4, 4); set => this._data[30..].SetByteValue(value, 4, 4); } /// /// Gets or sets the hero state. /// public CharacterHeroState HeroState { get => (CharacterHeroState)this._data[30..].GetByteValue(4, 0); set => this._data[30..].SetByteValue((byte)value, 4, 0); } } } /// /// Is sent by the server when: One or more NPCs got into the observed scope of the player. /// Causes reaction on client side: The client adds the NPCs to the shown map. /// public readonly ref struct AddNpcsToScopeRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AddNpcsToScopeRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AddNpcsToScopeRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x13; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the npc count. /// public byte NpcCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public NpcDataRef this[int index] => new (this._data[(5 + index * NpcDataRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AddNpcsToScopeRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AddNpcsToScopeRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int nPCsCount) => nPCsCount * NpcDataRef.Length + 5; /// /// Contains the data of an NPC.. /// public readonly ref struct NpcDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public NpcDataRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 10; /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets the type number. /// public ushort TypeNumber { get => ReadUInt16BigEndian(this._data[2..]); set => WriteUInt16BigEndian(this._data[2..], value); } /// /// Gets or sets the current position x. /// public byte CurrentPositionX { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the current position y. /// public byte CurrentPositionY { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the target position x. /// public byte TargetPositionX { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the target position y. /// public byte TargetPositionY { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[8..].GetByteValue(4, 4); set => this._data[8..].SetByteValue(value, 4, 4); } /// /// Gets or sets defines the number of effects which would be sent after this field. This is currently not supported. /// public byte EffectCount { get => this._data[9]; set => this._data[9] = value; } } } /// /// Is sent by the server when: One or more NPCs got into the observed scope of the player. /// Causes reaction on client side: The client adds the NPCs to the shown map. /// public readonly ref struct AddNpcsToScope075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AddNpcsToScope075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AddNpcsToScope075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x13; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the npc count. /// public byte NpcCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public NpcDataRef this[int index] => new (this._data[(5 + index * NpcDataRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AddNpcsToScope075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AddNpcsToScope075Ref packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int nPCsCount) => nPCsCount * NpcDataRef.Length + 5; /// /// Contains the data of an NPC.. /// public readonly ref struct NpcDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public NpcDataRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 9; /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets the type number. /// public byte TypeNumber { get => this._data[2]; set => this._data[2] = value; } /// /// Gets or sets the is poisoned. /// public bool IsPoisoned { get => this._data[3..].GetBoolean(0); set => this._data[3..].SetBoolean(value, 0); } /// /// Gets or sets the is iced. /// public bool IsIced { get => this._data[3..].GetBoolean(1); set => this._data[3..].SetBoolean(value, 1); } /// /// Gets or sets the is damage buffed. /// public bool IsDamageBuffed { get => this._data[3..].GetBoolean(2); set => this._data[3..].SetBoolean(value, 2); } /// /// Gets or sets the is defense buffed. /// public bool IsDefenseBuffed { get => this._data[3..].GetBoolean(3); set => this._data[3..].SetBoolean(value, 3); } /// /// Gets or sets the current position x. /// public byte CurrentPositionX { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the current position y. /// public byte CurrentPositionY { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the target position x. /// public byte TargetPositionX { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the target position y. /// public byte TargetPositionY { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[8..].GetByteValue(4, 4); set => this._data[8..].SetByteValue(value, 4, 4); } } } /// /// Is sent by the server when: One or more NPCs got into the observed scope of the player. /// Causes reaction on client side: The client adds the NPCs to the shown map. /// public readonly ref struct AddNpcsToScope095Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AddNpcsToScope095Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AddNpcsToScope095Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x13; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the npc count. /// public byte NpcCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public NpcDataRef this[int index] => new (this._data[(5 + index * NpcDataRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AddNpcsToScope095Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AddNpcsToScope095Ref packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int nPCsCount) => nPCsCount * NpcDataRef.Length + 5; /// /// Contains the data of an NPC.. /// public readonly ref struct NpcDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public NpcDataRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 12; /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets the type number. /// public byte TypeNumber { get => this._data[2]; set => this._data[2] = value; } /// /// Gets or sets the is poisoned. /// public bool IsPoisoned { get => this._data[4..].GetBoolean(0); set => this._data[4..].SetBoolean(value, 0); } /// /// Gets or sets the is iced. /// public bool IsIced { get => this._data[4..].GetBoolean(1); set => this._data[4..].SetBoolean(value, 1); } /// /// Gets or sets the is damage buffed. /// public bool IsDamageBuffed { get => this._data[4..].GetBoolean(2); set => this._data[4..].SetBoolean(value, 2); } /// /// Gets or sets the is defense buffed. /// public bool IsDefenseBuffed { get => this._data[4..].GetBoolean(3); set => this._data[4..].SetBoolean(value, 3); } /// /// Gets or sets the current position x. /// public byte CurrentPositionX { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the current position y. /// public byte CurrentPositionY { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the target position x. /// public byte TargetPositionX { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the target position y. /// public byte TargetPositionY { get => this._data[9]; set => this._data[9] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[10..].GetByteValue(4, 4); set => this._data[10..].SetByteValue(value, 4, 4); } } } /// /// Is sent by the server when: One or more summoned monsters got into the observed scope of the player. /// Causes reaction on client side: The client adds the monsters to the shown map. /// public readonly ref partial struct AddSummonedMonstersToScopeRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AddSummonedMonstersToScopeRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AddSummonedMonstersToScopeRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x1F; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the monster count. /// public byte MonsterCount { get => this._data[4]; set => this._data[4] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AddSummonedMonstersToScopeRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AddSummonedMonstersToScopeRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of and it's size. /// /// The count of from which the size will be calculated. /// The length of from which the size will be calculated. public static int GetRequiredSize(int summonedMonstersCount, int structLength) => summonedMonstersCount * structLength + 5; /// /// Contains the data of an NPC.. /// public readonly ref struct SummonedMonsterDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SummonedMonsterDataRef(Span data) { this._data = data; } /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets the type number. /// public ushort TypeNumber { get => ReadUInt16BigEndian(this._data[2..]); set => WriteUInt16BigEndian(this._data[2..], value); } /// /// Gets or sets the current position x. /// public byte CurrentPositionX { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the current position y. /// public byte CurrentPositionY { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the target position x. /// public byte TargetPositionX { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the target position y. /// public byte TargetPositionY { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[8..].GetByteValue(4, 4); set => this._data[8..].SetByteValue(value, 4, 4); } /// /// Gets or sets the owner character name. /// public string OwnerCharacterName { get => this._data.ExtractString(9, 10, System.Text.Encoding.UTF8); set => this._data.Slice(9, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets defines the number of effects which would be sent after this field. This is currently not supported. /// public byte EffectCount { get => this._data[19]; set => this._data[19] = value; } /// /// Gets the of the specified index. /// public EffectIdRef this[int index] => new (this._data[(20 + index * EffectIdRef.Length)..]); /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int effectsCount) => effectsCount * EffectIdRef.Length + 20; } /// /// Contains the id of a magic effect.. /// public readonly ref struct EffectIdRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public EffectIdRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 1; /// /// Gets or sets the id. /// public byte Id { get => this._data[0]; set => this._data[0] = value; } } } /// /// Is sent by the server when: One or more summoned monsters got into the observed scope of the player. /// Causes reaction on client side: The client adds the monsters to the shown map. /// public readonly ref struct AddSummonedMonstersToScope075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AddSummonedMonstersToScope075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AddSummonedMonstersToScope075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x1F; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the monster count. /// public byte MonsterCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public SummonedMonsterDataRef this[int index] => new (this._data[(5 + index * SummonedMonsterDataRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AddSummonedMonstersToScope075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AddSummonedMonstersToScope075Ref packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int summonedMonstersCount) => summonedMonstersCount * SummonedMonsterDataRef.Length + 5; /// /// Contains the data of an NPC.. /// public readonly ref struct SummonedMonsterDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SummonedMonsterDataRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 19; /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets the type number. /// public byte TypeNumber { get => this._data[2]; set => this._data[2] = value; } /// /// Gets or sets the is poisoned. /// public bool IsPoisoned { get => this._data[3..].GetBoolean(0); set => this._data[3..].SetBoolean(value, 0); } /// /// Gets or sets the is iced. /// public bool IsIced { get => this._data[3..].GetBoolean(1); set => this._data[3..].SetBoolean(value, 1); } /// /// Gets or sets the is damage buffed. /// public bool IsDamageBuffed { get => this._data[3..].GetBoolean(2); set => this._data[3..].SetBoolean(value, 2); } /// /// Gets or sets the is defense buffed. /// public bool IsDefenseBuffed { get => this._data[3..].GetBoolean(3); set => this._data[3..].SetBoolean(value, 3); } /// /// Gets or sets the current position x. /// public byte CurrentPositionX { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the current position y. /// public byte CurrentPositionY { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the target position x. /// public byte TargetPositionX { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the target position y. /// public byte TargetPositionY { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[8..].GetByteValue(4, 4); set => this._data[8..].SetByteValue(value, 4, 4); } /// /// Gets or sets the owner character name. /// public string OwnerCharacterName { get => this._data.ExtractString(9, 10, System.Text.Encoding.UTF8); set => this._data.Slice(9, 10).WriteString(value, System.Text.Encoding.UTF8); } } } /// /// Is sent by the server when: One or more summoned monsters got into the observed scope of the player. /// Causes reaction on client side: The client adds the monsters to the shown map. /// public readonly ref struct AddSummonedMonstersToScope095Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AddSummonedMonstersToScope095Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AddSummonedMonstersToScope095Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x1F; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the monster count. /// public byte MonsterCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public SummonedMonsterDataRef this[int index] => new (this._data[(5 + index * SummonedMonsterDataRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AddSummonedMonstersToScope095Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AddSummonedMonstersToScope095Ref packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int summonedMonstersCount) => summonedMonstersCount * SummonedMonsterDataRef.Length + 5; /// /// Contains the data of an NPC.. /// public readonly ref struct SummonedMonsterDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SummonedMonsterDataRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 20; /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets the type number. /// public byte TypeNumber { get => this._data[2]; set => this._data[2] = value; } /// /// Gets or sets the is poisoned. /// public bool IsPoisoned { get => this._data[4..].GetBoolean(0); set => this._data[4..].SetBoolean(value, 0); } /// /// Gets or sets the is iced. /// public bool IsIced { get => this._data[4..].GetBoolean(1); set => this._data[4..].SetBoolean(value, 1); } /// /// Gets or sets the is damage buffed. /// public bool IsDamageBuffed { get => this._data[4..].GetBoolean(2); set => this._data[4..].SetBoolean(value, 2); } /// /// Gets or sets the is defense buffed. /// public bool IsDefenseBuffed { get => this._data[4..].GetBoolean(3); set => this._data[4..].SetBoolean(value, 3); } /// /// Gets or sets the current position x. /// public byte CurrentPositionX { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the current position y. /// public byte CurrentPositionY { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the target position x. /// public byte TargetPositionX { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the target position y. /// public byte TargetPositionY { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[9..].GetByteValue(4, 4); set => this._data[9..].SetByteValue(value, 4, 4); } /// /// Gets or sets the owner character name. /// public string OwnerCharacterName { get => this._data.ExtractString(10, 10, System.Text.Encoding.UTF8); set => this._data.Slice(10, 10).WriteString(value, System.Text.Encoding.UTF8); } } } /// /// Is sent by the server when: One or more objects (player, npc, etc.) on the map got out of scope, e.g. when the own player moved away from it/them or the object itself moved. /// Causes reaction on client side: The game client removes the objects from the game map. /// public readonly ref struct MapObjectOutOfScopeRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MapObjectOutOfScopeRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MapObjectOutOfScopeRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x14; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the object count. /// public byte ObjectCount { get => this._data[3]; set => this._data[3] = value; } /// /// Gets the of the specified index. /// public ObjectIdRef this[int index] => new (this._data[(4 + index * ObjectIdRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MapObjectOutOfScopeRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MapObjectOutOfScopeRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int objectsCount) => objectsCount * ObjectIdRef.Length + 4; /// /// Contains the id of a object.. /// public readonly ref struct ObjectIdRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ObjectIdRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 2; /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } } } /// /// Is sent by the server when: An observed object was killed. /// Causes reaction on client side: The object is shown as dead. /// public readonly ref struct ObjectGotKilledRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ObjectGotKilledRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ObjectGotKilledRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x17; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 9; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the killed id. /// public ushort KilledId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the skill id. /// public ushort SkillId { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Gets or sets the killer id. /// public ushort KillerId { get => ReadUInt16BigEndian(this._data[7..]); set => WriteUInt16BigEndian(this._data[7..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ObjectGotKilledRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ObjectGotKilledRef packet) => packet._data; } /// /// Is sent by the server when: An object performs an animation. /// Causes reaction on client side: The animation is shown for the specified object. /// public readonly ref struct ObjectAnimationRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ObjectAnimationRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ObjectAnimationRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x18; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 9; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the object id. /// public ushort ObjectId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the direction. /// public byte Direction { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the animation. /// public byte Animation { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data[7..]); set => WriteUInt16BigEndian(this._data[7..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ObjectAnimationRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ObjectAnimationRef packet) => packet._data; } /// /// Is sent by the server when: An object performs a skill which has effect on an area. /// Causes reaction on client side: The animation is shown on the user interface. /// public readonly ref struct AreaSkillAnimationRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AreaSkillAnimationRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AreaSkillAnimationRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x1E; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 10; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the skill id. /// public ushort SkillId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Gets or sets the point x. /// public byte PointX { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the point y. /// public byte PointY { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[9]; set => this._data[9] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AreaSkillAnimationRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AreaSkillAnimationRef packet) => packet._data; } /// /// Is sent by the server when: An object performs a skill which is directly targeted to another object. /// Causes reaction on client side: The animation is shown on the user interface. /// public readonly ref struct SkillAnimationRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SkillAnimationRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private SkillAnimationRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x19; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 9; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the skill id. /// public ushort SkillId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data[7..]); set => WriteUInt16BigEndian(this._data[7..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator SkillAnimationRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(SkillAnimationRef packet) => packet._data; } /// /// Is sent by the server when: An object performs a skill which has effect on an area. /// Causes reaction on client side: The animation is shown on the user interface. /// public readonly ref struct AreaSkillAnimation075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AreaSkillAnimation075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AreaSkillAnimation075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x1E; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 9; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the skill id. /// public byte SkillId { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the point x. /// public byte PointX { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the point y. /// public byte PointY { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[8]; set => this._data[8] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AreaSkillAnimation075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AreaSkillAnimation075Ref packet) => packet._data; } /// /// Is sent by the server when: An object performs a skill which has effect on an area. /// Causes reaction on client side: The animation is shown on the user interface. /// public readonly ref struct AreaSkillAnimation095Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AreaSkillAnimation095Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AreaSkillAnimation095Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x1E; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 9; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the skill id. /// public byte SkillId { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the point x. /// public byte PointX { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the point y. /// public byte PointY { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[8]; set => this._data[8] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AreaSkillAnimation095Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AreaSkillAnimation095Ref packet) => packet._data; } /// /// Is sent by the server when: An object performs a skill which is directly targeted to another object. /// Causes reaction on client side: The animation is shown on the user interface. /// public readonly ref struct SkillAnimation075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SkillAnimation075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private SkillAnimation075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x19; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the skill id. /// public byte SkillId { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data[6..]); set => WriteUInt16BigEndian(this._data[6..], value); } /// /// Gets or sets the effect applied. /// public bool EffectApplied { get => this._data[6..].GetBoolean(7); set => this._data[6..].SetBoolean(value, 7); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator SkillAnimation075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(SkillAnimation075Ref packet) => packet._data; } /// /// Is sent by the server when: An object performs a skill which is directly targeted to another object. /// Causes reaction on client side: The animation is shown on the user interface. /// public readonly ref struct SkillAnimation095Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SkillAnimation095Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private SkillAnimation095Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x19; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the skill id. /// public byte SkillId { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data[6..]); set => WriteUInt16BigEndian(this._data[6..], value); } /// /// Gets or sets the effect applied. /// public bool EffectApplied { get => this._data[6..].GetBoolean(7); set => this._data[6..].SetBoolean(value, 7); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator SkillAnimation095Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(SkillAnimation095Ref packet) => packet._data; } /// /// Is sent by the server when: A player cancelled a specific magic effect of a skill (Infinity Arrow, Wizardry Enhance), or an effect was removed due a timeout (Ice, Poison) or antidote. /// Causes reaction on client side: The effect is removed from the target object. /// public readonly ref struct MagicEffectCancelledRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MagicEffectCancelledRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MagicEffectCancelledRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x1B; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the skill id. /// public ushort SkillId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MagicEffectCancelledRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MagicEffectCancelledRef packet) => packet._data; } /// /// Is sent by the server when: A player cancelled a specific magic effect of a skill (Infinity Arrow, Wizardry Enhance), or an effect was removed due a timeout (Ice, Poison) or antidote. /// Causes reaction on client side: The effect is removed from the target object. /// public readonly ref struct MagicEffectCancelled075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MagicEffectCancelled075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MagicEffectCancelled075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x1B; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 6; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the skill id. /// public byte SkillId { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MagicEffectCancelled075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MagicEffectCancelled075Ref packet) => packet._data; } /// /// Is sent by the server when: A player (rage fighter) performs the dark side skill on a target and sent a RageAttackRangeRequest. /// Causes reaction on client side: The targets are attacked with visual effects. /// public readonly ref struct RageAttackRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RageAttackRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private RageAttackRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x4A; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 9; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the skill id. /// public ushort SkillId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the source id. /// public ushort SourceId { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data[7..]); set => WriteUInt16BigEndian(this._data[7..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator RageAttackRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(RageAttackRef packet) => packet._data; } /// /// Is sent by the server when: A player (rage fighter) performs the dark side skill on a target and sent a RageAttackRangeRequest. /// Causes reaction on client side: The targets are attacked with visual effects. /// public readonly ref struct RageAttackRangeResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RageAttackRangeResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private RageAttackRangeResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x4B; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 16; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the skill id. /// public ushort SkillId { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets the of the specified index. /// public RageTargetRef this[int index] => new (this._data[(6 + index * RageTargetRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator RageAttackRangeResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(RageAttackRangeResponseRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int targetsCount) => targetsCount * RageTargetRef.Length + 6; /// /// Contains the target identifier.. /// public readonly ref struct RageTargetRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RageTargetRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 2; /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16LittleEndian(this._data); set => WriteUInt16LittleEndian(this._data, value); } } } /// /// Is sent by the server when: The appearance of a player changed, all surrounding players are informed about it. /// Causes reaction on client side: The appearance of the player is updated. /// public readonly ref struct AppearanceChangedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AppearanceChangedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AppearanceChangedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x25; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the changed player id. /// public ushort ChangedPlayerId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the item data. /// public Span ItemData { get => this._data.Slice(5); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AppearanceChangedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AppearanceChangedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int itemDataLength) => itemDataLength + 5; } /// /// Is sent by the server when: The appearance of a player changed, all surrounding players are informed about it. /// Causes reaction on client side: The appearance of the player is updated. /// public readonly ref struct AppearanceChangedExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AppearanceChangedExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AppearanceChangedExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x25; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 14; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the changed player id. /// public ushort ChangedPlayerId { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the item slot. /// public byte ItemSlot { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the item group. /// public byte ItemGroup { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the item number. /// public ushort ItemNumber { get => ReadUInt16LittleEndian(this._data[8..]); set => WriteUInt16LittleEndian(this._data[8..], value); } /// /// Gets or sets the item level. /// public byte ItemLevel { get => this._data[10]; set => this._data[10] = value; } /// /// Gets or sets the excellent flags. /// public byte ExcellentFlags { get => this._data[11]; set => this._data[11] = value; } /// /// Gets or sets the ancient discriminator. /// public byte AncientDiscriminator { get => this._data[12]; set => this._data[12] = value; } /// /// Gets or sets the is ancient set complete. /// public bool IsAncientSetComplete { get => this._data[13..].GetBoolean(); set => this._data[13..].SetBoolean(value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AppearanceChangedExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AppearanceChangedExtendedRef packet) => packet._data; } /// /// Is sent by the server when: The server wants to show a message above any kind of character, even NPCs. /// Causes reaction on client side: The message is shown above the character. /// public readonly ref struct ObjectMessageRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ObjectMessageRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ObjectMessageRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x01; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the object id. /// public ushort ObjectId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the message. /// public string Message { get => this._data.ExtractString(5, this._data.Length - 5, System.Text.Encoding.UTF8); set => this._data.Slice(5).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ObjectMessageRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ObjectMessageRef packet) => packet._data; /// /// Calculates the size of the packet for the specified field content. /// /// The content of the variable 'Message' field from which the size will be calculated. public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 5; /// /// Calculates the size of the packet for the specified field content. /// /// The content length in bytes of the variable 'Message' field from which the size will be calculated. public static int GetRequiredSize(int contentLength) => contentLength + 1 + 5; } /// /// Is sent by the server when: Another player requests party from the receiver of this message. /// Causes reaction on client side: The party request is shown. /// public readonly ref struct PartyRequestRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PartyRequestRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PartyRequestRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x40; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the requester id. /// public ushort RequesterId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PartyRequestRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PartyRequestRef packet) => packet._data; } /// /// Is sent by the server when: A player joined a party or requested the current party list by opening the party dialog. /// Causes reaction on client side: The party list is updated. /// public readonly ref struct PartyListRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PartyListRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PartyListRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x42; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x01; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the count. /// public byte Count { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public PartyMemberRef this[int index] => new (this._data[(5 + index * PartyMemberRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PartyListRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PartyListRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int membersCount) => membersCount * PartyMemberRef.Length + 5; /// /// Data about a party member.. /// public readonly ref struct PartyMemberRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PartyMemberRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 24; /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(0, 10, System.Text.Encoding.UTF8); set => this._data.Slice(0, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the index. /// public byte Index { get => this._data[10]; set => this._data[10] = value; } /// /// Gets or sets the map id. /// public byte MapId { get => this._data[11]; set => this._data[11] = value; } /// /// Gets or sets the position x. /// public byte PositionX { get => this._data[12]; set => this._data[12] = value; } /// /// Gets or sets the position y. /// public byte PositionY { get => this._data[13]; set => this._data[13] = value; } /// /// Gets or sets the current health. /// public uint CurrentHealth { get => ReadUInt32LittleEndian(this._data[16..]); set => WriteUInt32LittleEndian(this._data[16..], value); } /// /// Gets or sets the maximum health. /// public uint MaximumHealth { get => ReadUInt32LittleEndian(this._data[20..]); set => WriteUInt32LittleEndian(this._data[20..], value); } } } /// /// Is sent by the server when: A player joined a party or requested the current party list by opening the party dialog. /// Causes reaction on client side: The party list is updated. /// public readonly ref struct PartyList075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PartyList075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PartyList075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x42; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x01; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the count. /// public byte Count { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public PartyMemberRef this[int index] => new (this._data[(5 + index * PartyMemberRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PartyList075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PartyList075Ref packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int membersCount) => membersCount * PartyMemberRef.Length + 5; /// /// Data about a party member.. /// public readonly ref struct PartyMemberRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PartyMemberRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 14; /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(0, 10, System.Text.Encoding.UTF8); set => this._data.Slice(0, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the index. /// public byte Index { get => this._data[10]; set => this._data[10] = value; } /// /// Gets or sets the map id. /// public byte MapId { get => this._data[11]; set => this._data[11] = value; } /// /// Gets or sets the position x. /// public byte PositionX { get => this._data[12]; set => this._data[12] = value; } /// /// Gets or sets the position y. /// public byte PositionY { get => this._data[13]; set => this._data[13] = value; } } } /// /// Is sent by the server when: A party member got removed from a party in which the player is in. /// Causes reaction on client side: The party member with the specified index is removed from the party list on the user interface. /// public readonly ref struct RemovePartyMemberRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RemovePartyMemberRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private RemovePartyMemberRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x43; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the index. /// public byte Index { get => this._data[3]; set => this._data[3] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator RemovePartyMemberRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(RemovePartyMemberRef packet) => packet._data; } /// /// Is sent by the server when: Periodically, when the health state of the party changed. /// Causes reaction on client side: The party health list is updated. /// public readonly ref struct PartyHealthUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PartyHealthUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PartyHealthUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x44; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the count. /// public byte Count { get => this._data[3]; set => this._data[3] = value; } /// /// Gets the of the specified index. /// public PartyMemberHealthRef this[int index] => new (this._data[(4 + index * PartyMemberHealthRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PartyHealthUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PartyHealthUpdateRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int membersCount) => membersCount * PartyMemberHealthRef.Length + 4; /// /// Health of a party member. /// public readonly ref struct PartyMemberHealthRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PartyMemberHealthRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 1; /// /// Gets or sets the index. /// public byte Index { get => this._data.GetByteValue(4, 4); set => this._data.SetByteValue(value, 4, 4); } /// /// Gets or sets a value from 0 to 10 about the health of a player. 10 means the current health is 100% of the maximum health. /// public byte Value { get => this._data.GetByteValue(4, 0); set => this._data.SetByteValue(value, 4, 0); } } } /// /// Is sent by the server when: After the player requested to open his shop and this request was successful. /// Causes reaction on client side: The own player shop is shown as open. /// public readonly ref struct PlayerShopOpenSuccessfulRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PlayerShopOpenSuccessfulRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PlayerShopOpenSuccessfulRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.Success = true; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x3F; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x2; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the success. /// public bool Success { get => this._data[4..].GetBoolean(); set => this._data[4..].SetBoolean(value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PlayerShopOpenSuccessfulRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PlayerShopOpenSuccessfulRef packet) => packet._data; } /// /// Is sent by the server when: After the trading partner checked or unchecked the trade accept button. /// Causes reaction on client side: The game client updates the trade button state accordingly. /// public readonly ref struct TradeButtonStateChangedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TradeButtonStateChangedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private TradeButtonStateChangedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x3C; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the state. /// public TradeButtonStateChanged.TradeButtonState State { get => (TradeButtonStateChanged.TradeButtonState)this._data[3]; set => this._data[3] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator TradeButtonStateChangedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(TradeButtonStateChangedRef packet) => packet._data; } /// /// Is sent by the server when: The trade money has been set by a previous request of the player. /// Causes reaction on client side: The money which was set into the trade by the player is updated on the UI. /// public readonly ref struct TradeMoneySetResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TradeMoneySetResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private TradeMoneySetResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x3A; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x01; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator TradeMoneySetResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(TradeMoneySetResponseRef packet) => packet._data; } /// /// Is sent by the server when: This message is sent when the trading partner put a certain amount of money (also 0) into the trade. /// Causes reaction on client side: It overrides all previous sent money values. /// public readonly ref struct TradeMoneyUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TradeMoneyUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private TradeMoneyUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x3B; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the money amount. /// public uint MoneyAmount { get => ReadUInt32LittleEndian(this._data[4..]); set => WriteUInt32LittleEndian(this._data[4..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator TradeMoneyUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(TradeMoneyUpdateRef packet) => packet._data; } /// /// Is sent by the server when: The player which receives this message, sent a trade request to another player. This message is sent when the other player responded to this request. /// Causes reaction on client side: If the trade was accepted, a trade dialog is opened. Otherwise, a message is shown. /// public readonly ref struct TradeRequestAnswerRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TradeRequestAnswerRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private TradeRequestAnswerRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x37; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 20; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the accepted. /// public bool Accepted { get => this._data[3..].GetBoolean(); set => this._data[3..].SetBoolean(value); } /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(4, 10, System.Text.Encoding.UTF8); set => this._data.Slice(4, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the trade partner level. /// public ushort TradePartnerLevel { get => ReadUInt16BigEndian(this._data[14..]); set => WriteUInt16BigEndian(this._data[14..], value); } /// /// Gets or sets the guild id. /// public uint GuildId { get => ReadUInt32LittleEndian(this._data[16..]); set => WriteUInt32LittleEndian(this._data[16..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator TradeRequestAnswerRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(TradeRequestAnswerRef packet) => packet._data; } /// /// Is sent by the server when: A trade was requested by another player. /// Causes reaction on client side: A trade request dialog is shown. /// public readonly ref struct TradeRequestRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TradeRequestRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private TradeRequestRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x36; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 13; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(3, 10, System.Text.Encoding.UTF8); set => this._data.Slice(3, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator TradeRequestRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(TradeRequestRef packet) => packet._data; } /// /// Is sent by the server when: A trade was finished. /// Causes reaction on client side: The trade dialog is closed. Depending on the result, a message is shown. /// public readonly ref struct TradeFinishedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TradeFinishedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private TradeFinishedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x3D; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the result. /// public TradeFinished.TradeResult Result { get => (TradeFinished.TradeResult)this._data[3]; set => this._data[3] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator TradeFinishedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(TradeFinishedRef packet) => packet._data; } /// /// Is sent by the server when: The trading partner added an item to the trade. /// Causes reaction on client side: The item is added in the trade dialog. /// public readonly ref struct TradeItemAddedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TradeItemAddedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private TradeItemAddedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x39; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the to slot. /// public byte ToSlot { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the item data. /// public Span ItemData { get => this._data.Slice(4); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator TradeItemAddedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(TradeItemAddedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int itemDataLength) => itemDataLength + 4; } /// /// Is sent by the server when: The trading partner removed an item from the trade. /// Causes reaction on client side: The item is removed from the trade dialog. /// public readonly ref struct TradeItemRemovedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TradeItemRemovedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private TradeItemRemovedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x38; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the slot. /// public byte Slot { get => this._data[3]; set => this._data[3] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator TradeItemRemovedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(TradeItemRemovedRef packet) => packet._data; } /// /// Is sent by the server when: After the login request has been processed by the server. /// Causes reaction on client side: Shows the result. When it was successful, the client proceeds by sending a character list request. /// public readonly ref struct LoginResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LoginResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private LoginResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF1; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x01; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the success. /// public LoginResponse.LoginResult Success { get => (LoginResponse.LoginResult)this._data[4]; set => this._data[4] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator LoginResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(LoginResponseRef packet) => packet._data; } /// /// Is sent by the server when: After the logout request has been processed by the server. /// Causes reaction on client side: Depending on the result, the game client closes the game or changes to another selection screen. /// public readonly ref struct LogoutResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LogoutResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private LogoutResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF1; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x02; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C3HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the type. /// public LogOutType Type { get => (LogOutType)this._data[4]; set => this._data[4] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator LogoutResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(LogoutResponseRef packet) => packet._data; } /// /// Is sent by the server when: A player sends a chat message. /// Causes reaction on client side: The message is shown in the chat box and above the character of the sender. /// public readonly ref struct ChatMessageRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ChatMessageRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ChatMessageRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x00; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the type. /// public ChatMessage.ChatMessageType Type { get => (ChatMessage.ChatMessageType)this._data[2]; set => this._data[2] = (byte)value; } /// /// Gets or sets the sender. /// public string Sender { get => this._data.ExtractString(3, 10, System.Text.Encoding.UTF8); set => this._data.Slice(3, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the message. /// public string Message { get => this._data.ExtractString(13, this._data.Length - 13, System.Text.Encoding.UTF8); set => this._data.Slice(13).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ChatMessageRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ChatMessageRef packet) => packet._data; /// /// Calculates the size of the packet for the specified field content. /// /// The content of the variable 'Message' field from which the size will be calculated. public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 13; /// /// Calculates the size of the packet for the specified field content. /// /// The content length in bytes of the variable 'Message' field from which the size will be calculated. public static int GetRequiredSize(int contentLength) => contentLength + 1 + 13; } /// /// Is sent by the server when: An object got hit in two cases: 1. When the own player is hit; 2. When the own player attacked some other object which got hit. /// Causes reaction on client side: The damage is shown at the object which received the hit. /// public readonly ref struct ObjectHitRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ObjectHitRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ObjectHitRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x11; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 10; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the header code. /// public byte HeaderCode { get => this._data[2]; set => this._data[2] = value; } /// /// Gets or sets the object id. /// public ushort ObjectId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the health damage. /// public ushort HealthDamage { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Gets or sets the kind. /// public DamageKind Kind { get => (DamageKind)this._data[7..].GetByteValue(4, 0); set => this._data[7..].SetByteValue((byte)value, 4, 0); } /// /// Gets or sets the is rage fighter streak hit. /// public bool IsRageFighterStreakHit { get => this._data[7..].GetBoolean(4); set => this._data[7..].SetBoolean(value, 4); } /// /// Gets or sets the is rage fighter streak final hit. /// public bool IsRageFighterStreakFinalHit { get => this._data[7..].GetBoolean(5); set => this._data[7..].SetBoolean(value, 5); } /// /// Gets or sets the is double damage. /// public bool IsDoubleDamage { get => this._data[7..].GetBoolean(6); set => this._data[7..].SetBoolean(value, 6); } /// /// Gets or sets the is triple damage. /// public bool IsTripleDamage { get => this._data[7..].GetBoolean(7); set => this._data[7..].SetBoolean(value, 7); } /// /// Gets or sets the shield damage. /// public ushort ShieldDamage { get => ReadUInt16BigEndian(this._data[8..]); set => WriteUInt16BigEndian(this._data[8..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ObjectHitRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ObjectHitRef packet) => packet._data; } /// /// Is sent by the server when: An object got hit in two cases: 1. When the own player is hit; 2. When the own player attacked some other object which got hit. /// Causes reaction on client side: The damage is shown at the object which received the hit. /// public readonly ref struct ObjectHitExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ObjectHitExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ObjectHitExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x11; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 16; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the kind. /// public DamageKind Kind { get => (DamageKind)this._data[3..].GetByteValue(4, 0); set => this._data[3..].SetByteValue((byte)value, 4, 0); } /// /// Gets or sets the is rage fighter streak hit. /// public bool IsRageFighterStreakHit { get => this._data[3..].GetBoolean(4); set => this._data[3..].SetBoolean(value, 4); } /// /// Gets or sets the is rage fighter streak final hit. /// public bool IsRageFighterStreakFinalHit { get => this._data[3..].GetBoolean(5); set => this._data[3..].SetBoolean(value, 5); } /// /// Gets or sets the is double damage. /// public bool IsDoubleDamage { get => this._data[3..].GetBoolean(6); set => this._data[3..].SetBoolean(value, 6); } /// /// Gets or sets the is triple damage. /// public bool IsTripleDamage { get => this._data[3..].GetBoolean(7); set => this._data[3..].SetBoolean(value, 7); } /// /// Gets or sets the object id. /// public ushort ObjectId { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets gets or sets the status of the remaining health in fractions of 1/250. /// public byte HealthStatus { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets gets or sets the status of the remaining shield in fractions of 1/250. /// public byte ShieldStatus { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the health damage. /// public uint HealthDamage { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets or sets the shield damage. /// public uint ShieldDamage { get => ReadUInt32LittleEndian(this._data[12..]); set => WriteUInt32LittleEndian(this._data[12..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ObjectHitExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ObjectHitExtendedRef packet) => packet._data; } /// /// Is sent by the server when: An object in the observed scope (including the own player) moved instantly. /// Causes reaction on client side: The position of the object is updated on client side. /// public readonly ref struct ObjectMovedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ObjectMovedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ObjectMovedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x15; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the header code. /// public byte HeaderCode { get => this._data[2]; set => this._data[2] = value; } /// /// Gets or sets the object id. /// public ushort ObjectId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the position x. /// public byte PositionX { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the position y. /// public byte PositionY { get => this._data[6]; set => this._data[6] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ObjectMovedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ObjectMovedRef packet) => packet._data; } /// /// Is sent by the server when: An object in the observed scope (including the own player) walked to another position. /// Causes reaction on client side: The object is animated to walk to the new position. /// public readonly ref struct ObjectWalkedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ObjectWalkedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ObjectWalkedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xD4; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the header code. /// public byte HeaderCode { get => this._data[2]; set => this._data[2] = value; } /// /// Gets or sets the object id. /// public ushort ObjectId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the target x. /// public byte TargetX { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the target y. /// public byte TargetY { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the target rotation. /// public byte TargetRotation { get => this._data[7..].GetByteValue(4, 4); set => this._data[7..].SetByteValue(value, 4, 4); } /// /// Gets or sets the step count. /// public byte StepCount { get => this._data[7..].GetByteValue(4, 0); set => this._data[7..].SetByteValue(value, 4, 0); } /// /// Gets or sets the step data. /// public Span StepData { get => this._data.Slice(8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ObjectWalkedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ObjectWalkedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int stepDataLength) => stepDataLength + 8; } /// /// Is sent by the server when: An object in the observed scope (including the own player) walked to another position. /// Causes reaction on client side: The object is animated to walk to the new position. /// public readonly ref struct ObjectWalkedExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ObjectWalkedExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ObjectWalkedExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xD4; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the header code. /// public byte HeaderCode { get => this._data[2]; set => this._data[2] = value; } /// /// Gets or sets the object id. /// public ushort ObjectId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the source x. /// public byte SourceX { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the source y. /// public byte SourceY { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the target x. /// public byte TargetX { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the target y. /// public byte TargetY { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the target rotation. /// public byte TargetRotation { get => this._data[9..].GetByteValue(4, 4); set => this._data[9..].SetByteValue(value, 4, 4); } /// /// Gets or sets the step count. /// public byte StepCount { get => this._data[9..].GetByteValue(4, 0); set => this._data[9..].SetByteValue(value, 4, 0); } /// /// Gets or sets the step data. /// public Span StepData { get => this._data.Slice(10); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ObjectWalkedExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ObjectWalkedExtendedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int stepDataLength) => stepDataLength + 10; } /// /// Is sent by the server when: An object in the observed scope (including the own player) walked to another position. /// Causes reaction on client side: The object is animated to walk to the new position. /// public readonly ref struct ObjectWalked075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ObjectWalked075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ObjectWalked075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x10; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the object id. /// public ushort ObjectId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the target x. /// public byte TargetX { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the target y. /// public byte TargetY { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the target rotation. /// public byte TargetRotation { get => this._data[7..].GetByteValue(4, 4); set => this._data[7..].SetByteValue(value, 4, 4); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ObjectWalked075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ObjectWalked075Ref packet) => packet._data; } /// /// Is sent by the server when: A player gained experience. /// Causes reaction on client side: The experience is added to the experience counter and bar. /// public readonly ref struct ExperienceGainedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ExperienceGainedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ExperienceGainedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x16; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 9; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the killed object id. /// public ushort KilledObjectId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the added experience. /// public ushort AddedExperience { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Gets or sets the damage of last hit. /// public ushort DamageOfLastHit { get => ReadUInt16BigEndian(this._data[7..]); set => WriteUInt16BigEndian(this._data[7..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ExperienceGainedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ExperienceGainedRef packet) => packet._data; } /// /// Is sent by the server when: A player gained experience. /// Causes reaction on client side: The experience is added to the experience counter and bar. /// public readonly ref struct ExperienceGainedExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ExperienceGainedExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ExperienceGainedExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x16; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 16; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the type. /// public ExperienceGainedExtended.AddResult Type { get => (ExperienceGainedExtended.AddResult)this._data[3]; set => this._data[3] = (byte)value; } /// /// Gets or sets the added experience. /// public uint AddedExperience { get => ReadUInt32LittleEndian(this._data[4..]); set => WriteUInt32LittleEndian(this._data[4..], value); } /// /// Gets or sets the damage of last hit. /// public uint DamageOfLastHit { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets or sets the killed object id. /// public ushort KilledObjectId { get => ReadUInt16LittleEndian(this._data[12..]); set => WriteUInt16LittleEndian(this._data[12..], value); } /// /// Gets or sets the killer object id. /// public ushort KillerObjectId { get => ReadUInt16LittleEndian(this._data[14..]); set => WriteUInt16LittleEndian(this._data[14..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ExperienceGainedExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ExperienceGainedExtendedRef packet) => packet._data; } /// /// Is sent by the server when: The map was changed on the server side. /// Causes reaction on client side: The game client changes to the specified map and coordinates. /// public readonly ref struct MapChangedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MapChangedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MapChangedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.IsMapChange = true; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x1C; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0F; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 15; /// /// Gets the header of this packet. /// public C3HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets if false, it shows the teleport animation (white bubbles), and the client doesn't remove all of the objects in its scope. /// public bool IsMapChange { get => this._data[4..].GetBoolean(); set => this._data[4..].SetBoolean(value); } /// /// Gets or sets the map number. /// public ushort MapNumber { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Gets or sets the position x. /// public byte PositionX { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the position y. /// public byte PositionY { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[9]; set => this._data[9] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MapChangedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MapChangedRef packet) => packet._data; } /// /// Is sent by the server when: The map was changed on the server side. /// Causes reaction on client side: The game client changes to the specified map and coordinates. /// public readonly ref struct MapChanged075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MapChanged075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MapChanged075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); this.IsMapChange = true; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x1C; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets if false, it shows the teleport animation (white bubbles), and the client doesn't remove all of the objects in its scope. /// public bool IsMapChange { get => this._data[3..].GetBoolean(); set => this._data[3..].SetBoolean(value); } /// /// Gets or sets the map number. /// public byte MapNumber { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the position x. /// public byte PositionX { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the position y. /// public byte PositionY { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[7]; set => this._data[7] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MapChanged075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MapChanged075Ref packet) => packet._data; } /// /// Is sent by the server when: When entering the game world with a character. /// Causes reaction on client side: The client restores this configuration in its user interface. /// public readonly ref struct ApplyKeyConfigurationRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ApplyKeyConfigurationRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ApplyKeyConfigurationRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x30; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the binary data of the key configuration /// public Span Configuration { get => this._data.Slice(4); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ApplyKeyConfigurationRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ApplyKeyConfigurationRef packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int configurationLength) => configurationLength + 4; } /// /// Is sent by the server when: The items dropped on the ground. /// Causes reaction on client side: The client adds the items to the ground. /// public readonly ref struct ItemsDroppedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ItemsDroppedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ItemsDroppedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x20; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the item count. /// public byte ItemCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public DroppedItemRef this[int index, int droppedItemLength] => new (this._data[(5 + index * droppedItemLength)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ItemsDroppedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ItemsDroppedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of and it's size. /// /// The count of from which the size will be calculated. /// The length of from which the size will be calculated. public static int GetRequiredSize(int itemsCount, int structLength) => itemsCount * structLength + 5; /// /// Contains the data about a dropped item.. /// public readonly ref struct DroppedItemRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DroppedItemRef(Span data) { this._data = data; } /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets if this flag is set, the item is added to the map with an animation and sound. Otherwise it's just added like it was already on the ground before. /// public bool IsFreshDrop { get => this._data.GetBoolean(7); set => this._data.SetBoolean(value, 7); } /// /// Gets or sets the position x. /// public byte PositionX { get => this._data[2]; set => this._data[2] = value; } /// /// Gets or sets the position y. /// public byte PositionY { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the item data. /// public Span ItemData { get => this._data.Slice(4); } /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int itemDataLength) => itemDataLength + 4; } } /// /// Is sent by the server when: Money dropped on the ground. /// Causes reaction on client side: The client adds the money to the ground. /// public readonly ref partial struct MoneyDroppedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MoneyDroppedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MoneyDroppedRef(Span 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); this.ItemCount = 1; this.MoneyNumber = 15; this.MoneyGroup = 14; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x20; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 21; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the item count. /// public byte ItemCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Gets or sets if this flag is set, the money is added to the map with an animation and sound. Otherwise it's just added like it was already on the ground before. /// public bool IsFreshDrop { get => this._data[5..].GetBoolean(7); set => this._data[5..].SetBoolean(value, 7); } /// /// Gets or sets the position x. /// public byte PositionX { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the position y. /// public byte PositionY { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the money number. /// public byte MoneyNumber { get => this._data[9]; set => this._data[9] = value; } /// /// Gets or sets the money group. /// public byte MoneyGroup { get => this._data[14..].GetByteValue(8, 4); set => this._data[14..].SetByteValue(value, 8, 4); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MoneyDroppedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MoneyDroppedRef packet) => packet._data; } /// /// Is sent by the server when: Money dropped on the ground. /// Causes reaction on client side: The client adds the money to the ground. /// public readonly ref struct MoneyDroppedExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MoneyDroppedExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MoneyDroppedExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x2F; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 12; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets if this flag is set, the money is added to the map with an animation and sound. Otherwise, it's just added like it was already on the ground before. /// public bool IsFreshDrop { get => this._data[3..].GetBoolean(); set => this._data[3..].SetBoolean(value); } /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the position x. /// public byte PositionX { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the position y. /// public byte PositionY { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the amount. /// public uint Amount { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MoneyDroppedExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MoneyDroppedExtendedRef packet) => packet._data; } /// /// Is sent by the server when: Money dropped on the ground. /// Causes reaction on client side: The client adds the money to the ground. /// public readonly ref partial struct MoneyDropped075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MoneyDropped075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MoneyDropped075Ref(Span 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); this.ItemCount = 1; this.MoneyNumber = 15; this.MoneyGroup = 14; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x20; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 14; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the item count. /// public byte ItemCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Gets or sets if this flag is set, the money is added to the map with an animation and sound. Otherwise it's just added like it was already on the ground before. /// public bool IsFreshDrop { get => this._data[5..].GetBoolean(7); set => this._data[5..].SetBoolean(value, 7); } /// /// Gets or sets the position x. /// public byte PositionX { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the position y. /// public byte PositionY { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the money number. /// public byte MoneyNumber { get => this._data[9..].GetByteValue(4, 0); set => this._data[9..].SetByteValue(value, 4, 0); } /// /// Gets or sets the money group. /// public byte MoneyGroup { get => this._data[9..].GetByteValue(4, 4); set => this._data[9..].SetByteValue(value, 4, 4); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MoneyDropped075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MoneyDropped075Ref packet) => packet._data; } /// /// Is sent by the server when: A dropped item was removed from the ground of the map, e.g. when it timed out or was picked up. /// Causes reaction on client side: The client removes the item from the ground of the map. /// public readonly ref struct ItemDropRemovedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ItemDropRemovedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ItemDropRemovedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x21; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the item count. /// public byte ItemCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public DroppedItemIdRef this[int index] => new (this._data[(5 + index * DroppedItemIdRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ItemDropRemovedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ItemDropRemovedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int itemDataCount) => itemDataCount * DroppedItemIdRef.Length + 5; /// /// Contains the id of a dropped item.. /// public readonly ref struct DroppedItemIdRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DroppedItemIdRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 2; /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } } } /// /// Is sent by the server when: A new item was added to the inventory. /// Causes reaction on client side: The client adds the item to the inventory user interface. /// public readonly ref struct ItemAddedToInventoryRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ItemAddedToInventoryRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ItemAddedToInventoryRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x22; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the inventory slot. /// public byte InventorySlot { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the item data. /// public Span ItemData { get => this._data.Slice(4); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ItemAddedToInventoryRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ItemAddedToInventoryRef packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int itemDataLength) => itemDataLength + 4; } /// /// Is sent by the server when: The player requested to drop an item of his inventory. This message is the response about the success of the request. /// Causes reaction on client side: If successful, the client removes the item from the inventory user interface. /// public readonly ref struct ItemDropResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ItemDropResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ItemDropResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x23; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the success. /// public bool Success { get => this._data[3..].GetBoolean(); set => this._data[3..].SetBoolean(value); } /// /// Gets or sets the inventory slot. /// public byte InventorySlot { get => this._data[4]; set => this._data[4] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ItemDropResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ItemDropResponseRef packet) => packet._data; } /// /// Is sent by the server when: The player requested to pick up an item from to ground to add it to his inventory, but it failed. /// Causes reaction on client side: Depending on the reason, the game client shows a message. /// public readonly ref struct ItemPickUpRequestFailedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ItemPickUpRequestFailedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ItemPickUpRequestFailedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x22; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the fail reason. /// public ItemPickUpRequestFailed.ItemPickUpFailReason FailReason { get => (ItemPickUpRequestFailed.ItemPickUpFailReason)this._data[3]; set => this._data[3] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ItemPickUpRequestFailedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ItemPickUpRequestFailedRef packet) => packet._data; } /// /// Is sent by the server when: The players money amount of the inventory has been changed and needs an update. /// Causes reaction on client side: The money is updated in the inventory user interface. /// public readonly ref struct InventoryMoneyUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public InventoryMoneyUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private InventoryMoneyUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x22; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0xFE; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C3HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the money. /// public uint Money { get => ReadUInt32BigEndian(this._data[4..]); set => WriteUInt32BigEndian(this._data[4..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator InventoryMoneyUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(InventoryMoneyUpdateRef packet) => packet._data; } /// /// Is sent by the server when: An item in the inventory or vault of the player has been moved. /// Causes reaction on client side: The client updates the position of item in the user interface. /// public readonly ref struct ItemMovedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ItemMovedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ItemMovedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x24; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the target storage type. /// public ItemStorageKind TargetStorageType { get => (ItemStorageKind)this._data[3]; set => this._data[3] = (byte)value; } /// /// Gets or sets the target slot. /// public byte TargetSlot { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the item data. /// public Span ItemData { get => this._data.Slice(5); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ItemMovedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ItemMovedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int itemDataLength) => itemDataLength + 5; } /// /// Is sent by the server when: An item in the inventory or vault of the player could not be moved as requested by the player. /// Causes reaction on client side: The client restores the position of item in the user interface. /// public readonly ref struct ItemMoveRequestFailedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ItemMoveRequestFailedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ItemMoveRequestFailedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x24; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0xFF; /// /// Gets the header of this packet. /// public C3HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the item data. /// public Span ItemData { get => this._data.Slice(5); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ItemMoveRequestFailedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ItemMoveRequestFailedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int itemDataLength) => itemDataLength + 5; } /// /// Is sent by the server when: Periodically, or if the current health or shield changed on the server side, e.g. by hits. /// Causes reaction on client side: The health and shield bar is updated on the game client user interface. /// public readonly ref struct CurrentHealthAndShieldRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CurrentHealthAndShieldRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CurrentHealthAndShieldRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x26; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0xFF; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 9; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the health. /// public ushort Health { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the shield. /// public ushort Shield { get => ReadUInt16BigEndian(this._data[7..]); set => WriteUInt16BigEndian(this._data[7..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CurrentHealthAndShieldRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CurrentHealthAndShieldRef packet) => packet._data; } /// /// Is sent by the server when: When the maximum health changed, e.g. by adding stat points or changed items. /// Causes reaction on client side: The health and shield bar is updated on the game client user interface. /// public readonly ref struct MaximumHealthAndShieldRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MaximumHealthAndShieldRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MaximumHealthAndShieldRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x26; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0xFE; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 9; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the health. /// public ushort Health { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the shield. /// public ushort Shield { get => ReadUInt16BigEndian(this._data[7..]); set => WriteUInt16BigEndian(this._data[7..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MaximumHealthAndShieldRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MaximumHealthAndShieldRef packet) => packet._data; } /// /// Is sent by the server when: Periodically, or if the current stats, like health, shield, mana or attack speed changed on the server side, e.g. by hits. /// Causes reaction on client side: The values are updated on the game client user interface. /// public readonly ref struct CurrentStatsExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CurrentStatsExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CurrentStatsExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x26; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0xFF; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 24; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the health. /// public uint Health { get => ReadUInt32LittleEndian(this._data[4..]); set => WriteUInt32LittleEndian(this._data[4..], value); } /// /// Gets or sets the shield. /// public uint Shield { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets or sets the mana. /// public uint Mana { get => ReadUInt32LittleEndian(this._data[12..]); set => WriteUInt32LittleEndian(this._data[12..], value); } /// /// Gets or sets the ability. /// public uint Ability { get => ReadUInt32LittleEndian(this._data[16..]); set => WriteUInt32LittleEndian(this._data[16..], value); } /// /// Gets or sets the attack speed. /// public ushort AttackSpeed { get => ReadUInt16LittleEndian(this._data[20..]); set => WriteUInt16LittleEndian(this._data[20..], value); } /// /// Gets or sets the magic speed. /// public ushort MagicSpeed { get => ReadUInt16LittleEndian(this._data[22..]); set => WriteUInt16LittleEndian(this._data[22..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CurrentStatsExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CurrentStatsExtendedRef packet) => packet._data; } /// /// Is sent by the server when: When the maximum stats, like health, shield, mana or attack speed changed on the server side, e.g. by adding stat points or changed items. /// Causes reaction on client side: The values are updated on the game client user interface. /// public readonly ref struct MaximumStatsExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MaximumStatsExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MaximumStatsExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x26; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0xFE; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 20; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the health. /// public uint Health { get => ReadUInt32LittleEndian(this._data[4..]); set => WriteUInt32LittleEndian(this._data[4..], value); } /// /// Gets or sets the shield. /// public uint Shield { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets or sets the mana. /// public uint Mana { get => ReadUInt32LittleEndian(this._data[12..]); set => WriteUInt32LittleEndian(this._data[12..], value); } /// /// Gets or sets the ability. /// public uint Ability { get => ReadUInt32LittleEndian(this._data[16..]); set => WriteUInt32LittleEndian(this._data[16..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MaximumStatsExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MaximumStatsExtendedRef packet) => packet._data; } /// /// Is sent by the server when: When the consumption of an item failed. /// Causes reaction on client side: The game client gets a feedback about a failed consumption, and allows for do further consumption requests. /// public readonly ref struct ItemConsumptionFailedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ItemConsumptionFailedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ItemConsumptionFailedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x26; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0xFD; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 9; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the health. /// public ushort Health { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the shield. /// public ushort Shield { get => ReadUInt16BigEndian(this._data[7..]); set => WriteUInt16BigEndian(this._data[7..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ItemConsumptionFailedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ItemConsumptionFailedRef packet) => packet._data; } /// /// Is sent by the server when: When the consumption of an item failed. /// Causes reaction on client side: The game client gets a feedback about a failed consumption, and allows for do further consumption requests. /// public readonly ref struct ItemConsumptionFailedExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ItemConsumptionFailedExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ItemConsumptionFailedExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x26; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0xFD; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 12; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the health. /// public uint Health { get => ReadUInt32LittleEndian(this._data[4..]); set => WriteUInt32LittleEndian(this._data[4..], value); } /// /// Gets or sets the shield. /// public uint Shield { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ItemConsumptionFailedExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ItemConsumptionFailedExtendedRef packet) => packet._data; } /// /// Is sent by the server when: Setting the base stats of a character, e.g. set stats command or after a reset. /// Causes reaction on client side: The values are updated on the game client user interface. /// public readonly ref struct BaseStatsExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public BaseStatsExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private BaseStatsExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x32; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 24; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the strength. /// public uint Strength { get => ReadUInt32LittleEndian(this._data[4..]); set => WriteUInt32LittleEndian(this._data[4..], value); } /// /// Gets or sets the agility. /// public uint Agility { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets or sets the vitality. /// public uint Vitality { get => ReadUInt32LittleEndian(this._data[12..]); set => WriteUInt32LittleEndian(this._data[12..], value); } /// /// Gets or sets the energy. /// public uint Energy { get => ReadUInt32LittleEndian(this._data[16..]); set => WriteUInt32LittleEndian(this._data[16..], value); } /// /// Gets or sets the command. /// public uint Command { get => ReadUInt32LittleEndian(this._data[20..]); set => WriteUInt32LittleEndian(this._data[20..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator BaseStatsExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(BaseStatsExtendedRef packet) => packet._data; } /// /// Is sent by the server when: The currently available mana or ability has changed, e.g. by using a skill. /// Causes reaction on client side: The mana and ability bar is updated on the game client user interface. /// public readonly ref struct CurrentManaAndAbilityRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CurrentManaAndAbilityRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CurrentManaAndAbilityRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x27; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0xFF; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the mana. /// public ushort Mana { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the ability. /// public ushort Ability { get => ReadUInt16BigEndian(this._data[6..]); set => WriteUInt16BigEndian(this._data[6..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CurrentManaAndAbilityRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CurrentManaAndAbilityRef packet) => packet._data; } /// /// Is sent by the server when: The maximum available mana or ability has changed, e.g. by adding stat points. /// Causes reaction on client side: The mana and ability bar is updated on the game client user interface. /// public readonly ref struct MaximumManaAndAbilityRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MaximumManaAndAbilityRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MaximumManaAndAbilityRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x27; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0xFE; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the mana. /// public ushort Mana { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the ability. /// public ushort Ability { get => ReadUInt16BigEndian(this._data[6..]); set => WriteUInt16BigEndian(this._data[6..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MaximumManaAndAbilityRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MaximumManaAndAbilityRef packet) => packet._data; } /// /// Is sent by the server when: The item has been removed from the inventory of the player. /// Causes reaction on client side: The client removes the item in the inventory user interface. /// public readonly ref struct ItemRemovedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ItemRemovedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ItemRemovedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); this.TrueFlag = 1; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x28; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the affected slot of the item in the inventory. /// public byte InventorySlot { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the true flag. /// public byte TrueFlag { get => this._data[4]; set => this._data[4] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ItemRemovedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ItemRemovedRef packet) => packet._data; } /// /// Is sent by the server when: The client requested to consume a special item, e.g. a bottle of Ale. /// Causes reaction on client side: The player is shown in a red color and has increased attack speed. /// public readonly ref struct ConsumeItemWithEffectRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ConsumeItemWithEffectRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ConsumeItemWithEffectRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x29; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 6; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the item type. /// public ConsumeItemWithEffect.ConsumedItemType ItemType { get => (ConsumeItemWithEffect.ConsumedItemType)this._data[3]; set => this._data[3] = (byte)value; } /// /// Gets or sets the effect time in seconds. /// public ushort EffectTimeInSeconds { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ConsumeItemWithEffectRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ConsumeItemWithEffectRef packet) => packet._data; } /// /// Is sent by the server when: The durability of an item in the inventory of the player has been changed. /// Causes reaction on client side: The client updates the item in the inventory user interface. /// public readonly ref struct ItemDurabilityChangedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ItemDurabilityChangedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ItemDurabilityChangedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x2A; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 6; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the inventory slot. /// public byte InventorySlot { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the durability. /// public byte Durability { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets true, if the change resulted from an item consumption; otherwise, false /// public bool ByConsumption { get => this._data[5..].GetBoolean(); set => this._data[5..].SetBoolean(value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ItemDurabilityChangedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ItemDurabilityChangedRef packet) => packet._data; } /// /// Is sent by the server when: The player requested to consume a fruit. /// Causes reaction on client side: The client updates the user interface, by changing the added stat points and used fruit points. /// public readonly ref struct FruitConsumptionResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public FruitConsumptionResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private FruitConsumptionResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x2C; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the result. /// public FruitConsumptionResponse.FruitConsumptionResult Result { get => (FruitConsumptionResponse.FruitConsumptionResult)this._data[3]; set => this._data[3] = (byte)value; } /// /// Gets or sets the stat points. /// public ushort StatPoints { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the stat type. /// public FruitConsumptionResponse.FruitStatType StatType { get => (FruitConsumptionResponse.FruitStatType)this._data[6]; set => this._data[6] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator FruitConsumptionResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(FruitConsumptionResponseRef packet) => packet._data; } /// /// Is sent by the server when: The player requested to consume an item which gives a magic effect. /// Causes reaction on client side: The client updates the user interface, it shows the remaining time at the effect icon. /// public readonly ref struct EffectItemConsumptionRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public EffectItemConsumptionRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private EffectItemConsumptionRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x2D; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 17; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the origin. /// public EffectItemConsumption.EffectOrigin Origin { get => (EffectItemConsumption.EffectOrigin)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets the type. /// public EffectItemConsumption.EffectType Type { get => (EffectItemConsumption.EffectType)this._data[6]; set => this._data[6] = (byte)value; } /// /// Gets or sets the action. /// public EffectItemConsumption.EffectAction Action { get => (EffectItemConsumption.EffectAction)this._data[8]; set => this._data[8] = (byte)value; } /// /// Gets or sets the remaining seconds. /// public uint RemainingSeconds { get => ReadUInt32LittleEndian(this._data[12..]); set => WriteUInt32LittleEndian(this._data[12..], value); } /// /// Gets or sets the magic effect number. /// public byte MagicEffectNumber { get => this._data[16]; set => this._data[16] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator EffectItemConsumptionRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(EffectItemConsumptionRef packet) => packet._data; } /// /// Is sent by the server when: After the client talked to an NPC which should cause a dialog to open on the client side. /// Causes reaction on client side: The client opens the specified dialog. /// public readonly ref struct NpcWindowResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public NpcWindowResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private NpcWindowResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x30; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 11; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the window. /// public NpcWindowResponse.NpcWindow Window { get => (NpcWindowResponse.NpcWindow)this._data[3]; set => this._data[3] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator NpcWindowResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(NpcWindowResponseRef packet) => packet._data; } /// /// Is sent by the server when: The player opens a merchant npc or the vault. It's sent after the dialog was opened by another message. /// Causes reaction on client side: The client shows the items in the opened dialog. /// public readonly ref struct StoreItemListRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public StoreItemListRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private StoreItemListRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x31; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the type. /// public StoreItemList.ItemWindow Type { get => (StoreItemList.ItemWindow)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets the item count. /// public byte ItemCount { get => this._data[5]; set => this._data[5] = value; } /// /// Gets the of the specified index. /// public StoredItemRef this[int index, int storedItemLength] => new (this._data[(6 + index * storedItemLength)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator StoreItemListRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(StoreItemListRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of and it's size. /// /// The count of from which the size will be calculated. /// The length of from which the size will be calculated. public static int GetRequiredSize(int itemsCount, int structLength) => itemsCount * structLength + 6; } /// /// Is sent by the server when: The request of buying an item from a NPC failed. /// Causes reaction on client side: The client is responsive again. Without this message, it may stuck. /// public readonly ref struct NpcItemBuyFailedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public NpcItemBuyFailedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private NpcItemBuyFailedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x32; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0xFF; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator NpcItemBuyFailedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(NpcItemBuyFailedRef packet) => packet._data; } /// /// Is sent by the server when: The request of buying an item from a player or npc was successful. /// Causes reaction on client side: The bought item is added to the inventory. /// public readonly ref struct ItemBoughtRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ItemBoughtRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ItemBoughtRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x32; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the inventory slot. /// public byte InventorySlot { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the item data. /// public Span ItemData { get => this._data.Slice(4); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ItemBoughtRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ItemBoughtRef packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int itemDataLength) => itemDataLength + 4; } /// /// Is sent by the server when: The result of a previous item sell request. /// Causes reaction on client side: The amount of specified money is set at the players inventory. /// public readonly ref struct NpcItemSellResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public NpcItemSellResultRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private NpcItemSellResultRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x33; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the success. /// public bool Success { get => this._data[3..].GetBoolean(); set => this._data[3..].SetBoolean(value); } /// /// Gets or sets the money. /// public uint Money { get => ReadUInt32LittleEndian(this._data[4..]); set => WriteUInt32LittleEndian(this._data[4..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator NpcItemSellResultRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(NpcItemSellResultRef packet) => packet._data; } /// /// Is sent by the server when: The player requested to set a price for an item of the players shop. /// Causes reaction on client side: The item gets a price on the user interface. /// public readonly ref struct PlayerShopSetItemPriceResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PlayerShopSetItemPriceResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PlayerShopSetItemPriceResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x3F; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x01; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 6; /// /// Gets the header of this packet. /// public C3HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the inventory slot. /// public byte InventorySlot { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the result. /// public PlayerShopSetItemPriceResponse.ItemPriceSetResult Result { get => (PlayerShopSetItemPriceResponse.ItemPriceSetResult)this._data[4]; set => this._data[4] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PlayerShopSetItemPriceResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PlayerShopSetItemPriceResponseRef packet) => packet._data; } /// /// Is sent by the server when: After a player in scope requested to close his shop or after all items has been sold. /// Causes reaction on client side: The player shop not shown as open anymore. /// public readonly ref struct PlayerShopClosedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PlayerShopClosedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PlayerShopClosedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.Success = true; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x3F; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x3; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the success. /// public bool Success { get => this._data[4..].GetBoolean(); set => this._data[4..].SetBoolean(value); } /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PlayerShopClosedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PlayerShopClosedRef packet) => packet._data; } /// /// Is sent by the server when: An item of the players shop was sold to another player. /// Causes reaction on client side: The item is removed from the players inventory and a blue system message appears. /// public readonly ref struct PlayerShopItemSoldToPlayerRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PlayerShopItemSoldToPlayerRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PlayerShopItemSoldToPlayerRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x3F; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x08; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 15; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the inventory slot. /// public byte InventorySlot { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the buyer name. /// public string BuyerName { get => this._data.ExtractString(5, 10, System.Text.Encoding.UTF8); set => this._data.Slice(5, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PlayerShopItemSoldToPlayerRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PlayerShopItemSoldToPlayerRef packet) => packet._data; } /// /// Is sent by the server when: After the player requested to close his shop or after all items has been sold. /// Causes reaction on client side: The player shop dialog is closed for the shop of the specified player. /// public readonly ref struct ClosePlayerShopDialogRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ClosePlayerShopDialogRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ClosePlayerShopDialogRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x3F; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x12; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 6; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ClosePlayerShopDialogRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ClosePlayerShopDialogRef packet) => packet._data; } /// /// Is sent by the server when: After the player requested to open a shop of another player. /// Causes reaction on client side: The player shop dialog is shown with the provided item data. /// public readonly ref struct PlayerShopItemListRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PlayerShopItemListRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PlayerShopItemListRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; header.SubCode = SubCode; this.Success = true; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x3F; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x05; /// /// Gets the header of this packet. /// public C2HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the action. /// public PlayerShopItemList.ActionKind Action { get => (PlayerShopItemList.ActionKind)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets the success. /// public bool Success { get => this._data[5..].GetBoolean(); set => this._data[5..].SetBoolean(value); } /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[6..]); set => WriteUInt16BigEndian(this._data[6..], value); } /// /// Gets or sets the player name. /// public string PlayerName { get => this._data.ExtractString(8, 10, System.Text.Encoding.UTF8); set => this._data.Slice(8, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the shop name. /// public string ShopName { get => this._data.ExtractString(18, 36, System.Text.Encoding.UTF8); set => this._data.Slice(18, 36).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the item count. /// public byte ItemCount { get => this._data[54]; set => this._data[54] = value; } /// /// Gets the of the specified index. /// public PlayerShopItemRef this[int index] => new (this._data[(55 + index * PlayerShopItemRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PlayerShopItemListRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PlayerShopItemListRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int itemsCount) => itemsCount * PlayerShopItemRef.Length + 55; } /// /// Is sent by the server when: After the player requested to buy an item of a shop of another player. /// Causes reaction on client side: The result is shown to the player. If successful, the item is added to the inventory. /// public readonly ref struct PlayerShopBuyResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PlayerShopBuyResultRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PlayerShopBuyResultRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x3F; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x06; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 21; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the result. /// public PlayerShopBuyResult.ResultKind Result { get => (PlayerShopBuyResult.ResultKind)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets the seller id. /// public ushort SellerId { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Gets or sets the item data. /// public Span ItemData { get => this._data.Slice(7, 13); } /// /// Gets or sets the item slot. /// public byte ItemSlot { get => this._data[20]; set => this._data[20] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PlayerShopBuyResultRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PlayerShopBuyResultRef packet) => packet._data; } /// /// Is sent by the server when: After the player requested to buy an item of a shop of another player. /// Causes reaction on client side: The result is shown to the player. If successful, the item is added to the inventory. /// public readonly ref struct PlayerShopBuyResultExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PlayerShopBuyResultExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PlayerShopBuyResultExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x3F; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x06; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the seller id. /// public ushort SellerId { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the result. /// public PlayerShopBuyResultExtended.ResultKind Result { get => (PlayerShopBuyResultExtended.ResultKind)this._data[6]; set => this._data[6] = (byte)value; } /// /// Gets or sets the item slot. /// public byte ItemSlot { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the item data. /// public Span ItemData { get => this._data.Slice(8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PlayerShopBuyResultExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PlayerShopBuyResultExtendedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int itemDataLength) => itemDataLength + 8; } /// /// Is sent by the server when: After the player requested to open a shop of another player. /// Causes reaction on client side: The player shop dialog is shown with the provided item data. /// public readonly ref struct PlayerShopItemListExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PlayerShopItemListExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PlayerShopItemListExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; header.SubCode = SubCode; this.Success = true; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x3F; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x05; /// /// Gets the header of this packet. /// public C2HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the action. /// public PlayerShopItemListExtended.ActionKind Action { get => (PlayerShopItemListExtended.ActionKind)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets the success. /// public bool Success { get => this._data[5..].GetBoolean(); set => this._data[5..].SetBoolean(value); } /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[6..]); set => WriteUInt16BigEndian(this._data[6..], value); } /// /// Gets or sets the player name. /// public string PlayerName { get => this._data.ExtractString(8, 10, System.Text.Encoding.UTF8); set => this._data.Slice(8, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the shop name. /// public string ShopName { get => this._data.ExtractString(18, 36, System.Text.Encoding.UTF8); set => this._data.Slice(18, 36).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the item count. /// public byte ItemCount { get => this._data[54]; set => this._data[54] = value; } /// /// Gets the of the specified index. /// public PlayerShopItemExtendedRef this[int index, int playerShopItemExtendedLength] => new (this._data[(55 + index * playerShopItemExtendedLength)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PlayerShopItemListExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PlayerShopItemListExtendedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of and it's size. /// /// The count of from which the size will be calculated. /// The length of from which the size will be calculated. public static int GetRequiredSize(int itemsCount, int structLength) => itemsCount * structLength + 55; } /// /// Is sent by the server when: After the player gets into scope of a player with an opened shop. /// Causes reaction on client side: The player shop title is shown at the specified players. /// public readonly ref struct PlayerShopsRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PlayerShopsRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PlayerShopsRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x3F; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x00; /// /// Gets the header of this packet. /// public C2HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the shop count. /// public byte ShopCount { get => this._data[5]; set => this._data[5] = value; } /// /// Gets the of the specified index. /// public PlayerShopRef this[int index] => new (this._data[(6 + index * PlayerShopRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PlayerShopsRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PlayerShopsRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int shopsCount) => shopsCount * PlayerShopRef.Length + 6; /// /// Data of the shop of a player.. /// public readonly ref struct PlayerShopRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PlayerShopRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 38; /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets the store name. /// public string StoreName { get => this._data.ExtractString(2, 36, System.Text.Encoding.UTF8); set => this._data.Slice(2, 36).WriteString(value, System.Text.Encoding.UTF8); } } } /// /// Is sent by the server when: The player wears a monster transformation ring. /// Causes reaction on client side: The character appears as monster, defined by the Skin property. /// public readonly ref struct AddTransformedCharactersToScope075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AddTransformedCharactersToScope075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AddTransformedCharactersToScope075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x45; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the character count. /// public byte CharacterCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public CharacterDataRef this[int index] => new (this._data[(5 + index * CharacterDataRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AddTransformedCharactersToScope075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AddTransformedCharactersToScope075Ref packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int charactersCount) => charactersCount * CharacterDataRef.Length + 5; /// /// Contains the data of an transformed character.. /// public readonly ref struct CharacterDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterDataRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 19; /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets the current position x. /// public byte CurrentPositionX { get => this._data[2]; set => this._data[2] = value; } /// /// Gets or sets the current position y. /// public byte CurrentPositionY { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the skin. /// public byte Skin { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the is poisoned. /// public bool IsPoisoned { get => this._data[5..].GetBoolean(0); set => this._data[5..].SetBoolean(value, 0); } /// /// Gets or sets the is iced. /// public bool IsIced { get => this._data[5..].GetBoolean(1); set => this._data[5..].SetBoolean(value, 1); } /// /// Gets or sets the is damage buffed. /// public bool IsDamageBuffed { get => this._data[5..].GetBoolean(2); set => this._data[5..].SetBoolean(value, 2); } /// /// Gets or sets the is defense buffed. /// public bool IsDefenseBuffed { get => this._data[5..].GetBoolean(3); set => this._data[5..].SetBoolean(value, 3); } /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(6, 10, System.Text.Encoding.UTF8); set => this._data.Slice(6, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the target position x. /// public byte TargetPositionX { get => this._data[16]; set => this._data[16] = value; } /// /// Gets or sets the target position y. /// public byte TargetPositionY { get => this._data[17]; set => this._data[17] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[18..].GetByteValue(4, 4); set => this._data[18..].SetByteValue(value, 4, 4); } /// /// Gets or sets the hero state. /// public CharacterHeroState HeroState { get => (CharacterHeroState)this._data[18..].GetByteValue(4, 0); set => this._data[18..].SetByteValue((byte)value, 4, 0); } } } /// /// Is sent by the server when: The player wears a monster transformation ring. /// Causes reaction on client side: The character appears as monster, defined by the Skin property. /// public readonly ref partial struct AddTransformedCharactersToScopeRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AddTransformedCharactersToScopeRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AddTransformedCharactersToScopeRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x45; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the character count. /// public byte CharacterCount { get => this._data[4]; set => this._data[4] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AddTransformedCharactersToScopeRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AddTransformedCharactersToScopeRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of and it's size. /// /// The count of from which the size will be calculated. /// The length of from which the size will be calculated. public static int GetRequiredSize(int charactersCount, int structLength) => charactersCount * structLength + 5; /// /// Contains the data of an transformed character.. /// public readonly ref struct CharacterDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterDataRef(Span data) { this._data = data; } /// /// Gets or sets the id. /// public ushort Id { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets the current position x. /// public byte CurrentPositionX { get => this._data[2]; set => this._data[2] = value; } /// /// Gets or sets the current position y. /// public byte CurrentPositionY { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the skin. /// public ushort Skin { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(6, 10, System.Text.Encoding.UTF8); set => this._data.Slice(6, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the target position x. /// public byte TargetPositionX { get => this._data[16]; set => this._data[16] = value; } /// /// Gets or sets the target position y. /// public byte TargetPositionY { get => this._data[17]; set => this._data[17] = value; } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[18..].GetByteValue(4, 4); set => this._data[18..].SetByteValue(value, 4, 4); } /// /// Gets or sets the hero state. /// public CharacterHeroState HeroState { get => (CharacterHeroState)this._data[18..].GetByteValue(4, 0); set => this._data[18..].SetByteValue((byte)value, 4, 0); } /// /// Gets or sets the appearance. /// public Span Appearance { get => this._data.Slice(19, 18); } /// /// Gets or sets defines the number of effects which would be sent after this field. /// public byte EffectCount { get => this._data[37]; set => this._data[37] = value; } /// /// Gets the of the specified index. /// public EffectIdRef this[int index] => new (this._data[(38 + index * EffectIdRef.Length)..]); /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int effectsCount) => effectsCount * EffectIdRef.Length + 38; } /// /// Contains the id of a magic effect.. /// public readonly ref struct EffectIdRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public EffectIdRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 1; /// /// Gets or sets the id. /// public byte Id { get => this._data[0]; set => this._data[0] = value; } } } /// /// Is sent by the server when: The server wants to alter the terrain attributes of a map at runtime. /// Causes reaction on client side: The client updates the terrain attributes on its side. /// public readonly ref struct ChangeTerrainAttributesRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ChangeTerrainAttributesRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ChangeTerrainAttributesRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; this.Type = false; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x46; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the type. /// public bool Type { get => this._data[3..].GetBoolean(); set => this._data[3..].SetBoolean(value); } /// /// Gets or sets the attribute. /// public ChangeTerrainAttributes.TerrainAttributeType Attribute { get => (ChangeTerrainAttributes.TerrainAttributeType)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets when this is true, the attribute is removed on the client side. If it's false, then the attribute is added. /// public bool RemoveAttribute { get => this._data[5..].GetBoolean(); set => this._data[5..].SetBoolean(value); } /// /// Gets or sets the area count. /// public byte AreaCount { get => this._data[6]; set => this._data[6] = value; } /// /// Gets the of the specified index. /// public TerrainAreaRef this[int index] => new (this._data[(7 + index * TerrainAreaRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ChangeTerrainAttributesRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ChangeTerrainAttributesRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int areasCount) => areasCount * TerrainAreaRef.Length + 7; /// /// Defines the area which should be changed.. /// public readonly ref struct TerrainAreaRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public TerrainAreaRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets or sets the start x. /// public byte StartX { get => this._data[0]; set => this._data[0] = value; } /// /// Gets or sets the start y. /// public byte StartY { get => this._data[1]; set => this._data[1] = value; } /// /// Gets or sets the end x. /// public byte EndX { get => this._data[2]; set => this._data[2] = value; } /// /// Gets or sets the end y. /// public byte EndY { get => this._data[3]; set => this._data[3] = value; } } } /// /// Is sent by the server when: After a player achieved or lost something. /// Causes reaction on client side: An effect is shown for the affected player. /// public readonly ref struct ShowEffectRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ShowEffectRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ShowEffectRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x48; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 6; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the effect. /// public ShowEffect.EffectType Effect { get => (ShowEffect.EffectType)this._data[5]; set => this._data[5] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ShowEffectRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ShowEffectRef packet) => packet._data; } /// /// Is sent by the server when: After the game client requested it, usually after a successful login. /// Causes reaction on client side: The game client shows the available characters of the account. /// public readonly ref struct CharacterListRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterListRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterListRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x00; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the unlock flags. /// public CharacterCreationUnlockFlags UnlockFlags { get => (CharacterCreationUnlockFlags)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets the move cnt. /// public byte MoveCnt { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the character count. /// public byte CharacterCount { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the is vault extended. /// public bool IsVaultExtended { get => this._data[7..].GetBoolean(); set => this._data[7..].SetBoolean(value); } /// /// Gets the of the specified index. /// public CharacterDataRef this[int index] => new (this._data[(8 + index * CharacterDataRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterListRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterListRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int charactersCount) => charactersCount * CharacterDataRef.Length + 8; /// /// Data of one character in the list.. /// public readonly ref struct CharacterDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterDataRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 34; /// /// Gets or sets the slot index. /// public byte SlotIndex { get => this._data[0]; set => this._data[0] = value; } /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(1, 10, System.Text.Encoding.UTF8); set => this._data.Slice(1, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the level. /// public ushort Level { get => ReadUInt16LittleEndian(this._data[12..]); set => WriteUInt16LittleEndian(this._data[12..], value); } /// /// Gets or sets the status. /// public CharacterStatus Status { get => (CharacterStatus)this._data[14..].GetByteValue(4, 0); set => this._data[14..].SetByteValue((byte)value, 4, 0); } /// /// Gets or sets the is item block active. /// public bool IsItemBlockActive { get => this._data[14..].GetBoolean(4); set => this._data[14..].SetBoolean(value, 4); } /// /// Gets or sets the appearance. /// public Span Appearance { get => this._data.Slice(15, 18); } /// /// Gets or sets the guild position. /// public GuildMemberRole GuildPosition { get => (GuildMemberRole)this._data[33]; set => this._data[33] = (byte)value; } } } /// /// Is sent by the server when: After the game client requested it, usually after a successful login. /// Causes reaction on client side: The game client shows the available characters of the account. /// public readonly ref struct CharacterListExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterListExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterListExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x00; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the unlock flags. /// public CharacterCreationUnlockFlags UnlockFlags { get => (CharacterCreationUnlockFlags)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets the move cnt. /// public byte MoveCnt { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the character count. /// public byte CharacterCount { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the is vault extended. /// public bool IsVaultExtended { get => this._data[7..].GetBoolean(); set => this._data[7..].SetBoolean(value); } /// /// Gets the of the specified index. /// public CharacterDataRef this[int index] => new (this._data[(8 + index * CharacterDataRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterListExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterListExtendedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int charactersCount) => charactersCount * CharacterDataRef.Length + 8; /// /// Data of one character in the list.. /// public readonly ref struct CharacterDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterDataRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 44; /// /// Gets or sets the slot index. /// public byte SlotIndex { get => this._data[0]; set => this._data[0] = value; } /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(1, 10, System.Text.Encoding.UTF8); set => this._data.Slice(1, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the level. /// public ushort Level { get => ReadUInt16LittleEndian(this._data[12..]); set => WriteUInt16LittleEndian(this._data[12..], value); } /// /// Gets or sets the status. /// public CharacterStatus Status { get => (CharacterStatus)this._data[14..].GetByteValue(4, 0); set => this._data[14..].SetByteValue((byte)value, 4, 0); } /// /// Gets or sets the is item block active. /// public bool IsItemBlockActive { get => this._data[14..].GetBoolean(4); set => this._data[14..].SetBoolean(value, 4); } /// /// Gets or sets the appearance. /// public Span Appearance { get => this._data.Slice(15, 27); } /// /// Gets or sets the guild position. /// public GuildMemberRole GuildPosition { get => (GuildMemberRole)this._data[42]; set => this._data[42] = (byte)value; } } } /// /// Is sent by the server when: It's send right after the CharacterList, in the character selection screen, if the account has any unlocked character classes. /// Causes reaction on client side: The client unlocks the specified character classes, so they can be created. /// public readonly ref struct CharacterClassCreationUnlockRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterClassCreationUnlockRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterClassCreationUnlockRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xDE; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x00; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the unlock flags. /// public CharacterCreationUnlockFlags UnlockFlags { get => (CharacterCreationUnlockFlags)this._data[4]; set => this._data[4] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterClassCreationUnlockRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterClassCreationUnlockRef packet) => packet._data; } /// /// Is sent by the server when: After the game client requested it, usually after a successful login. /// Causes reaction on client side: The game client shows the available characters of the account. /// public readonly ref struct CharacterList075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterList075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterList075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x00; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the character count. /// public byte CharacterCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public CharacterDataRef this[int index] => new (this._data[(5 + index * CharacterDataRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterList075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterList075Ref packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int charactersCount) => charactersCount * CharacterDataRef.Length + 5; /// /// Data of one character in the list.. /// public readonly ref struct CharacterDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterDataRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 24; /// /// Gets or sets the slot index. /// public byte SlotIndex { get => this._data[0]; set => this._data[0] = value; } /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(1, 10, System.Text.Encoding.UTF8); set => this._data.Slice(1, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the level. /// public ushort Level { get => ReadUInt16BigEndian(this._data[11..]); set => WriteUInt16BigEndian(this._data[11..], value); } /// /// Gets or sets the status. /// public CharacterStatus Status { get => (CharacterStatus)this._data[13..].GetByteValue(4, 0); set => this._data[13..].SetByteValue((byte)value, 4, 0); } /// /// Gets or sets the is item block active. /// public bool IsItemBlockActive { get => this._data[13..].GetBoolean(4); set => this._data[13..].SetBoolean(value, 4); } /// /// Gets or sets the appearance. /// public Span Appearance { get => this._data.Slice(14, 9); } } } /// /// Is sent by the server when: After the game client requested it, usually after a successful login. /// Causes reaction on client side: The game client shows the available characters of the account. /// public readonly ref struct CharacterList095Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterList095Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterList095Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x00; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the character count. /// public byte CharacterCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public CharacterDataRef this[int index] => new (this._data[(5 + index * CharacterDataRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterList095Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterList095Ref packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int charactersCount) => charactersCount * CharacterDataRef.Length + 5; /// /// Data of one character in the list.. /// public readonly ref struct CharacterDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterDataRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 26; /// /// Gets or sets the slot index. /// public byte SlotIndex { get => this._data[0]; set => this._data[0] = value; } /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(1, 10, System.Text.Encoding.UTF8); set => this._data.Slice(1, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the level. /// public ushort Level { get => ReadUInt16LittleEndian(this._data[12..]); set => WriteUInt16LittleEndian(this._data[12..], value); } /// /// Gets or sets the status. /// public CharacterStatus Status { get => (CharacterStatus)this._data[14..].GetByteValue(4, 0); set => this._data[14..].SetByteValue((byte)value, 4, 0); } /// /// Gets or sets the is item block active. /// public bool IsItemBlockActive { get => this._data[14..].GetBoolean(4); set => this._data[14..].SetBoolean(value, 4); } /// /// Gets or sets the appearance. /// public Span Appearance { get => this._data.Slice(15, 11); } } } /// /// Is sent by the server when: After the server successfully processed a character creation request. /// Causes reaction on client side: The new character is shown in the character list /// public readonly ref struct CharacterCreationSuccessfulRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterCreationSuccessfulRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterCreationSuccessfulRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.Success = true; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x01; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 42; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the success. /// public bool Success { get => this._data[4..].GetBoolean(); set => this._data[4..].SetBoolean(value); } /// /// Gets or sets the character name. /// public string CharacterName { get => this._data.ExtractString(5, 10, System.Text.Encoding.UTF8); set => this._data.Slice(5, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the character slot. /// public byte CharacterSlot { get => this._data[15]; set => this._data[15] = value; } /// /// Gets or sets the level. /// public ushort Level { get => ReadUInt16LittleEndian(this._data[16..]); set => WriteUInt16LittleEndian(this._data[16..], value); } /// /// Gets or sets the class. /// public CharacterClassNumber Class { get => (CharacterClassNumber)this._data[18..].GetByteValue(8, 3); set => this._data[18..].SetByteValue((byte)value, 8, 3); } /// /// Gets or sets the character status. /// public byte CharacterStatus { get => this._data[19]; set => this._data[19] = value; } /// /// Gets or sets the preview data. /// public Span PreviewData { get => this._data.Slice(20); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterCreationSuccessfulRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterCreationSuccessfulRef packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int previewDataLength) => previewDataLength + 20; } /// /// Is sent by the server when: After the server processed a character creation request without success. /// Causes reaction on client side: A message is shown that it failed. /// public readonly ref struct CharacterCreationFailedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterCreationFailedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterCreationFailedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x01; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterCreationFailedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterCreationFailedRef packet) => packet._data; } /// /// Is sent by the server when: The character respawned after death. /// Causes reaction on client side: The character respawns with the specified attributes at the specified map. /// public readonly ref struct RespawnAfterDeath075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RespawnAfterDeath075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private RespawnAfterDeath075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x04; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 20; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the position x. /// public byte PositionX { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the position y. /// public byte PositionY { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the map number. /// public byte MapNumber { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the direction. /// public byte Direction { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the current health. /// public ushort CurrentHealth { get => ReadUInt16LittleEndian(this._data[8..]); set => WriteUInt16LittleEndian(this._data[8..], value); } /// /// Gets or sets the current mana. /// public ushort CurrentMana { get => ReadUInt16LittleEndian(this._data[10..]); set => WriteUInt16LittleEndian(this._data[10..], value); } /// /// Gets or sets the experience. /// public uint Experience { get => ReadUInt32LittleEndian(this._data[12..]); set => WriteUInt32LittleEndian(this._data[12..], value); } /// /// Gets or sets the money. /// public uint Money { get => ReadUInt32LittleEndian(this._data[16..]); set => WriteUInt32LittleEndian(this._data[16..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator RespawnAfterDeath075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(RespawnAfterDeath075Ref packet) => packet._data; } /// /// Is sent by the server when: The character respawned after death. /// Causes reaction on client side: The character respawns with the specified attributes at the specified map. /// public readonly ref struct RespawnAfterDeath095Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RespawnAfterDeath095Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private RespawnAfterDeath095Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x04; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 22; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the position x. /// public byte PositionX { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the position y. /// public byte PositionY { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the map number. /// public byte MapNumber { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the direction. /// public byte Direction { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the current health. /// public ushort CurrentHealth { get => ReadUInt16LittleEndian(this._data[8..]); set => WriteUInt16LittleEndian(this._data[8..], value); } /// /// Gets or sets the current mana. /// public ushort CurrentMana { get => ReadUInt16LittleEndian(this._data[10..]); set => WriteUInt16LittleEndian(this._data[10..], value); } /// /// Gets or sets the current ability. /// public ushort CurrentAbility { get => ReadUInt16LittleEndian(this._data[12..]); set => WriteUInt16LittleEndian(this._data[12..], value); } /// /// Gets or sets the experience. /// public uint Experience { get => ReadUInt32LittleEndian(this._data[14..]); set => WriteUInt32LittleEndian(this._data[14..], value); } /// /// Gets or sets the money. /// public uint Money { get => ReadUInt32LittleEndian(this._data[18..]); set => WriteUInt32LittleEndian(this._data[18..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator RespawnAfterDeath095Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(RespawnAfterDeath095Ref packet) => packet._data; } /// /// Is sent by the server when: The character respawned after death. /// Causes reaction on client side: The character respawns with the specified attributes at the specified map. /// public readonly ref struct RespawnAfterDeathRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RespawnAfterDeathRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private RespawnAfterDeathRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x04; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 28; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the position x. /// public byte PositionX { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the position y. /// public byte PositionY { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the map number. /// public byte MapNumber { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the direction. /// public byte Direction { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the current health. /// public ushort CurrentHealth { get => ReadUInt16LittleEndian(this._data[8..]); set => WriteUInt16LittleEndian(this._data[8..], value); } /// /// Gets or sets the current mana. /// public ushort CurrentMana { get => ReadUInt16LittleEndian(this._data[10..]); set => WriteUInt16LittleEndian(this._data[10..], value); } /// /// Gets or sets the current shield. /// public ushort CurrentShield { get => ReadUInt16LittleEndian(this._data[12..]); set => WriteUInt16LittleEndian(this._data[12..], value); } /// /// Gets or sets the current ability. /// public ushort CurrentAbility { get => ReadUInt16LittleEndian(this._data[14..]); set => WriteUInt16LittleEndian(this._data[14..], value); } /// /// Gets or sets the experience. /// public ulong Experience { get => ReadUInt64BigEndian(this._data[16..]); set => WriteUInt64BigEndian(this._data[16..], value); } /// /// Gets or sets the money. /// public uint Money { get => ReadUInt32LittleEndian(this._data[24..]); set => WriteUInt32LittleEndian(this._data[24..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator RespawnAfterDeathRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(RespawnAfterDeathRef packet) => packet._data; } /// /// Is sent by the server when: The character respawned after death. /// Causes reaction on client side: The character respawns with the specified attributes at the specified map. /// public readonly ref struct RespawnAfterDeathExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RespawnAfterDeathExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private RespawnAfterDeathExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x04; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 36; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the position x. /// public byte PositionX { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the position y. /// public byte PositionY { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the map number. /// public byte MapNumber { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the direction. /// public byte Direction { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the current health. /// public uint CurrentHealth { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets or sets the current mana. /// public uint CurrentMana { get => ReadUInt32LittleEndian(this._data[12..]); set => WriteUInt32LittleEndian(this._data[12..], value); } /// /// Gets or sets the current shield. /// public uint CurrentShield { get => ReadUInt32LittleEndian(this._data[16..]); set => WriteUInt32LittleEndian(this._data[16..], value); } /// /// Gets or sets the current ability. /// public uint CurrentAbility { get => ReadUInt32LittleEndian(this._data[20..]); set => WriteUInt32LittleEndian(this._data[20..], value); } /// /// Gets or sets the experience. /// public ulong Experience { get => ReadUInt64LittleEndian(this._data[24..]); set => WriteUInt64LittleEndian(this._data[24..], value); } /// /// Gets or sets the money. /// public uint Money { get => ReadUInt32LittleEndian(this._data[32..]); set => WriteUInt32LittleEndian(this._data[32..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator RespawnAfterDeathExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(RespawnAfterDeathExtendedRef packet) => packet._data; } /// /// Is sent by the server when: The character got damaged by being poisoned on old client versions. /// Causes reaction on client side: Removes the damage from the health without showing a damage number. /// public readonly ref struct PoisonDamageRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PoisonDamageRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PoisonDamageRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x07; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the health damage. /// public ushort HealthDamage { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the current shield. /// public ushort CurrentShield { get => ReadUInt16BigEndian(this._data[6..]); set => WriteUInt16BigEndian(this._data[6..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PoisonDamageRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PoisonDamageRef packet) => packet._data; } /// /// Is sent by the server when: After a the hero state of an observed character changed. /// Causes reaction on client side: The color of the name of the character is changed accordingly and a message is shown. /// public readonly ref struct HeroStateChangedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public HeroStateChangedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private HeroStateChangedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x08; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the new state. /// public CharacterHeroState NewState { get => (CharacterHeroState)this._data[6]; set => this._data[6] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator HeroStateChangedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(HeroStateChangedRef packet) => packet._data; } /// /// Is sent by the server when: After a skill got added to the skill list, e.g. by equipping an item or learning a skill. /// Causes reaction on client side: The skill is added to the skill list on client side. /// public readonly ref struct SkillAddedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SkillAddedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private SkillAddedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.Flag = 0xFE; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x11; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 10; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the flag. /// public byte Flag { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the skill index. /// public byte SkillIndex { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the skill number. /// public ushort SkillNumber { get => ReadUInt16LittleEndian(this._data[7..]); set => WriteUInt16LittleEndian(this._data[7..], value); } /// /// Gets or sets the skill level. /// public byte SkillLevel { get => this._data[9]; set => this._data[9] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator SkillAddedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(SkillAddedRef packet) => packet._data; } /// /// Is sent by the server when: After a skill got removed from the skill list, e.g. by removing an equipped item. /// Causes reaction on client side: The skill is added to the skill list on client side. /// public readonly ref struct SkillRemovedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SkillRemovedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private SkillRemovedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.Flag = 0xFF; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x11; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 10; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the flag. /// public byte Flag { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the skill index. /// public byte SkillIndex { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the skill number. /// public ushort SkillNumber { get => ReadUInt16LittleEndian(this._data[7..]); set => WriteUInt16LittleEndian(this._data[7..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator SkillRemovedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(SkillRemovedRef packet) => packet._data; } /// /// Is sent by the server when: Usually, when the player entered the game with a character. When skills get added or removed, this message is sent as well, but with a misleading count. /// Causes reaction on client side: The skill list gets initialized. /// public readonly ref struct SkillListUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SkillListUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private SkillListUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x11; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets mixed usage: Skill list count (when list). 0xFE when adding a skill, 0xFF when removing a Skill. /// public byte Count { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public SkillEntryRef this[int index] => new (this._data[(6 + index * SkillEntryRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator SkillListUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(SkillListUpdateRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int skillsCount) => skillsCount * SkillEntryRef.Length + 6; /// /// Structure for a skill entry of the skill list.. /// public readonly ref struct SkillEntryRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SkillEntryRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets or sets the skill index. /// public byte SkillIndex { get => this._data[0]; set => this._data[0] = value; } /// /// Gets or sets the skill number. /// public ushort SkillNumber { get => ReadUInt16LittleEndian(this._data[1..]); set => WriteUInt16LittleEndian(this._data[1..], value); } /// /// Gets or sets the skill level. /// public byte SkillLevel { get => this._data[3]; set => this._data[3] = value; } } } /// /// Is sent by the server when: After a skill got added to the skill list, e.g. by equipping an item or learning a skill. /// Causes reaction on client side: The skill is added to the skill list on client side. /// public readonly ref struct SkillAdded075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SkillAdded075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private SkillAdded075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.Flag = 1; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x11; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the flag. /// public byte Flag { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the skill index. /// public byte SkillIndex { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the skill number and level. /// public ushort SkillNumberAndLevel { get => ReadUInt16BigEndian(this._data[6..]); set => WriteUInt16BigEndian(this._data[6..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator SkillAdded075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(SkillAdded075Ref packet) => packet._data; } /// /// Is sent by the server when: After a skill got removed from the skill list, e.g. by removing an equipped item. /// Causes reaction on client side: The skill is added to the skill list on client side. /// public readonly ref struct SkillRemoved075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SkillRemoved075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private SkillRemoved075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.Flag = 0; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x11; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 10; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the flag. /// public byte Flag { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the skill index. /// public byte SkillIndex { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the skill number and level. /// public ushort SkillNumberAndLevel { get => ReadUInt16BigEndian(this._data[6..]); set => WriteUInt16BigEndian(this._data[6..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator SkillRemoved075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(SkillRemoved075Ref packet) => packet._data; } /// /// Is sent by the server when: After a skill got added to the skill list, e.g. by equipping an item or learning a skill. /// Causes reaction on client side: The skill is added to the skill list on client side. /// public readonly ref struct SkillAdded095Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SkillAdded095Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private SkillAdded095Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.Flag = 0xFE; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x11; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the flag. /// public byte Flag { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the skill index. /// public byte SkillIndex { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the skill number and level. /// public ushort SkillNumberAndLevel { get => ReadUInt16BigEndian(this._data[6..]); set => WriteUInt16BigEndian(this._data[6..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator SkillAdded095Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(SkillAdded095Ref packet) => packet._data; } /// /// Is sent by the server when: After a skill got removed from the skill list, e.g. by removing an equipped item. /// Causes reaction on client side: The skill is added to the skill list on client side. /// public readonly ref struct SkillRemoved095Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SkillRemoved095Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private SkillRemoved095Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.Flag = 0xFF; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x11; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 10; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the flag. /// public byte Flag { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the skill index. /// public byte SkillIndex { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the skill number and level. /// public ushort SkillNumberAndLevel { get => ReadUInt16BigEndian(this._data[6..]); set => WriteUInt16BigEndian(this._data[6..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator SkillRemoved095Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(SkillRemoved095Ref packet) => packet._data; } /// /// Is sent by the server when: Usually, when the player entered the game with a character. When skills get added or removed, this message is sent as well, but with a misleading count. /// Causes reaction on client side: The skill list gets initialized. /// public readonly ref struct SkillListUpdate075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SkillListUpdate075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private SkillListUpdate075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x11; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets mixed usage: Skill list count (when list). 0xFE when adding a skill, 0xFF when removing a Skill. /// public byte Count { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public SkillEntryRef this[int index] => new (this._data[(5 + index * SkillEntryRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator SkillListUpdate075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(SkillListUpdate075Ref packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int skillsCount) => skillsCount * SkillEntryRef.Length + 5; /// /// Structure for a skill entry of the skill list.. /// public readonly ref struct SkillEntryRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SkillEntryRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 3; /// /// Gets or sets the skill index. /// public byte SkillIndex { get => this._data[0]; set => this._data[0] = value; } /// /// Gets or sets the skill number and level. /// public ushort SkillNumberAndLevel { get => ReadUInt16BigEndian(this._data[1..]); set => WriteUInt16BigEndian(this._data[1..], value); } } } /// /// Is sent by the server when: After the client focused the character successfully on the server side. /// Causes reaction on client side: The client highlights the focused character. /// public readonly ref struct CharacterFocusedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterFocusedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterFocusedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x15; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 15; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the character name. /// public string CharacterName { get => this._data.ExtractString(4, 10, System.Text.Encoding.UTF8); set => this._data.Slice(4, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterFocusedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterFocusedRef packet) => packet._data; } /// /// Is sent by the server when: After the server processed a character stat increase request packet. /// Causes reaction on client side: If it was successful, adds a point to the requested stat type. /// public readonly ref struct CharacterStatIncreaseResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterStatIncreaseResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterStatIncreaseResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x06; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 12; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the success. /// public bool Success { get => this._data[4..].GetBoolean(4); set => this._data[4..].SetBoolean(value, 4); } /// /// Gets or sets the attribute. /// public CharacterStatAttribute Attribute { get => (CharacterStatAttribute)this._data[4..].GetByteValue(4, 0); set => this._data[4..].SetByteValue((byte)value, 4, 0); } /// /// Gets or sets the updated dependent maximum stat. /// public ushort UpdatedDependentMaximumStat { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the updated maximum shield. /// public ushort UpdatedMaximumShield { get => ReadUInt16LittleEndian(this._data[8..]); set => WriteUInt16LittleEndian(this._data[8..], value); } /// /// Gets or sets the updated maximum ability. /// public ushort UpdatedMaximumAbility { get => ReadUInt16LittleEndian(this._data[10..]); set => WriteUInt16LittleEndian(this._data[10..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterStatIncreaseResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterStatIncreaseResponseRef packet) => packet._data; } /// /// Is sent by the server when: After the server processed a character stat increase request packet. /// Causes reaction on client side: If it was successful, adds a point to the requested stat type. /// public readonly ref struct CharacterStatIncreaseResponseExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterStatIncreaseResponseExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterStatIncreaseResponseExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x06; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 24; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the attribute. /// public CharacterStatAttribute Attribute { get => (CharacterStatAttribute)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets the added amount. /// public ushort AddedAmount { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the updated maximum health. /// public uint UpdatedMaximumHealth { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets or sets the updated maximum mana. /// public uint UpdatedMaximumMana { get => ReadUInt32LittleEndian(this._data[12..]); set => WriteUInt32LittleEndian(this._data[12..], value); } /// /// Gets or sets the updated maximum shield. /// public uint UpdatedMaximumShield { get => ReadUInt32LittleEndian(this._data[16..]); set => WriteUInt32LittleEndian(this._data[16..], value); } /// /// Gets or sets the updated maximum ability. /// public uint UpdatedMaximumAbility { get => ReadUInt32LittleEndian(this._data[20..]); set => WriteUInt32LittleEndian(this._data[20..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterStatIncreaseResponseExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterStatIncreaseResponseExtendedRef packet) => packet._data; } /// /// Is sent by the server when: After the server processed a character delete response of the client. /// Causes reaction on client side: If successful, the character is deleted from the character selection screen. Otherwise, a message is shown. /// public readonly ref struct CharacterDeleteResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterDeleteResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterDeleteResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x02; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the result. /// public CharacterDeleteResponse.CharacterDeleteResult Result { get => (CharacterDeleteResponse.CharacterDeleteResult)this._data[4]; set => this._data[4] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterDeleteResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterDeleteResponseRef packet) => packet._data; } /// /// Is sent by the server when: After a character leveled up. /// Causes reaction on client side: Updates the level (and other related stats) in the game client and shows an effect. /// public readonly ref struct CharacterLevelUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterLevelUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterLevelUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x05; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 24; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the level. /// public ushort Level { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the level up points. /// public ushort LevelUpPoints { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the maximum health. /// public ushort MaximumHealth { get => ReadUInt16LittleEndian(this._data[8..]); set => WriteUInt16LittleEndian(this._data[8..], value); } /// /// Gets or sets the maximum mana. /// public ushort MaximumMana { get => ReadUInt16LittleEndian(this._data[10..]); set => WriteUInt16LittleEndian(this._data[10..], value); } /// /// Gets or sets the maximum shield. /// public ushort MaximumShield { get => ReadUInt16LittleEndian(this._data[12..]); set => WriteUInt16LittleEndian(this._data[12..], value); } /// /// Gets or sets the maximum ability. /// public ushort MaximumAbility { get => ReadUInt16LittleEndian(this._data[14..]); set => WriteUInt16LittleEndian(this._data[14..], value); } /// /// Gets or sets the fruit points. /// public ushort FruitPoints { get => ReadUInt16LittleEndian(this._data[16..]); set => WriteUInt16LittleEndian(this._data[16..], value); } /// /// Gets or sets the maximum fruit points. /// public ushort MaximumFruitPoints { get => ReadUInt16LittleEndian(this._data[18..]); set => WriteUInt16LittleEndian(this._data[18..], value); } /// /// Gets or sets the negative fruit points. /// public ushort NegativeFruitPoints { get => ReadUInt16LittleEndian(this._data[20..]); set => WriteUInt16LittleEndian(this._data[20..], value); } /// /// Gets or sets the maximum negative fruit points. /// public ushort MaximumNegativeFruitPoints { get => ReadUInt16LittleEndian(this._data[22..]); set => WriteUInt16LittleEndian(this._data[22..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterLevelUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterLevelUpdateRef packet) => packet._data; } /// /// Is sent by the server when: After the character was selected by the player and entered the game. /// Causes reaction on client side: The characters enters the game world. /// public readonly ref struct CharacterInformationRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterInformationRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterInformationRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x03; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 72; /// /// Gets the header of this packet. /// public C3HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the x. /// public byte X { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the y. /// public byte Y { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the map id. /// public ushort MapId { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the current experience. /// public ulong CurrentExperience { get => ReadUInt64BigEndian(this._data[8..]); set => WriteUInt64BigEndian(this._data[8..], value); } /// /// Gets or sets the experience for next level. /// public ulong ExperienceForNextLevel { get => ReadUInt64BigEndian(this._data[16..]); set => WriteUInt64BigEndian(this._data[16..], value); } /// /// Gets or sets the level up points. /// public ushort LevelUpPoints { get => ReadUInt16LittleEndian(this._data[24..]); set => WriteUInt16LittleEndian(this._data[24..], value); } /// /// Gets or sets the strength. /// public ushort Strength { get => ReadUInt16LittleEndian(this._data[26..]); set => WriteUInt16LittleEndian(this._data[26..], value); } /// /// Gets or sets the agility. /// public ushort Agility { get => ReadUInt16LittleEndian(this._data[28..]); set => WriteUInt16LittleEndian(this._data[28..], value); } /// /// Gets or sets the vitality. /// public ushort Vitality { get => ReadUInt16LittleEndian(this._data[30..]); set => WriteUInt16LittleEndian(this._data[30..], value); } /// /// Gets or sets the energy. /// public ushort Energy { get => ReadUInt16LittleEndian(this._data[32..]); set => WriteUInt16LittleEndian(this._data[32..], value); } /// /// Gets or sets the current health. /// public ushort CurrentHealth { get => ReadUInt16LittleEndian(this._data[34..]); set => WriteUInt16LittleEndian(this._data[34..], value); } /// /// Gets or sets the maximum health. /// public ushort MaximumHealth { get => ReadUInt16LittleEndian(this._data[36..]); set => WriteUInt16LittleEndian(this._data[36..], value); } /// /// Gets or sets the current mana. /// public ushort CurrentMana { get => ReadUInt16LittleEndian(this._data[38..]); set => WriteUInt16LittleEndian(this._data[38..], value); } /// /// Gets or sets the maximum mana. /// public ushort MaximumMana { get => ReadUInt16LittleEndian(this._data[40..]); set => WriteUInt16LittleEndian(this._data[40..], value); } /// /// Gets or sets the current shield. /// public ushort CurrentShield { get => ReadUInt16LittleEndian(this._data[42..]); set => WriteUInt16LittleEndian(this._data[42..], value); } /// /// Gets or sets the maximum shield. /// public ushort MaximumShield { get => ReadUInt16LittleEndian(this._data[44..]); set => WriteUInt16LittleEndian(this._data[44..], value); } /// /// Gets or sets the current ability. /// public ushort CurrentAbility { get => ReadUInt16LittleEndian(this._data[46..]); set => WriteUInt16LittleEndian(this._data[46..], value); } /// /// Gets or sets the maximum ability. /// public ushort MaximumAbility { get => ReadUInt16LittleEndian(this._data[48..]); set => WriteUInt16LittleEndian(this._data[48..], value); } /// /// Gets or sets the money. /// public uint Money { get => ReadUInt32LittleEndian(this._data[52..]); set => WriteUInt32LittleEndian(this._data[52..], value); } /// /// Gets or sets the hero state. /// public CharacterHeroState HeroState { get => (CharacterHeroState)this._data[56]; set => this._data[56] = (byte)value; } /// /// Gets or sets the status. /// public CharacterStatus Status { get => (CharacterStatus)this._data[57]; set => this._data[57] = (byte)value; } /// /// Gets or sets the used fruit points. /// public ushort UsedFruitPoints { get => ReadUInt16LittleEndian(this._data[58..]); set => WriteUInt16LittleEndian(this._data[58..], value); } /// /// Gets or sets the max fruit points. /// public ushort MaxFruitPoints { get => ReadUInt16LittleEndian(this._data[60..]); set => WriteUInt16LittleEndian(this._data[60..], value); } /// /// Gets or sets the leadership. /// public ushort Leadership { get => ReadUInt16LittleEndian(this._data[62..]); set => WriteUInt16LittleEndian(this._data[62..], value); } /// /// Gets or sets the used negative fruit points. /// public ushort UsedNegativeFruitPoints { get => ReadUInt16LittleEndian(this._data[64..]); set => WriteUInt16LittleEndian(this._data[64..], value); } /// /// Gets or sets the max negative fruit points. /// public ushort MaxNegativeFruitPoints { get => ReadUInt16LittleEndian(this._data[66..]); set => WriteUInt16LittleEndian(this._data[66..], value); } /// /// Gets or sets the inventory extensions. /// public byte InventoryExtensions { get => this._data[68]; set => this._data[68] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterInformationRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterInformationRef packet) => packet._data; } /// /// Is sent by the server when: After a character leveled up. /// Causes reaction on client side: Updates the level (and other related stats) in the game client and shows an effect. /// public readonly ref struct CharacterLevelUpdateExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterLevelUpdateExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterLevelUpdateExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x05; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 32; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the level. /// public ushort Level { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the level up points. /// public ushort LevelUpPoints { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the maximum health. /// public uint MaximumHealth { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets or sets the maximum mana. /// public uint MaximumMana { get => ReadUInt32LittleEndian(this._data[12..]); set => WriteUInt32LittleEndian(this._data[12..], value); } /// /// Gets or sets the maximum shield. /// public uint MaximumShield { get => ReadUInt32LittleEndian(this._data[16..]); set => WriteUInt32LittleEndian(this._data[16..], value); } /// /// Gets or sets the maximum ability. /// public uint MaximumAbility { get => ReadUInt32LittleEndian(this._data[20..]); set => WriteUInt32LittleEndian(this._data[20..], value); } /// /// Gets or sets the fruit points. /// public ushort FruitPoints { get => ReadUInt16LittleEndian(this._data[24..]); set => WriteUInt16LittleEndian(this._data[24..], value); } /// /// Gets or sets the maximum fruit points. /// public ushort MaximumFruitPoints { get => ReadUInt16LittleEndian(this._data[26..]); set => WriteUInt16LittleEndian(this._data[26..], value); } /// /// Gets or sets the negative fruit points. /// public ushort NegativeFruitPoints { get => ReadUInt16LittleEndian(this._data[28..]); set => WriteUInt16LittleEndian(this._data[28..], value); } /// /// Gets or sets the maximum negative fruit points. /// public ushort MaximumNegativeFruitPoints { get => ReadUInt16LittleEndian(this._data[30..]); set => WriteUInt16LittleEndian(this._data[30..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterLevelUpdateExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterLevelUpdateExtendedRef packet) => packet._data; } /// /// Is sent by the server when: After the character was selected by the player and entered the game. /// Causes reaction on client side: The characters enters the game world. /// public readonly ref struct CharacterInformationExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterInformationExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterInformationExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x03; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 92; /// /// Gets the header of this packet. /// public C3HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the x. /// public byte X { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the y. /// public byte Y { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the map id. /// public ushort MapId { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the current experience. /// public ulong CurrentExperience { get => ReadUInt64BigEndian(this._data[8..]); set => WriteUInt64BigEndian(this._data[8..], value); } /// /// Gets or sets the experience for next level. /// public ulong ExperienceForNextLevel { get => ReadUInt64BigEndian(this._data[16..]); set => WriteUInt64BigEndian(this._data[16..], value); } /// /// Gets or sets the level up points. /// public ushort LevelUpPoints { get => ReadUInt16LittleEndian(this._data[24..]); set => WriteUInt16LittleEndian(this._data[24..], value); } /// /// Gets or sets the strength. /// public ushort Strength { get => ReadUInt16LittleEndian(this._data[26..]); set => WriteUInt16LittleEndian(this._data[26..], value); } /// /// Gets or sets the agility. /// public ushort Agility { get => ReadUInt16LittleEndian(this._data[28..]); set => WriteUInt16LittleEndian(this._data[28..], value); } /// /// Gets or sets the vitality. /// public ushort Vitality { get => ReadUInt16LittleEndian(this._data[30..]); set => WriteUInt16LittleEndian(this._data[30..], value); } /// /// Gets or sets the energy. /// public ushort Energy { get => ReadUInt16LittleEndian(this._data[32..]); set => WriteUInt16LittleEndian(this._data[32..], value); } /// /// Gets or sets the leadership. /// public ushort Leadership { get => ReadUInt16LittleEndian(this._data[34..]); set => WriteUInt16LittleEndian(this._data[34..], value); } /// /// Gets or sets the current health. /// public uint CurrentHealth { get => ReadUInt32LittleEndian(this._data[36..]); set => WriteUInt32LittleEndian(this._data[36..], value); } /// /// Gets or sets the maximum health. /// public uint MaximumHealth { get => ReadUInt32LittleEndian(this._data[40..]); set => WriteUInt32LittleEndian(this._data[40..], value); } /// /// Gets or sets the current mana. /// public uint CurrentMana { get => ReadUInt32LittleEndian(this._data[44..]); set => WriteUInt32LittleEndian(this._data[44..], value); } /// /// Gets or sets the maximum mana. /// public uint MaximumMana { get => ReadUInt32LittleEndian(this._data[48..]); set => WriteUInt32LittleEndian(this._data[48..], value); } /// /// Gets or sets the current shield. /// public uint CurrentShield { get => ReadUInt32LittleEndian(this._data[52..]); set => WriteUInt32LittleEndian(this._data[52..], value); } /// /// Gets or sets the maximum shield. /// public uint MaximumShield { get => ReadUInt32LittleEndian(this._data[56..]); set => WriteUInt32LittleEndian(this._data[56..], value); } /// /// Gets or sets the current ability. /// public uint CurrentAbility { get => ReadUInt32LittleEndian(this._data[60..]); set => WriteUInt32LittleEndian(this._data[60..], value); } /// /// Gets or sets the maximum ability. /// public uint MaximumAbility { get => ReadUInt32LittleEndian(this._data[64..]); set => WriteUInt32LittleEndian(this._data[64..], value); } /// /// Gets or sets the money. /// public uint Money { get => ReadUInt32LittleEndian(this._data[68..]); set => WriteUInt32LittleEndian(this._data[68..], value); } /// /// Gets or sets the hero state. /// public CharacterHeroState HeroState { get => (CharacterHeroState)this._data[72]; set => this._data[72] = (byte)value; } /// /// Gets or sets the status. /// public CharacterStatus Status { get => (CharacterStatus)this._data[73]; set => this._data[73] = (byte)value; } /// /// Gets or sets the used fruit points. /// public ushort UsedFruitPoints { get => ReadUInt16LittleEndian(this._data[74..]); set => WriteUInt16LittleEndian(this._data[74..], value); } /// /// Gets or sets the max fruit points. /// public ushort MaxFruitPoints { get => ReadUInt16LittleEndian(this._data[76..]); set => WriteUInt16LittleEndian(this._data[76..], value); } /// /// Gets or sets the used negative fruit points. /// public ushort UsedNegativeFruitPoints { get => ReadUInt16LittleEndian(this._data[78..]); set => WriteUInt16LittleEndian(this._data[78..], value); } /// /// Gets or sets the max negative fruit points. /// public ushort MaxNegativeFruitPoints { get => ReadUInt16LittleEndian(this._data[80..]); set => WriteUInt16LittleEndian(this._data[80..], value); } /// /// Gets or sets the attack speed. /// public ushort AttackSpeed { get => ReadUInt16LittleEndian(this._data[82..]); set => WriteUInt16LittleEndian(this._data[82..], value); } /// /// Gets or sets the magic speed. /// public ushort MagicSpeed { get => ReadUInt16LittleEndian(this._data[84..]); set => WriteUInt16LittleEndian(this._data[84..], value); } /// /// Gets or sets the maximum attack speed. /// public ushort MaximumAttackSpeed { get => ReadUInt16LittleEndian(this._data[86..]); set => WriteUInt16LittleEndian(this._data[86..], value); } /// /// Gets or sets the inventory extensions. /// public byte InventoryExtensions { get => this._data[88]; set => this._data[88] = value; } /// /// Gets or sets the resets. /// public ushort Resets { get => ReadUInt16LittleEndian(this._data[90..]); set => WriteUInt16LittleEndian(this._data[90..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterInformationExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterInformationExtendedRef packet) => packet._data; } /// /// Is sent by the server when: After the character was selected by the player and entered the game. /// Causes reaction on client side: The characters enters the game world. /// public readonly ref struct CharacterInformation075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterInformation075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterInformation075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x03; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 42; /// /// Gets the header of this packet. /// public C3HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the x. /// public byte X { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the y. /// public byte Y { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the map id. /// public byte MapId { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the current experience. /// public uint CurrentExperience { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets or sets the experience for next level. /// public uint ExperienceForNextLevel { get => ReadUInt32LittleEndian(this._data[12..]); set => WriteUInt32LittleEndian(this._data[12..], value); } /// /// Gets or sets the level up points. /// public ushort LevelUpPoints { get => ReadUInt16LittleEndian(this._data[16..]); set => WriteUInt16LittleEndian(this._data[16..], value); } /// /// Gets or sets the strength. /// public ushort Strength { get => ReadUInt16LittleEndian(this._data[18..]); set => WriteUInt16LittleEndian(this._data[18..], value); } /// /// Gets or sets the agility. /// public ushort Agility { get => ReadUInt16LittleEndian(this._data[20..]); set => WriteUInt16LittleEndian(this._data[20..], value); } /// /// Gets or sets the vitality. /// public ushort Vitality { get => ReadUInt16LittleEndian(this._data[22..]); set => WriteUInt16LittleEndian(this._data[22..], value); } /// /// Gets or sets the energy. /// public ushort Energy { get => ReadUInt16LittleEndian(this._data[24..]); set => WriteUInt16LittleEndian(this._data[24..], value); } /// /// Gets or sets the current health. /// public ushort CurrentHealth { get => ReadUInt16LittleEndian(this._data[26..]); set => WriteUInt16LittleEndian(this._data[26..], value); } /// /// Gets or sets the maximum health. /// public ushort MaximumHealth { get => ReadUInt16LittleEndian(this._data[28..]); set => WriteUInt16LittleEndian(this._data[28..], value); } /// /// Gets or sets the current mana. /// public ushort CurrentMana { get => ReadUInt16LittleEndian(this._data[30..]); set => WriteUInt16LittleEndian(this._data[30..], value); } /// /// Gets or sets the maximum mana. /// public ushort MaximumMana { get => ReadUInt16LittleEndian(this._data[32..]); set => WriteUInt16LittleEndian(this._data[32..], value); } /// /// Gets or sets the money. /// public uint Money { get => ReadUInt32LittleEndian(this._data[36..]); set => WriteUInt32LittleEndian(this._data[36..], value); } /// /// Gets or sets the hero state. /// public CharacterHeroState HeroState { get => (CharacterHeroState)this._data[40]; set => this._data[40] = (byte)value; } /// /// Gets or sets the status. /// public CharacterStatus Status { get => (CharacterStatus)this._data[41]; set => this._data[41] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterInformation075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterInformation075Ref packet) => packet._data; } /// /// Is sent by the server when: After the character was selected by the player and entered the game. /// Causes reaction on client side: The characters enters the game world. /// public readonly ref struct CharacterInformation097Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterInformation097Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterInformation097Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x03; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 52; /// /// Gets the header of this packet. /// public C3HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the x. /// public byte X { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the y. /// public byte Y { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the map id. /// public byte MapId { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the direction. /// public byte Direction { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the current experience. /// public uint CurrentExperience { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets or sets the experience for next level. /// public uint ExperienceForNextLevel { get => ReadUInt32LittleEndian(this._data[12..]); set => WriteUInt32LittleEndian(this._data[12..], value); } /// /// Gets or sets the level up points. /// public ushort LevelUpPoints { get => ReadUInt16LittleEndian(this._data[16..]); set => WriteUInt16LittleEndian(this._data[16..], value); } /// /// Gets or sets the strength. /// public ushort Strength { get => ReadUInt16LittleEndian(this._data[18..]); set => WriteUInt16LittleEndian(this._data[18..], value); } /// /// Gets or sets the agility. /// public ushort Agility { get => ReadUInt16LittleEndian(this._data[20..]); set => WriteUInt16LittleEndian(this._data[20..], value); } /// /// Gets or sets the vitality. /// public ushort Vitality { get => ReadUInt16LittleEndian(this._data[22..]); set => WriteUInt16LittleEndian(this._data[22..], value); } /// /// Gets or sets the energy. /// public ushort Energy { get => ReadUInt16LittleEndian(this._data[24..]); set => WriteUInt16LittleEndian(this._data[24..], value); } /// /// Gets or sets the current health. /// public ushort CurrentHealth { get => ReadUInt16LittleEndian(this._data[26..]); set => WriteUInt16LittleEndian(this._data[26..], value); } /// /// Gets or sets the maximum health. /// public ushort MaximumHealth { get => ReadUInt16LittleEndian(this._data[28..]); set => WriteUInt16LittleEndian(this._data[28..], value); } /// /// Gets or sets the current mana. /// public ushort CurrentMana { get => ReadUInt16LittleEndian(this._data[30..]); set => WriteUInt16LittleEndian(this._data[30..], value); } /// /// Gets or sets the maximum mana. /// public ushort MaximumMana { get => ReadUInt16LittleEndian(this._data[32..]); set => WriteUInt16LittleEndian(this._data[32..], value); } /// /// Gets or sets the current ability. /// public ushort CurrentAbility { get => ReadUInt16LittleEndian(this._data[34..]); set => WriteUInt16LittleEndian(this._data[34..], value); } /// /// Gets or sets the maximum ability. /// public ushort MaximumAbility { get => ReadUInt16LittleEndian(this._data[36..]); set => WriteUInt16LittleEndian(this._data[36..], value); } /// /// Gets or sets the money. /// public uint Money { get => ReadUInt32LittleEndian(this._data[40..]); set => WriteUInt32LittleEndian(this._data[40..], value); } /// /// Gets or sets the hero state. /// public CharacterHeroState HeroState { get => (CharacterHeroState)this._data[44]; set => this._data[44] = (byte)value; } /// /// Gets or sets the status. /// public CharacterStatus Status { get => (CharacterStatus)this._data[45]; set => this._data[45] = (byte)value; } /// /// Gets or sets the used fruit points. /// public ushort UsedFruitPoints { get => ReadUInt16LittleEndian(this._data[46..]); set => WriteUInt16LittleEndian(this._data[46..], value); } /// /// Gets or sets the max fruit points. /// public ushort MaxFruitPoints { get => ReadUInt16LittleEndian(this._data[48..]); set => WriteUInt16LittleEndian(this._data[48..], value); } /// /// Gets or sets the leadership. /// public ushort Leadership { get => ReadUInt16LittleEndian(this._data[50..]); set => WriteUInt16LittleEndian(this._data[50..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterInformation097Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterInformation097Ref packet) => packet._data; } /// /// Is sent by the server when: The player entered the game or finished a trade. /// Causes reaction on client side: The user interface of the inventory is initialized with all of its items. /// public readonly ref struct CharacterInventoryRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CharacterInventoryRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CharacterInventoryRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC4; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x10; /// /// Gets the header of this packet. /// public C4HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the item count. /// public byte ItemCount { get => this._data[5]; set => this._data[5] = value; } /// /// Gets the of the specified index. /// public StoredItemRef this[int index, int storedItemLength] => new (this._data[(6 + index * storedItemLength)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CharacterInventoryRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CharacterInventoryRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of and it's size. /// /// The count of from which the size will be calculated. /// The length of from which the size will be calculated. public static int GetRequiredSize(int itemsCount, int structLength) => itemsCount * structLength + 6; } /// /// Is sent by the server when: An item in the inventory got upgraded by the player, e.g. by applying a jewel. /// Causes reaction on client side: The item is updated on the user interface. /// public readonly ref struct InventoryItemUpgradedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public InventoryItemUpgradedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private InventoryItemUpgradedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x14; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the inventory slot. /// public byte InventorySlot { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the item data. /// public Span ItemData { get => this._data.Slice(5); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator InventoryItemUpgradedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(InventoryItemUpgradedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int itemDataLength) => itemDataLength + 5; } /// /// Is sent by the server when: When health of a summoned monster (Elf Skill) changed. /// Causes reaction on client side: The health is updated on the user interface. /// public readonly ref struct SummonHealthUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SummonHealthUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private SummonHealthUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x20; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the health percent. /// public byte HealthPercent { get => this._data[4]; set => this._data[4] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator SummonHealthUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(SummonHealthUpdateRef packet) => packet._data; } /// /// Is sent by the server when: Every second during a guild soccer match. /// Causes reaction on client side: The time is updated on the user interface. /// public readonly ref struct GuildSoccerTimeUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildSoccerTimeUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildSoccerTimeUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x22; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 6; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the seconds. /// public ushort Seconds { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildSoccerTimeUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildSoccerTimeUpdateRef packet) => packet._data; } /// /// Is sent by the server when: Whenever the score of the soccer game changed, and at the beginning of the match. /// Causes reaction on client side: The score is updated on the user interface. /// public readonly ref struct GuildSoccerScoreUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildSoccerScoreUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildSoccerScoreUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x23; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 22; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the red team name. /// public string RedTeamName { get => this._data.ExtractString(4, 8, System.Text.Encoding.UTF8); set => this._data.Slice(4, 8).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the red team goals. /// public byte RedTeamGoals { get => this._data[12]; set => this._data[12] = value; } /// /// Gets or sets the blue team name. /// public string BlueTeamName { get => this._data.ExtractString(13, 8, System.Text.Encoding.UTF8); set => this._data.Slice(13, 8).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the blue team goals. /// public byte BlueTeamGoals { get => this._data[21]; set => this._data[21] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildSoccerScoreUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildSoccerScoreUpdateRef packet) => packet._data; } /// /// Is sent by the server when: E.g. when event items are dropped to the floor, or a specific dialog should be shown. /// Causes reaction on client side: The client shows an effect, e.g. a firework. /// public readonly ref struct ServerCommandRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ServerCommandRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ServerCommandRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x40; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the command type. /// public byte CommandType { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the parameter 1. /// public byte Parameter1 { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the parameter 2. /// public byte Parameter2 { get => this._data[6]; set => this._data[6] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ServerCommandRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ServerCommandRef packet) => packet._data; } /// /// Is sent by the server when: E.g. when event items are dropped to the floor. /// Causes reaction on client side: The client shows an fireworks effect at the specified coordinates. /// public readonly ref struct ShowFireworksRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ShowFireworksRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ShowFireworksRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.EffectType = 0; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x40; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the effect type. /// public byte EffectType { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the x. /// public byte X { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the y. /// public byte Y { get => this._data[6]; set => this._data[6] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ShowFireworksRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ShowFireworksRef packet) => packet._data; } /// /// Is sent by the server when: E.g. when event items are dropped to the floor. /// Causes reaction on client side: The client shows an christmas fireworks effect at the specified coordinates. /// public readonly ref struct ShowChristmasFireworksRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ShowChristmasFireworksRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ShowChristmasFireworksRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.EffectType = 59; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x40; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the effect type. /// public byte EffectType { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the x. /// public byte X { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the y. /// public byte Y { get => this._data[6]; set => this._data[6] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ShowChristmasFireworksRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ShowChristmasFireworksRef packet) => packet._data; } /// /// Is sent by the server when: E.g. when event items are dropped to the floor. /// Causes reaction on client side: The client plays a fanfare sound at the specified coordinates. /// public readonly ref struct PlayFanfareSoundRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PlayFanfareSoundRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PlayFanfareSoundRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.EffectType = 2; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x40; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the effect type. /// public byte EffectType { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the x. /// public byte X { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the y. /// public byte Y { get => this._data[6]; set => this._data[6] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PlayFanfareSoundRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PlayFanfareSoundRef packet) => packet._data; } /// /// Is sent by the server when: E.g. when event items are dropped to the floor. /// Causes reaction on client side: The client shows a swirl effect at the specified object. /// public readonly ref struct ShowSwirlRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ShowSwirlRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ShowSwirlRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.EffectType = 58; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x40; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the effect type. /// public byte EffectType { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the target object id. /// public ushort TargetObjectId { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ShowSwirlRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ShowSwirlRef packet) => packet._data; } /// /// Is sent by the server when: After entering the game with a master class character. /// Causes reaction on client side: The master related data is available. /// public readonly ref struct MasterStatsUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MasterStatsUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MasterStatsUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x50; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 32; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the master level. /// public ushort MasterLevel { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the master experience. /// public ulong MasterExperience { get => ReadUInt64BigEndian(this._data[6..]); set => WriteUInt64BigEndian(this._data[6..], value); } /// /// Gets or sets the master experience of next level. /// public ulong MasterExperienceOfNextLevel { get => ReadUInt64BigEndian(this._data[14..]); set => WriteUInt64BigEndian(this._data[14..], value); } /// /// Gets or sets the master level up points. /// public ushort MasterLevelUpPoints { get => ReadUInt16LittleEndian(this._data[22..]); set => WriteUInt16LittleEndian(this._data[22..], value); } /// /// Gets or sets the maximum health. /// public ushort MaximumHealth { get => ReadUInt16LittleEndian(this._data[24..]); set => WriteUInt16LittleEndian(this._data[24..], value); } /// /// Gets or sets the maximum mana. /// public ushort MaximumMana { get => ReadUInt16LittleEndian(this._data[26..]); set => WriteUInt16LittleEndian(this._data[26..], value); } /// /// Gets or sets the maximum shield. /// public ushort MaximumShield { get => ReadUInt16LittleEndian(this._data[28..]); set => WriteUInt16LittleEndian(this._data[28..], value); } /// /// Gets or sets the maximum ability. /// public ushort MaximumAbility { get => ReadUInt16LittleEndian(this._data[30..]); set => WriteUInt16LittleEndian(this._data[30..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MasterStatsUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MasterStatsUpdateRef packet) => packet._data; } /// /// Is sent by the server when: After entering the game with a master class character. /// Causes reaction on client side: The master related data is available. /// public readonly ref struct MasterStatsUpdateExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MasterStatsUpdateExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MasterStatsUpdateExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x50; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 40; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the master level. /// public ushort MasterLevel { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the master experience. /// public ulong MasterExperience { get => ReadUInt64BigEndian(this._data[6..]); set => WriteUInt64BigEndian(this._data[6..], value); } /// /// Gets or sets the master experience of next level. /// public ulong MasterExperienceOfNextLevel { get => ReadUInt64BigEndian(this._data[14..]); set => WriteUInt64BigEndian(this._data[14..], value); } /// /// Gets or sets the master level up points. /// public ushort MasterLevelUpPoints { get => ReadUInt16LittleEndian(this._data[22..]); set => WriteUInt16LittleEndian(this._data[22..], value); } /// /// Gets or sets the maximum health. /// public uint MaximumHealth { get => ReadUInt32LittleEndian(this._data[24..]); set => WriteUInt32LittleEndian(this._data[24..], value); } /// /// Gets or sets the maximum mana. /// public uint MaximumMana { get => ReadUInt32LittleEndian(this._data[28..]); set => WriteUInt32LittleEndian(this._data[28..], value); } /// /// Gets or sets the maximum shield. /// public uint MaximumShield { get => ReadUInt32LittleEndian(this._data[32..]); set => WriteUInt32LittleEndian(this._data[32..], value); } /// /// Gets or sets the maximum ability. /// public uint MaximumAbility { get => ReadUInt32LittleEndian(this._data[36..]); set => WriteUInt32LittleEndian(this._data[36..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MasterStatsUpdateExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MasterStatsUpdateExtendedRef packet) => packet._data; } /// /// Is sent by the server when: After a master character leveled up. /// Causes reaction on client side: Updates the master level (and other related stats) in the game client and shows an effect. /// public readonly ref struct MasterCharacterLevelUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MasterCharacterLevelUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MasterCharacterLevelUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x51; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 20; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the master level. /// public ushort MasterLevel { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the gained master points. /// public ushort GainedMasterPoints { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the current master points. /// public ushort CurrentMasterPoints { get => ReadUInt16LittleEndian(this._data[8..]); set => WriteUInt16LittleEndian(this._data[8..], value); } /// /// Gets or sets the maximum master points. /// public ushort MaximumMasterPoints { get => ReadUInt16LittleEndian(this._data[10..]); set => WriteUInt16LittleEndian(this._data[10..], value); } /// /// Gets or sets the maximum health. /// public ushort MaximumHealth { get => ReadUInt16LittleEndian(this._data[12..]); set => WriteUInt16LittleEndian(this._data[12..], value); } /// /// Gets or sets the maximum mana. /// public ushort MaximumMana { get => ReadUInt16LittleEndian(this._data[14..]); set => WriteUInt16LittleEndian(this._data[14..], value); } /// /// Gets or sets the maximum shield. /// public ushort MaximumShield { get => ReadUInt16LittleEndian(this._data[16..]); set => WriteUInt16LittleEndian(this._data[16..], value); } /// /// Gets or sets the maximum ability. /// public ushort MaximumAbility { get => ReadUInt16LittleEndian(this._data[18..]); set => WriteUInt16LittleEndian(this._data[18..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MasterCharacterLevelUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MasterCharacterLevelUpdateRef packet) => packet._data; } /// /// Is sent by the server when: After a master character leveled up. /// Causes reaction on client side: Updates the master level (and other related stats) in the game client and shows an effect. /// public readonly ref struct MasterCharacterLevelUpdateExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MasterCharacterLevelUpdateExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MasterCharacterLevelUpdateExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x51; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 28; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the master level. /// public ushort MasterLevel { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the gained master points. /// public ushort GainedMasterPoints { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the current master points. /// public ushort CurrentMasterPoints { get => ReadUInt16LittleEndian(this._data[8..]); set => WriteUInt16LittleEndian(this._data[8..], value); } /// /// Gets or sets the maximum master points. /// public ushort MaximumMasterPoints { get => ReadUInt16LittleEndian(this._data[10..]); set => WriteUInt16LittleEndian(this._data[10..], value); } /// /// Gets or sets the maximum health. /// public uint MaximumHealth { get => ReadUInt32LittleEndian(this._data[12..]); set => WriteUInt32LittleEndian(this._data[12..], value); } /// /// Gets or sets the maximum mana. /// public uint MaximumMana { get => ReadUInt32LittleEndian(this._data[16..]); set => WriteUInt32LittleEndian(this._data[16..], value); } /// /// Gets or sets the maximum shield. /// public uint MaximumShield { get => ReadUInt32LittleEndian(this._data[20..]); set => WriteUInt32LittleEndian(this._data[20..], value); } /// /// Gets or sets the maximum ability. /// public uint MaximumAbility { get => ReadUInt32LittleEndian(this._data[24..]); set => WriteUInt32LittleEndian(this._data[24..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MasterCharacterLevelUpdateExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MasterCharacterLevelUpdateExtendedRef packet) => packet._data; } /// /// Is sent by the server when: After a master skill level has been changed (usually increased). /// Causes reaction on client side: The level is updated in the master skill tree. /// public readonly ref struct MasterSkillLevelUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MasterSkillLevelUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MasterSkillLevelUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x52; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 28; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the success. /// public bool Success { get => this._data[4..].GetBoolean(); set => this._data[4..].SetBoolean(value); } /// /// Gets or sets the master level up points. /// public ushort MasterLevelUpPoints { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the index of the master skill on the clients master skill tree for the given character class. /// public byte MasterSkillIndex { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the master skill number. /// public ushort MasterSkillNumber { get => ReadUInt16LittleEndian(this._data[12..]); set => WriteUInt16LittleEndian(this._data[12..], value); } /// /// Gets or sets the level. /// public byte Level { get => this._data[16]; set => this._data[16] = value; } /// /// Gets or sets the display value. /// public float DisplayValue { get => ReadSingleLittleEndian(this._data[20..]); set => WriteSingleLittleEndian(this._data[20..], value); } /// /// Gets or sets the display value of next level. /// public float DisplayValueOfNextLevel { get => ReadSingleLittleEndian(this._data[24..]); set => WriteSingleLittleEndian(this._data[24..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MasterSkillLevelUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MasterSkillLevelUpdateRef packet) => packet._data; } /// /// Is sent by the server when: Usually after entering the game with a master character. /// Causes reaction on client side: The data is available in the master skill tree. /// public readonly ref struct MasterSkillListRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MasterSkillListRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MasterSkillListRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x53; /// /// Gets the header of this packet. /// public C2HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the master skill count. /// public uint MasterSkillCount { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets the of the specified index. /// public MasterSkillEntryRef this[int index] => new (this._data[(12 + index * MasterSkillEntryRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MasterSkillListRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MasterSkillListRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int skillsCount) => skillsCount * MasterSkillEntryRef.Length + 12; /// /// An entry in the master skill list.. /// public readonly ref struct MasterSkillEntryRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MasterSkillEntryRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 12; /// /// Gets or sets the index of the master skill on the clients master skill tree for the given character class. /// public byte MasterSkillIndex { get => this._data[0]; set => this._data[0] = value; } /// /// Gets or sets the level. /// public byte Level { get => this._data[1]; set => this._data[1] = value; } /// /// Gets or sets the display value. /// public float DisplayValue { get => ReadSingleLittleEndian(this._data[4..]); set => WriteSingleLittleEndian(this._data[4..], value); } /// /// Gets or sets the display value of next level. /// public float DisplayValueOfNextLevel { get => ReadSingleLittleEndian(this._data[8..]); set => WriteSingleLittleEndian(this._data[8..], value); } } } /// /// Is sent by the server when: /// Causes reaction on client side: /// public readonly ref struct ServerMessageRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ServerMessageRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ServerMessageRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x0D; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the type. /// public ServerMessage.MessageType Type { get => (ServerMessage.MessageType)this._data[3]; set => this._data[3] = (byte)value; } /// /// Gets or sets the message. /// public string Message { get => this._data.ExtractString(4, this._data.Length - 4, System.Text.Encoding.UTF8); set => this._data.Slice(4).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ServerMessageRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ServerMessageRef packet) => packet._data; /// /// Calculates the size of the packet for the specified field content. /// /// The content of the variable 'Message' field from which the size will be calculated. public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 4; /// /// Calculates the size of the packet for the specified field content. /// /// The content length in bytes of the variable 'Message' field from which the size will be calculated. public static int GetRequiredSize(int contentLength) => contentLength + 1 + 4; } /// /// Is sent by the server when: A player requested to join a guild. This message is sent then to the guild master. /// Causes reaction on client side: The guild master gets a message box with the request popping up. /// public readonly ref struct GuildJoinRequestRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildJoinRequestRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildJoinRequestRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x50; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the requester id. /// public ushort RequesterId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildJoinRequestRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildJoinRequestRef packet) => packet._data; } /// /// Is sent by the server when: After a guild master responded to a request of a player to join his guild. This message is sent back to the requesting player. /// Causes reaction on client side: The requester gets a corresponding message showing. /// public readonly ref struct GuildJoinResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildJoinResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildJoinResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x51; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the result. /// public GuildJoinResponse.GuildJoinRequestResult Result { get => (GuildJoinResponse.GuildJoinRequestResult)this._data[3]; set => this._data[3] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildJoinResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildJoinResponseRef packet) => packet._data; } /// /// Is sent by the server when: After a game client requested the list of players of his guild, which is usually the case when the player opens the guild dialog at the game client. /// Causes reaction on client side: The list of player is available at the client. /// public readonly ref struct GuildListRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildListRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildListRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x52; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the is in guild. /// public bool IsInGuild { get => this._data[4..].GetBoolean(); set => this._data[4..].SetBoolean(value); } /// /// Gets or sets the guild member count. /// public byte GuildMemberCount { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the total score. /// public uint TotalScore { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets or sets the current score. /// public byte CurrentScore { get => this._data[12]; set => this._data[12] = value; } /// /// Gets or sets the rival guild name. /// public string RivalGuildName { get => this._data.ExtractString(13, 8, System.Text.Encoding.UTF8); set => this._data.Slice(13, 8).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets the of the specified index. /// public GuildMemberRef this[int index] => new (this._data[(24 + index * GuildMemberRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildListRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildListRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int membersCount) => membersCount * GuildMemberRef.Length + 24; /// /// Contains the data of one guild member.. /// public readonly ref struct GuildMemberRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildMemberRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 13; /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(0, 10, System.Text.Encoding.UTF8); set => this._data.Slice(0, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the server id. /// public byte ServerId { get => this._data[10]; set => this._data[10] = value; } /// /// Gets or sets the server id 2. /// public byte ServerId2 { get => this._data[11]; set => this._data[11] = value; } /// /// Gets or sets the role. /// public GuildMemberRole Role { get => (GuildMemberRole)this._data[12]; set => this._data[12] = (byte)value; } } } /// /// Is sent by the server when: After a game client requested the list of players of his guild, which is usually the case when the player opens the guild dialog at the game client. /// Causes reaction on client side: The list of player is available at the client. /// public readonly ref struct GuildList075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildList075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildList075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x52; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the is in guild. /// public bool IsInGuild { get => this._data[4..].GetBoolean(); set => this._data[4..].SetBoolean(value); } /// /// Gets or sets the guild member count. /// public byte GuildMemberCount { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the total score. /// public uint TotalScore { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets or sets the current score. /// public byte CurrentScore { get => this._data[12]; set => this._data[12] = value; } /// /// Gets the of the specified index. /// public GuildMemberRef this[int index] => new (this._data[(13 + index * GuildMemberRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildList075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildList075Ref packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int membersCount) => membersCount * GuildMemberRef.Length + 13; /// /// Contains the data of one guild member.. /// public readonly ref struct GuildMemberRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildMemberRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 12; /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(0, 10, System.Text.Encoding.UTF8); set => this._data.Slice(0, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the server id. /// public byte ServerId { get => this._data[10]; set => this._data[10] = value; } /// /// Gets or sets the server id 2. /// public byte ServerId2 { get => this._data[11]; set => this._data[11] = value; } } } /// /// Is sent by the server when: After a guild master sent a request to kick a player from its guild and the server processed this request. /// Causes reaction on client side: The client shows a message depending on the result. /// public readonly ref struct GuildKickResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildKickResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildKickResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x53; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the result. /// public GuildKickResponse.GuildKickSuccess Result { get => (GuildKickResponse.GuildKickSuccess)this._data[3]; set => this._data[3] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildKickResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildKickResponseRef packet) => packet._data; } /// /// Is sent by the server when: After a player started talking to the guild master NPC and the player is allowed to create a guild. /// Causes reaction on client side: The client shows the guild master dialog. /// public readonly ref struct ShowGuildMasterDialogRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ShowGuildMasterDialogRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ShowGuildMasterDialogRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x54; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 3; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ShowGuildMasterDialogRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ShowGuildMasterDialogRef packet) => packet._data; } /// /// Is sent by the server when: After a player started talking to the guild master NPC and the player proceeds to create a guild. /// Causes reaction on client side: The client shows the guild creation dialog. /// public readonly ref struct ShowGuildCreationDialogRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ShowGuildCreationDialogRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ShowGuildCreationDialogRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x55; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 3; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ShowGuildCreationDialogRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ShowGuildCreationDialogRef packet) => packet._data; } /// /// Is sent by the server when: After a player requested to create a guild at the guild master NPC. /// Causes reaction on client side: Depending on the result, a message is shown. /// public readonly ref struct GuildCreationResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildCreationResultRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildCreationResultRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x56; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the success. /// public bool Success { get => this._data[3..].GetBoolean(); set => this._data[3..].SetBoolean(value); } /// /// Gets or sets the error. /// public GuildCreationResult.GuildCreationErrorType Error { get => (GuildCreationResult.GuildCreationErrorType)this._data[4]; set => this._data[4] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildCreationResultRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildCreationResultRef packet) => packet._data; } /// /// Is sent by the server when: A player left a guild. This message is sent to the player and all surrounding players. /// Causes reaction on client side: The player is not longer shown as a guild member. /// public readonly ref struct GuildMemberLeftGuildRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildMemberLeftGuildRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildMemberLeftGuildRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x5D; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the is guild master. /// public bool IsGuildMaster { get => this._data[3..].GetBoolean(7); set => this._data[3..].SetBoolean(value, 7); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildMemberLeftGuildRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildMemberLeftGuildRef packet) => packet._data; } /// /// Is sent by the server when: A guild master requested a guild war against another guild. /// Causes reaction on client side: The guild master of the other guild gets this request. /// public readonly ref struct GuildWarRequestResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildWarRequestResultRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildWarRequestResultRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x60; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the result. /// public GuildWarRequestResult.RequestResult Result { get => (GuildWarRequestResult.RequestResult)this._data[3]; set => this._data[3] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildWarRequestResultRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildWarRequestResultRef packet) => packet._data; } /// /// Is sent by the server when: A guild master requested a guild war against another guild. /// Causes reaction on client side: The guild master of the other guild gets this request. /// public readonly ref struct GuildWarRequestRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildWarRequestRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildWarRequestRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x61; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 12; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the guild name. /// public string GuildName { get => this._data.ExtractString(3, 8, System.Text.Encoding.UTF8); set => this._data.Slice(3, 8).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the type. /// public GuildWarType Type { get => (GuildWarType)this._data[11]; set => this._data[11] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildWarRequestRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildWarRequestRef packet) => packet._data; } /// /// Is sent by the server when: A guild master requested a guild war against another guild. /// Causes reaction on client side: The guild master of the other guild gets this request. /// public readonly ref struct GuildWarDeclaredRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildWarDeclaredRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildWarDeclaredRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x62; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 13; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the guild name. /// public string GuildName { get => this._data.ExtractString(3, 8, System.Text.Encoding.UTF8); set => this._data.Slice(3, 8).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the type. /// public GuildWarType Type { get => (GuildWarType)this._data[11]; set => this._data[11] = (byte)value; } /// /// Gets or sets the team code. /// public byte TeamCode { get => this._data[12]; set => this._data[12] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildWarDeclaredRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildWarDeclaredRef packet) => packet._data; } /// /// Is sent by the server when: The guild war ended. /// Causes reaction on client side: The guild war is shown as ended on the client side. /// public readonly ref struct GuildWarEndedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildWarEndedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildWarEndedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x63; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 12; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the result. /// public GuildWarEnded.GuildWarResult Result { get => (GuildWarEnded.GuildWarResult)this._data[3]; set => this._data[3] = (byte)value; } /// /// Gets or sets the guild name. /// public string GuildName { get => this._data.ExtractString(4, 8, System.Text.Encoding.UTF8); set => this._data.Slice(4, 8).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildWarEndedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildWarEndedRef packet) => packet._data; } /// /// Is sent by the server when: The guild war score changed. /// Causes reaction on client side: The guild score is updated on the client side. /// public readonly ref struct GuildWarScoreUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildWarScoreUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildWarScoreUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); this.Type = 0; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x64; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 6; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the score of own guild. /// public byte ScoreOfOwnGuild { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the score of enemy guild. /// public byte ScoreOfEnemyGuild { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the type. /// public byte Type { get => this._data[5]; set => this._data[5] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildWarScoreUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildWarScoreUpdateRef packet) => packet._data; } /// /// Is sent by the server when: A guild master sent a relationship change request (alliance or hostility) and the server forwards this request to the target guild master. /// Causes reaction on client side: The target guild master (receiver of this message) sees the incoming request dialog. /// public readonly ref struct GuildRelationshipRequestRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildRelationshipRequestRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildRelationshipRequestRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xE5; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the relationship type. /// public GuildRelationshipType RelationshipType { get => (GuildRelationshipType)this._data[3]; set => this._data[3] = (byte)value; } /// /// Gets or sets the request type. /// public GuildRelationshipRequestType RequestType { get => (GuildRelationshipRequestType)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets the sender id. /// public ushort SenderId { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildRelationshipRequestRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildRelationshipRequestRef packet) => packet._data; } /// /// Is sent by the server when: The result of a guild relationship change request (alliance or hostility) is sent back to the requester. /// Causes reaction on client side: The requester sees the result of the relationship change. /// public readonly ref struct GuildRelationshipChangeResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildRelationshipChangeResultRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildRelationshipChangeResultRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xE6; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the relationship type. /// public GuildRelationshipType RelationshipType { get => (GuildRelationshipType)this._data[3]; set => this._data[3] = (byte)value; } /// /// Gets or sets the request type. /// public GuildRelationshipRequestType RequestType { get => (GuildRelationshipRequestType)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets the result. /// public GuildRelationshipChangeResult.GuildRelationshipChangeResultType Result { get => (GuildRelationshipChangeResult.GuildRelationshipChangeResultType)this._data[5]; set => this._data[5] = (byte)value; } /// /// Gets or sets the guild master id. /// public ushort GuildMasterId { get => ReadUInt16BigEndian(this._data[6..]); set => WriteUInt16BigEndian(this._data[6..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildRelationshipChangeResultRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildRelationshipChangeResultRef packet) => packet._data; } /// /// Is sent by the server when: A player requested the alliance list dialog. /// Causes reaction on client side: The client shows the list of guilds in the alliance. /// public readonly ref struct AllianceListRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AllianceListRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AllianceListRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xE9; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the guild count. /// public byte GuildCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the success. /// public bool Success { get => this._data[5..].GetBoolean(); set => this._data[5..].SetBoolean(value); } /// /// Gets or sets the__ rival count. /// public byte __RivalCount { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the__ union count. /// public byte __UnionCount { get => this._data[7]; set => this._data[7] = value; } /// /// Gets the of the specified index. /// public AllianceGuildEntryRef this[int index] => new (this._data[(8 + index * AllianceGuildEntryRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AllianceListRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AllianceListRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int guildsCount) => guildsCount * AllianceGuildEntryRef.Length + 8; /// /// Contains the data of one alliance guild entry.. /// public readonly ref struct AllianceGuildEntryRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AllianceGuildEntryRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 41; /// /// Gets or sets the member count. /// public byte MemberCount { get => this._data[0]; set => this._data[0] = value; } /// /// Gets or sets the logo. /// public Span Logo { get => this._data.Slice(1, 32); } /// /// Gets or sets the guild name. /// public string GuildName { get => this._data.ExtractString(33, 8, System.Text.Encoding.UTF8); set => this._data.Slice(33, 8).WriteString(value, System.Text.Encoding.UTF8); } } } /// /// Is sent by the server when: A guild master sent a message to kick the guild from the alliance and it has been processed. /// Causes reaction on client side: The list of guilds is updated accordingly. /// public readonly ref struct RemoveAllianceGuildResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RemoveAllianceGuildResultRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private RemoveAllianceGuildResultRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xEB; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x01; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the result. /// public bool Result { get => this._data[4..].GetBoolean(); set => this._data[4..].SetBoolean(value); } /// /// Gets or sets the request type. /// public GuildRelationshipRequestType RequestType { get => (GuildRelationshipRequestType)this._data[5]; set => this._data[5] = (byte)value; } /// /// Gets or sets the relationship type. /// public GuildRelationshipType RelationshipType { get => (GuildRelationshipType)this._data[6]; set => this._data[6] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator RemoveAllianceGuildResultRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(RemoveAllianceGuildResultRef packet) => packet._data; } /// /// Is sent by the server when: The server wants to visibly assign a player to a guild, e.g. when two players met each other and one of them is a guild member. /// Causes reaction on client side: The players which belong to the guild are shown as guild players. If the game client doesn't met a player of this guild yet, it will send another request to get the guild information. /// public readonly ref struct AssignCharacterToGuildRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AssignCharacterToGuildRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AssignCharacterToGuildRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x65; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the player count. /// public byte PlayerCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public GuildMemberRelationRef this[int index] => new (this._data[(5 + index * GuildMemberRelationRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AssignCharacterToGuildRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AssignCharacterToGuildRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int membersCount) => membersCount * GuildMemberRelationRef.Length + 5; /// /// Relation between a guild and a member.. /// public readonly ref struct GuildMemberRelationRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildMemberRelationRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 12; /// /// Gets or sets the guild id. /// public uint GuildId { get => ReadUInt32LittleEndian(this._data); set => WriteUInt32LittleEndian(this._data, value); } /// /// Gets or sets the role. /// public GuildMemberRole Role { get => (GuildMemberRole)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets the is player appearing new. /// public bool IsPlayerAppearingNew { get => this._data[7..].GetBoolean(7); set => this._data[7..].SetBoolean(value, 7); } /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[7..]); set => WriteUInt16BigEndian(this._data[7..], value); } } } /// /// Is sent by the server when: The server wants to visibly assign a player to a guild, e.g. when two players met each other and one of them is a guild member. /// Causes reaction on client side: The players which belong to the guild are shown as guild players. If the game client doesn't met a player of this guild yet, it will send another request to get the guild information. /// public readonly ref struct AssignCharacterToGuild075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AssignCharacterToGuild075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AssignCharacterToGuild075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x5B; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the player count. /// public byte PlayerCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public GuildMemberRelationRef this[int index] => new (this._data[(5 + index * GuildMemberRelationRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AssignCharacterToGuild075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AssignCharacterToGuild075Ref packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int membersCount) => membersCount * GuildMemberRelationRef.Length + 5; /// /// Relation between a guild and a member.. /// public readonly ref struct GuildMemberRelationRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildMemberRelationRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets the guild id. /// public ushort GuildId { get => ReadUInt16BigEndian(this._data[2..]); set => WriteUInt16BigEndian(this._data[2..], value); } } } /// /// Is sent by the server when: A game client requested the (public) info of a guild, e.g. when it met a player of previously unknown guild. /// Causes reaction on client side: The players which belong to the guild are shown as guild players. /// public readonly ref struct GuildInformationRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildInformationRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildInformationRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x66; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 60; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the guild id. /// public uint GuildId { get => ReadUInt32LittleEndian(this._data[4..]); set => WriteUInt32LittleEndian(this._data[4..], value); } /// /// Gets or sets the guild type. /// public byte GuildType { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the alliance guild name. /// public string AllianceGuildName { get => this._data.ExtractString(9, 8, System.Text.Encoding.UTF8); set => this._data.Slice(9, 8).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the guild name. /// public string GuildName { get => this._data.ExtractString(17, 8, System.Text.Encoding.UTF8); set => this._data.Slice(17, 8).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the logo. /// public Span Logo { get => this._data.Slice(25, 32); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildInformationRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildInformationRef packet) => packet._data; } /// /// Is sent by the server when: A player went into the scope of one or more guild members. /// Causes reaction on client side: The players which belong to the guild are shown as guild players. /// public readonly ref struct GuildInformations075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildInformations075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private GuildInformations075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x5A; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the guild count. /// public byte GuildCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public GuildInfoRef this[int index] => new (this._data[(5 + index * GuildInfoRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator GuildInformations075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(GuildInformations075Ref packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int guildsCount) => guildsCount * GuildInfoRef.Length + 5; /// /// Information about one guild.. /// public readonly ref struct GuildInfoRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public GuildInfoRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 42; /// /// Gets or sets the guild id. /// public ushort GuildId { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets the guild name. /// public string GuildName { get => this._data.ExtractString(2, 8, System.Text.Encoding.UTF8); set => this._data.Slice(2, 8).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the logo. /// public Span Logo { get => this._data.Slice(10, 32); } } } /// /// Is sent by the server when: After a guild has been created. However, in OpenMU, we just send the GuildInformations075 message, because it works just the same. /// Causes reaction on client side: The players which belong to the guild are shown as guild players. /// public readonly ref struct SingleGuildInformation075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SingleGuildInformation075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private SingleGuildInformation075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x5C; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 45; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the guild id. /// public ushort GuildId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the guild name. /// public string GuildName { get => this._data.ExtractString(5, 8, System.Text.Encoding.UTF8); set => this._data.Slice(5, 8).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the logo. /// public Span Logo { get => this._data.Slice(13, 32); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator SingleGuildInformation075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(SingleGuildInformation075Ref packet) => packet._data; } /// /// Is sent by the server when: After the player requested to move money between the vault and inventory. /// Causes reaction on client side: The game client updates the money values of vault and inventory. /// public readonly ref struct VaultMoneyUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public VaultMoneyUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private VaultMoneyUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x81; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 12; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the success. /// public bool Success { get => this._data[3..].GetBoolean(); set => this._data[3..].SetBoolean(value); } /// /// Gets or sets the vault money. /// public uint VaultMoney { get => ReadUInt32LittleEndian(this._data[4..]); set => WriteUInt32LittleEndian(this._data[4..], value); } /// /// Gets or sets the inventory money. /// public uint InventoryMoney { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator VaultMoneyUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(VaultMoneyUpdateRef packet) => packet._data; } /// /// Is sent by the server when: After the player requested to close the vault, this confirmation is sent back to the client. /// Causes reaction on client side: The game client closes the vault dialog. /// public readonly ref struct VaultClosedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public VaultClosedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private VaultClosedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x82; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 3; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator VaultClosedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(VaultClosedRef packet) => packet._data; } /// /// Is sent by the server when: After the player requested to open the vault. /// Causes reaction on client side: The game client updates the UI to show the current vault protection state. /// public readonly ref struct VaultProtectionInformationRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public VaultProtectionInformationRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private VaultProtectionInformationRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x83; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the protection state. /// public VaultProtectionInformation.VaultProtectionState ProtectionState { get => (VaultProtectionInformation.VaultProtectionState)this._data[3]; set => this._data[3] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator VaultProtectionInformationRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(VaultProtectionInformationRef packet) => packet._data; } /// /// Is sent by the server when: After the player requested to execute an item crafting, e.g. at the chaos machine. /// Causes reaction on client side: The game client updates the UI to show the resulting item. /// public readonly ref struct ItemCraftingResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ItemCraftingResultRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ItemCraftingResultRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x86; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the result. /// public ItemCraftingResult.CraftingResult Result { get => (ItemCraftingResult.CraftingResult)this._data[3]; set => this._data[3] = (byte)value; } /// /// Gets or sets the item data. /// public Span ItemData { get => this._data.Slice(4); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ItemCraftingResultRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ItemCraftingResultRef packet) => packet._data; /// /// Calculates the size of the packet for the specified length of . /// /// The length in bytes of on which the required size depends. public static int GetRequiredSize(int itemDataLength) => itemDataLength + 4; } /// /// Is sent by the server when: After the player requested to close the crafting dialog, this confirmation is sent back to the client. /// Causes reaction on client side: The game client closes the crafting dialog. /// public readonly ref struct CraftingDialogClosed075Ref { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public CraftingDialogClosed075Ref(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private CraftingDialogClosed075Ref(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x87; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 3; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator CraftingDialogClosed075Ref(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(CraftingDialogClosed075Ref packet) => packet._data; } /// /// Is sent by the server when: After the player entered the game with his character. /// Causes reaction on client side: The game client updates the quest state for the quest dialog accordingly. /// public readonly ref partial struct LegacyQuestStateListRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LegacyQuestStateListRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private LegacyQuestStateListRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; this.QuestCount = 6; this.ScrollOfEmperorState = LegacyQuestState.Inactive; this.ThreeTreasuresOfMuState = LegacyQuestState.Inactive; this.GainHeroStatusState = LegacyQuestState.Inactive; this.SecretOfDarkStoneState = LegacyQuestState.Inactive; this.CertificateOfStrengthState = LegacyQuestState.Inactive; this.InfiltrationOfBarrackState = LegacyQuestState.Inactive; this.InfiltrationOfRefugeState = LegacyQuestState.Inactive; this.UnusedQuestState = LegacyQuestState.Undefined; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xA0; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the quest count. /// public byte QuestCount { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the scroll of emperor state. /// public LegacyQuestState ScrollOfEmperorState { get => (LegacyQuestState)this._data[4..].GetByteValue(2, 0); set => this._data[4..].SetByteValue((byte)value, 2, 0); } /// /// Gets or sets the three treasures of mu state. /// public LegacyQuestState ThreeTreasuresOfMuState { get => (LegacyQuestState)this._data[4..].GetByteValue(2, 2); set => this._data[4..].SetByteValue((byte)value, 2, 2); } /// /// Gets or sets the gain hero status state. /// public LegacyQuestState GainHeroStatusState { get => (LegacyQuestState)this._data[4..].GetByteValue(2, 4); set => this._data[4..].SetByteValue((byte)value, 2, 4); } /// /// Gets or sets the secret of dark stone state. /// public LegacyQuestState SecretOfDarkStoneState { get => (LegacyQuestState)this._data[4..].GetByteValue(2, 6); set => this._data[4..].SetByteValue((byte)value, 2, 6); } /// /// Gets or sets the certificate of strength state. /// public LegacyQuestState CertificateOfStrengthState { get => (LegacyQuestState)this._data[5..].GetByteValue(2, 0); set => this._data[5..].SetByteValue((byte)value, 2, 0); } /// /// Gets or sets the infiltration of barrack state. /// public LegacyQuestState InfiltrationOfBarrackState { get => (LegacyQuestState)this._data[5..].GetByteValue(2, 2); set => this._data[5..].SetByteValue((byte)value, 2, 2); } /// /// Gets or sets the infiltration of refuge state. /// public LegacyQuestState InfiltrationOfRefugeState { get => (LegacyQuestState)this._data[5..].GetByteValue(2, 4); set => this._data[5..].SetByteValue((byte)value, 2, 4); } /// /// Gets or sets the unused quest state. /// public LegacyQuestState UnusedQuestState { get => (LegacyQuestState)this._data[5..].GetByteValue(2, 6); set => this._data[5..].SetByteValue((byte)value, 2, 6); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator LegacyQuestStateListRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(LegacyQuestStateListRef packet) => packet._data; } /// /// Is sent by the server when: When the player clicks on the quest npc. /// Causes reaction on client side: The game client shows the next steps in the quest dialog. /// public readonly ref struct LegacyQuestStateDialogRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LegacyQuestStateDialogRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private LegacyQuestStateDialogRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xA1; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the quest index. /// public byte QuestIndex { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets this is the complete byte with the state of four quests within the same byte. /// public byte State { get => this._data[4]; set => this._data[4] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator LegacyQuestStateDialogRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(LegacyQuestStateDialogRef packet) => packet._data; } /// /// Is sent by the server when: As response to the set state request (C1A2). /// Causes reaction on client side: The game client shows the new quest state. /// public readonly ref struct LegacySetQuestStateResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LegacySetQuestStateResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private LegacySetQuestStateResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xA2; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 6; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the quest index. /// public byte QuestIndex { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets this value is 0 if successful. Otherwise, 0xFF or even other magic values. /// public byte Result { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets this is the complete byte with the state of four quests within the same byte. /// public byte NewState { get => this._data[5]; set => this._data[5] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator LegacySetQuestStateResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(LegacySetQuestStateResponseRef packet) => packet._data; } /// /// Is sent by the server when: As response to the completed quest of a player in scope. /// Causes reaction on client side: The game client shows the reward accordingly. /// public readonly ref struct LegacyQuestRewardRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LegacyQuestRewardRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private LegacyQuestRewardRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xA3; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data[3..]); set => WriteUInt16BigEndian(this._data[3..], value); } /// /// Gets or sets the reward. /// public LegacyQuestReward.QuestRewardType Reward { get => (LegacyQuestReward.QuestRewardType)this._data[5]; set => this._data[5] = (byte)value; } /// /// Gets or sets the count. /// public byte Count { get => this._data[6]; set => this._data[6] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator LegacyQuestRewardRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(LegacyQuestRewardRef packet) => packet._data; } /// /// Is sent by the server when: As response when a player opens the quest npc with a running quest which requires monster kills. /// Causes reaction on client side: The game client shows the current state. /// public readonly ref struct LegacyQuestMonsterKillInfoRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LegacyQuestMonsterKillInfoRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private LegacyQuestMonsterKillInfoRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.Result = 1; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xA4; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x00; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 48; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the result. /// public byte Result { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the quest index. /// public byte QuestIndex { get => this._data[5]; set => this._data[5] = value; } /// /// Gets the of the specified index. /// public MonsterKillInfoRef this[int index] => new (this._data[(8 + index * MonsterKillInfoRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator LegacyQuestMonsterKillInfoRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(LegacyQuestMonsterKillInfoRef packet) => packet._data; /// /// A pair of Monster number and the current kill count.. /// public readonly ref struct MonsterKillInfoRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MonsterKillInfoRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets or sets the monster number. /// public uint MonsterNumber { get => ReadUInt32LittleEndian(this._data); set => WriteUInt32LittleEndian(this._data, value); } /// /// Gets or sets the kill count. /// public uint KillCount { get => ReadUInt32LittleEndian(this._data[4..]); set => WriteUInt32LittleEndian(this._data[4..], value); } } } /// /// Is sent by the server when: After the client sent a PetAttackCommand (as confirmation), or when the previous command finished and the pet is reset to Normal-mode. /// Causes reaction on client side: The client updates the pet mode in its user interface. /// public readonly ref struct PetModeRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PetModeRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PetModeRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); this.Pet = ClientToServer.PetType.DarkRaven; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xA7; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the pet. /// public ClientToServer.PetType Pet { get => (ClientToServer.PetType)this._data[3]; set => this._data[3] = (byte)value; } /// /// Gets or sets the pet command mode. /// public ClientToServer.PetCommandMode PetCommandMode { get => (ClientToServer.PetCommandMode)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PetModeRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PetModeRef packet) => packet._data; } /// /// Is sent by the server when: After the client sent a PetAttackCommand, the pet attacks automatically. For each attack, the player and all observing players get this message. /// Causes reaction on client side: The client shows the pet attacking the target. /// public readonly ref struct PetAttackRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PetAttackRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PetAttackRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); this.Pet = ClientToServer.PetType.DarkRaven; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xA8; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 9; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the pet. /// public ClientToServer.PetType Pet { get => (ClientToServer.PetType)this._data[3]; set => this._data[3] = (byte)value; } /// /// Gets or sets the skill type. /// public PetAttack.PetSkillType SkillType { get => (PetAttack.PetSkillType)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets the owner id. /// public ushort OwnerId { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16BigEndian(this._data[7..]); set => WriteUInt16BigEndian(this._data[7..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PetAttackRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PetAttackRef packet) => packet._data; } /// /// Is sent by the server when: After the client sent a PetInfoRequest for a pet (dark raven, horse). /// Causes reaction on client side: The client shows the information about the pet. /// public readonly ref struct PetInfoResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PetInfoResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private PetInfoResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xA9; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 13; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the pet. /// public ClientToServer.PetType Pet { get => (ClientToServer.PetType)this._data[3]; set => this._data[3] = (byte)value; } /// /// Gets or sets the storage. /// public ClientToServer.StorageType Storage { get => (ClientToServer.StorageType)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets the item slot. /// public byte ItemSlot { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the level. /// public byte Level { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the experience. /// public uint Experience { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets or sets the health. /// public byte Health { get => this._data[12]; set => this._data[12] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator PetInfoResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(PetInfoResponseRef packet) => packet._data; } /// /// Is sent by the server when: After the client sent a DuelStartRequest, and it either failed or the requested player sent a response. /// Causes reaction on client side: The client shows the started or aborted duel. /// public readonly ref struct DuelStartResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelStartResultRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private DuelStartResultRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xAA; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x01; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 17; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the result. /// public DuelStartResult.DuelStartResultType Result { get => (DuelStartResult.DuelStartResultType)this._data[4]; set => this._data[4] = (byte)value; } /// /// Gets or sets the opponent id. /// public ushort OpponentId { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Gets or sets the opponent name. /// public string OpponentName { get => this._data.ExtractString(7, 10, System.Text.Encoding.UTF8); set => this._data.Slice(7, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator DuelStartResultRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(DuelStartResultRef packet) => packet._data; } /// /// Is sent by the server when: After another client sent a DuelStartRequest, to ask the requested player for a response. /// Causes reaction on client side: The client shows the duel request. /// public readonly ref struct DuelStartRequestRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelStartRequestRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private DuelStartRequestRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xAA; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x02; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 16; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the requester id. /// public ushort RequesterId { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the requester name. /// public string RequesterName { get => this._data.ExtractString(6, 10, System.Text.Encoding.UTF8); set => this._data.Slice(6, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator DuelStartRequestRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(DuelStartRequestRef packet) => packet._data; } /// /// Is sent by the server when: After a duel ended. /// Causes reaction on client side: The client updates its state. /// public readonly ref struct DuelEndRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelEndRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private DuelEndRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.Result = 0; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xAA; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x03; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 17; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the result. /// public byte Result { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the opponent id. /// public ushort OpponentId { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Gets or sets the opponent name. /// public string OpponentName { get => this._data.ExtractString(7, 10, System.Text.Encoding.UTF8); set => this._data.Slice(7, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator DuelEndRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(DuelEndRef packet) => packet._data; } /// /// Is sent by the server when: When the score of the duel has been changed. /// Causes reaction on client side: The client updates the displayed duel score. /// public readonly ref struct DuelScoreRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelScoreRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private DuelScoreRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xAA; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x04; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 10; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the player 1 id. /// public ushort Player1Id { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the player 2 id. /// public ushort Player2Id { get => ReadUInt16BigEndian(this._data[6..]); set => WriteUInt16BigEndian(this._data[6..], value); } /// /// Gets or sets the player 1 score. /// public byte Player1Score { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the player 2 score. /// public byte Player2Score { get => this._data[9]; set => this._data[9] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator DuelScoreRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(DuelScoreRef packet) => packet._data; } /// /// Is sent by the server when: When the health/shield of the duel players has been changed. /// Causes reaction on client side: The client updates the displayed health and shield bars. /// public readonly ref struct DuelHealthUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelHealthUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private DuelHealthUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xAA; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x05; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 12; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the player 1 id. /// public ushort Player1Id { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the player 2 id. /// public ushort Player2Id { get => ReadUInt16BigEndian(this._data[6..]); set => WriteUInt16BigEndian(this._data[6..], value); } /// /// Gets or sets the player 1 health percentage. /// public byte Player1HealthPercentage { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the player 2 health percentage. /// public byte Player2HealthPercentage { get => this._data[9]; set => this._data[9] = value; } /// /// Gets or sets the player 1 shield percentage. /// public byte Player1ShieldPercentage { get => this._data[10]; set => this._data[10] = value; } /// /// Gets or sets the player 2 shield percentage. /// public byte Player2ShieldPercentage { get => this._data[11]; set => this._data[11] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator DuelHealthUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(DuelHealthUpdateRef packet) => packet._data; } /// /// Is sent by the server when: When the client requested the list of the current duel rooms. /// Causes reaction on client side: The client shows the list of duel rooms. /// public readonly ref struct DuelStatusRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelStatusRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private DuelStatusRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xAA; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x06; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 92; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets the of the specified index. /// public DuelRoomStatusRef this[int index] => new (this._data[(4 + index * DuelRoomStatusRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator DuelStatusRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(DuelStatusRef packet) => packet._data; /// /// Structure for a duel room entry.. /// public readonly ref struct DuelRoomStatusRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelRoomStatusRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 22; /// /// Gets or sets the player 1 name. /// public string Player1Name { get => this._data.ExtractString(0, 10, System.Text.Encoding.UTF8); set => this._data.Slice(0, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the player 2 name. /// public string Player2Name { get => this._data.ExtractString(10, 10, System.Text.Encoding.UTF8); set => this._data.Slice(10, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the duel running. /// public bool DuelRunning { get => this._data[20..].GetBoolean(); set => this._data[20..].SetBoolean(value); } /// /// Gets or sets the duel open. /// public bool DuelOpen { get => this._data[21..].GetBoolean(); set => this._data[21..].SetBoolean(value); } } } /// /// Is sent by the server when: When the duel starts. /// Causes reaction on client side: The client initializes the duel state. /// public readonly ref struct DuelInitRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelInitRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private DuelInitRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xAA; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x07; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 30; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the result. /// public byte Result { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the room index. /// public byte RoomIndex { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the player 1 name. /// public string Player1Name { get => this._data.ExtractString(6, 10, System.Text.Encoding.UTF8); set => this._data.Slice(6, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the player 2 name. /// public string Player2Name { get => this._data.ExtractString(16, 10, System.Text.Encoding.UTF8); set => this._data.Slice(16, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the player 1 id. /// public ushort Player1Id { get => ReadUInt16BigEndian(this._data[26..]); set => WriteUInt16BigEndian(this._data[26..], value); } /// /// Gets or sets the player 2 id. /// public ushort Player2Id { get => ReadUInt16BigEndian(this._data[28..]); set => WriteUInt16BigEndian(this._data[28..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator DuelInitRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(DuelInitRef packet) => packet._data; } /// /// Is sent by the server when: When the duel starts, after the DuelInit message. /// Causes reaction on client side: The client updates the displayed health and shield bars. /// public readonly ref struct DuelHealthBarInitRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelHealthBarInitRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private DuelHealthBarInitRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xAA; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0D; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator DuelHealthBarInitRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(DuelHealthBarInitRef packet) => packet._data; } /// /// Is sent by the server when: When a spectator joins a duel. /// Causes reaction on client side: The client updates the list of spectators. /// public readonly ref struct DuelSpectatorAddedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelSpectatorAddedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private DuelSpectatorAddedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xAA; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x08; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 14; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(4, 10, System.Text.Encoding.UTF8); set => this._data.Slice(4, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator DuelSpectatorAddedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(DuelSpectatorAddedRef packet) => packet._data; } /// /// Is sent by the server when: When a spectator joins a duel. /// Causes reaction on client side: The client updates the list of spectators. /// public readonly ref struct DuelSpectatorRemovedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelSpectatorRemovedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private DuelSpectatorRemovedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xAA; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0A; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 14; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(4, 10, System.Text.Encoding.UTF8); set => this._data.Slice(4, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator DuelSpectatorRemovedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(DuelSpectatorRemovedRef packet) => packet._data; } /// /// Is sent by the server when: When a spectator joins or leaves a duel. /// Causes reaction on client side: The client updates the list of spectators. /// public readonly ref struct DuelSpectatorListRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelSpectatorListRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private DuelSpectatorListRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xAA; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0B; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 105; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the count. /// public byte Count { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public DuelSpectatorRef this[int index] => new (this._data[(5 + index * DuelSpectatorRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator DuelSpectatorListRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(DuelSpectatorListRef packet) => packet._data; /// /// Structure for a duel room entry.. /// public readonly ref struct DuelSpectatorRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelSpectatorRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 10; /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(0, 10, System.Text.Encoding.UTF8); set => this._data.Slice(0, 10).WriteString(value, System.Text.Encoding.UTF8); } } } /// /// Is sent by the server when: When the duel finished. /// Causes reaction on client side: The client shows the winner and loser names. /// public readonly ref struct DuelFinishedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DuelFinishedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private DuelFinishedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xAA; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0C; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 24; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the winner. /// public string Winner { get => this._data.ExtractString(4, 10, System.Text.Encoding.UTF8); set => this._data.Slice(4, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the loser. /// public string Loser { get => this._data.ExtractString(14, 10, System.Text.Encoding.UTF8); set => this._data.Slice(14, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator DuelFinishedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(DuelFinishedRef packet) => packet._data; } /// /// Is sent by the server when: After a player started a skill which needs to load up, like Nova. /// Causes reaction on client side: The client may show the loading intensity. /// public readonly ref struct SkillStageUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public SkillStageUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private SkillStageUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); this.SkillNumber = 0x28; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xBA; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the object id. /// public ushort ObjectId { get => ReadUInt16LittleEndian(this._data[3..]); set => WriteUInt16LittleEndian(this._data[3..], value); } /// /// Gets or sets the skill number. /// public byte SkillNumber { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the stage. /// public byte Stage { get => this._data[6]; set => this._data[6] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator SkillStageUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(SkillStageUpdateRef packet) => packet._data; } /// /// Is sent by the server when: The player requested to enter the illusion temple event. /// Causes reaction on client side: The client shows the result. /// public readonly ref struct IllusionTempleEnterResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public IllusionTempleEnterResultRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private IllusionTempleEnterResultRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x00; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the result. /// public byte Result { get => this._data[4]; set => this._data[4] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator IllusionTempleEnterResultRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(IllusionTempleEnterResultRef packet) => packet._data; } /// /// Is sent by the server when: The player is in the illusion temple event and the server sends a cyclic update. /// Causes reaction on client side: The client shows the state in the user interface. /// public readonly ref struct IllusionTempleStateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public IllusionTempleStateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private IllusionTempleStateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x01; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the remaining seconds. /// public ushort RemainingSeconds { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the player index. /// public ushort PlayerIndex { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the position x. /// public byte PositionX { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the position y. /// public byte PositionY { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the team 1 points. /// public byte Team1Points { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the team 2 points. /// public byte Team2Points { get => this._data[9]; set => this._data[9] = value; } /// /// Gets or sets the my team. /// public byte MyTeam { get => this._data[10]; set => this._data[10] = value; } /// /// Gets or sets the party count. /// public byte PartyCount { get => this._data[11]; set => this._data[11] = value; } /// /// Gets the of the specified index. /// public IllusionTemplePartyEntryRef this[int index] => new (this._data[(12 + index * IllusionTemplePartyEntryRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator IllusionTempleStateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(IllusionTempleStateRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int partyMembersCount) => partyMembersCount * IllusionTemplePartyEntryRef.Length + 12; /// /// Contains the info about a party member in illusion temple.. /// public readonly ref struct IllusionTemplePartyEntryRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public IllusionTemplePartyEntryRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16LittleEndian(this._data); set => WriteUInt16LittleEndian(this._data, value); } /// /// Gets or sets the map number. /// public ushort MapNumber { get => ReadUInt16LittleEndian(this._data[2..]); set => WriteUInt16LittleEndian(this._data[2..], value); } /// /// Gets or sets the position x. /// public byte PositionX { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the position y. /// public byte PositionY { get => this._data[4]; set => this._data[4] = value; } } } /// /// Is sent by the server when: A player requested to use a specific skill in the illusion temple event. /// Causes reaction on client side: The client shows the result. /// public readonly ref struct IllusionTempleSkillUsageResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public IllusionTempleSkillUsageResultRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private IllusionTempleSkillUsageResultRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x02; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 11; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the result. /// public byte Result { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the skill number. /// public ushort SkillNumber { get => ReadUInt16BigEndian(this._data[5..]); set => WriteUInt16BigEndian(this._data[5..], value); } /// /// Gets or sets the source object id. /// public ushort SourceObjectId { get => ReadUInt16LittleEndian(this._data[7..]); set => WriteUInt16LittleEndian(this._data[7..], value); } /// /// Gets or sets the target object id. /// public ushort TargetObjectId { get => ReadUInt16LittleEndian(this._data[9..]); set => WriteUInt16LittleEndian(this._data[9..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator IllusionTempleSkillUsageResultRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(IllusionTempleSkillUsageResultRef packet) => packet._data; } /// /// Is sent by the server when: ? /// Causes reaction on client side: The client shows the counts. /// public readonly ref struct IllusionTempleUserCountRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public IllusionTempleUserCountRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private IllusionTempleUserCountRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x03; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 10; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the user count 1. /// public byte UserCount1 { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the user count 2. /// public byte UserCount2 { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the user count 3. /// public byte UserCount3 { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the user count 4. /// public byte UserCount4 { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the user count 5. /// public byte UserCount5 { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the user count 6. /// public byte UserCount6 { get => this._data[9]; set => this._data[9] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator IllusionTempleUserCountRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(IllusionTempleUserCountRef packet) => packet._data; } /// /// Is sent by the server when: The illusion temple event ended. /// Causes reaction on client side: The client shows the results. /// public readonly ref struct IllusionTempleResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public IllusionTempleResultRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private IllusionTempleResultRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x04; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the team 1 points. /// public byte Team1Points { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the team 2 points. /// public byte Team2Points { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the player count. /// public byte PlayerCount { get => this._data[6]; set => this._data[6] = value; } /// /// Gets the of the specified index. /// public PlayerResultRef this[int index] => new (this._data[(10 + index * PlayerResultRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator IllusionTempleResultRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(IllusionTempleResultRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int playersCount) => playersCount * PlayerResultRef.Length + 10; /// /// Contains the result of a player in the event.. /// public readonly ref struct PlayerResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PlayerResultRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 17; /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(0, this._data.Length - 0, System.Text.Encoding.UTF8); set => this._data.Slice(0).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the map number. /// public byte MapNumber { get => this._data[10]; set => this._data[10] = value; } /// /// Gets or sets the team. /// public byte Team { get => this._data[11]; set => this._data[11] = value; } /// /// Gets or sets the class. /// public byte Class { get => this._data[12]; set => this._data[12] = value; } /// /// Gets or sets the added experience. /// public uint AddedExperience { get => ReadUInt32LittleEndian(this._data[13..]); set => WriteUInt32LittleEndian(this._data[13..], value); } /// /// Calculates the size of the packet for the specified field content. /// /// The content of the variable 'Name' field from which the size will be calculated. public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 0; /// /// Calculates the size of the packet for the specified field content. /// /// The content length in bytes of the variable 'Name' field from which the size will be calculated. public static int GetRequiredSize(int contentLength) => contentLength + 1 + 0; } } /// /// Is sent by the server when: ? /// Causes reaction on client side: The client shows the skill points. /// public readonly ref struct IllusionTempleSkillPointUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public IllusionTempleSkillPointUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private IllusionTempleSkillPointUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x06; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the skill points. /// public byte SkillPoints { get => this._data[4]; set => this._data[4] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator IllusionTempleSkillPointUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(IllusionTempleSkillPointUpdateRef packet) => packet._data; } /// /// Is sent by the server when: ? /// Causes reaction on client side: The client shows the skill points. /// public readonly ref struct IllusionTempleSkillEndedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public IllusionTempleSkillEndedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private IllusionTempleSkillEndedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x07; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the skill number. /// public ushort SkillNumber { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the object index. /// public ushort ObjectIndex { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator IllusionTempleSkillEndedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(IllusionTempleSkillEndedRef packet) => packet._data; } /// /// Is sent by the server when: ? /// Causes reaction on client side: ?. /// public readonly ref struct IllusionTempleHolyItemRelicsRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public IllusionTempleHolyItemRelicsRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private IllusionTempleHolyItemRelicsRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x08; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 16; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the user index. /// public ushort UserIndex { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(6, this._data.Length - 6, System.Text.Encoding.UTF8); set => this._data.Slice(6).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator IllusionTempleHolyItemRelicsRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(IllusionTempleHolyItemRelicsRef packet) => packet._data; /// /// Calculates the size of the packet for the specified field content. /// /// The content of the variable 'Name' field from which the size will be calculated. public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 6; /// /// Calculates the size of the packet for the specified field content. /// /// The content length in bytes of the variable 'Name' field from which the size will be calculated. public static int GetRequiredSize(int contentLength) => contentLength + 1 + 6; } /// /// Is sent by the server when: ? /// Causes reaction on client side: The client shows the skill points. /// public readonly ref struct IllusionTempleSkillEndRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public IllusionTempleSkillEndRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private IllusionTempleSkillEndRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x07; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 6; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the temple number. /// public byte TempleNumber { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the state. /// public byte State { get => this._data[5]; set => this._data[5] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator IllusionTempleSkillEndRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(IllusionTempleSkillEndRef packet) => packet._data; } /// /// Is sent by the server when: The player applied chain lightning to a target and the server calculated the hits. /// Causes reaction on client side: The client shows the chain lightning effect. /// public readonly ref struct ChainLightningHitInfoRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ChainLightningHitInfoRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ChainLightningHitInfoRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0A; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the skill number. /// public ushort SkillNumber { get => ReadUInt16BigEndian(this._data[4..]); set => WriteUInt16BigEndian(this._data[4..], value); } /// /// Gets or sets the player id. /// public ushort PlayerId { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the target count. /// public byte TargetCount { get => this._data[8]; set => this._data[8] = value; } /// /// Gets the of the specified index. /// public ChainTargetRef this[int index] => new (this._data[(10 + index * ChainTargetRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ChainLightningHitInfoRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ChainLightningHitInfoRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int targetsCount) => targetsCount * ChainTargetRef.Length + 10; /// /// Contains the target identifier.. /// public readonly ref struct ChainTargetRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ChainTargetRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 2; /// /// Gets or sets the target id. /// public ushort TargetId { get => ReadUInt16LittleEndian(this._data); set => WriteUInt16LittleEndian(this._data, value); } } } /// /// Is sent by the server when: The server validated or changed the status of the MU Helper. /// Causes reaction on client side: The client toggle the MU Helper status. /// public readonly ref struct MuHelperStatusUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MuHelperStatusUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MuHelperStatusUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xBF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x51; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 16; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the flag, if money should be consumed. If this is 'true', setting PauseStatus to 'false' doesn't cause starting the helper. /// public bool ConsumeMoney { get => this._data[4..].GetBoolean(); set => this._data[4..].SetBoolean(value); } /// /// Gets or sets the money. /// public uint Money { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Gets or sets the pause status. A value of 'true' always works to stop the helper. However, it can only be started, with ConsumeMoney set to 'false'. /// public bool PauseStatus { get => this._data[12..].GetBoolean(); set => this._data[12..].SetBoolean(value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MuHelperStatusUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MuHelperStatusUpdateRef packet) => packet._data; } /// /// Is sent by the server when: The server saved the users MU Helper data. /// Causes reaction on client side: The user wants to save the MU Helper data. /// public readonly ref struct MuHelperConfigurationDataRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MuHelperConfigurationDataRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MuHelperConfigurationDataRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xAE; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 261; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the helper data. /// public Span HelperData { get => this._data.Slice(4, 257); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MuHelperConfigurationDataRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MuHelperConfigurationDataRef packet) => packet._data; } /// /// Is sent by the server when: After entering the game with a character. /// Causes reaction on client side: /// public readonly ref struct MessengerInitializationRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MessengerInitializationRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MessengerInitializationRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xC0; /// /// Gets the header of this packet. /// public C2HeaderRef Header => new (this._data); /// /// Gets or sets the letter count. /// public byte LetterCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the maximum letter count. /// public byte MaximumLetterCount { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the friend count. /// public byte FriendCount { get => this._data[6]; set => this._data[6] = value; } /// /// Gets the of the specified index. /// public FriendRef this[int index] => new (this._data[(7 + index * FriendRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MessengerInitializationRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MessengerInitializationRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int friendsCount) => friendsCount * FriendRef.Length + 7; /// /// The structure which contains the friend name and online state.. /// public readonly ref struct FriendRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public FriendRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 11; /// /// Gets or sets the name. /// public string Name { get => this._data.ExtractString(0, 10, System.Text.Encoding.UTF8); set => this._data.Slice(0, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the server id on which the player currently is online. 0xFF means offline. /// public byte ServerId { get => this._data[10]; set => this._data[10] = value; } } } /// /// Is sent by the server when: After a friend has been added to the friend list. /// Causes reaction on client side: The friend appears in the friend list. /// public readonly ref struct FriendAddedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public FriendAddedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private FriendAddedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; this.ServerId = 0xFF; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xC1; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x01; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 15; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the friend name. /// public string FriendName { get => this._data.ExtractString(4, 10, System.Text.Encoding.UTF8); set => this._data.Slice(4, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the server id on which the player currently is online. 0xFF means offline. /// public byte ServerId { get => this._data[14]; set => this._data[14] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator FriendAddedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(FriendAddedRef packet) => packet._data; } /// /// Is sent by the server when: After a player has requested to add another player as friend. This other player gets this message. /// Causes reaction on client side: The friend request appears on the user interface. /// public readonly ref struct FriendRequestRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public FriendRequestRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private FriendRequestRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xC2; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 13; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the requester. /// public string Requester { get => this._data.ExtractString(3, 10, System.Text.Encoding.UTF8); set => this._data.Slice(3, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator FriendRequestRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(FriendRequestRef packet) => packet._data; } /// /// Is sent by the server when: After a friend has been removed from the friend list. /// Causes reaction on client side: The friend is removed from the friend list. /// public readonly ref struct FriendDeletedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public FriendDeletedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private FriendDeletedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xC3; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x01; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 14; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the friend name. /// public string FriendName { get => this._data.ExtractString(4, 10, System.Text.Encoding.UTF8); set => this._data.Slice(4, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator FriendDeletedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(FriendDeletedRef packet) => packet._data; } /// /// Is sent by the server when: After a friend has been added to the friend list. /// Causes reaction on client side: The friend appears in the friend list. /// public readonly ref struct FriendOnlineStateUpdateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public FriendOnlineStateUpdateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private FriendOnlineStateUpdateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xC4; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 14; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the friend name. /// public string FriendName { get => this._data.ExtractString(3, 10, System.Text.Encoding.UTF8); set => this._data.Slice(3, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the server id on which the player currently is online. 0xFF means offline. /// public byte ServerId { get => this._data[13]; set => this._data[13] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator FriendOnlineStateUpdateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(FriendOnlineStateUpdateRef packet) => packet._data; } /// /// Is sent by the server when: After the player requested to send a letter to another player. /// Causes reaction on client side: Depending on the result, the letter send dialog closes or an error message appears. /// public readonly ref struct LetterSendResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public LetterSendResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private LetterSendResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xC5; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the letter id. /// public uint LetterId { get => ReadUInt32LittleEndian(this._data[4..]); set => WriteUInt32LittleEndian(this._data[4..], value); } /// /// Gets or sets the result. /// public LetterSendResponse.LetterSendRequestResult Result { get => (LetterSendResponse.LetterSendRequestResult)this._data[3]; set => this._data[3] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator LetterSendResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(LetterSendResponseRef packet) => packet._data; } /// /// Is sent by the server when: After a letter has been received or after the player entered the game with a character. /// Causes reaction on client side: The letter appears in the letter list. /// public readonly ref struct AddLetterRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AddLetterRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AddLetterRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xC6; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 79; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the letter index. /// public ushort LetterIndex { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the sender name. /// public string SenderName { get => this._data.ExtractString(6, 10, System.Text.Encoding.UTF8); set => this._data.Slice(6, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the timestamp. /// public string Timestamp { get => this._data.ExtractString(16, 30, System.Text.Encoding.UTF8); set => this._data.Slice(16, 30).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the subject. /// public string Subject { get => this._data.ExtractString(46, 32, System.Text.Encoding.UTF8); set => this._data.Slice(46, 32).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the state. /// public AddLetter.LetterState State { get => (AddLetter.LetterState)this._data[78]; set => this._data[78] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AddLetterRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AddLetterRef packet) => packet._data; } /// /// Is sent by the server when: After the player requested to read a letter. /// Causes reaction on client side: The letter is opened in a new dialog. /// public readonly ref struct OpenLetterRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public OpenLetterRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private OpenLetterRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC4; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xC7; /// /// Gets the header of this packet. /// public C4HeaderRef Header => new (this._data); /// /// Gets or sets the letter index. /// public ushort LetterIndex { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the message size. /// public ushort MessageSize { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the sender appearance. /// public Span SenderAppearance { get => this._data.Slice(8, 18); } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[26]; set => this._data[26] = value; } /// /// Gets or sets the animation. /// public byte Animation { get => this._data[27]; set => this._data[27] = value; } /// /// Gets or sets the message. /// public string Message { get => this._data.ExtractString(28, this._data.Length - 28, System.Text.Encoding.UTF8); set => this._data.Slice(28).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator OpenLetterRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(OpenLetterRef packet) => packet._data; /// /// Calculates the size of the packet for the specified field content. /// /// The content of the variable 'Message' field from which the size will be calculated. public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 28; /// /// Calculates the size of the packet for the specified field content. /// /// The content length in bytes of the variable 'Message' field from which the size will be calculated. public static int GetRequiredSize(int contentLength) => contentLength + 1 + 28; } /// /// Is sent by the server when: After the player requested to read a letter. /// Causes reaction on client side: The letter is opened in a new dialog. /// public readonly ref struct OpenLetterExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public OpenLetterExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private OpenLetterExtendedRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (ushort)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC4; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xC7; /// /// Gets the header of this packet. /// public C4HeaderRef Header => new (this._data); /// /// Gets or sets the letter index. /// public ushort LetterIndex { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the sender appearance. /// public Span SenderAppearance { get => this._data.Slice(6, 42); } /// /// Gets or sets the rotation. /// public byte Rotation { get => this._data[48]; set => this._data[48] = value; } /// /// Gets or sets the animation. /// public byte Animation { get => this._data[49]; set => this._data[49] = value; } /// /// Gets or sets the message. /// public string Message { get => this._data.ExtractString(50, this._data.Length - 50, System.Text.Encoding.UTF8); set => this._data.Slice(50).WriteString(value, System.Text.Encoding.UTF8); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator OpenLetterExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(OpenLetterExtendedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified field content. /// /// The content of the variable 'Message' field from which the size will be calculated. public static int GetRequiredSize(string content) => System.Text.Encoding.UTF8.GetByteCount(content) + 1 + 50; /// /// Calculates the size of the packet for the specified field content. /// /// The content length in bytes of the variable 'Message' field from which the size will be calculated. public static int GetRequiredSize(int contentLength) => contentLength + 1 + 50; } /// /// Is sent by the server when: After a letter has been deleted by the request of the player. /// Causes reaction on client side: The letter is removed from the letter list. /// public readonly ref struct RemoveLetterRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public RemoveLetterRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private RemoveLetterRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); this.RequestSuccessful = true; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xC8; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 6; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the request successful. /// public bool RequestSuccessful { get => this._data[3..].GetBoolean(); set => this._data[3..].SetBoolean(value); } /// /// Gets or sets the letter index. /// public ushort LetterIndex { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator RemoveLetterRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(RemoveLetterRef packet) => packet._data; } /// /// Is sent by the server when: The player is invited to join a chat room on the chat server. /// Causes reaction on client side: The game client connects to the chat server and joins the chat room with the specified authentication data. /// public readonly ref struct ChatRoomConnectionInfoRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ChatRoomConnectionInfoRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ChatRoomConnectionInfoRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); this.Type = 1; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xCA; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 36; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the chat server ip. /// public string ChatServerIp { get => this._data.ExtractString(3, 15, System.Text.Encoding.UTF8); set => this._data.Slice(3, 15).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the chat room id. /// public ushort ChatRoomId { get => ReadUInt16LittleEndian(this._data[18..]); set => WriteUInt16LittleEndian(this._data[18..], value); } /// /// Gets or sets the authentication token. /// public uint AuthenticationToken { get => ReadUInt32LittleEndian(this._data[20..]); set => WriteUInt32LittleEndian(this._data[20..], value); } /// /// Gets or sets the type. /// public byte Type { get => this._data[24]; set => this._data[24] = value; } /// /// Gets or sets the friend name. /// public string FriendName { get => this._data.ExtractString(25, 10, System.Text.Encoding.UTF8); set => this._data.Slice(25, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the success. /// public bool Success { get => this._data[35..].GetBoolean(); set => this._data[35..].SetBoolean(value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ChatRoomConnectionInfoRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ChatRoomConnectionInfoRef packet) => packet._data; } /// /// Is sent by the server when: The player requested to add another player to his friend list and the server processed this request. /// Causes reaction on client side: The game client knows if the invitation could be sent to the other player. /// public readonly ref struct FriendInvitationResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public FriendInvitationResultRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private FriendInvitationResultRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xCB; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C3HeaderRef Header => new (this._data); /// /// Gets or sets the success. /// public bool Success { get => this._data[3..].GetBoolean(); set => this._data[3..].SetBoolean(value); } /// /// Gets or sets the request id. /// public uint RequestId { get => ReadUInt32BigEndian(this._data[4..]); set => WriteUInt32BigEndian(this._data[4..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator FriendInvitationResultRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(FriendInvitationResultRef packet) => packet._data; } /// /// Is sent by the server when: After the game client requested the list of event quests after entering the game. It seems to be sent only if the character is not a member of a Gen. /// Causes reaction on client side: Unknown. /// public readonly ref struct QuestEventResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestEventResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private QuestEventResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x03; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 12; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets the of the specified index. /// public QuestIdentificationRef this[int index] => new (this._data[(4 + index * QuestIdentificationRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator QuestEventResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(QuestEventResponseRef packet) => packet._data; } /// /// Is sent by the server when: After the game client requested the list of available quests through an NPC dialog. /// Causes reaction on client side: The client shows the available quests for the currently interacting NPC. /// public readonly ref struct AvailableQuestsRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public AvailableQuestsRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private AvailableQuestsRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0A; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the quest npc number. /// public ushort QuestNpcNumber { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the quest count. /// public ushort QuestCount { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets the of the specified index. /// public QuestIdentificationRef this[int index] => new (this._data[(8 + index * QuestIdentificationRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator AvailableQuestsRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(AvailableQuestsRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int questsCount) => questsCount * QuestIdentificationRef.Length + 8; } /// /// Is sent by the server when: After the game client clicked on a quest in the quest list, proceeded with a quest or refused to start a quest. /// Causes reaction on client side: The client shows the corresponding description about the current quest step. /// public readonly ref struct QuestStepInfoRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestStepInfoRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private QuestStepInfoRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0B; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 11; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets a number specifying the description: A) when selecting a quest in the quest list, it's the "StartingNumber"; B) when a quest has been started it's the quest number; C) when the starting number has been sent previously and the player refused to start the quest, it sends a "RefuseNumber". /// public ushort QuestStepNumber { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the quest group. /// public ushort QuestGroup { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator QuestStepInfoRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(QuestStepInfoRef packet) => packet._data; } /// /// Is sent by the server when: First, after the game client requested to initialize a quest and the quest is already active. Second, after the game client requested the next quest step. /// Causes reaction on client side: The client shows the quest progress accordingly. /// public readonly ref struct QuestProgressRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestProgressRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private QuestProgressRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0C; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 251; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the quest number. /// public ushort QuestNumber { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the quest group. /// public ushort QuestGroup { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the condition count. /// public byte ConditionCount { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the reward count. /// public byte RewardCount { get => this._data[9]; set => this._data[9] = value; } /// /// Gets the of the specified index. /// public QuestConditionRef GetQuestCondition(int index) => new (this._data[(11 + index * QuestConditionRef.Length)..]); /// /// Gets the of the specified index. /// public QuestRewardRef GetQuestReward(int index) => new (this._data[(141 + index * QuestRewardRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator QuestProgressRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(QuestProgressRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int conditionsCount) => conditionsCount * QuestConditionRef.Length + 11; } /// /// Is sent by the server when: First, after the game client requested to initialize a quest and the quest is already active. Second, after the game client requested the next quest step. /// Causes reaction on client side: The client shows the quest progress accordingly. /// public readonly ref struct QuestProgressExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestProgressExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private QuestProgressExtendedRef(Span 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); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0C; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 272; /// /// Gets the header of this packet. /// public C2HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the condition count. /// public byte ConditionCount { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the reward count. /// public byte RewardCount { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the random reward count. /// public byte RandomRewardCount { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the quest number. /// public ushort QuestNumber { get => ReadUInt16LittleEndian(this._data[8..]); set => WriteUInt16LittleEndian(this._data[8..], value); } /// /// Gets or sets the quest group. /// public ushort QuestGroup { get => ReadUInt16LittleEndian(this._data[10..]); set => WriteUInt16LittleEndian(this._data[10..], value); } /// /// Gets the of the specified index. /// public QuestConditionExtendedRef GetQuestConditionExtended(int index) => new (this._data[(12 + index * QuestConditionExtendedRef.Length)..]); /// /// Gets the of the specified index. /// public QuestRewardExtendedRef GetQuestRewardExtended(int index) => new (this._data[(152 + index * QuestRewardExtendedRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator QuestProgressExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(QuestProgressExtendedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int conditionsCount) => conditionsCount * QuestConditionExtendedRef.Length + 12; } /// /// Is sent by the server when: The server acknowledges the completion of a quest. /// Causes reaction on client side: The client shows the success and possibly requests for the next available quests. /// public readonly ref struct QuestCompletionResponseRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestCompletionResponseRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private QuestCompletionResponseRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0D; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 9; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the quest number. /// public ushort QuestNumber { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the quest group. /// public ushort QuestGroup { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the is quest completed. /// public bool IsQuestCompleted { get => this._data[8..].GetBoolean(); set => this._data[8..].SetBoolean(value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator QuestCompletionResponseRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(QuestCompletionResponseRef packet) => packet._data; } /// /// Is sent by the server when: The server acknowledges the requested cancellation of a quest. /// Causes reaction on client side: The client resets the state of the quest and can request a new list of available quests again. This list would then probably contain the cancelled quest again. /// public readonly ref struct QuestCancelledRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestCancelledRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private QuestCancelledRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x0F; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 8; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the current quest number. In this message, it's always 0, because the group is relevant for the client. /// public ushort QuestNumber { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the quest group. /// public ushort QuestGroup { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator QuestCancelledRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(QuestCancelledRef packet) => packet._data; } /// /// Is sent by the server when: After the game client requested the list of all quests which are currently in progress or accepted. /// Causes reaction on client side: Unknown. /// public readonly ref struct QuestStateListRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestStateListRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private QuestStateListRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x1A; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the quest count. /// public byte QuestCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public QuestIdentificationRef this[int index] => new (this._data[(5 + index * QuestIdentificationRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator QuestStateListRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(QuestStateListRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int questsCount) => questsCount * QuestIdentificationRef.Length + 5; } /// /// Is sent by the server when: After the game client requested it, when the player opened the quest menu and clicked on a quest. /// Causes reaction on client side: The client shows the quest progress accordingly. /// public readonly ref struct QuestStateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestStateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private QuestStateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x1B; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 251; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the quest number. /// public ushort QuestNumber { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the quest group. /// public ushort QuestGroup { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the condition count. /// public byte ConditionCount { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the reward count. /// public byte RewardCount { get => this._data[9]; set => this._data[9] = value; } /// /// Gets or sets the random reward count. /// public byte RandomRewardCount { get => this._data[10]; set => this._data[10] = value; } /// /// Gets the of the specified index. /// public QuestConditionRef GetQuestCondition(int index) => new (this._data[(11 + index * QuestConditionRef.Length)..]); /// /// Gets the of the specified index. /// public QuestRewardRef GetQuestReward(int index) => new (this._data[(141 + index * QuestRewardRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator QuestStateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(QuestStateRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int conditionsCount) => conditionsCount * QuestConditionRef.Length + 11; } /// /// Is sent by the server when: After the game client requested it, when the player opened the quest menu and clicked on a quest. /// Causes reaction on client side: The client shows the quest progress accordingly. /// public readonly ref struct QuestStateExtendedRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public QuestStateExtendedRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private QuestStateExtendedRef(Span 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); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC2; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF6; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x1B; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 272; /// /// Gets the header of this packet. /// public C2HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the condition count. /// public byte ConditionCount { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the reward count. /// public byte RewardCount { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the random reward count. /// public byte RandomRewardCount { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the quest number. /// public ushort QuestNumber { get => ReadUInt16LittleEndian(this._data[8..]); set => WriteUInt16LittleEndian(this._data[8..], value); } /// /// Gets or sets the quest group. /// public ushort QuestGroup { get => ReadUInt16LittleEndian(this._data[10..]); set => WriteUInt16LittleEndian(this._data[10..], value); } /// /// Gets the of the specified index. /// public QuestConditionExtendedRef GetQuestConditionExtended(int index) => new (this._data[(12 + index * QuestConditionExtendedRef.Length)..]); /// /// Gets the of the specified index. /// public QuestRewardExtendedRef GetQuestRewardExtended(int index) => new (this._data[(152 + index * QuestRewardExtendedRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator QuestStateExtendedRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(QuestStateExtendedRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int conditionsCount) => conditionsCount * QuestConditionExtendedRef.Length + 12; } /// /// Is sent by the server when: The server acknowledges the requested opening of an npc dialog. /// Causes reaction on client side: The client opens the dialog of the specified npc. /// public readonly ref struct OpenNpcDialogRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public OpenNpcDialogRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private OpenNpcDialogRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC3; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xF9; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x01; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 12; /// /// Gets the header of this packet. /// public C3HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the npc number. /// public ushort NpcNumber { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the gens contribution points. /// public uint GensContributionPoints { get => ReadUInt32LittleEndian(this._data[8..]); set => WriteUInt32LittleEndian(this._data[8..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator OpenNpcDialogRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(OpenNpcDialogRef packet) => packet._data; } /// /// Is sent by the server when: The player requested to enter the devil square mini game through the Charon NPC. /// Causes reaction on client side: In case it failed, it shows the corresponding error message. /// public readonly ref struct DevilSquareEnterResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public DevilSquareEnterResultRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private DevilSquareEnterResultRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x90; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the result. /// public DevilSquareEnterResult.EnterResult Result { get => (DevilSquareEnterResult.EnterResult)this._data[3]; set => this._data[3] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator DevilSquareEnterResultRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(DevilSquareEnterResultRef packet) => packet._data; } /// /// Is sent by the server when: The player requests to get the current opening state of a mini game event, by clicking on an ticket item. /// Causes reaction on client side: The opening state of the event (remaining entering time, etc.) is shown at the client. /// public readonly ref struct MiniGameOpeningStateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MiniGameOpeningStateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MiniGameOpeningStateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x91; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 7; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the game type. /// public MiniGameType GameType { get => (MiniGameType)this._data[3]; set => this._data[3] = (byte)value; } /// /// Gets or sets the remaining entering time minutes. /// public byte RemainingEnteringTimeMinutes { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the user count. /// public byte UserCount { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets just used for Chaos Castle. In this case, this field contains the lower byte of the remaining minutes. For other event types, this field is not used. /// public byte RemainingEnteringTimeMinutesLow { get => this._data[6]; set => this._data[6] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MiniGameOpeningStateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MiniGameOpeningStateRef packet) => packet._data; } /// /// Is sent by the server when: The state of a mini game event is about to change in 30 seconds. /// Causes reaction on client side: The client side shows a message about the changing state. /// public readonly ref struct UpdateMiniGameStateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public UpdateMiniGameStateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private UpdateMiniGameStateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x92; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the state. /// public UpdateMiniGameState.MiniGameTypeState State { get => (UpdateMiniGameState.MiniGameTypeState)this._data[3]; set => this._data[3] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator UpdateMiniGameStateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(UpdateMiniGameStateRef packet) => packet._data; } /// /// Is sent by the server when: A mini game ended and the score table is sent to the player. /// Causes reaction on client side: The score table is shown at the client. /// public readonly ref struct MiniGameScoreTableRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MiniGameScoreTableRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MiniGameScoreTableRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x93; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the player rank. /// public byte PlayerRank { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the result count. /// public byte ResultCount { get => this._data[4]; set => this._data[4] = value; } /// /// Gets the of the specified index. /// public ResultItemRef this[int index] => new (this._data[(5 + index * ResultItemRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MiniGameScoreTableRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MiniGameScoreTableRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int resultsCount) => resultsCount * ResultItemRef.Length + 5; /// /// The result of one player.. /// public readonly ref struct ResultItemRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ResultItemRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 24; /// /// Gets or sets the player name. /// public string PlayerName { get => this._data.ExtractString(0, 10, System.Text.Encoding.UTF8); set => this._data.Slice(0, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the total score. /// public uint TotalScore { get => ReadUInt32LittleEndian(this._data[12..]); set => WriteUInt32LittleEndian(this._data[12..], value); } /// /// Gets or sets the bonus experience. /// public uint BonusExperience { get => ReadUInt32LittleEndian(this._data[16..]); set => WriteUInt32LittleEndian(this._data[16..], value); } /// /// Gets or sets the bonus money. /// public uint BonusMoney { get => ReadUInt32LittleEndian(this._data[20..]); set => WriteUInt32LittleEndian(this._data[20..], value); } } } /// /// Is sent by the server when: The blood castle mini game ended and the score of the player is sent to the player. /// Causes reaction on client side: The score is shown at the client. /// public readonly ref struct BloodCastleScoreRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public BloodCastleScoreRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private BloodCastleScoreRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); this.Type = 0xFF; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x93; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 29; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the success. /// public bool Success { get => this._data[3..].GetBoolean(); set => this._data[3..].SetBoolean(value); } /// /// Gets or sets the type. /// public byte Type { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the player name. /// public string PlayerName { get => this._data.ExtractString(5, 10, System.Text.Encoding.UTF8); set => this._data.Slice(5, 10).WriteString(value, System.Text.Encoding.UTF8); } /// /// Gets or sets the total score. /// public uint TotalScore { get => ReadUInt32LittleEndian(this._data[17..]); set => WriteUInt32LittleEndian(this._data[17..], value); } /// /// Gets or sets the bonus experience. /// public uint BonusExperience { get => ReadUInt32LittleEndian(this._data[21..]); set => WriteUInt32LittleEndian(this._data[21..], value); } /// /// Gets or sets the bonus money. /// public uint BonusMoney { get => ReadUInt32LittleEndian(this._data[25..]); set => WriteUInt32LittleEndian(this._data[25..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator BloodCastleScoreRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(BloodCastleScoreRef packet) => packet._data; } /// /// Is sent by the server when: The player requested to enter the blood castle mini game through the Archangel Messenger NPC. /// Causes reaction on client side: In case it failed, it shows the corresponding error message. /// public readonly ref struct BloodCastleEnterResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public BloodCastleEnterResultRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private BloodCastleEnterResultRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x9A; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 4; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the result. /// public BloodCastleEnterResult.EnterResult Result { get => (BloodCastleEnterResult.EnterResult)this._data[3]; set => this._data[3] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator BloodCastleEnterResultRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(BloodCastleEnterResultRef packet) => packet._data; } /// /// Is sent by the server when: The state of a blood castle event is about to change. /// Causes reaction on client side: The client side shows a message about the changing state. /// public readonly ref struct BloodCastleStateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public BloodCastleStateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private BloodCastleStateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x9B; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 13; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the state. /// public BloodCastleState.Status State { get => (BloodCastleState.Status)this._data[3]; set => this._data[3] = (byte)value; } /// /// Gets or sets the remain second. /// public ushort RemainSecond { get => ReadUInt16LittleEndian(this._data[4..]); set => WriteUInt16LittleEndian(this._data[4..], value); } /// /// Gets or sets the max monster. /// public ushort MaxMonster { get => ReadUInt16LittleEndian(this._data[6..]); set => WriteUInt16LittleEndian(this._data[6..], value); } /// /// Gets or sets the cur monster. /// public ushort CurMonster { get => ReadUInt16LittleEndian(this._data[8..]); set => WriteUInt16LittleEndian(this._data[8..], value); } /// /// Gets or sets the item owner id. /// public ushort ItemOwnerId { get => ReadUInt16LittleEndian(this._data[10..]); set => WriteUInt16LittleEndian(this._data[10..], value); } /// /// Gets or sets the item level. /// public byte ItemLevel { get => this._data[12]; set => this._data[12] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator BloodCastleStateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(BloodCastleStateRef packet) => packet._data; } /// /// Is sent by the server when: The player requested to enter the chaos castle mini game by using the 'Armor of Guardsman' item. /// Causes reaction on client side: In case it failed, it shows the corresponding error message. /// public readonly ref struct ChaosCastleEnterResultRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public ChaosCastleEnterResultRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private ChaosCastleEnterResultRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); header.SubCode = SubCode; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xAF; /// /// Gets the operation sub-code of this data packet. /// The is used as a grouping key. /// public static byte SubCode => 0x01; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderWithSubCodeRef Header => new (this._data); /// /// Gets or sets the result. /// public ChaosCastleEnterResult.EnterResult Result { get => (ChaosCastleEnterResult.EnterResult)this._data[4]; set => this._data[4] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator ChaosCastleEnterResultRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(ChaosCastleEnterResultRef packet) => packet._data; } /// /// Is sent by the server when: The state of event is about to change. /// Causes reaction on client side: The event's effect is shown. /// public readonly ref struct MapEventStateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public MapEventStateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private MapEventStateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0x0B; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the enable. /// public bool Enable { get => this._data[3..].GetBoolean(); set => this._data[3..].SetBoolean(value); } /// /// Gets or sets the event. /// public MapEventState.Events Event { get => (MapEventState.Events)this._data[4]; set => this._data[4] = (byte)value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator MapEventStateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(MapEventStateRef packet) => packet._data; } /// /// Is sent by the server when: The Heykel Savasi (Statue War) event is available and the team selection panel should be shown to the player. /// Causes reaction on client side: The client opens the team selection panel, showing the current balance of red and blue team members. /// public readonly ref struct HeykelSavasiOpenTeamPanelRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public HeykelSavasiOpenTeamPanelRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private HeykelSavasiOpenTeamPanelRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xFA; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 5; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the red count. /// public byte RedCount { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets the blue count. /// public byte BlueCount { get => this._data[4]; set => this._data[4] = value; } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator HeykelSavasiOpenTeamPanelRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(HeykelSavasiOpenTeamPanelRef packet) => packet._data; } /// /// Is sent by the server when: Periodically (about once per second) while the Heykel Savasi (Statue War) event is open for registration, in its pre-battle countdown, or being played. /// Causes reaction on client side: The client updates its Heykel Savasi HUD panel (team counts, statue progress, and remaining time). /// public readonly ref struct HeykelSavasiHudStateRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public HeykelSavasiHudStateRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private HeykelSavasiHudStateRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)Math.Min(data.Length, Length); } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xFB; /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 11; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets 0 = registration open, 1 = preparation countdown, 2 = battle, 3 = ended. /// public byte Phase { get => this._data[3]; set => this._data[3] = value; } /// /// Gets or sets 0 = none, 1 = red, 2 = blue. /// public byte MyTeam { get => this._data[4]; set => this._data[4] = value; } /// /// Gets or sets the red count. /// public byte RedCount { get => this._data[5]; set => this._data[5] = value; } /// /// Gets or sets the blue count. /// public byte BlueCount { get => this._data[6]; set => this._data[6] = value; } /// /// Gets or sets the number (0-7) of statues the red team has destroyed of the blue team's line. /// public byte RedProgress { get => this._data[7]; set => this._data[7] = value; } /// /// Gets or sets the number (0-7) of statues the blue team has destroyed of the red team's line. /// public byte BlueProgress { get => this._data[8]; set => this._data[8] = value; } /// /// Gets or sets the number of seconds left in the current phase. /// public ushort RemainingSeconds { get => ReadUInt16BigEndian(this._data[9..]); set => WriteUInt16BigEndian(this._data[9..], value); } /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator HeykelSavasiHudStateRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(HeykelSavasiHudStateRef packet) => packet._data; } /// /// Is sent by the server when: Periodically (about once every one to two seconds) while the Heykel Savasi (Statue War) event is open for registration, in its pre-battle countdown, or being played. /// Causes reaction on client side: The client tints each listed nearby player red or blue according to its team. /// public readonly ref struct HeykelSavasiTeamRosterRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public HeykelSavasiTeamRosterRef(Span data) : this(data, true) { } /// /// Initializes a new instance of the struct. /// /// The underlying data. /// If set to true, the header data is automatically initialized and written to the underlying span. private HeykelSavasiTeamRosterRef(Span data, bool initialize) { this._data = data; if (initialize) { var header = this.Header; header.Type = HeaderType; header.Code = Code; header.Length = (byte)data.Length; } } /// /// Gets the header type of this data packet. /// public static byte HeaderType => 0xC1; /// /// Gets the operation code of this data packet. /// public static byte Code => 0xFC; /// /// Gets the header of this packet. /// public C1HeaderRef Header => new (this._data); /// /// Gets or sets the number of player-team entries which follow. /// public byte Count { get => this._data[3]; set => this._data[3] = value; } /// /// Gets the of the specified index. /// public PlayerTeamRef this[int index] => new (this._data[(4 + index * PlayerTeamRef.Length)..]); /// /// Performs an implicit conversion from a Span of bytes to a . /// /// The packet as span. /// The packet as struct. public static implicit operator HeykelSavasiTeamRosterRef(Span packet) => new (packet, false); /// /// Performs an implicit conversion from to a Span of bytes. /// /// The packet as struct. /// The packet as byte span. public static implicit operator Span(HeykelSavasiTeamRosterRef packet) => packet._data; /// /// Calculates the size of the packet for the specified count of . /// /// The count of from which the size will be calculated. public static int GetRequiredSize(int playersCount) => playersCount * PlayerTeamRef.Length + 4; /// /// Maps a player's network id to its Heykel Savasi team.. /// public readonly ref struct PlayerTeamRef { private readonly Span _data; /// /// Initializes a new instance of the struct. /// /// The underlying data. public PlayerTeamRef(Span data) { this._data = data; } /// /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. /// public static int Length => 3; /// /// Gets or sets the network id of the player (same id used in the viewport/appearance packets). /// public ushort PlayerId { get => ReadUInt16BigEndian(this._data); set => WriteUInt16BigEndian(this._data, value); } /// /// Gets or sets 1 = red, 2 = blue. /// public byte Team { get => this._data[2]; set => this._data[2] = value; } } }