Files
plugins/otoca@asphyxia/utils.ts
iamsub 7518cd2abc otoca: split the plugin into handlers, models and helpers
index.ts now only registers settings and routes. Handlers are grouped
by part of the game (version, card, key, print, play, item, gift), the
stored documents live in models/, and the closet, player creation, db
access, game data and helpers each have their own file. No behavior
change: the test flow gives the same results.
2026-09-29 15:32:48 +09:00

10 lines
403 B
TypeScript

export const now = () => Math.floor(Date.now() / 1000);
export const rand = (n: number) => Math.floor(Math.random() * n);
export const u8 = (v: number) => K.ITEM('u8', v || 0);
export const u32 = (v: number) => K.ITEM('u32', v || 0);
export const bool = (v: boolean) => K.ITEM('bool', !!v);
export function log(method: string, data: any) {
console.log(`[otoca] ${method} ${JSON.stringify(data)}`);
}