diff --git a/fluXis.Game/Map/MapEvents.cs b/fluXis.Game/Map/MapEvents.cs index e37ff3a8..aad534b1 100644 --- a/fluXis.Game/Map/MapEvents.cs +++ b/fluXis.Game/Map/MapEvents.cs @@ -82,6 +82,13 @@ public class MapEvents : IDeepCloneable && TimeOffsetEvents.Count == 0 && NoteEvents.Count == 0; + #region Server-Side Stuff + + [JsonIgnore] + public string RawContent { get; set; } = ""; + + #endregion + public static T Load(string content) where T : MapEvents, new() { @@ -89,6 +96,7 @@ public static T Load(string content) return new T().loadLegacy(content) as T; var events = content.Deserialize(); + events.RawContent = content; return events.Sort() as T; } diff --git a/fluXis.Game/Map/MapInfo.cs b/fluXis.Game/Map/MapInfo.cs index 3535b0d1..2d6dcb54 100644 --- a/fluXis.Game/Map/MapInfo.cs +++ b/fluXis.Game/Map/MapInfo.cs @@ -89,6 +89,19 @@ public int MaxCombo [JsonIgnore] public string StoryboardHash { get; private set; } + #region Server-Side Stuff + + [JsonIgnore] + public string RawContent { get; set; } = ""; + + [JsonIgnore] + public string FileName { get; set; } = ""; + + [JsonIgnore] + public int KeyCount => HitObjects.Max(x => x.Lane); + + #endregion + public MapInfo(MapMetadata metadata) : this() { diff --git a/fluXis.Game/Online/API/Models/Chat/APIChatChannel.cs b/fluXis.Game/Online/API/Models/Chat/APIChatChannel.cs index 4e839229..e34af292 100644 --- a/fluXis.Game/Online/API/Models/Chat/APIChatChannel.cs +++ b/fluXis.Game/Online/API/Models/Chat/APIChatChannel.cs @@ -8,13 +8,13 @@ public class APIChatChannel public string Name { get; init; } = null!; [JsonProperty("type")] - public ChannelType Type { get; init; } + public APIChannelType Type { get; init; } [JsonProperty("count")] public long UserCount { get; init; } } -public enum ChannelType +public enum APIChannelType { Public = 0, Private = 1 diff --git a/fluXis.Game/Online/API/Models/Clubs/APIClub.cs b/fluXis.Game/Online/API/Models/Clubs/APIClub.cs index 8f99a835..72282839 100644 --- a/fluXis.Game/Online/API/Models/Clubs/APIClub.cs +++ b/fluXis.Game/Online/API/Models/Clubs/APIClub.cs @@ -28,7 +28,7 @@ public class APIClub public long MemberCount { get; set; } [JsonProperty("colors")] - public List Colors { get; set; } = new(); + public List Colors { get; set; } = new(); #region Optional @@ -53,7 +53,7 @@ public static APIClub CreateUnknown(long id) ID = id, Name = "Unknown Club", Tag = "UNK", - Colors = new List + Colors = new List { new() { Color = "#ffffff", Position = 0 }, new() { Color = "#ffffff", Position = 0 } diff --git a/fluXis.Game/Online/API/Models/Other/GradientColor.cs b/fluXis.Game/Online/API/Models/Other/APIGradientColor.cs similarity index 88% rename from fluXis.Game/Online/API/Models/Other/GradientColor.cs rename to fluXis.Game/Online/API/Models/Other/APIGradientColor.cs index 3665ac1c..32ca202e 100644 --- a/fluXis.Game/Online/API/Models/Other/GradientColor.cs +++ b/fluXis.Game/Online/API/Models/Other/APIGradientColor.cs @@ -2,7 +2,7 @@ namespace fluXis.Game.Online.API.Models.Other; -public class GradientColor +public class APIGradientColor { [JsonProperty("color")] public string Color { get; set; } = "#ffffff"; diff --git a/fluXis.Game/Online/API/Models/Users/Equipment/APINamePaint.cs b/fluXis.Game/Online/API/Models/Users/Equipment/APINamePaint.cs index ae4c94ce..3660c3dc 100644 --- a/fluXis.Game/Online/API/Models/Users/Equipment/APINamePaint.cs +++ b/fluXis.Game/Online/API/Models/Users/Equipment/APINamePaint.cs @@ -13,5 +13,5 @@ public class APINamePaint public string Name { get; set; } = ""; [JsonProperty("colors")] - public List Colors { get; set; } = new(); + public List Colors { get; set; } = new(); } diff --git a/fluXis.Game/Utils/Extensions/APIExtensions.cs b/fluXis.Game/Utils/Extensions/APIExtensions.cs index 00af9a3e..0913f2bf 100644 --- a/fluXis.Game/Utils/Extensions/APIExtensions.cs +++ b/fluXis.Game/Utils/Extensions/APIExtensions.cs @@ -21,7 +21,7 @@ public static class APIExtensions public static ColourInfo CreateColorInfo(this APIClub club) => CreateColorInfo(club.Colors); - public static ColourInfo CreateColorInfo(this List colors) + public static ColourInfo CreateColorInfo(this List colors) { try { diff --git a/fluXis.Game/Utils/MapUtils.cs b/fluXis.Game/Utils/MapUtils.cs index cc67f615..220a1a41 100644 --- a/fluXis.Game/Utils/MapUtils.cs +++ b/fluXis.Game/Utils/MapUtils.cs @@ -137,7 +137,7 @@ public static RealmMapFilters UpdateFilters(this RealmMapFilters filters, MapInf filters.NoteCount++; } - filters.NotesPerSecond = getNps(map.HitObjects); + filters.NotesPerSecond = GetNps(map.HitObjects); foreach (var timingPoint in map.TimingPoints) { @@ -152,12 +152,15 @@ public static RealmMapFilters UpdateFilters(this RealmMapFilters filters, MapInf filters.Effects |= MapEffectType.ScrollVelocity; if (events != null) - filters.Effects = getEffects(events); + filters.Effects = GetEffects(events); return filters; } - private static MapEffectType getEffects(MapEvents events) + public static RealmMapFilters GetMapFilters(MapInfo map, MapEvents events) + => new RealmMapFilters().UpdateFilters(map, events); + + public static MapEffectType GetEffects(MapEvents events) { MapEffectType effects = 0; @@ -206,10 +209,7 @@ private static MapEffectType getEffects(MapEvents events) return effects; } - public static RealmMapFilters GetMapFilters(MapInfo map, MapEvents events) - => new RealmMapFilters().UpdateFilters(map, events); - - private static float getNps(List hitObjects) + public static float GetNps(List hitObjects) { if (hitObjects.Count == 0) return 0;