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

59 lines
1.3 KiB
TypeScript

// Lobby replies (festo's layout). Every version uses entry / refresh / report; festo also uses check.
export const Check = (req, reqData, send) => {
const { data } = reqData;
const enter = $(data).content("enter");
const time = $(data).content("time");
return send.object(
{
data: {
entrant_nr: K.ITEM("u32", 0, { time }),
interval: K.ITEM("s16", 0),
entry_timeout: K.ITEM("s16", 15),
waitlist: K.ATTR({ count: "0" }, { music: [] }),
},
},
{ compress: true }
);
};
export const Entry = (req: EamuseInfo, data: any, send: EamuseSend) => {
const {
data: { music },
} = data;
const musicId = $(music).content("id");
const musicSeq = $(music).content("seq");
return send.object(
{
data: {
roomid: K.ITEM("s64", BigInt(1), { master: "1" }),
refresh_intr: K.ITEM("s16", 0),
music: {
id: K.ITEM("u32", musicId),
seq: K.ITEM("u8", musicSeq),
},
},
},
{ compress: true }
);
};
export const Refresh = (req: EamuseInfo, data: any, send: EamuseSend) => {
return send.object(
{
data: { refresh_intr: K.ITEM("s16", 0), start: K.ITEM("bool", true) },
},
{ compress: true }
);
};
export const Report = (req: EamuseInfo, data: any, send: EamuseSend) =>
send.object(
{
data: { refresh_intr: K.ITEM("s16", 0) },
},
{ compress: true }
);