forked from Cookies_Github_mirror/AquaDX
[+] Mut
This commit is contained in:
@@ -139,7 +139,7 @@ class AllNet(
|
||||
val ver = reqMap["ver"] ?: "1.0"
|
||||
|
||||
val formatVer = reqMap["format_ver"] ?: ""
|
||||
val resp = props.map.toMutableMap() + mapOf(
|
||||
val resp = props.map.mut + mapOf(
|
||||
"uri" to switchUri(localAddr, localPort, gameId, ver, session),
|
||||
"host" to props.host.ifBlank { localAddr },
|
||||
)
|
||||
|
||||
@@ -91,7 +91,7 @@ fun ChusanController.chusanInit() {
|
||||
data["nextIndex"] = rawIndex % 10000000000L
|
||||
mapOf("itemKind" to kind) grabs {
|
||||
// TODO: All unlock
|
||||
val items = db.userItem.findAllByUser_Card_ExtIdAndItemKind(uid, kind).toMutableList()
|
||||
val items = db.userItem.findAllByUser_Card_ExtIdAndItemKind(uid, kind).mut
|
||||
|
||||
// Check game options
|
||||
db.userData.findByCard_ExtId(uid)()?.card?.aquaUser?.gameOptions?.let {
|
||||
@@ -146,7 +146,7 @@ fun ChusanController.chusanInit() {
|
||||
// Compatibility: Older chusan uses boolean for isSuccess
|
||||
fun checkAncient(d: List<UserMusicDetail>) =
|
||||
data["version"]?.double?.let { if (it >= 2.15) d else d.map {
|
||||
d.toJson().jsonMap().toMutableMap().apply { this["isSuccess"] = this["isSuccess"].truthy }
|
||||
d.toJson().jsonMap().mut.apply { this["isSuccess"] = this["isSuccess"].truthy }
|
||||
} } ?: d
|
||||
|
||||
db.userMusicDetail.findByUser_Card_ExtId(uid).groupBy { it.musicId }
|
||||
|
||||
@@ -62,7 +62,7 @@ abstract class MeowApi(val serialize: (String, Any?) -> String) {
|
||||
}
|
||||
else pageCache[cacheKey] = millis() to list
|
||||
|
||||
(mapOf("userId" to uid, "length" to lst.size, "nextIndex" to iAfter, key to lst) + add).toMutableMap()
|
||||
(mapOf("userId" to uid, "length" to lst.size, "nextIndex" to iAfter, key to lst) + add).mut
|
||||
.also { p.post?.invoke(it) }
|
||||
}
|
||||
fun String.paged(key: String, fn: PagedHandler) = pagedWithKind(key) { PagedProcessor(null, fn) }
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package icu.samnyan.aqua.sega.general
|
||||
|
||||
import ext.ls
|
||||
import jakarta.persistence.AttributeConverter
|
||||
import jakarta.persistence.Converter
|
||||
|
||||
@Converter
|
||||
class IntegerListConverter : AttributeConverter<List<Int>, String> {
|
||||
override fun convertToDatabaseColumn(lst: List<Int>?) = lst?.joinToString(";") ?: ""
|
||||
override fun convertToEntityAttribute(str: String?) = if (str.isNullOrBlank()) mutableListOf() else
|
||||
str.split(';').map { it.toInt() }.toMutableList()
|
||||
override fun convertToEntityAttribute(str: String?) = if (str.isNullOrBlank()) ls() else
|
||||
str.split(';').map { it.toInt() }
|
||||
}
|
||||
|
||||
@@ -319,17 +319,17 @@ class Maimai2ServletController(
|
||||
"GetUserScoreRankingApi", "UpsertClientBookkeepingApi", "UpsertClientSettingApi",
|
||||
"UpsertClientTestmodeApi", "UpsertClientUploadApi", "Ping", "RemoveTokenApi", "CMLoginApi", "CMLogoutApi",
|
||||
"CMUpsertBuyCardApi", "GetGameSettingApi", "GetGameKaleidxScopeApi", "GetGameMusicScoreApi",
|
||||
"GetUserKaleidxScopeApi", "GetUserNewItemApi", "GetUserNewItemListApi").toMutableList()
|
||||
"GetUserKaleidxScopeApi", "GetUserNewItemApi", "GetUserNewItemListApi").mut
|
||||
|
||||
val noopEndpoint = endpointList.popAll("GetUserScoreRankingApi", "UpsertClientBookkeepingApi",
|
||||
val noopEndpoint = setOf("GetUserScoreRankingApi", "UpsertClientBookkeepingApi",
|
||||
"UpsertClientSettingApi", "UpsertClientTestmodeApi", "UpsertClientUploadApi", "Ping", "RemoveTokenApi",
|
||||
"CMLoginApi", "CMLogoutApi", "CMUpsertBuyCardApi", "UserLogoutApi", "GetGameMapAreaConditionApi",
|
||||
"UpsertUserChargelogApi")
|
||||
"UpsertUserChargelogApi").also { endpointList.removeAll(it) }
|
||||
|
||||
val staticEndpoint = mapOf(
|
||||
"CreateTokenApi" to """{"Bearer":"meow"}""",
|
||||
"CMUpsertUserPrintlogApi" to """{"returnCode":1,"orderId":"0","serialId":"FAKECARDIMAG12345678"}""",
|
||||
).also { endpointList.popAll(it.keys.toList()) }
|
||||
).also { endpointList.removeAll(it.keys.toSet()) }
|
||||
|
||||
val members = this::class.declaredMemberProperties
|
||||
val handlers: Map<String, BaseHandler> = endpointList.associateWith { api ->
|
||||
|
||||
@@ -196,7 +196,7 @@ fun WaccaServer.init() {
|
||||
"user/status/GetDetail" api@ { _, (uid) ->
|
||||
val u = user(uid) ?: return@api "[]"
|
||||
val o = options(u)
|
||||
val items = rp.item.findByUser(u).groupBy { it.type }.toMutableMap()
|
||||
val items = rp.item.findByUser(u).groupBy { it.type }.mut
|
||||
val scores = rp.bestScore.findByUser(u)
|
||||
val scoreMap = scores.associateBy { it.musicId to it.level }
|
||||
val gates = rp.gate.findByUser(u)
|
||||
@@ -343,7 +343,7 @@ fun WaccaServer.init() {
|
||||
?: WcUserScore().apply { user = u; musicId = pl.musicId; level = pl.level }).apply {
|
||||
|
||||
grades[WaccaGrades.valueMap[pl.grade]?.ordinal ?: (400 - "Grade ${pl.grade} invalid")]++
|
||||
clears = clears.zip(pl.clears()) { a, b -> a + b }.toMutableList()
|
||||
clears = clears.zip(pl.clears()) { a, b -> a + b }.mut
|
||||
achievement = max(achievement, pl.achievement)
|
||||
bestCombo = max(bestCombo, pl.maxCombo)
|
||||
lowestMissCt = min(lowestMissCt, pl.judgements[3])
|
||||
@@ -425,7 +425,7 @@ fun WaccaServer.init() {
|
||||
|
||||
"user/status/update" empty { req, (uid, playType, items, isContinue, isFirstPlayFree, itemsUsed, lastSong) ->
|
||||
val u = user(uid) ?: (404 - "User not found")
|
||||
u.lastSongInfo = (lastSong as List<Int>).toMutableList()
|
||||
u.lastSongInfo = (lastSong as List<Int>).mut
|
||||
afterPlay(u, items as List<List<Int>>, playType.int(), req.appVersion)
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ fun WaccaServer.init() {
|
||||
clearStatus = clearType.int() // 0..3: Fail, Blue, Silver, Gold
|
||||
clearSongCt = clearCt.int()
|
||||
playCt++
|
||||
if (scores.sum() > s.songScores.sum()) songScores = scores.toMutableList()
|
||||
if (scores.sum() > s.songScores.sum()) songScores = scores.mut
|
||||
})
|
||||
|
||||
if (dan.int() > u.danLevel || (dan.int() == u.danLevel && clearType.int() > u.danType)) {
|
||||
|
||||
@@ -101,7 +101,7 @@ class WcUserScore : WaccaUserEntity() {
|
||||
var clears: MutableList<Int> = mutableListOf(0, 0, 0, 0, 0) // Played, Clear, Full Combo, Missless, All Marv
|
||||
|
||||
@Convert(converter = IntegerListConverter::class)
|
||||
var grades: MutableList<Int> = (1..13).map { 0 }.toMutableList() // From D to SSS+
|
||||
var grades: MutableList<Int> = (1..13).map { 0 }.mut // From D to SSS+
|
||||
var bestCombo = 0
|
||||
var lowestMissCt = Int.MAX_VALUE
|
||||
var rating = 0
|
||||
|
||||
Reference in New Issue
Block a user