mirror of
https://github.com/asphyxia-core/plugins.git
synced 2026-12-05 03:30:23 -06:00
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.
10 lines
403 B
TypeScript
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)}`);
|
|
}
|