mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-05 04:17:26 +08:00
Feat: Favorites (for all supported games) (#174)
This commit is contained in:
@@ -148,7 +148,7 @@ abstract class GameApiController<T : IUserData>(val name: String, userDataClass:
|
||||
userMusicRepo.findByUser_Card_ExtIdAndMusicIdIn(card.extId, musicList)
|
||||
}
|
||||
|
||||
fun genericUserSummary(card: Card, ratingComp: Map<String, String>, rival: Boolean? = null): GenericGameSummary {
|
||||
fun genericUserSummary(card: Card, ratingComp: Map<String, String>, rival: Boolean? = null, favorites: List<Int>? = null): GenericGameSummary {
|
||||
// Summary values: total plays, player rating, server-wide ranking
|
||||
// number of each rank, max combo, number of full combo, number of all perfect
|
||||
val user = userDataRepo.findByCard(card) ?: (404 - "Game data not found")
|
||||
@@ -199,7 +199,8 @@ abstract class GameApiController<T : IUserData>(val name: String, userDataClass:
|
||||
ratingComposition = ratingComp,
|
||||
recent = plays.sortedBy { it.userPlayDate.toString() }.takeLast(100).reversed(),
|
||||
lastPlayedHost = user.lastClientId?.let { us.userRepo.findByKeychip(it)?.username },
|
||||
rival = rival
|
||||
rival = rival,
|
||||
favorites = favorites
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,8 @@ data class GenericGameSummary(
|
||||
|
||||
val recent: List<IGenericGamePlaylog>,
|
||||
|
||||
val rival: Boolean?
|
||||
val rival: Boolean?,
|
||||
val favorites: List<Int>?
|
||||
)
|
||||
|
||||
data class GenericRankingPlayer(
|
||||
|
||||
@@ -60,7 +60,9 @@ class Chusan(
|
||||
"new" to (extra["rating_new_list"] ?: ""),
|
||||
)
|
||||
|
||||
genericUserSummary(card, ratingComposition)
|
||||
val misc = rp.userMisc.findByUser_Card_ExtId(card.extId).firstOrNull()
|
||||
|
||||
genericUserSummary(card, ratingComposition, null, misc?.favMusic)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -66,7 +66,7 @@ class Maimai2(
|
||||
}
|
||||
}
|
||||
|
||||
genericUserSummary(card, ratingComposition, isMyRival)
|
||||
genericUserSummary(card, ratingComposition, isMyRival, extra["favorite_music"]?.split(",")?.mapNotNull{it -> it.toIntOrNull()})
|
||||
}
|
||||
|
||||
@API("user-rating")
|
||||
|
||||
@@ -31,7 +31,10 @@ class Wacca(
|
||||
|
||||
override suspend fun userSummary(@RP username: String, @RP token: String?) = us.cardByName(username) { card ->
|
||||
// TODO: Rating composition
|
||||
genericUserSummary(card, mapOf())
|
||||
|
||||
val data = userDataRepo.findByCard_ExtId(card.extId)
|
||||
|
||||
genericUserSummary(card, mapOf(), null, if (data.isPresent) data.get().favoriteSongs else null)
|
||||
}
|
||||
|
||||
override val shownRanks: List<Pair<Int, String>> = waccaScores.filter { it.first > 85 * 10000 }
|
||||
|
||||
Reference in New Issue
Block a user