Add workaround for weird score bug

This commit is contained in:
Slendy 2022-11-13 17:28:04 -06:00
parent a253e768a7
commit 75de1d0faa
No known key found for this signature in database
GPG key ID: 7288D68361B91428
2 changed files with 31 additions and 2 deletions

View file

@ -48,6 +48,10 @@ public class ScoreController : ControllerBase
return this.BadRequest();
}
// This only seems to happens on lbp2 versus levels, not sure why
if(score.PlayerIdCollection.Contains(':'))
score.PlayerIdCollection = score.PlayerIdCollection.Replace(':', ',');
if (score.PlayerIds.Length == 0)
{
Logger.Warn($"Rejecting score upload, there are 0 playerIds (slotType={slotType}, slotId={id}, user={username})", LogArea.Score);
@ -77,7 +81,7 @@ public class ScoreController : ControllerBase
string bodyString = await new StreamReader(this.Request.Body).ReadToEndAsync();
Logger.Warn("Rejecting score upload, requester username is not present in playerIds" +
$" (user={username}, playerIds={string.Join(",", score.PlayerIds)}, " +
$"gameVersion={token.GameVersion.ToPrettyString()}, type={score.Type}, id={score.SlotId}, slotType={slotType}, body='{bodyString}')", LogArea.Score);
$"gameVersion={token.GameVersion.ToPrettyString()}, type={score.Type}, id={id}, slotType={slotType}, body='{bodyString}')", LogArea.Score);
return this.BadRequest();
}
@ -169,7 +173,10 @@ public class ScoreController : ControllerBase
UserFriendData? store = UserFriendStore.GetUserFriendData(token.UserId);
if (store == null) return this.Ok();
List<string> friendNames = new();
List<string> friendNames = new()
{
username,
};
foreach (int friendId in store.FriendIds)
{