/// <summary>
/// Gets or sets host's version of the game.
/// </summary>
- public byte Version { get; set; }
+ public byte Version { get; set; } = LatestVersion;
/// <summary>
/// Gets or sets the maximum amount of players for this lobby.
/// </summary>
- public byte MaxPlayers { get; set; }
+ public byte MaxPlayers { get; set; } = 10;
/// <summary>
/// Gets or sets the language of the lobby as per <see cref="GameKeywords"/> enum.
/// </summary>
- public GameKeywords Keywords { get; set; }
+ public GameKeywords Keywords { get; set; } = GameKeywords.English;
/// <summary>
- /// Gets or sets the MapId selected for this lobby
+ /// Gets or sets the Map selected for this lobby.
/// </summary>
- /// <remarks>
- /// Skeld = 0, MiraHQ = 1, Polus = 2.
- /// </remarks>
- internal byte MapId { get; set; }
-
- /// <summary>
- /// Gets or sets the map selected for this lobby
- /// </summary>
- public MapTypes Map
- {
- get => (MapTypes)MapId;
- set => MapId = (byte)value;
- }
+ public MapTypes Map { get; set; } = MapTypes.Skeld;
/// <summary>
/// Gets or sets the Player speed modifier.
/// </summary>
- public float PlayerSpeedMod { get; set; }
+ public float PlayerSpeedMod { get; set; } = 1f;
/// <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; }
+ public float CrewLightMod { get; set; } = 1f;
/// <summary>
/// Gets or sets the Light modifier for the players that are Impostors as a multiplier value.
/// </summary>
- public float ImpostorLightMod { get; set; }
+ public float ImpostorLightMod { get; set; } = 1f;
/// <summary>
/// Gets or sets the Impostor cooldown to kill in seconds.
/// </summary>
- public float KillCooldown { get; set; }
+ public float KillCooldown { get; set; } = 15f;
/// <summary>
/// Gets or sets the number of common tasks.
/// </summary>
- public int NumCommonTasks { get; set; }
+ public int NumCommonTasks { get; set; } = 1;
/// <summary>
/// Gets or sets the number of long tasks.
/// </summary>
- public int NumLongTasks { get; set; }
+ public int NumLongTasks { get; set; } = 1;
/// <summary>
/// Gets or sets the number of short tasks.
/// </summary>
- public int NumShortTasks { get; set; }
+ public int NumShortTasks { get; set; } = 2;
/// <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; }
+ public int NumEmergencyMeetings { get; set; } = 1;
/// <summary>
/// Gets or sets the cooldown between each time any player can call an emergency meeting in seconds.
/// </summary>
- public int EmergencyCooldown { get; set; }
+ public int EmergencyCooldown { get; set; } = 15;
/// <summary>
/// Gets or sets the number of impostors for this lobby.
/// </summary>
- public int NumImpostors { get; set; }
+ public int NumImpostors { get; set; } = 1;
/// <summary>
/// Gets or sets a value indicating whether ghosts (dead crew members) can do tasks.
/// </summary>
- public bool GhostsDoTasks { get; set; }
+ public bool GhostsDoTasks { get; set; } = true;
/// <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; }
+ public KillDistances KillDistance { get; set; } = KillDistances.Normal;
/// <summary>
/// Gets or sets the time for discussion before voting time in seconds.
/// </summary>
- public int DiscussionTime { get; set; }
+ public int DiscussionTime { get; set; } = 15;
/// <summary>
/// Gets or sets the time for voting in seconds.
/// </summary>
- public int VotingTime { get; set; }
+ public int VotingTime { get; set; } = 120;
/// <summary>
/// Gets or sets a value indicating whether an ejected player is an impostor or not.
/// </summary>
- public bool ConfirmImpostor { get; set; }
+ public bool ConfirmImpostor { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether players are able to see tasks being performed by other players.
/// <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; }
+ public bool VisualTasks { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether the vote is anonymous.
/// <summary>
/// Gets or sets the task bar update mode as per values in <see cref="Innersloth.TaskBarUpdate"/>.
/// </summary>
- public TaskBarUpdate TaskBarUpdate { get; set; }
+ public TaskBarUpdate TaskBarUpdate { get; set; } = TaskBarUpdate.Always;
/// <summary>
/// Gets or sets a value indicating whether the GameOptions are the default ones.
/// </summary>
- public bool IsDefaults { get; set; }
+ public bool IsDefaults { get; set; } = true;
/// <summary>
/// Deserialize a packet/message to a new GameOptionsData object.
writer.Write((byte)version);
writer.Write((byte)MaxPlayers);
writer.Write((uint)Keywords);
- writer.Write((byte)MapId);
+ writer.Write((byte)Map);
writer.Write((float)PlayerSpeedMod);
writer.Write((float)CrewLightMod);
writer.Write((float)ImpostorLightMod);
Version = bytes.ReadByte();
MaxPlayers = bytes.ReadByte();
Keywords = (GameKeywords)bytes.ReadUInt32();
- MapId = bytes.ReadByte();
+ Map = (MapTypes)bytes.ReadByte();
PlayerSpeedMod = bytes.ReadSingle();
CrewLightMod = bytes.ReadSingle();
using System.Threading.Tasks;
+using Impostor.Api.Games.Managers;
+using Impostor.Api.Innersloth;
using Impostor.Api.Plugins;
using Microsoft.Extensions.Logging;
public class ExamplePlugin : PluginBase
{
private readonly ILogger<ExamplePlugin> _logger;
+ private readonly IGameManager _gameManager;
- public ExamplePlugin(ILogger<ExamplePlugin> logger)
+ public ExamplePlugin(ILogger<ExamplePlugin> logger, IGameManager gameManager)
{
_logger = logger;
+ _gameManager = gameManager;
}
- public override ValueTask EnableAsync()
+ public override async ValueTask EnableAsync()
{
_logger.LogInformation("Example is being enabled.");
- return default;
+
+ var game = await _gameManager.CreateAsync(new GameOptionsData());
+ game.DisplayName = "Example game";
+ await game.SetPrivacyAsync(true);
+
+ _logger.LogInformation("Created game {0}.", game.Code.Code);
}
public override ValueTask DisableAsync()