feat(hs): add open-team-panel (S2C) and team-select (C2S) packets

This commit is contained in:
Acentech Dev
2026-07-20 23:22:33 +03:00
parent cc0b7abb44
commit f5e1f46444
8 changed files with 430 additions and 0 deletions

View File

@@ -17525,6 +17525,85 @@ public readonly struct DuelChannelQuitRequest
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(DuelChannelQuitRequest packet) => packet._data;
}
/// <summary>
/// Is sent by the client when: A player selects a team (Red or Blue) in the Heykel Savasi (Statue War) team selection panel.
/// Causes reaction on server side: The server assigns the player to the requested team, if possible, and updates the event state accordingly.
/// </summary>
public readonly struct HeykelSavasiTeamSelect
{
private readonly Memory<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="HeykelSavasiTeamSelect"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public HeykelSavasiTeamSelect(Memory<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="HeykelSavasiTeamSelect"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private HeykelSavasiTeamSelect(Memory<byte> data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xFA;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1Header Header => new (this._data);
/// <summary>
/// Gets or sets 1 = Red team, 2 = Blue team.
/// </summary>
public byte Team
{
get => this._data.Span[3];
set => this._data.Span[3] = value;
}
/// <summary>
/// Performs an implicit conversion from a Memory of bytes to a <see cref="HeykelSavasiTeamSelect"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator HeykelSavasiTeamSelect(Memory<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="HeykelSavasiTeamSelect"/> to a Memory of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Memory<byte>(HeykelSavasiTeamSelect packet) => packet._data;
}
/// <summary>
/// The state of the trade button.
/// </summary>

View File

@@ -4251,6 +4251,23 @@
<Fields>
</Fields>
</Packet>
<Packet>
<HeaderType>C1Header</HeaderType>
<Code>FA</Code>
<Name>HeykelSavasiTeamSelect</Name>
<Length>4</Length>
<Direction>ClientToServer</Direction>
<SentWhen>A player selects a team (Red or Blue) in the Heykel Savasi (Statue War) team selection panel.</SentWhen>
<CausedReaction>The server assigns the player to the requested team, if possible, and updates the event state accordingly.</CausedReaction>
<Fields>
<Field>
<Index>3</Index>
<Type>Byte</Type>
<Name>Team</Name>
<Description>1 = Red team, 2 = Blue team.</Description>
</Field>
</Fields>
</Packet>
</Packets>
<Enums>
<Enum>

View File

@@ -17318,3 +17318,82 @@ public readonly ref struct DuelChannelQuitRequestRef
/// <returns>The packet as byte span.</returns>
public static implicit operator Span<byte>(DuelChannelQuitRequestRef packet) => packet._data;
}
/// <summary>
/// Is sent by the client when: A player selects a team (Red or Blue) in the Heykel Savasi (Statue War) team selection panel.
/// Causes reaction on server side: The server assigns the player to the requested team, if possible, and updates the event state accordingly.
/// </summary>
public readonly ref struct HeykelSavasiTeamSelectRef
{
private readonly Span<byte> _data;
/// <summary>
/// Initializes a new instance of the <see cref="HeykelSavasiTeamSelectRef"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
public HeykelSavasiTeamSelectRef(Span<byte> data)
: this(data, true)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="HeykelSavasiTeamSelectRef"/> struct.
/// </summary>
/// <param name="data">The underlying data.</param>
/// <param name="initialize">If set to <c>true</c>, the header data is automatically initialized and written to the underlying span.</param>
private HeykelSavasiTeamSelectRef(Span<byte> data, bool initialize)
{
this._data = data;
if (initialize)
{
var header = this.Header;
header.Type = HeaderType;
header.Code = Code;
header.Length = (byte)Math.Min(data.Length, Length);
}
}
/// <summary>
/// Gets the header type of this data packet.
/// </summary>
public static byte HeaderType => 0xC1;
/// <summary>
/// Gets the operation code of this data packet.
/// </summary>
public static byte Code => 0xFA;
/// <summary>
/// Gets the initial length of this data packet. When the size is dynamic, this value may be bigger than actually needed.
/// </summary>
public static int Length => 4;
/// <summary>
/// Gets the header of this packet.
/// </summary>
public C1HeaderRef Header => new (this._data);
/// <summary>
/// Gets or sets 1 = Red team, 2 = Blue team.
/// </summary>
public byte Team
{
get => this._data[3];
set => this._data[3] = value;
}
/// <summary>
/// Performs an implicit conversion from a Span of bytes to a <see cref="HeykelSavasiTeamSelect"/>.
/// </summary>
/// <param name="packet">The packet as span.</param>
/// <returns>The packet as struct.</returns>
public static implicit operator HeykelSavasiTeamSelectRef(Span<byte> packet) => new (packet, false);
/// <summary>
/// Performs an implicit conversion from <see cref="HeykelSavasiTeamSelect"/> to a Span of bytes.
/// </summary>
/// <param name="packet">The packet as struct.</param>
/// <returns>The packet as byte span.</returns>
public static implicit operator Span<byte>(HeykelSavasiTeamSelectRef packet) => packet._data;
}

View File

@@ -5546,5 +5546,33 @@ public static class ConnectionExtensions
return packet.Header.Length;
}
await connection.SendAsync(WritePacket).ConfigureAwait(false);
}
/// <summary>
/// Sends a <see cref="HeykelSavasiTeamSelect" /> to this connection.
/// </summary>
/// <param name="connection">The connection.</param>
/// <param name="team">1 = Red team, 2 = Blue team.</param>
/// <remarks>
/// 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.
/// </remarks>
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);
}}