Hostitel prida na volne sedadlo bota (+ Bot = heuristika, + AI bot = natrenovana siet) alebo bota odoberie; boti maju vlastnu ikonu a flag is_bot v rosteroch. Surove ucty bot:<kind>-<n> sa vsade zobrazuju cez displayName ako "Bot 2" / "AI bot 1" (stol, kopka, tabulky, historia). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
104 lines
2.1 KiB
TypeScript
104 lines
2.1 KiB
TypeScript
export type CardColor = 'HEARTS' | 'LEAVES' | 'ACORNS' | 'BELLS';
|
|
export type CardValue = 'C7' | 'C8' | 'C9' | 'C10' | 'LOWER' | 'UPPER' | 'KING' | 'ACE';
|
|
|
|
export interface Card {
|
|
color: CardColor;
|
|
value: CardValue;
|
|
}
|
|
|
|
export interface PlayerInfo {
|
|
order: number;
|
|
name: string;
|
|
connected: boolean;
|
|
player_id?: number;
|
|
is_bot?: boolean;
|
|
}
|
|
|
|
export interface MyPlayer {
|
|
order: number;
|
|
name: string;
|
|
token: string;
|
|
gid: string;
|
|
}
|
|
|
|
export interface StashData {
|
|
first_player: number;
|
|
cards: Record<string, Card>;
|
|
}
|
|
|
|
export interface GameStatusDetail {
|
|
active_player?: number;
|
|
active_round_guesses?: Record<string, number>;
|
|
active_round_stashes?: number[];
|
|
active_stash?: StashData;
|
|
previous_stash?: StashData;
|
|
standings: number[][][];
|
|
/** Tips per series/round/seat, same shape as standings. Used to show the
|
|
* struck-through tip in place of 0 when a tip failed. */
|
|
standings_guesses?: number[][][];
|
|
}
|
|
|
|
export interface GameStatusPayload {
|
|
gid: string;
|
|
completed: boolean;
|
|
players: PlayerInfo[];
|
|
series_number: number;
|
|
round_number: number;
|
|
cards_in_round: number;
|
|
status: GameStatusDetail;
|
|
}
|
|
|
|
export interface GameInfo {
|
|
gid: string;
|
|
name: string;
|
|
started: boolean;
|
|
players: PlayerInfo[];
|
|
}
|
|
|
|
export type Hand = Record<string, Card>;
|
|
|
|
// --- authentication (TOTP) ---
|
|
|
|
export interface Account {
|
|
player_id: number;
|
|
username: string;
|
|
}
|
|
|
|
export interface Registration {
|
|
username: string;
|
|
secret: string;
|
|
otpauth_uri: string;
|
|
}
|
|
|
|
// --- history ---
|
|
|
|
export interface HistoryGame {
|
|
gid: string;
|
|
name: string;
|
|
created_at: string | null;
|
|
ended_at: string | null;
|
|
players: string[];
|
|
my_points: number;
|
|
/** True = dohraná naplno; false = predčasne ukončená (dá sa obnoviť do lobby). */
|
|
completed: boolean;
|
|
}
|
|
|
|
export interface GameDetailRound {
|
|
series_number: number;
|
|
round_number: number;
|
|
player_id: number;
|
|
username: string | null;
|
|
guess: number;
|
|
points: number;
|
|
won: boolean;
|
|
}
|
|
|
|
export interface GameDetail {
|
|
gid: string;
|
|
name: string;
|
|
created_at: string | null;
|
|
ended_at: string | null;
|
|
players: { player_id: number; username: string }[];
|
|
rounds: GameDetailRound[];
|
|
}
|