forked from Cookies_Github_mirror/AquaDX
[+] Ongeki adaptor
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package icu.samnyan.aqua.net.games
|
||||
|
||||
import ext.API
|
||||
import ext.RP
|
||||
|
||||
data class TrendOut(val date: String, val rating: Int, val plays: Int)
|
||||
|
||||
@@ -41,7 +42,7 @@ data class GenericGameSummary(
|
||||
|
||||
interface GameApiController {
|
||||
@API("trend")
|
||||
fun trend(username: String): List<TrendOut>
|
||||
fun trend(@RP username: String): List<TrendOut>
|
||||
@API("user-summary")
|
||||
fun userSummary(username: String): GenericGameSummary
|
||||
fun userSummary(@RP username: String): GenericGameSummary
|
||||
}
|
||||
37
src/main/java/icu/samnyan/aqua/net/games/Ongeki.kt
Normal file
37
src/main/java/icu/samnyan/aqua/net/games/Ongeki.kt
Normal file
@@ -0,0 +1,37 @@
|
||||
package icu.samnyan.aqua.net.games
|
||||
|
||||
import ext.API
|
||||
import icu.samnyan.aqua.net.db.AquaUserServices
|
||||
import icu.samnyan.aqua.net.utils.TrendLog
|
||||
import icu.samnyan.aqua.net.utils.findTrend
|
||||
import icu.samnyan.aqua.net.utils.genericUserSummary
|
||||
import icu.samnyan.aqua.net.utils.ongekiScores
|
||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserDataRepository
|
||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserGeneralDataRepository
|
||||
import icu.samnyan.aqua.sega.ongeki.dao.userdata.UserPlaylogRepository
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
@API("api/v2/game/ongeki")
|
||||
class Ongeki(
|
||||
val us: AquaUserServices,
|
||||
val userPlaylogRepository: UserPlaylogRepository,
|
||||
val userDataRepository: UserDataRepository,
|
||||
val userGeneralDataRepository: UserGeneralDataRepository
|
||||
): GameApiController {
|
||||
override fun trend(username: String) = us.byName(username) { u ->
|
||||
findTrend(userPlaylogRepository.findByUser_Card_ExtId(u.ghostCard.extId)
|
||||
.map { TrendLog(it.playDate, it.playerRating) })
|
||||
}
|
||||
|
||||
private val shownRanks = ongekiScores.filter { it.first >= 950000 }
|
||||
|
||||
override fun userSummary(username: String) = us.byName(username) { u ->
|
||||
// val extra = userGeneralDataRepository.findByUser_Card_ExtId(u.ghostCard.extId)
|
||||
// .associate { it.propertyKey to it.propertyValue }
|
||||
|
||||
// TODO: Rating composition
|
||||
|
||||
genericUserSummary(u, userDataRepository, userPlaylogRepository, shownRanks, mapOf())
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,19 @@ val chu3Scores = listOf(
|
||||
60.0 to "B",
|
||||
50.0 to "C",
|
||||
0.0 to "D",
|
||||
).map { (k, v) -> (k * 10000).toInt() to v }
|
||||
|
||||
val ongekiScores = listOf(
|
||||
100.75 to "SSS+",
|
||||
100.0 to "SSS",
|
||||
99.0 to "SS",
|
||||
97.0 to "S",
|
||||
94.0 to "AAA",
|
||||
90.0 to "AA",
|
||||
85.0 to "A",
|
||||
80.0 to "BBB",
|
||||
75.0 to "BB",
|
||||
70.0 to "B",
|
||||
50.0 to "C",
|
||||
0.0 to "D",
|
||||
).map { (k, v) -> (k * 10000).toInt() to v }
|
||||
Reference in New Issue
Block a user