From: miniduikboot Date: Tue, 18 Aug 2026 17:33:03 +0000 (+0200) Subject: Add support for RoleOptions v11 X-Git-Tag: v1.10.8~11 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=caab877c80b7eb48105812cc314f5eac58aef607;p=rhonda%2Fimpostor.git Add support for RoleOptions v11 This is bare minimum bringup for AU v18 --- diff --git a/src/Impostor.Api/Innersloth/Data/enums/RoleTypes.json b/src/Impostor.Api/Innersloth/Data/enums/RoleTypes.json index 4186732..7f846c4 100644 --- a/src/Impostor.Api/Innersloth/Data/enums/RoleTypes.json +++ b/src/Impostor.Api/Innersloth/Data/enums/RoleTypes.json @@ -11,5 +11,6 @@ "Phantom": 9, "Tracker": 10, "Detective": 12, - "Viper": 18 -} \ No newline at end of file + "Viper": 18, + "Judge": 19 +} diff --git a/src/Impostor.Api/Innersloth/GameOptions/NormalGameOptions.cs b/src/Impostor.Api/Innersloth/GameOptions/NormalGameOptions.cs index 4055f82..ac2a5a6 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 = 10; + public const int LatestVersion = 11; public NormalGameOptions(byte version = LatestVersion) { @@ -144,6 +144,11 @@ public class NormalGameOptions : IGameOptions public void Deserialize(IMessageReader reader) { + if (Version > LatestVersion) + { + IGameOptions.ThrowUnknownVersion(Version); + } + if (Version >= 8) { SpecialMode = (SpecialGameModes)reader.ReadByte(); @@ -184,11 +189,6 @@ public class NormalGameOptions : IGameOptions } RoleOptions.Deserialize(reader); - - if (Version > LatestVersion) - { - IGameOptions.ThrowUnknownVersion(Version); - } } public void Serialize(IMessageWriter writer) diff --git a/src/Impostor.Api/Innersloth/GameOptions/RoleOptions/JudgeRoleOptions.cs b/src/Impostor.Api/Innersloth/GameOptions/RoleOptions/JudgeRoleOptions.cs new file mode 100644 index 0000000..638a9f9 --- /dev/null +++ b/src/Impostor.Api/Innersloth/GameOptions/RoleOptions/JudgeRoleOptions.cs @@ -0,0 +1,29 @@ +namespace Impostor.Api.Innersloth.GameOptions.RoleOptions; + +public class JudgeRoleOptions : IRoleOptions +{ + public JudgeRoleOptions(byte version) + { + Version = version; + } + + public byte Version { get; } + + public RoleTypes Type => RoleTypes.Judge; + + public float JudgeTaskRequirementPercentage { get; set; } = 50f; + + public static JudgeRoleOptions Deserialize(IMessageReader reader, byte version) + { + var options = new JudgeRoleOptions(version); + + options.JudgeTaskRequirementPercentage = (int)reader.ReadByte(); + + return options; + } + + public void Serialize(IMessageWriter writer) + { + writer.Write((byte)JudgeTaskRequirementPercentage); + } +} diff --git a/src/Impostor.Api/Innersloth/GameOptions/RoleOptions/RoleOptionsCollection.cs b/src/Impostor.Api/Innersloth/GameOptions/RoleOptions/RoleOptionsCollection.cs index 187987b..b90c3ad 100644 --- a/src/Impostor.Api/Innersloth/GameOptions/RoleOptions/RoleOptionsCollection.cs +++ b/src/Impostor.Api/Innersloth/GameOptions/RoleOptions/RoleOptionsCollection.cs @@ -34,6 +34,7 @@ public class RoleOptionsCollection RoleTypes.Tracker => TrackerRoleOptions.Deserialize(roleOptionsReader, Version), RoleTypes.Detective => DetectiveRoleOptions.Deserialize(roleOptionsReader, Version), RoleTypes.Viper => ViperRoleOptions.Deserialize(roleOptionsReader, Version), + RoleTypes.Judge => JudgeRoleOptions.Deserialize(roleOptionsReader, Version), _ => throw new ArgumentOutOfRangeException(nameof(roleType), roleType, null), }; diff --git a/src/Impostor.Server/Net/Manager/CompatibilityManager.cs b/src/Impostor.Server/Net/Manager/CompatibilityManager.cs index f8e734e..f8eb23b 100644 --- a/src/Impostor.Server/Net/Manager/CompatibilityManager.cs +++ b/src/Impostor.Server/Net/Manager/CompatibilityManager.cs @@ -45,6 +45,10 @@ internal class CompatibilityManager : ICompatibilityManager new GameVersion(2026, 3, 18), // 17.4 (2026-06-05, build 7044, pc only) new GameVersion(2026, 4, 23), // 17.4 (2026-06-05, build 7045, mobile only) }, + new[] + { + new GameVersion(2026, 7, 15), // 18.0 (2026-08-18, build 7238) + }, }; private readonly List _compatibilityGroups = new();