diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ScoreController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ScoreController.cs
index 8a859fd7..a7c41dd6 100644
--- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ScoreController.cs
+++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ScoreController.cs
@@ -152,7 +152,9 @@ public class ScoreController : ControllerBase
this.database.Scores.Add(existingScore);
}
- if (score.Points > existingScore.Points)
+ bool personalBest = score.Points > existingScore.Points;
+
+ if (personalBest)
{
existingScore.Points = score.Points;
existingScore.Timestamp = TimeHelper.TimestampMillis;
@@ -172,12 +174,14 @@ public class ScoreController : ControllerBase
TargetPlayerIds = null,
});
- if (score.Type == 1 && scores.YourRank == 1 && scores.Total > 1)
+ // if this is a PB, singleplayer, at the top of the leaderboard (not scores.YourRank==1 because it might be tied), and there is at least one other score,
+ // send a notification to the user with the previous highscore
+ if (personalBest && score.Type == 1 && scores.Scores[0].UserId == token.UserId && scores.Total > 1)
{
GameScore? second = scores.Scores[1];
UserEntity? user = await this.database.UserFromGameToken(token);
- await this.database.SendNotification(second.UserId, $"{user?.InfoXml} beat your highscore ({second.Points}) on {slot.InfoXml} with a score of {score.Points}.", true);
+ await this.database.SendNotification(second.UserId, $"{user?.InfoXml} beat your highscore ({second.Points}) on {slot.InfoXml} with a score of {score.Points}.", false);
}
return this.Ok(scores);