mirror of https://github.com/hykilpikonna/AquaDX
[+] Add summary to SDK
parent
48558bec0f
commit
2ca6be77ed
|
@ -1,5 +1,6 @@
|
|||
import {aqua_host} from "./config";
|
||||
import type {TrendEntry} from "./generalTypes";
|
||||
import type {MaimaiUserSummaryEntry} from "./maimaiTypes";
|
||||
|
||||
|
||||
const multTable = [
|
||||
|
@ -39,4 +40,8 @@ export async function getMaimaiApi(endpoint: string, params: any) {
|
|||
|
||||
export async function getMaimaiTrend(userId: number): Promise<TrendEntry[]> {
|
||||
return await getMaimaiApi("trend", {userId})
|
||||
}
|
||||
|
||||
export async function getMaimaiUser(userId: number): Promise<MaimaiUserSummaryEntry> {
|
||||
return await getMaimaiApi("user-summary", {userId})
|
||||
}
|
|
@ -38,4 +38,26 @@ export interface MaiUserPreviewData {
|
|||
isLogin: boolean
|
||||
iconId: number
|
||||
frameId: number
|
||||
}
|
||||
|
||||
export interface MaimaiUserSummaryEntry {
|
||||
name: string
|
||||
iconId: number
|
||||
serverRank: number
|
||||
accuracy: number
|
||||
rating: number
|
||||
ratingHighest: number
|
||||
ranks: { name: string, count: number }[]
|
||||
maxCombo: number
|
||||
fullCombo: number
|
||||
allPerfect: number
|
||||
totalDxScore: number
|
||||
plays: number
|
||||
totalPlayTime: number
|
||||
joined: string
|
||||
lastSeen: string
|
||||
lastVersion: string
|
||||
best35: string
|
||||
best15: string
|
||||
recent: Rating[]
|
||||
}
|
|
@ -67,7 +67,7 @@ class Maimai2New(
|
|||
"accuracy" to plays.sumOf { it.achievement } / plays.size,
|
||||
"rating" to user.playerRating,
|
||||
"ratingHighest" to user.highestRating,
|
||||
"ranks" to ranks,
|
||||
"ranks" to ranks.map { (k, v) -> mapOf("name" to k, "count" to v) },
|
||||
"maxCombo" to plays.maxOf { it.maxCombo },
|
||||
"fullCombo" to plays.count { it.totalCombo == it.maxCombo },
|
||||
"allPerfect" to plays.count { it.achievement == 1010000 },
|
||||
|
|
Loading…
Reference in New Issue