From 3e2c3f152534a0e160f4a480d6694dc6776eca37 Mon Sep 17 00:00:00 2001 From: miniduikboot Date: Tue, 25 Mar 2025 19:48:54 +0100 Subject: [PATCH] Update Game Options Creating a game is now possible --- .../GameOptions/HideNSeekGameOptions.cs | 17 ++++++++++++++++- .../Innersloth/GameOptions/NormalGameOptions.cs | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/Impostor.Api/Innersloth/GameOptions/HideNSeekGameOptions.cs b/src/Impostor.Api/Innersloth/GameOptions/HideNSeekGameOptions.cs index 87b01ad..10df425 100644 --- a/src/Impostor.Api/Innersloth/GameOptions/HideNSeekGameOptions.cs +++ b/src/Impostor.Api/Innersloth/GameOptions/HideNSeekGameOptions.cs @@ -2,7 +2,7 @@ namespace Impostor.Api.Innersloth.GameOptions; public class HideNSeekGameOptions : IGameOptions { - public const int LatestVersion = 8; + public const int LatestVersion = 9; public HideNSeekGameOptions(byte version = LatestVersion) { @@ -93,6 +93,11 @@ public class HideNSeekGameOptions : IGameOptions public float MaxPingTime { get; set; } = 6f; + /// + /// Gets or sets the experience level of people in the lobby: Beginner, Intermediate or Expert. + /// + public byte Tag { get; set; } = 0; + public static HideNSeekGameOptions Deserialize(IMessageReader reader, byte version) { var options = new HideNSeekGameOptions(version); @@ -133,6 +138,11 @@ public class HideNSeekGameOptions : IGameOptions MaxPingTime = reader.ReadSingle(); CrewmateTimeInVent = reader.ReadSingle(); + if (Version >= 9) + { + Tag = reader.ReadByte(); + } + if (Version > LatestVersion) { IGameOptions.ThrowUnknownVersion(Version); @@ -172,6 +182,11 @@ public class HideNSeekGameOptions : IGameOptions writer.Write(MaxPingTime); writer.Write(CrewmateTimeInVent); + if (Version >= 9) + { + writer.Write((byte)Tag); + } + if (Version > LatestVersion) { IGameOptions.ThrowUnknownVersion(Version); diff --git a/src/Impostor.Api/Innersloth/GameOptions/NormalGameOptions.cs b/src/Impostor.Api/Innersloth/GameOptions/NormalGameOptions.cs index 7095f6d..61fdd5f 100644 --- a/src/Impostor.Api/Innersloth/GameOptions/NormalGameOptions.cs +++ b/src/Impostor.Api/Innersloth/GameOptions/NormalGameOptions.cs @@ -4,7 +4,7 @@ namespace Impostor.Api.Innersloth.GameOptions; public class NormalGameOptions : IGameOptions { - public const int LatestVersion = 8; + public const int LatestVersion = 9; public NormalGameOptions(byte version = LatestVersion) { @@ -128,6 +128,11 @@ public class NormalGameOptions : IGameOptions /// public TaskBarUpdate TaskBarUpdate { get; set; } = TaskBarUpdate.Always; + /// + /// Gets or sets the experience level of people in the lobby: Beginner, Intermediate or Expert. + /// + public byte Tag { get; set; } = 0; + public RoleOptionsCollection RoleOptions { get; set; } public static NormalGameOptions Deserialize(IMessageReader reader, byte version) @@ -173,6 +178,11 @@ public class NormalGameOptions : IGameOptions AnonymousVotes = reader.ReadBoolean(); TaskBarUpdate = (TaskBarUpdate)reader.ReadByte(); + if (Version >= 9) + { + Tag = reader.ReadByte(); + } + RoleOptions.Deserialize(reader); if (Version > LatestVersion) @@ -217,6 +227,11 @@ public class NormalGameOptions : IGameOptions writer.Write(AnonymousVotes); writer.Write((byte)TaskBarUpdate); + if (Version >= 9) + { + writer.Write((byte)Tag); + } + RoleOptions.Serialize(writer); if (Version > LatestVersion) -- 2.39.5