mirror of
https://git.suyu.dev/suyu/website.git
synced 2026-01-07 06:58:05 +01:00
blarghh
This commit is contained in:
parent
5351c54d8d
commit
f56d94bffc
4 changed files with 69 additions and 1 deletions
37
src/lib/server/class/Room.ts
Normal file
37
src/lib/server/class/Room.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import type { IRoom } from "$types/rooms";
|
||||
import type { SuyuUser } from "../schema";
|
||||
|
||||
export class Room {
|
||||
public roomInfo: IRoom;
|
||||
constructor(
|
||||
name: string,
|
||||
description: string,
|
||||
game: string,
|
||||
players: SuyuUser[],
|
||||
maxPlayers: number,
|
||||
) {
|
||||
this.roomInfo = {
|
||||
name,
|
||||
description,
|
||||
preferredGameName: game,
|
||||
players,
|
||||
maxPlayers,
|
||||
address: "localhost",
|
||||
externalGuid: "1234",
|
||||
hasPassword: false,
|
||||
id: "1234",
|
||||
netVersion: 1,
|
||||
owner: "1234",
|
||||
port: 1234,
|
||||
preferredGameId: 1234,
|
||||
};
|
||||
}
|
||||
|
||||
async addPlayer(user: SuyuUser) {
|
||||
this.roomInfo.players.push(user);
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return this.roomInfo;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue