This repository has been archived by the owner on Aug 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
118 lines (95 loc) · 2.7 KB
/
index.d.ts
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import { Server } from "socket.io";
import { Socket } from "socket.io-client";
import * as events from "events";
declare module "skribbler" {
export type Vote = "like" | "dislike"
export type ClientEvents = "connect" | "packet" | "disconnect" | "playerJoin" | "playerLeave" | "hintRevealed" | "playerGuessed" | "closeWord" | "newOwner" | "draw" | "clearCanvas" | "text" | "undo" | "vote" | "votekick" | "startError" | "stateUpdate" | Number
export interface ClientOptions {
name?: String
avatar?: Array<Number>
lobbyCode?: String
createPrivateRoom?: Boolean
language?: Number | String
serverURL?: String
httpHeaders?: Object
socketOptions?: Object
}
export interface PlayerObject {
id: Number
name: String
avatar: Array<Number>
score: Number
guessed: Boolean
flags: Number
}
export interface LobbySettings {
language?: Number
maxPlayers?: Number
maxDrawTime?: Number
maxRounds?: Number
wordCount?: Number
maxHints?: Number
wordMode?: Number
useCustomWords?: Boolean
}
export class Client extends events {
constructor(options?: ClientOptions)
options: ClientOptions
socket?: Socket
connected: Boolean
lobbyId?: String
settings: LobbySettings
state?: Number
round: Number
userId?: Number
ownerId?: Number
lobbyType?: Number
players: Array<PlayerObject>
time: Number
currentDrawer?: PlayerObject
availableWords: Array<String>
canvas: Array<Array<Number>>
word: String
init(): void
sendPacket(id: Number, data?: any): void
hostKick(userId: Number): void
hostBan(userId: Number): void
votekick(userId: Number): void
vote(id: Number | Vote): void
updateRoomSettings(settingId: String, val: String): void
draw(data: Array<Array<Number>>): void
clearCanvas(): void
undo(id?: Number): void
startGame(customWords?: Array<String>): void
endGame(): void
selectWord(word: Number | String): void
sendMessage(msg: String): void
disconnect(): void
on(event: ClientEvents, listener: Function): this
}
type ProxyEvents = "playerJoin"
export class ProxyOptions {
port?: Number
lobbyCode?: String
language?: Number | String
serverURL?: String
httpHeaders?: Object
}
export class Proxy extends events {
constructor(options?: ClientOptions)
options: ProxyOptions
init(): void
on(event: ProxyEvents, callback: Function): this
}
type ProxyPlayerEvents = "connect" | "incoming" | "outgoing" | "disconnect"
export class ProxyPlayer extends events {
constructor(client: Socket, server: Server)
upstream: Server
socket: Socket
connected: Boolean
sendOutbound(id: Number, data?: any): void
sendInbound(id: Number, data?: any): void
disconnect(): void
on(event: ProxyPlayerEvents, callback: Function): this
}
}