[F] Fix music difficulty unlock conflict

pull/29/head
Azalea 2024-03-29 02:58:25 -04:00
parent 26a72244c0
commit d7fc6f9f49
1 changed files with 4 additions and 1 deletions

View File

@ -222,7 +222,8 @@ fun WaccaServer.init() {
if (recv.isEmpty()) return
val newItems = mutableListOf<WcUserItem>()
recv.forEach { (type, id, param) ->
val ex = items[type]?.get(id)
var ex = items[type]?.get(id)
if (type == MUSIC_DIFFICULTY_UNLOCK()) ex = ex ?: items[MUSIC_UNLOCK()]?.get(id)
when (type) {
WP() -> { u.wp += param; u.wpTotal += param }
XP() -> u.xp += param
@ -306,6 +307,8 @@ fun WaccaServer.init() {
rating = waccaRating(achievement, pl.levelConst)
})
// TODO: Update player rating - Best 35 old & 15 new
// Re-calculate user total score
rp.user.save(u.apply { totalScore = rp.bestScore.sumScoreByUser(u) })