-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
58 lines (51 loc) · 1.27 KB
/
types.ts
File metadata and controls
58 lines (51 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
export enum GameStatus {
LOBBY = 'LOBBY',
PLAYING = 'PLAYING',
REVEAL = 'REVEAL', // Phase where players check their words
VOTING = 'VOTING',
FINISHED = 'FINISHED'
}
export enum PlayerRole {
CIVILIAN = 'CIVILIAN',
SPY = 'SPY',
BLANK = 'BLANK', // Optional future use
SPECTATOR = 'SPECTATOR' // Host when not playing
}
export interface Player {
id: string;
name: string;
role?: PlayerRole;
word?: string;
isAlive: boolean;
isHost: boolean;
isBot?: boolean;
hasViewedWord?: boolean; // New field to track if word has been seen
joinedAt: number;
currentChat?: string; // Real-time chat message bubbles
}
export interface GameSettings {
civilianWord: string;
spyWord: string;
spyCount: number;
blankCount: number;
}
export interface RoomData {
id: string;
status: GameStatus;
players: Record<string, Player>;
settings: GameSettings;
createdAt: number;
winner?: 'CIVILIAN' | 'SPY' | 'BLANK';
votes?: Record<string, string>; // voterId -> candidateId
timer?: TimerState;
}
export interface TimerState {
endTime: number; // Unix timestamp when timer ends
duration: number; // Duration in seconds (for reference/reset)
isRunning: boolean;
}
// Helper for local session
export interface UserSession {
id: string;
name: string;
}