]> git.deb.at Git - rhonda/impostor.git/commitdiff
Xml documentation for the GameOptionsData class. (#85)
authorSombrio <chrisparkerrr@gmail.com>
Sun, 25 Oct 2020 21:40:34 +0000 (18:40 -0300)
committerGitHub <noreply@github.com>
Sun, 25 Oct 2020 21:40:34 +0000 (22:40 +0100)
src/Impostor.Api/Innersloth/GameOptionsData.cs
src/Impostor.Api/Innersloth/KillDistances.cs [new file with mode: 0644]

index 9bb30cd20a29eeeb1df0075998b12ca9bb39c7eb..98e0a1a9d86a0ff4c7b9b9c135c415b2d1c1910a 100644 (file)
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.IO;
 using Impostor.Api.Net.Messages;
 
@@ -6,54 +6,152 @@ namespace Impostor.Api.Innersloth
 {
     public class GameOptionsData
     {
+        /// <summary>
+        /// The latest major version of the game client.
+        /// </summary>
         public const int LatestVersion = 2;
 
+        /// <summary>
+        /// Gets or sets host's version of the game.
+        /// </summary>
         public byte Version { get; set; }
 
+        /// <summary>
+        /// Gets or sets the maximum amount of players for this lobby.
+        /// </summary>
         public byte MaxPlayers { get; set; }
 
+        /// <summary>
+        /// Gets or sets the language of the lobby as per <see cref="GameKeywords"/> enum.
+        /// </summary>
         public GameKeywords Keywords { get; set; }
 
+        /// <summary>
+        /// Gets or sets the MapId selected for this lobby as per values in <see cref="Innersloth.MapId"/>.
+        /// </summary>
+        /// <remarks>
+        /// Skeld = 0, MiraHQ = 1, Polus = 2.
+        /// </remarks>
         public byte MapId { get; set; }
 
+        /// <summary>
+        /// Gets or sets the Player speed modifier.
+        /// </summary>
         public float PlayerSpeedMod { get; set; }
 
+        /// <summary>
+        /// Gets or sets the Light modifier for the players that are members of the crew as a multiplier value.
+        /// </summary>
         public float CrewLightMod { get; set; }
 
+        /// <summary>
+        /// Gets or sets the Light modifier for the players that are Impostors as a multiplier value.
+        /// </summary>
         public float ImpostorLightMod { get; set; }
 
+        /// <summary>
+        /// Gets or sets the Impostor cooldown to kill in seconds.
+        /// </summary>
         public float KillCooldown { get; set; }
 
+        /// <summary>
+        /// Gets or sets the number of common tasks.
+        /// </summary>
         public int NumCommonTasks { get; set; }
 
+        /// <summary>
+        /// Gets or sets the number of long tasks.
+        /// </summary>
         public int NumLongTasks { get; set; }
 
+        /// <summary>
+        /// Gets or sets the number of short tasks.
+        /// </summary>
         public int NumShortTasks { get; set; }
 
+        /// <summary>
+        /// Gets or sets the maximum amount of emergency meetings each player can call during the game in seconds.
+        /// </summary>
         public int NumEmergencyMeetings { get; set; }
 
+        /// <summary>
+        /// Gets or sets the cooldown between each time any player can call an emergency meeting in seconds.
+        /// </summary>
         public int EmergencyCooldown { get; set; }
 
+        /// <summary>
+        /// Gets or sets the number of impostors for this lobby.
+        /// </summary>
         public int NumImpostors { get; set; }
 
+        /// <summary>
+        /// Gets or sets a value indicating whether ghosts (dead crew members) can do tasks.
+        /// </summary>
         public bool GhostsDoTasks { get; set; }
 
-        public int KillDistance { get; set; }
-
+        /// <summary>
+        /// Gets or sets the Kill as per values in <see cref="KillDistances"/>.
+        /// </summary>
+        /// <remarks>
+        /// Short = 0, Normal = 1, Long = 2.
+        /// </remarks>
+        public KillDistances KillDistance { get; set; }
+
+        /// <summary>
+        /// Gets or sets the time for discussion before voting time in seconds.
+        /// </summary>
         public int DiscussionTime { get; set; }
 
+        /// <summary>
+        /// Gets or sets the time for voting in seconds.
+        /// </summary>
         public int VotingTime { get; set; }
 
+        /// <summary>
+        /// Gets or sets a value indicating whether an ejected player is an impostor or not.
+        /// </summary>
         public bool ConfirmImpostor { get; set; }
 
+        /// <summary>
+        /// Gets or sets a value indicating whether players are able to see tasks being performed by other players.
+        /// </summary>
+        /// <remarks>
+        /// By being set to true, tasks such as Empty Garbage, Submit Scan, Clear asteroids, Prime shields execution will be visible to other players.
+        /// </remarks>
         public bool VisualTasks { get; set; }
 
+        /// <summary>
+        /// Gets or sets a value indicating whether the vote is anonymous.
+        /// </summary>
         public bool AnonymousVotes { get; set; }
 
+        /// <summary>
+        /// Gets or sets the task bar update mode as per values in <see cref="Innersloth.TaskBarUpdate"/>.
+        /// </summary>
         public TaskBarUpdate TaskBarUpdate { get; set; }
 
+        /// <summary>
+        /// Gets or sets a value indicating whether the GameOptions are the default ones.
+        /// </summary>
         public bool IsDefaults { get; set; }
 
+        /// <summary>
+        /// Deserialize a packet/message to a new GameOptionsData object.
+        /// </summary>
+        /// <param name="reader">Message reader object containing the raw message.</param>
+        /// <returns>GameOptionsData object.</returns>
+        public static GameOptionsData DeserializeCreate(IMessageReader reader)
+        {
+            var options = new GameOptionsData();
+            options.Deserialize(reader.ReadBytesAndSize());
+            return options;
+        }
+
+        /// <summary>
+        /// Serializes this instance of GameOptionsData object to a specified BinaryWriter.
+        /// </summary>
+        /// <param name="writer">The stream to write the message to.</param>
+        /// <param name="version">The version of the game.</param>
         public void Serialize(BinaryWriter writer, byte version)
         {
             writer.Write((byte)version);
@@ -97,6 +195,10 @@ namespace Impostor.Api.Innersloth
             }
         }
 
+        /// <summary>
+        /// Deserialize a ReadOnlyMemory object to this instance of the GameOptionsData object.
+        /// </summary>
+        /// <param name="memory">Memory containing the message/packet.</param>
         public void Deserialize(ReadOnlyMemory<byte> memory)
         {
             var bytes = memory.Span;
@@ -118,7 +220,7 @@ namespace Impostor.Api.Innersloth
             NumEmergencyMeetings = bytes.ReadInt32();
 
             NumImpostors = bytes.ReadByte();
-            KillDistance = bytes.ReadByte();
+            KillDistance = (KillDistances)bytes.ReadByte();
             DiscussionTime = bytes.ReadInt32();
             VotingTime = bytes.ReadInt32();
 
@@ -146,12 +248,5 @@ namespace Impostor.Api.Innersloth
                 throw new ImpostorException($"Unknown GameOptionsData version {Version}.");
             }
         }
-
-        public static GameOptionsData DeserializeCreate(IMessageReader reader)
-        {
-            var options = new GameOptionsData();
-            options.Deserialize(reader.ReadBytesAndSize());
-            return options;
-        }
     }
 }
\ No newline at end of file
diff --git a/src/Impostor.Api/Innersloth/KillDistances.cs b/src/Impostor.Api/Innersloth/KillDistances.cs
new file mode 100644 (file)
index 0000000..b2ee5d9
--- /dev/null
@@ -0,0 +1,12 @@
+using System;
+
+namespace Impostor.Api.Innersloth
+{
+    [Flags]
+    public enum KillDistances : byte
+    {
+        Short = 0,
+        Normal = 1,
+        Long = 2,
+    }
+}