mirror of https://github.com/hykilpikonna/AquaDX
[+] Wacca endpoints
parent
d8c1144881
commit
70aed1d5db
|
@ -103,6 +103,7 @@ fun millis() = System.currentTimeMillis()
|
|||
val DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd")
|
||||
fun LocalDate.isoDate() = format(DATE_FORMAT)
|
||||
fun String.isoDate() = DATE_FORMAT.parse(this, LocalDate::from)
|
||||
fun Date.utc() = toInstant().atZone(java.time.ZoneOffset.UTC).toLocalDate()
|
||||
fun LocalDate.toDate() = Date(atStartOfDay().toInstant(java.time.ZoneOffset.UTC).toEpochMilli())
|
||||
fun LocalDateTime.isoDateTime() = format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
|
||||
fun String.isoDateTime() = LocalDateTime.parse(this, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
package icu.samnyan.aqua.net.games.wacca
|
||||
|
||||
import ext.API
|
||||
import ext.minus
|
||||
import ext.*
|
||||
import icu.samnyan.aqua.net.db.AquaUserServices
|
||||
import icu.samnyan.aqua.net.games.GameApiController
|
||||
import icu.samnyan.aqua.net.games.GenericGameSummary
|
||||
import icu.samnyan.aqua.net.games.TrendOut
|
||||
import icu.samnyan.aqua.net.games.USERNAME_CHARS
|
||||
import icu.samnyan.aqua.net.utils.AquaNetProps
|
||||
import icu.samnyan.aqua.sega.wacca.model.db.WaccaRepos
|
||||
import icu.samnyan.aqua.net.games.*
|
||||
import icu.samnyan.aqua.net.utils.waccaScores
|
||||
import icu.samnyan.aqua.sega.wacca.model.db.WaccaUser
|
||||
import icu.samnyan.aqua.sega.wacca.model.db.WcUserPlayLogRepo
|
||||
import icu.samnyan.aqua.sega.wacca.model.db.WcUserRepo
|
||||
|
@ -20,8 +15,6 @@ class Wacca(
|
|||
override val us: AquaUserServices,
|
||||
override val playlogRepo: WcUserPlayLogRepo,
|
||||
override val userDataRepo: WcUserRepo,
|
||||
val repos: WaccaRepos,
|
||||
val netProps: AquaNetProps,
|
||||
): GameApiController<WaccaUser>("wacca", WaccaUser::class) {
|
||||
override val settableFields: Map<String, (WaccaUser, String) -> Unit> by lazy { mapOf(
|
||||
"userName" to { u, v -> u.userName = v
|
||||
|
@ -29,13 +22,15 @@ class Wacca(
|
|||
},
|
||||
) }
|
||||
|
||||
override suspend fun trend(username: String): List<TrendOut> {
|
||||
TODO("Not yet implemented")
|
||||
override suspend fun trend(@RP username: String) = us.cardByName(username) { card ->
|
||||
findTrend(playlogRepo.findByUserCardExtId(card.extId)
|
||||
.map { TrendLog(it.userPlayDate.utc().isoDate(), it.afterRating) })
|
||||
}
|
||||
|
||||
override suspend fun userSummary(username: String): GenericGameSummary {
|
||||
TODO("Not yet implemented")
|
||||
override suspend fun userSummary(@RP username: String) = us.cardByName(username) { card ->
|
||||
// TODO: Rating composition
|
||||
genericUserSummary(card, mapOf())
|
||||
}
|
||||
|
||||
override val shownRanks: List<Pair<Int, String>> = emptyList()
|
||||
override val shownRanks: List<Pair<Int, String>> = waccaScores.filter { it.first > 83 * 10000 }
|
||||
}
|
|
@ -45,4 +45,17 @@ val ongekiScores = listOf(
|
|||
70.0 to "B",
|
||||
50.0 to "C",
|
||||
0.0 to "D",
|
||||
).map { (k, v) -> (k * 10000).toInt() to v }
|
||||
|
||||
val waccaScores = listOf(
|
||||
100.0 to "AP",
|
||||
98.0 to "SSS",
|
||||
95.0 to "SS",
|
||||
90.0 to "S",
|
||||
85.0 to "AAA",
|
||||
80.0 to "AA",
|
||||
70.0 to "A",
|
||||
60.0 to "B",
|
||||
1.0 to "C",
|
||||
0.0 to "D",
|
||||
).map { (k, v) -> (k * 10000).toInt() to v }
|
Loading…
Reference in New Issue