Skip to content

Commit

Permalink
wip(1.35): new extended status fields
Browse files Browse the repository at this point in the history
  • Loading branch information
roydejong committed Apr 4, 2024
1 parent e4a37fc commit 3a7e582
Showing 1 changed file with 59 additions and 44 deletions.
103 changes: 59 additions & 44 deletions MultiplayerCore/Models/MpStatusData.cs
Original file line number Diff line number Diff line change
@@ -1,60 +1,74 @@
using System;
using Newtonsoft.Json;

// ReSharper disable InconsistentNaming
namespace MultiplayerCore.Models
{
[Serializable]
public class MpStatusData : MultiplayerStatusData
{
/// <summary>
/// Handled by MultiplayerCore. If defined, and if a mod with a bad version is found, the multiplayer status
/// check fails and MUR-5 is returned.
/// </summary>
[JsonProperty("required_mods")]
private RequiredMod[] _requiredMods
{
get
{
return requiredMods;
}

set
{
requiredMods = value;
}
}
public RequiredMod[]? requiredMods { get; set; }

/// <summary>
/// Handled by MultiplayerCore. If defined, and if the current game version exceeds this version, the
/// multiplayer status check fails and MUR-6 is returned.
/// </summary>
[JsonProperty("maximum_app_version")]
private string _maximumAppVersion
{
get
{
return maximumAppVersion;
}
public string? maximumAppVersion { get; set; }

set
{
maximumAppVersion = value;
}
}

/// <summary>
/// Information only. Indicates whether dedicated server connections should use SSL/TLS. Currently, most modded
/// multiplayer servers do not use encryption.
/// </summary>
[JsonProperty("use_ssl")]
private bool _useSsl
{
get
{
return useSsl;
}
public bool useSsl { get; set; }

set
{
useSsl = value;
}
}
/// <summary>
/// Information only. Master server display name.
/// </summary>
[JsonProperty("name")]
public string? name { get; set; }

/// <summary>
/// Information only. Master server display description.
/// </summary>
[JsonProperty("description")]
public string? description { get; set; }

/// <summary>
/// Information only. Master server display image URL.
/// </summary>
[JsonProperty("image_url")]
public string? imageUrl { get; set; }

/// <summary>
/// Information only. Maximum player count when creating new lobbies.
/// </summary>
[JsonProperty("max_players")]
public int maxPlayers { get; set; }

public RequiredMod[] requiredMods = null!;
public string maximumAppVersion = null!;
/// <summary>
/// Request SSL (DTLS) connections when connecting to dedicated servers.
/// MultiplayerCore does NOT enforce this setting.
/// Information only. Server capability: per-player modifiers.
/// </summary>
public bool useSsl = false;
[JsonProperty("supports_pp_modifiers")]
public bool supportsPPModifiers { get; set; }

/// <summary>
/// Information only. Server capability: per-player difficulties.
/// </summary>
[JsonProperty("supports_pp_difficulties")]
public bool supportsPPDifficulties { get; set; }

/// <summary>
/// Information only. Server capability: per-player level selection.
/// </summary>
[JsonProperty("supports_pp_maps")]
public bool supportsPPMaps { get; set; }

[Serializable]
public class RequiredMod
Expand All @@ -63,15 +77,16 @@ public class RequiredMod
/// BSIPA Mod ID.
/// </summary>
public string id = null!;

/// <summary>
/// Minimum version of the mod required.
/// Minimum version of the mod required, if installed.
/// </summary>
public string version = null!;

/// <summary>
/// Indicates whether the mod is required or not.
/// If false, only minimum versions are enforced.
/// Indicates whether the mod must be installed.
/// </summary>
public bool required = false;
}
}
}
}

0 comments on commit 3a7e582

Please sign in to comment.