From f7c4f09fc79379b333d16a940cecdf63b324ba38 Mon Sep 17 00:00:00 2001 From: jvyden Date: Wed, 6 Oct 2021 12:01:13 -0400 Subject: [PATCH] Move static fields from User.cs to ServerSettings.cs --- ProjectLighthouse/Types/ServerSettings.cs | 10 ++++++++++ ProjectLighthouse/Types/User.cs | 18 ++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 ProjectLighthouse/Types/ServerSettings.cs diff --git a/ProjectLighthouse/Types/ServerSettings.cs b/ProjectLighthouse/Types/ServerSettings.cs new file mode 100644 index 00000000..bf045e2d --- /dev/null +++ b/ProjectLighthouse/Types/ServerSettings.cs @@ -0,0 +1,10 @@ +namespace ProjectLighthouse.Types { + public static class ServerSettings { + /// + /// The maximum amount of slots allowed on users' earth + /// + public static int EntitledSlots = 20; + + public static int ListsQuota = 20; + } +} \ No newline at end of file diff --git a/ProjectLighthouse/Types/User.cs b/ProjectLighthouse/Types/User.cs index 12004fd1..cbff3e58 100644 --- a/ProjectLighthouse/Types/User.cs +++ b/ProjectLighthouse/Types/User.cs @@ -6,7 +6,6 @@ namespace ProjectLighthouse.Types { public string IconHash { get; set; } public int Game { get; set; } public int Lists { get; set; } - public static int ListsQuota = 20; public int HeartCount { get; set; } public string YayHash { get; set; } public string BooHash { get; set; } @@ -32,15 +31,10 @@ namespace ProjectLighthouse.Types { public int StaffChallengeGoldCount { get; set; } public int StaffChallengeSilverCount { get; set; } public int StaffChallengeBronzeCount { get; set; } - public ClientsConnected ClientsConnected; + public ClientsConnected ClientsConnected { get; set; } #region Slots - - /// - /// The maximum amount of slots allowed on the earth - /// - public static int EntitledSlots = 20; - + /// /// The number of used slots on the earth /// @@ -49,7 +43,7 @@ namespace ProjectLighthouse.Types { /// /// The number of slots remaining on the earth /// - public int FreeSlots => EntitledSlots - this.UsedSlots; + public int FreeSlots => ServerSettings.EntitledSlots - this.UsedSlots; private static string[] slotTypes = { // "lbp1", @@ -62,12 +56,12 @@ namespace ProjectLighthouse.Types { string slots = string.Empty; slots += LbpSerializer.StringElement("lbp1UsedSlots", this.UsedSlots); - slots += LbpSerializer.StringElement("entitledSlots", EntitledSlots); + slots += LbpSerializer.StringElement("entitledSlots", ServerSettings.EntitledSlots); slots += LbpSerializer.StringElement("freeSlots", this.FreeSlots); foreach(string slotType in slotTypes) { slots += LbpSerializer.StringElement(slotType + "UsedSlots", this.UsedSlots); - slots += LbpSerializer.StringElement(slotType + "EntitledSlots", EntitledSlots); + slots += LbpSerializer.StringElement(slotType + "EntitledSlots", ServerSettings.EntitledSlots); // ReSharper disable once StringLiteralTypo slots += LbpSerializer.StringElement(slotType + slotType == "crossControl" ? "PurchsedSlots" : "PurchasedSlots", 0); slots += LbpSerializer.StringElement(slotType + "FreeSlots", this.FreeSlots); @@ -83,7 +77,7 @@ namespace ProjectLighthouse.Types { LbpSerializer.StringElement("game", this.Game) + this.SerializeSlots() + LbpSerializer.StringElement("lists", this.Lists) + - LbpSerializer.StringElement("lists_quota", ListsQuota) + + LbpSerializer.StringElement("lists_quota", ServerSettings.ListsQuota) + // technically not a part of the user but LBP expects it LbpSerializer.StringElement("heartCount", this.HeartCount) + LbpSerializer.StringElement("yay2", this.YayHash) + LbpSerializer.StringElement("boo2", this.BooHash) +