mirror of
https://github.com/Impostor/Impostor.git
synced 2026-10-20 01:46:11 +00:00
Add GameOptions V10
Manually added roles to RoleTypes, will clean up later
This commit is contained in:
1 parent
ebd7f99438
commit
8ba89d9844
6 files changed
+66
-4
No files matched your search
@@ -9,5 +9,7 @@
|
||||
"ImpostorGhost": 7,
|
||||
"Noisemaker": 8,
|
||||
"Phantom": 9,
|
||||
"Tracker": 10
|
||||
}
|
||||
"Tracker": 10,
|
||||
"Detective": 12,
|
||||
"Viper": 18
|
||||
}
|
||||
@@ -2,7 +2,7 @@ namespace Impostor.Api.Innersloth.GameOptions;
|
||||
|
||||
public class HideNSeekGameOptions : IGameOptions
|
||||
{
|
||||
public const int LatestVersion = 9;
|
||||
public const int LatestVersion = 10;
|
||||
|
||||
public HideNSeekGameOptions(byte version = LatestVersion)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Impostor.Api.Innersloth.GameOptions;
|
||||
|
||||
public class NormalGameOptions : IGameOptions
|
||||
{
|
||||
public const int LatestVersion = 9;
|
||||
public const int LatestVersion = 10;
|
||||
|
||||
public NormalGameOptions(byte version = LatestVersion)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
namespace Impostor.Api.Innersloth.GameOptions.RoleOptions;
|
||||
|
||||
public class DetectiveRoleOptions : IRoleOptions
|
||||
{
|
||||
public DetectiveRoleOptions(byte version)
|
||||
{
|
||||
Version = version;
|
||||
}
|
||||
|
||||
public byte Version { get; }
|
||||
|
||||
public RoleTypes Type => RoleTypes.Detective;
|
||||
|
||||
public byte DetectiveSuspectLimit { get; set; } = 3;
|
||||
|
||||
public static DetectiveRoleOptions Deserialize(IMessageReader reader, byte version)
|
||||
{
|
||||
var options = new DetectiveRoleOptions(version);
|
||||
|
||||
options.DetectiveSuspectLimit = reader.ReadByte();
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.Write((byte)DetectiveSuspectLimit);
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,8 @@ public class RoleOptionsCollection
|
||||
RoleTypes.Noisemaker => NoisemakerRoleOptions.Deserialize(roleOptionsReader, Version),
|
||||
RoleTypes.Phantom => PhantomRoleOptions.Deserialize(roleOptionsReader, Version),
|
||||
RoleTypes.Tracker => TrackerRoleOptions.Deserialize(roleOptionsReader, Version),
|
||||
RoleTypes.Detective => DetectiveRoleOptions.Deserialize(roleOptionsReader, Version),
|
||||
RoleTypes.Viper => ViperRoleOptions.Deserialize(roleOptionsReader, Version),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(roleType), roleType, null),
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
namespace Impostor.Api.Innersloth.GameOptions.RoleOptions;
|
||||
|
||||
public class ViperRoleOptions : IRoleOptions
|
||||
{
|
||||
public ViperRoleOptions(byte version)
|
||||
{
|
||||
Version = version;
|
||||
}
|
||||
|
||||
public byte Version { get; }
|
||||
|
||||
public RoleTypes Type => RoleTypes.Viper;
|
||||
|
||||
public byte ViperDissolveTime { get; set; } = 15;
|
||||
|
||||
public static ViperRoleOptions Deserialize(IMessageReader reader, byte version)
|
||||
{
|
||||
var options = new ViperRoleOptions(version);
|
||||
|
||||
options.ViperDissolveTime = reader.ReadByte();
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
public void Serialize(IMessageWriter writer)
|
||||
{
|
||||
writer.Write((byte)ViperDissolveTime);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user