Archived
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
export interface ClientMessage {
|
|
uuid: string;
|
|
target: string;
|
|
method: string;
|
|
args: { [key: string]: string };
|
|
}
|
|
|
|
export interface LobbyEvents {
|
|
newGame: (author: IUser, game: IGameListing) => void;
|
|
}
|
|
|
|
type TeamEvents = {
|
|
team_addPlayer: { gameObject: string; data: IPlayer };
|
|
};
|
|
|
|
type TE = {
|
|
[T in keyof TeamEvents]: { event: T } & TeamEvents[T];
|
|
};
|
|
|
|
type ChildEvents = TE;
|
|
|
|
export interface GameEvents {
|
|
createTeam: (author: IUser, team: ITeam) => void;
|
|
removeTeam: (author: IUser, team: ITeam) => void;
|
|
createPlayer: (author: IUser, player: IPlayer) => void;
|
|
removePlayer: (author: IUser, player: IPlayer, reason: string) => void;
|
|
childEvent: (event: ChildEvents[keyof ChildEvents]) => void;
|
|
}
|
|
|
|
export interface IGameObject {
|
|
readonly uuid: string;
|
|
}
|
|
|
|
export interface IUser {
|
|
readonly username: string;
|
|
readonly image: string;
|
|
}
|
|
|
|
export interface IPlayer extends IGameObject {}
|
|
|
|
export interface ITeam extends IGameObject {}
|
|
export interface IGameListing extends IGameObject {
|
|
readonly players: IUser[];
|
|
readonly started: boolean;
|
|
readonly owner: string;
|
|
readonly rules: {};
|
|
}
|