diff --git a/src/Network/Packets/ClientToServer/ClientToServerPackets.cs b/src/Network/Packets/ClientToServer/ClientToServerPackets.cs index 57a7c92..314a492 100644 --- a/src/Network/Packets/ClientToServer/ClientToServerPackets.cs +++ b/src/Network/Packets/ClientToServer/ClientToServerPackets.cs @@ -17525,6 +17525,85 @@ public readonly struct DuelChannelQuitRequest /// The packet as byte span. public static implicit operator Memory(DuelChannelQuitRequest packet) => packet._data; } + + +/// +/// Is sent by the client when: A player selects a team (Red or Blue) in the Heykel Savasi (Statue War) team selection panel. +/// Causes reaction on server side: The server assigns the player to the requested team, if possible, and updates the event state accordingly. +/// +public readonly struct HeykelSavasiTeamSelect +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public HeykelSavasiTeamSelect(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private HeykelSavasiTeamSelect(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xFA; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 4; + + /// + /// Gets the header of this packet. + /// + public C1Header Header => new (this._data); + + /// + /// Gets or sets 1 = Red team, 2 = Blue team. + /// + public byte Team + { + get => this._data.Span[3]; + set => this._data.Span[3] = value; + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator HeykelSavasiTeamSelect(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(HeykelSavasiTeamSelect packet) => packet._data; +} /// /// The state of the trade button. /// diff --git a/src/Network/Packets/ClientToServer/ClientToServerPackets.xml b/src/Network/Packets/ClientToServer/ClientToServerPackets.xml index 47cbed4..89e8bfb 100644 --- a/src/Network/Packets/ClientToServer/ClientToServerPackets.xml +++ b/src/Network/Packets/ClientToServer/ClientToServerPackets.xml @@ -4251,6 +4251,23 @@ + + C1Header + FA + HeykelSavasiTeamSelect + 4 + ClientToServer + A player selects a team (Red or Blue) in the Heykel Savasi (Statue War) team selection panel. + The server assigns the player to the requested team, if possible, and updates the event state accordingly. + + + 3 + Byte + Team + 1 = Red team, 2 = Blue team. + + + diff --git a/src/Network/Packets/ClientToServer/ClientToServerPacketsRef.cs b/src/Network/Packets/ClientToServer/ClientToServerPacketsRef.cs index f058421..d76f8e8 100644 --- a/src/Network/Packets/ClientToServer/ClientToServerPacketsRef.cs +++ b/src/Network/Packets/ClientToServer/ClientToServerPacketsRef.cs @@ -17318,3 +17318,82 @@ public readonly ref struct DuelChannelQuitRequestRef /// The packet as byte span. public static implicit operator Span(DuelChannelQuitRequestRef packet) => packet._data; } + + +/// +/// Is sent by the client when: A player selects a team (Red or Blue) in the Heykel Savasi (Statue War) team selection panel. +/// Causes reaction on server side: The server assigns the player to the requested team, if possible, and updates the event state accordingly. +/// +public readonly ref struct HeykelSavasiTeamSelectRef +{ + private readonly Span _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public HeykelSavasiTeamSelectRef(Span data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private HeykelSavasiTeamSelectRef(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 => 4; + + /// + /// Gets the header of this packet. + /// + public C1HeaderRef Header => new (this._data); + + /// + /// Gets or sets 1 = Red team, 2 = Blue team. + /// + public byte Team + { + 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 HeykelSavasiTeamSelectRef(Span packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Span of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Span(HeykelSavasiTeamSelectRef packet) => packet._data; +} diff --git a/src/Network/Packets/ClientToServer/ConnectionExtensions.cs b/src/Network/Packets/ClientToServer/ConnectionExtensions.cs index fe8b8ee..5cbdc21 100644 --- a/src/Network/Packets/ClientToServer/ConnectionExtensions.cs +++ b/src/Network/Packets/ClientToServer/ConnectionExtensions.cs @@ -5546,5 +5546,33 @@ public static class ConnectionExtensions return packet.Header.Length; } + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// 1 = Red team, 2 = Blue team. + /// + /// Is sent by the client when: A player selects a team (Red or Blue) in the Heykel Savasi (Statue War) team selection panel. + /// Causes reaction on server side: The server assigns the player to the requested team, if possible, and updates the event state accordingly. + /// + public static async ValueTask SendHeykelSavasiTeamSelectAsync(this IConnection? connection, byte @team) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = HeykelSavasiTeamSelectRef.Length; + var packet = new HeykelSavasiTeamSelectRef(connection.Output.GetSpan(length)[..length]); + packet.Team = @team; + + return packet.Header.Length; + } + await connection.SendAsync(WritePacket).ConfigureAwait(false); }} \ No newline at end of file diff --git a/src/Network/Packets/ServerToClient/ConnectionExtensions.cs b/src/Network/Packets/ServerToClient/ConnectionExtensions.cs index c953fa6..9e5dc4b 100644 --- a/src/Network/Packets/ServerToClient/ConnectionExtensions.cs +++ b/src/Network/Packets/ServerToClient/ConnectionExtensions.cs @@ -6287,5 +6287,35 @@ public static class ConnectionExtensions return packet.Header.Length; } + await connection.SendAsync(WritePacket).ConfigureAwait(false); + } + + /// + /// Sends a to this connection. + /// + /// The connection. + /// The red count. + /// The blue count. + /// + /// 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 static async ValueTask SendHeykelSavasiOpenTeamPanelAsync(this IConnection? connection, byte @redCount, byte @blueCount) + { + if (connection is null) + { + return; + } + + int WritePacket() + { + var length = HeykelSavasiOpenTeamPanelRef.Length; + var packet = new HeykelSavasiOpenTeamPanelRef(connection.Output.GetSpan(length)[..length]); + packet.RedCount = @redCount; + packet.BlueCount = @blueCount; + + return packet.Header.Length; + } + await connection.SendAsync(WritePacket).ConfigureAwait(false); }} \ No newline at end of file diff --git a/src/Network/Packets/ServerToClient/ServerToClientPackets.cs b/src/Network/Packets/ServerToClient/ServerToClientPackets.cs index 0fc45b9..4544da8 100644 --- a/src/Network/Packets/ServerToClient/ServerToClientPackets.cs +++ b/src/Network/Packets/ServerToClient/ServerToClientPackets.cs @@ -30671,6 +30671,94 @@ public readonly struct MapEventState /// The packet as byte span. public static implicit operator Memory(MapEventState 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 struct HeykelSavasiOpenTeamPanel +{ + private readonly Memory _data; + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + public HeykelSavasiOpenTeamPanel(Memory data) + : this(data, true) + { + } + + /// + /// Initializes a new instance of the struct. + /// + /// The underlying data. + /// If set to true, the header data is automatically initialized and written to the underlying span. + private HeykelSavasiOpenTeamPanel(Memory data, bool initialize) + { + this._data = data; + if (initialize) + { + var header = this.Header; + header.Type = HeaderType; + header.Code = Code; + header.Length = (byte)Math.Min(data.Length, Length); + } + } + + /// + /// Gets the header type of this data packet. + /// + public static byte HeaderType => 0xC1; + + /// + /// Gets the operation code of this data packet. + /// + public static byte Code => 0xFA; + + /// + /// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed. + /// + public static int Length => 5; + + /// + /// Gets the header of this packet. + /// + public C1Header Header => new (this._data); + + /// + /// Gets or sets the red count. + /// + public byte RedCount + { + get => this._data.Span[3]; + set => this._data.Span[3] = value; + } + + /// + /// Gets or sets the blue count. + /// + public byte BlueCount + { + get => this._data.Span[4]; + set => this._data.Span[4] = value; + } + + /// + /// Performs an implicit conversion from a Memory of bytes to a . + /// + /// The packet as span. + /// The packet as struct. + public static implicit operator HeykelSavasiOpenTeamPanel(Memory packet) => new (packet, false); + + /// + /// Performs an implicit conversion from to a Memory of bytes. + /// + /// The packet as struct. + /// The packet as byte span. + public static implicit operator Memory(HeykelSavasiOpenTeamPanel packet) => packet._data; +} /// /// Defines the role of a guild member. /// diff --git a/src/Network/Packets/ServerToClient/ServerToClientPackets.xml b/src/Network/Packets/ServerToClient/ServerToClientPackets.xml index d0dcf23..379b709 100644 --- a/src/Network/Packets/ServerToClient/ServerToClientPackets.xml +++ b/src/Network/Packets/ServerToClient/ServerToClientPackets.xml @@ -11067,6 +11067,27 @@ + + C1Header + FA + HeykelSavasiOpenTeamPanel + 5 + ServerToClient + The Heykel Savasi (Statue War) event is available and the team selection panel should be shown to the player. + The client opens the team selection panel, showing the current balance of red and blue team members. + + + 3 + Byte + RedCount + + + 4 + Byte + BlueCount + + + diff --git a/src/Network/Packets/ServerToClient/ServerToClientPacketsRef.cs b/src/Network/Packets/ServerToClient/ServerToClientPacketsRef.cs index b1cf1bf..2921413 100644 --- a/src/Network/Packets/ServerToClient/ServerToClientPacketsRef.cs +++ b/src/Network/Packets/ServerToClient/ServerToClientPacketsRef.cs @@ -29034,3 +29034,91 @@ public readonly ref struct MapEventStateRef /// 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; +}