mirror of https://github.com/hykilpikonna/AquaDX
parent
b23385ba28
commit
d28b9bf5a8
|
@ -42,6 +42,7 @@ export interface CardSummary {
|
||||||
ongeki: CardSummaryGame | null
|
ongeki: CardSummaryGame | null
|
||||||
diva: CardSummaryGame | null
|
diva: CardSummaryGame | null
|
||||||
wacca: CardSummaryGame | null
|
wacca: CardSummaryGame | null
|
||||||
|
auto: CardSummaryGame | null // let's pretend this just doesn't exist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { DATA_HOST } from "./config"
|
import { DATA_HOST } from "./config"
|
||||||
import type { MusicMeta } from "./generalTypes"
|
import type { MusicMeta } from "./generalTypes"
|
||||||
|
|
||||||
export type GameName = 'mai2' | 'chu3' | 'ongeki' | 'wacca'
|
export type GameName = 'mai2' | 'chu3' | 'ongeki' | 'wacca' | 'auto'
|
||||||
|
|
||||||
const multTable = {
|
const multTable = {
|
||||||
'mai2': [
|
'mai2': [
|
||||||
|
@ -67,7 +67,9 @@ const multTable = {
|
||||||
[ 60.0, 0, 'B' ],
|
[ 60.0, 0, 'B' ],
|
||||||
[ 1.0, 0, 'C' ],
|
[ 1.0, 0, 'C' ],
|
||||||
[ 0.0, 0, 'D' ]
|
[ 0.0, 0, 'D' ]
|
||||||
]
|
],
|
||||||
|
|
||||||
|
'auto': []
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMult(achievement: number, game: GameName) {
|
export function getMult(achievement: number, game: GameName) {
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
registerChart()
|
registerChart()
|
||||||
|
|
||||||
export let username: string;
|
export let username: string;
|
||||||
export let game: GameName = "mai2"
|
export let game: GameName = "auto"
|
||||||
let calElement: HTMLElement
|
let calElement: HTMLElement
|
||||||
let error: string;
|
let error: string;
|
||||||
let me: AquaNetUser
|
let me: AquaNetUser
|
||||||
|
@ -57,6 +57,19 @@
|
||||||
USER.isLoggedIn() && USER.me().then(u => me = u)
|
USER.isLoggedIn() && USER.me().then(u => me = u)
|
||||||
|
|
||||||
CARD.userGames(username).then(games => {
|
CARD.userGames(username).then(games => {
|
||||||
|
if (game == "auto") {
|
||||||
|
let targetGames = Object.entries(games)
|
||||||
|
.map(d => {
|
||||||
|
if (d[1])
|
||||||
|
d[1].lastLogin = d[1].lastLogin ? new Date(d[1].lastLogin) : new Date(0);
|
||||||
|
return d;
|
||||||
|
}).sort((a,b) => {
|
||||||
|
return b[1]?.lastLogin - a[1]?.lastLogin;
|
||||||
|
});
|
||||||
|
if (targetGames[0])
|
||||||
|
window.location.href = `/u/${username}/${targetGames[0][0]}`
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!games[game]) {
|
if (!games[game]) {
|
||||||
// Find a valid game
|
// Find a valid game
|
||||||
const valid = Object.entries(games).filter(([g, valid]) => valid)
|
const valid = Object.entries(games).filter(([g, valid]) => valid)
|
||||||
|
@ -105,7 +118,7 @@
|
||||||
}).catch((e) => { error = e.message; console.error(e) } );
|
}).catch((e) => { error = e.message; console.error(e) } );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Object.keys(GAME_TITLE).includes(game)) init()
|
if (Object.keys(GAME_TITLE).includes(game) || game == "auto") init()
|
||||||
else error = t("UserHome.InvalidGame", {game})
|
else error = t("UserHome.InvalidGame", {game})
|
||||||
|
|
||||||
const setRival = (isAdd: boolean) => {
|
const setRival = (isAdd: boolean) => {
|
||||||
|
|
Loading…
Reference in New Issue