Update Game Options

Creating a game is now possible
This commit is contained in:
miniduikboot committed 2025-03-30 20:34:18 +02:00
1 parent 61cbd5c4d8
commit 3e2c3f1525
2 files changed
+32 -2

No files matched your search

@@ -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;
/// <summary>
/// Gets or sets the experience level of people in the lobby: Beginner, Intermediate or Expert.
/// </summary>
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<HideNSeekGameOptions>(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<HideNSeekGameOptions>(Version);
@@ -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
/// </summary>
public TaskBarUpdate TaskBarUpdate { get; set; } = TaskBarUpdate.Always;
/// <summary>
/// Gets or sets the experience level of people in the lobby: Beginner, Intermediate or Expert.
/// </summary>
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)