diff --git a/ProjectLighthouse/Controllers/SlotsController.cs b/ProjectLighthouse/Controllers/SlotsController.cs index f305c14e..192a3d4b 100644 --- a/ProjectLighthouse/Controllers/SlotsController.cs +++ b/ProjectLighthouse/Controllers/SlotsController.cs @@ -41,7 +41,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers .Include(s => s.Location) .Where(s => s.Creator!.Username == user.Username) .Skip(pageStart - 1) - .Take(Math.Min(pageSize, ServerStatics.EntitledSlots)), + .Take(Math.Min(pageSize, ServerSettings.Instance.EntitledSlots)), string.Empty, (current, slot) => current + slot.Serialize() ); @@ -55,7 +55,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers new Dictionary { { - "hint_start", pageStart + Math.Min(pageSize, ServerStatics.EntitledSlots) + "hint_start", pageStart + Math.Min(pageSize, ServerSettings.Instance.EntitledSlots) }, { "total", user.UsedSlots diff --git a/ProjectLighthouse/Pages/UserPage.cshtml b/ProjectLighthouse/Pages/UserPage.cshtml index 6f015362..15af68f3 100644 --- a/ProjectLighthouse/Pages/UserPage.cshtml +++ b/ProjectLighthouse/Pages/UserPage.cshtml @@ -17,7 +17,7 @@
@Model.ProfileUser.Hearts @Model.ProfileUser.Comments - @Model.ProfileUser.UsedSlots / @ServerStatics.EntitledSlots + @Model.ProfileUser.UsedSlots / @ServerSettings.Instance.EntitledSlots @Model.ProfileUser.PhotosByMe
diff --git a/ProjectLighthouse/Types/Settings/ServerSettings.cs b/ProjectLighthouse/Types/Settings/ServerSettings.cs index 017539b3..eabf41c4 100644 --- a/ProjectLighthouse/Types/Settings/ServerSettings.cs +++ b/ProjectLighthouse/Types/Settings/ServerSettings.cs @@ -63,7 +63,7 @@ namespace LBPUnion.ProjectLighthouse.Types.Settings } } - public const int CurrentConfigVersion = 9; // MUST BE INCREMENTED FOR EVERY CONFIG CHANGE! + public const int CurrentConfigVersion = 10; // MUST BE INCREMENTED FOR EVERY CONFIG CHANGE! #region Meta @@ -95,5 +95,12 @@ namespace LBPUnion.ProjectLighthouse.Types.Settings public bool CheckForUnsafeFiles { get; set; } = true; public bool RegistrationEnabled { get; set; } = true; + + /// + /// The maximum amount of slots allowed on users' earth + /// + public int EntitledSlots { get; set; } = 50; + + public int ListsQuota { get; set; } = 50; } } \ No newline at end of file diff --git a/ProjectLighthouse/Types/Settings/ServerStatics.cs b/ProjectLighthouse/Types/Settings/ServerStatics.cs index a6b29548..900f9d66 100644 --- a/ProjectLighthouse/Types/Settings/ServerStatics.cs +++ b/ProjectLighthouse/Types/Settings/ServerStatics.cs @@ -8,13 +8,6 @@ namespace LBPUnion.ProjectLighthouse.Types.Settings { public static class ServerStatics { - /// - /// The maximum amount of slots allowed on users' earth - /// - public const int EntitledSlots = 50; - - public const int ListsQuota = 50; - public const string ServerName = "ProjectLighthouse"; public static bool DbConnected { diff --git a/ProjectLighthouse/Types/User.cs b/ProjectLighthouse/Types/User.cs index f87a872c..1f100d2f 100644 --- a/ProjectLighthouse/Types/User.cs +++ b/ProjectLighthouse/Types/User.cs @@ -120,7 +120,8 @@ namespace LBPUnion.ProjectLighthouse.Types LbpSerializer.StringElement("game", this.Game) + this.SerializeSlots(gameVersion == GameVersion.LittleBigPlanetVita) + LbpSerializer.StringElement("lists", this.Lists) + - LbpSerializer.StringElement("lists_quota", ServerStatics.ListsQuota) + // technically not a part of the user but LBP expects it + LbpSerializer.StringElement + ("lists_quota", ServerSettings.Instance.ListsQuota) + // technically not a part of the user but LBP expects it LbpSerializer.StringElement("biography", this.Biography) + LbpSerializer.StringElement("reviewCount", this.Reviews) + LbpSerializer.StringElement("commentCount", this.Comments) + @@ -162,7 +163,7 @@ namespace LBPUnion.ProjectLighthouse.Types /// /// The number of slots remaining on the earth /// - public int FreeSlots => ServerStatics.EntitledSlots - this.UsedSlots; + public int FreeSlots => ServerSettings.Instance.EntitledSlots - this.UsedSlots; private static readonly string[] slotTypes = { @@ -192,12 +193,12 @@ namespace LBPUnion.ProjectLighthouse.Types slotTypesLocal = slotTypes; } - slots += LbpSerializer.StringElement("entitledSlots", ServerStatics.EntitledSlots); + slots += LbpSerializer.StringElement("entitledSlots", ServerSettings.Instance.EntitledSlots); slots += LbpSerializer.StringElement("freeSlots", this.FreeSlots); foreach (string slotType in slotTypesLocal) { - slots += LbpSerializer.StringElement(slotType + "EntitledSlots", ServerStatics.EntitledSlots); + slots += LbpSerializer.StringElement(slotType + "EntitledSlots", ServerSettings.Instance.EntitledSlots); // ReSharper disable once StringLiteralTypo slots += LbpSerializer.StringElement(slotType + slotType == "crossControl" ? "PurchsedSlots" : "PurchasedSlots", 0); slots += LbpSerializer.StringElement(slotType + "FreeSlots", this.FreeSlots);