Files
LatoWolf e343d790dd jubeat: split versions into modules with shared player and scores
Each version (prop, Qubell, clan, festo) is now a module under versions/
with its own route table and model date range. All jubeat versions call
the same method names, so versions/index.ts registers one route per
method and picks the version from the model date.

- handlers/player.ts: one jubeat ID and name per card, in the existing
  festo `profile` document
- handlers/scores.ts: one score store for every version; prop, Qubell
  and clan only see normal-mode charts of songs up to their own
- handlers/version_data.ts: per-version fields, course and league
  results, keyed by version id (7 prop, 8 Qubell, 9 clan, 10 festo)
- V2.1.0 Qubell saves move to the shared profile and scores on first
  login; the old documents are kept and marked `migrated`
- festo moves to versions/festo with the same requests and responses;
  records without a ghost now get an empty one instead of a broken node
- builds older than prop are refused instead of answered as Qubell

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 16:29:15 +08:00

45 lines
1.5 KiB
TypeScript

import { VersionInfo } from "../versions/types";
import { mostPlayed } from "./scores";
// Replies that versions before festo share.
export const news: EamusePluginRoute = (info, data, send) =>
send.object({ data: { officialnews: K.ATTR({ count: "0" }) } }, { compress: true });
/** Top 10 songs by plays on this server, limited to the version's songs. */
export const hitchart = (version: VersionInfo): EamusePluginRoute => async (info, data, send) => {
const now = new Date();
const pad = (n: number) => (n < 10 ? "0" : "") + n;
const top = await mostPlayed(version, 10);
return send.object({
data: {
update: K.ITEM("str", `${pad(now.getDate())}/${pad(now.getMonth() + 1)}/${now.getFullYear()}`),
hitchart_lic: K.ATTR({ count: "0" }),
hitchart_org: K.ATTR({ count: String(top.length) }, {
rankdata: top.map((id, i) => ({
music_id: K.ITEM("s32", id),
rank: K.ITEM("s16", i + 1),
prev: K.ITEM("s16", i + 1),
})),
}),
},
}, { compress: true });
};
export const meeting: EamusePluginRoute = (info, data, send) =>
send.object({
data: {
meeting: { single: K.ATTR({ count: "0" }), tag: K.ATTR({ count: "0" }) },
reward: { total: K.ITEM("s32", -1), point: K.ITEM("s32", -1) },
},
}, { compress: true });
export const lobbyCheck: EamusePluginRoute = (info, data, send) =>
send.object({
data: {
interval: K.ITEM("s16", 0),
entry_timeout: K.ITEM("s16", 0),
entrant_nr: K.ITEM("u32", 0, { time: "0" }),
},
}, { compress: true });