From 55b47a3c02c4c3f44a1428cca5fef3083ec00f06 Mon Sep 17 00:00:00 2001 From: RandomEwok <111259438+randomewok@users.noreply.github.com> Date: Mon, 21 Sep 2026 05:55:59 +1000 Subject: [PATCH] fix: various bug fixes for wacca (#245) --- Dockerfile | 3 +++ .../java/icu/samnyan/aqua/net/SettingsApi.kt | 6 ++++-- .../icu/samnyan/aqua/sega/wacca/WaccaServer.kt | 18 +++++++++++------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2713f370..7774f604 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,9 @@ RUN ./gradlew dependencies # Copy the project source, this layer is rebuilt whenever a file has changed COPY --chown=gradle:gradle src /home/gradle/src +# Download game metadata (music/items lists) +RUN bash /home/gradle/src/main/resources/meta/update.sh + # Build the application RUN ./gradlew build -x test diff --git a/src/main/java/icu/samnyan/aqua/net/SettingsApi.kt b/src/main/java/icu/samnyan/aqua/net/SettingsApi.kt index fb761aa1..99394cc3 100644 --- a/src/main/java/icu/samnyan/aqua/net/SettingsApi.kt +++ b/src/main/java/icu/samnyan/aqua/net/SettingsApi.kt @@ -37,8 +37,10 @@ class SettingsApi( @Doc("Set a field in the game options") fun setField(@RP token: String, @RP key: String, @RP value: String) = us.jwt.auth(token) { u -> val field = fieldMap[key] ?: (400 - "Invalid field $key") - val options = u.gameOptions ?: AquaGameOptions().also { - userRepo.save(u.apply { gameOptions = it }) + var options = u.gameOptions + if (options == null) { + options = goRepo.save(AquaGameOptions()) + userRepo.save(u.apply { gameOptions = options }) } // Check field type field.setCast(options, value) diff --git a/src/main/java/icu/samnyan/aqua/sega/wacca/WaccaServer.kt b/src/main/java/icu/samnyan/aqua/sega/wacca/WaccaServer.kt index e8c9ae7f..950c842c 100644 --- a/src/main/java/icu/samnyan/aqua/sega/wacca/WaccaServer.kt +++ b/src/main/java/icu/samnyan/aqua/sega/wacca/WaccaServer.kt @@ -93,7 +93,7 @@ class WaccaServer { if (path in cacheMap) return resp(cacheMap[path]!!) - log.info("Wacca < $path : $body") + log.info("Wacca < $path : ${body.truncate(500)}") return try { Metrics.timer("aquadx_wacca_api_latency", "api" to path).recordCallable { @@ -102,7 +102,7 @@ class WaccaServer { is String -> resp(it) is List<*> -> resp(it.toJson()) else -> error("Invalid response type ${it.javaClass}") - } }.also { log.info("Wacca > $path : ${it.body}") } + } }.also { log.info("Wacca > $path : ${it.body?.truncate(500)}") } } } catch (e: Exception) { Metrics.counter( @@ -206,7 +206,9 @@ fun WaccaServer.init() { // All unlock if (go.waccaUnlockMusic && wacca.musicMapping.isNotEmpty()) { - items[MUSIC_UNLOCK()] = wacca.musicMapping.map { (id, v) -> MUSIC_UNLOCK(u, id, p1 = v.notes.size.long() - 1) } + items[MUSIC_UNLOCK()] = wacca.musicMapping.map { (id, v) -> + MUSIC_UNLOCK(u, id, p1 = if (v.notes.size == 1) WaccaDifficulty.INFERNO.value.toLong() else v.notes.size.long() - 1) + } } if (go.waccaUnlockTickets) { var i = 0 @@ -445,10 +447,12 @@ fun WaccaServer.init() { ?: WcUserOption(k, v).apply { user = u } }) // Update favorite songs - rp.user.save(u.apply { favoriteSongs.apply { - addAll(favAdd as List) - removeAll(favRem as List) - } }) + rp.user.save(u.apply { + favoriteSongs = favoriteSongs.toMutableList().apply { + addAll(favAdd as List) + removeAll(favRem as List) + } + }) } // TODO: Test this