]> git.deb.at Git - rhonda/impostor.git/commitdiff
Add support for RoleOptions v11
authorminiduikboot <mini@duikbo.at>
Tue, 18 Aug 2026 17:33:03 +0000 (19:33 +0200)
committerminiduikboot <mini@duikbo.at>
Sun, 30 Aug 2026 16:48:37 +0000 (18:48 +0200)
This is bare minimum bringup for AU v18

src/Impostor.Api/Innersloth/Data/enums/RoleTypes.json
src/Impostor.Api/Innersloth/GameOptions/NormalGameOptions.cs
src/Impostor.Api/Innersloth/GameOptions/RoleOptions/JudgeRoleOptions.cs [new file with mode: 0644]
src/Impostor.Api/Innersloth/GameOptions/RoleOptions/RoleOptionsCollection.cs
src/Impostor.Server/Net/Manager/CompatibilityManager.cs

index 4186732a86127fa570f12b2d4ceee44839e0a0fe..7f846c461bbc560915210ebc625269d4386605aa 100644 (file)
@@ -11,5 +11,6 @@
   "Phantom": 9,
   "Tracker": 10,
   "Detective": 12,
-  "Viper": 18
-}
\ No newline at end of file
+  "Viper": 18,
+  "Judge": 19
+}
index 4055f826a998bed7d5399370abd28791a89c6eeb..ac2a5a6092281dad9b16adab0a123f9109898f84 100644 (file)
@@ -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<NormalGameOptions>(Version);
+        }
+
         if (Version >= 8)
         {
             SpecialMode = (SpecialGameModes)reader.ReadByte();
@@ -184,11 +189,6 @@ public class NormalGameOptions : IGameOptions
         }
 
         RoleOptions.Deserialize(reader);
-
-        if (Version > LatestVersion)
-        {
-            IGameOptions.ThrowUnknownVersion<NormalGameOptions>(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 (file)
index 0000000..638a9f9
--- /dev/null
@@ -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);
+    }
+}
index 187987ba272509298e1a532dd1a818a2395f71d8..b90c3ad4e2f00b83f073baf2b2abdf8315dd1954 100644 (file)
@@ -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),
             };
 
index f8e734e891c5a4cbc8daaf8e3dd89474e523c1d1..f8eb23bdc4cb5b5124bd23f68d2733f636a2720b 100644 (file)
@@ -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<CompatibilityGroup> _compatibilityGroups = new();