Two teams try and fill in any horizontal, vertical, or diagonal line on a bingo board by playing maps on osu! osu.bingo
osu
at main 37 lines 868 B view raw
1/** 2 * Processes 'TimeEvents' from the database, 3 * scheduled by `polling/gamescheduler.ts` 4 */ 5 6import q from '$lib/drizzle/queries'; 7import { claimchange } from './game/rulechange'; 8import { startGame } from './game/start'; 9import { finalCall } from './game/final_call'; 10 11export type EventHandler = { 12 evaluate: (event: Bingo.TimeEvent) => Promise<void>; 13}; 14 15const events: { [key: string]: EventHandler } = { 16 start: { 17 evaluate: async ({ game_id, id }) => { 18 await q.setFulfilled(id); 19 await startGame(game_id); 20 } 21 }, 22 claimchange: { 23 evaluate: async ({ game_id, id, action }) => { 24 await q.setFulfilled(id); 25 const rule = action.split('_').slice(1).join('_'); 26 await claimchange(game_id, rule); 27 } 28 }, 29 finalcall: { 30 evaluate: async ({ game_id, id }) => { 31 await q.setFulfilled(id); 32 await finalCall(game_id); 33 } 34 } 35}; 36 37export default events;