mirror of
https://github.com/hykilpikonna/AquaDX.git
synced 2026-09-25 02:21:43 -05:00
fix: various bug fixes for wacca (#245)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<Int>)
|
||||
removeAll(favRem as List<Int>)
|
||||
} })
|
||||
rp.user.save(u.apply {
|
||||
favoriteSongs = favoriteSongs.toMutableList().apply {
|
||||
addAll(favAdd as List<Int>)
|
||||
removeAll(favRem as List<Int>)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// TODO: Test this
|
||||
|
||||
Reference in New Issue
Block a user