Skip to content

Commit 7c3dfd1

Browse files
authored
Set missing play/completion attributes (#1011)
Adds various more total/unique plays and completion stat attributes like `lbp1CompletionCount` and `lbp3UniquePlayCount` to game level responses. This allows LBP3 to correctly show all these stats without defaulting to 0 (including the play count outside the statistics page, on the tooltip). The server will set all these attributes to the play/completion stats from all games for now, but in the future they could be properly separated by game (scores already store the game they were uploaded from, but none of the play relations do so yet). Closes #708. <img width="500" height="300" alt="lel_20260209_200135" src="https://github.com/user-attachments/assets/0ea5451a-97fa-4540-a491-119ab2a70124" /> <img width="500" height="300" alt="lel_20260209_200706" src="https://github.com/user-attachments/assets/23d68dcb-cb32-4079-a68c-f9e34c1fa78d" />
2 parents 38ad17b + 03af410 commit 7c3dfd1

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

Refresh.Interfaces.Game/Endpoints/DataTypes/Response/GameLevelResponse.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public class GameLevelResponse : GameMinimalLevelResponse, IDataConvertableFrom<
1919
[XmlElement("enforceMinMaxPlayers")] public bool EnforceMinMaxPlayers { get; set; }
2020
[XmlElement("sameScreenGame")] public bool SameScreenGame { get; set; }
2121
[XmlElement("completionCount")] public int CompletionCount { get; set; }
22+
[XmlElement("lbp1CompletionCount")] public int Lbp1CompletionCount { get; set; }
23+
[XmlElement("lbp2CompletionCount")] public int Lbp2CompletionCount { get; set; }
24+
[XmlElement("lbp3CompletionCount")] public int Lbp3CompletionCount { get; set; }
2225

2326
[XmlElement("yourlbp1PlayCount")] public int YourLbp1PlayCount { get; set; }
2427
[XmlElement("yourlbp2PlayCount")] public int YourLbp2PlayCount { get; set; }
@@ -57,7 +60,11 @@ private static GameLevelResponse FromMinimal(GameMinimalLevelResponse minimal)
5760
HeartCount = minimal.HeartCount,
5861
TotalPlayCount = minimal.TotalPlayCount,
5962
UniquePlayCount = minimal.UniquePlayCount,
60-
Lbp3PlayCount = minimal.Lbp3PlayCount,
63+
Lbp1TotalPlayCount = minimal.Lbp1TotalPlayCount,
64+
Lbp1UniquePlayCount = minimal.Lbp1UniquePlayCount,
65+
Lbp2TotalPlayCount = minimal.Lbp2TotalPlayCount,
66+
Lbp3TotalPlayCount = minimal.Lbp3TotalPlayCount,
67+
Lbp3UniquePlayCount = minimal.Lbp3UniquePlayCount,
6168
YayCount = minimal.YayCount,
6269
BooCount = minimal.BooCount,
6370
AverageStarRating = minimal.AverageStarRating,
@@ -106,6 +113,9 @@ private static GameLevelResponse FromMinimal(GameMinimalLevelResponse minimal)
106113
Debug.Assert(old?.Statistics != null);
107114

108115
response.CompletionCount = old.Statistics.CompletionCount;
116+
response.Lbp1CompletionCount = old.Statistics.CompletionCount;
117+
response.Lbp2CompletionCount = old.Statistics.CompletionCount;
118+
response.Lbp3CompletionCount = old.Statistics.CompletionCount;
109119
response.PublishDate = old.PublishDate.ToUnixTimeMilliseconds();
110120
response.UpdateDate = old.UpdateDate.ToUnixTimeMilliseconds();
111121
response.MinPlayers = old.MinPlayers;

Refresh.Interfaces.Game/Types/Levels/GameMinimalLevelResponse.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ public class GameMinimalLevelResponse : IDataConvertableFrom<GameMinimalLevelRes
3434

3535
[XmlElement("playCount")] public required int TotalPlayCount { get; set; }
3636
[XmlElement("uniquePlayCount")] public required int UniquePlayCount { get; set; }
37-
[XmlElement("lbp3PlayCount")] public required int Lbp3PlayCount { get; set; }
37+
[XmlElement("lbp1PlayCount")] public required int Lbp1TotalPlayCount { get; set; }
38+
[XmlElement("lbp1UniquePlayCount")] public required int Lbp1UniquePlayCount { get; set; }
39+
[XmlElement("lbp2PlayCount")] public required int Lbp2TotalPlayCount { get; set; }
40+
// There is no lbp2UniquePlayCount attribute in the packet captures
41+
[XmlElement("lbp3PlayCount")] public required int Lbp3TotalPlayCount { get; set; }
42+
[XmlElement("lbp3UniquePlayCount")] public required int Lbp3UniquePlayCount { get; set; }
43+
3844
[XmlElement("thumbsup")] public required int YayCount { get; set; }
3945
[XmlElement("thumbsdown")] public required int BooCount { get; set; }
4046
[XmlElement("averageRating")] public double AverageStarRating { get; set; }
@@ -87,7 +93,11 @@ public static GameMinimalLevelResponse FromHash(string hash, DataContext dataCon
8793
HeartCount = 0,
8894
TotalPlayCount = 0,
8995
UniquePlayCount = 0,
90-
Lbp3PlayCount = 0,
96+
Lbp1TotalPlayCount = 0,
97+
Lbp1UniquePlayCount = 0,
98+
Lbp2TotalPlayCount = 0,
99+
Lbp3TotalPlayCount = 0,
100+
Lbp3UniquePlayCount = 0,
91101
YayCount = 0,
92102
BooCount = 0,
93103
AverageStarRating = 0,
@@ -131,7 +141,11 @@ public static GameMinimalLevelResponse FromHash(string hash, DataContext dataCon
131141
HeartCount = old.Statistics.FavouriteCount,
132142
TotalPlayCount = old.Statistics.PlayCount,
133143
UniquePlayCount = old.Statistics.UniquePlayCount,
134-
Lbp3PlayCount = old.Statistics.UniquePlayCount,
144+
Lbp1TotalPlayCount = old.Statistics.PlayCount,
145+
Lbp1UniquePlayCount = old.Statistics.UniquePlayCount,
146+
Lbp2TotalPlayCount = old.Statistics.PlayCount,
147+
Lbp3TotalPlayCount = old.Statistics.PlayCount,
148+
Lbp3UniquePlayCount = old.Statistics.UniquePlayCount,
135149
YayCount = old.Statistics.YayCount,
136150
BooCount = old.Statistics.BooCount,
137151
TeamPicked = old.TeamPicked,
@@ -223,7 +237,11 @@ public static GameMinimalLevelResponse FromHash(string hash, DataContext dataCon
223237
HeartCount = 0,
224238
TotalPlayCount = 0,
225239
UniquePlayCount = 0,
226-
Lbp3PlayCount = 0,
240+
Lbp1TotalPlayCount = 0,
241+
Lbp1UniquePlayCount = 0,
242+
Lbp2TotalPlayCount = 0,
243+
Lbp3TotalPlayCount = 0,
244+
Lbp3UniquePlayCount = 0,
227245
YayCount = 0,
228246
BooCount = 0,
229247
AverageStarRating = 0,

0 commit comments

Comments
 (0)