From: AlexejheroYTB Date: Thu, 12 Nov 2020 07:49:36 +0000 (+0200) Subject: Add MapTypes X-Git-Tag: v1.2.2~19^2~1 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=cef3605c5638fbdce5d2602c845256e504e9cb5f;p=rhonda%2Fimpostor.git Add MapTypes --- diff --git a/src/Impostor.Api/Innersloth/GameOptionsData.cs b/src/Impostor.Api/Innersloth/GameOptionsData.cs index 98e0a1a..95ef288 100644 --- a/src/Impostor.Api/Innersloth/GameOptionsData.cs +++ b/src/Impostor.Api/Innersloth/GameOptionsData.cs @@ -33,6 +33,15 @@ namespace Impostor.Api.Innersloth /// Skeld = 0, MiraHQ = 1, Polus = 2. /// public byte MapId { get; set; } + + /// + /// Gets or sets the map selected for this lobby + /// + public MapTypes Map + { + get => (MapTypes)MapId; + set => MapId = (byte)value; + } /// /// Gets or sets the Player speed modifier. diff --git a/src/Impostor.Api/Innersloth/MapId.cs b/src/Impostor.Api/Innersloth/MapId.cs index c075d73..711a886 100644 --- a/src/Impostor.Api/Innersloth/MapId.cs +++ b/src/Impostor.Api/Innersloth/MapId.cs @@ -1,8 +1,10 @@ -namespace Impostor.Api.Innersloth +using System; + +namespace Impostor.Api.Innersloth { + [Obsolete("Use Map property instead of MapId, and compare with MapTypes enum.")] public static class MapId { - // TODO: Not sure if correct, check public const int Skeld = 0; public const int MiraHQ = 1; public const int Polus = 2; diff --git a/src/Impostor.Api/Innersloth/MapTypes.cs b/src/Impostor.Api/Innersloth/MapTypes.cs new file mode 100644 index 0000000..8dc07b5 --- /dev/null +++ b/src/Impostor.Api/Innersloth/MapTypes.cs @@ -0,0 +1,9 @@ +namespace Impostor.Api.Innersloth +{ + public enum MapTypes + { + Skeld = 0, + MiraHQ = 1, + Polus = 2, + } +} \ No newline at end of file diff --git a/src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/DoorsSystemType.cs b/src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/DoorsSystemType.cs index fc01578..712b00a 100644 --- a/src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/DoorsSystemType.cs +++ b/src/Impostor.Server/Net/Inner/Objects/Systems/ShipStatus/DoorsSystemType.cs @@ -14,11 +14,11 @@ namespace Impostor.Server.Net.Inner.Objects.Systems.ShipStatus public DoorsSystemType(IGame game) { // TODO: Check - var doorCount = game.Options.MapId switch + var doorCount = game.Options.Map switch { - MapId.Skeld => 13, - MapId.MiraHQ => 2, - MapId.Polus => 12, + MapTypes.Skeld => 13, + MapTypes.MiraHQ => 2, + MapTypes.Polus => 12, _ => throw new ArgumentOutOfRangeException() };