update to v2

This commit is contained in:
Soph :3 2024-08-27 20:39:18 +03:00
parent 53ca898b13
commit 4842cc268a
Signed by: sophie
GPG key ID: EDA5D222A0C270F2
6 changed files with 310 additions and 272 deletions

1
.gitignore vendored
View file

@ -173,3 +173,4 @@ dist
# Finder (MacOS) folder config # Finder (MacOS) folder config
.DS_Store .DS_Store
dump

View file

@ -30,7 +30,6 @@ interface Player {
y?: number; y?: number;
} }
export class Client extends (EventEmitter as new () => TypedEmitter<MessageEvents>) { export class Client extends (EventEmitter as new () => TypedEmitter<MessageEvents>) {
private ws: WebSocket; private ws: WebSocket;
me!: Player; me!: Player;
@ -42,6 +41,10 @@ export class Client extends (EventEmitter as new () => TypedEmitter<MessageEvent
rooms: proto.ServerMessage_Room[] = []; rooms: proto.ServerMessage_Room[] = [];
players = new Map<string, proto.Profile>(); players = new Map<string, proto.Profile>();
private resolvePingPromise?: (a: number) => void;
private lastPing: number = -1;
move(x: number, y: number) { move(x: number, y: number) {
this.ws.send( this.ws.send(
new proto.ClientMessage({ new proto.ClientMessage({
@ -53,6 +56,18 @@ export class Client extends (EventEmitter as new () => TypedEmitter<MessageEvent
}).toBinary() }).toBinary()
); );
} }
getPing() {
this.ws.send(
new proto.ClientMessage({
event: CEventType.PING,
}).toBinary()
);
this.lastPing = Date.now();
return new Promise((res, rej) => {
this.resolvePingPromise = res;
});
}
message(chat: string) { message(chat: string) {
chat.match(/.{1,200}/gm)?.forEach((z, i) => { chat.match(/.{1,200}/gm)?.forEach((z, i) => {
setTimeout(() => { setTimeout(() => {
@ -142,16 +157,20 @@ export class Client extends (EventEmitter as new () => TypedEmitter<MessageEvent
console.log(data); console.log(data);
return; return;
} }
if (decode.event == SEventType.PONG) {
if (this.resolvePingPromise)
this.resolvePingPromise(Date.now() - this.lastPing);
}
if(decode.event == SEventType.CHOWN) { if (decode.event == SEventType.CHOWN) {
this.room.owner = decode.chown; this.room.owner = decode.chown;
this.emit("chown"); this.emit("chown");
} }
if(decode.event == SEventType.MESSAGE) { if (decode.event == SEventType.MESSAGE) {
this.emit("serverMessage", decode.message); this.emit("serverMessage", decode.message);
} }
if (decode.event == SEventType.RATELIMIT) { if (decode.event == SEventType.RATELIMIT) {
console.log("Ratelimit reached! Time left: " + decode.rateLimit); console.log("Ratelimit reached! Time left: " + decode.ratelimit);
} }
if (decode.event == SEventType.JOIN) { if (decode.event == SEventType.JOIN) {
this.players.set(decode.join!.id, decode.join!); this.players.set(decode.join!.id, decode.join!);

18
inspect-dump.ts Normal file
View file

@ -0,0 +1,18 @@
import { $ } from "bun";
import * as fs from "fs/promises";
const dumps = ["EAMqERIGc29waGllGgcjZDlhMmMy", "16, 3, 42, 9, 10, 5, 76, 111, 98, 98, 121, 16, 4, 42, 8, 10, 4, 116, 101, 115, 116, 16, 1, 42, 20, 10, 16, 83, 111, 109, 101, 111, 110, 101, 32, 112, 114, 97, 99, 116, 105, 115, 101, 16, 1 "].map(
(z) => {
if(z.includes(",")) {
return new Uint8Array(z.split(",").map(z=>+z))
} else {
return Buffer.from(z, "base64");
}
}
);
for await (const dump of dumps) {
await fs.writeFile("dump", new Uint8Array(dump.buffer));
const info = await $`~/.local/bin/protobuf_inspector < dump`;
}

View file

@ -2,7 +2,7 @@
"name": "pianoverse", "name": "pianoverse",
"module": "index.ts", "module": "index.ts",
"type": "module", "type": "module",
"version": "v1.0.1", "version": "v2.0.0",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"homepage": "https://git.sad.ovh/sophie/pianoverse", "homepage": "https://git.sad.ovh/sophie/pianoverse",
"bugs": "https://git.sad.ovh/sophie/pianoverse/issues", "bugs": "https://git.sad.ovh/sophie/pianoverse/issues",

View file

@ -1,4 +1,4 @@
// PV version = 0cdf4ec01ef9a5de77ad785183b3f56fcd0b58db // PV version = 9a65ffd093eefcad972f715896bf35d9d5058a2d
syntax = "proto3"; syntax = "proto3";
@ -6,54 +6,52 @@ package pianoverse;
message ClientMessage { message ClientMessage {
enum EventType { enum EventType {
PING = 0; CHOWN = 0;
ROOM = 1; PING = 1;
PROFILE = 2; ROOM = 2;
CHAT = 3; PROFILE = 3;
MOVE = 4; CHAT = 4;
MUTE = 5; MOVE = 5;
UNMUTE = 6; MUTE = 6;
KICK = 7; UNMUTE = 7;
PRESS = 8; KICK = 8;
RELEASE = 9; PRESS = 9;
SUSTAIN = 10; RELEASE = 10;
HEARTBEAT = 11; SUSTAIN = 11;
BAN = 12; HEARTBEAT = 12;
CHOWN = 13; BAN = 13;
IPBAN = 14;
MOD = 15;
UNMOD = 16;
} }
string chown = 1;
EventType event = 1; EventType event = 2;
Heartbeat ping = 3;
Room room = 3; Room room = 4;
message Room { message Room {
string room = 1; string room = 1;
bool private = 2; bool private = 2;
} }
Profile profile = 5;
string chat = 6;
Move move = 7;
string mute = 8;
string unmute = 9;
string kick = 10;
Press press = 11;
Release release = 12;
bool sustain = 13;
Heartbeat heartbeat = 14;
Ban ban = 15;
string ipban = 16;
string mod = 17;
string unmod = 18;
Profile profile = 4;
string chat = 5;
Move move = 6;
string mute = 7;
string unmute = 8;
string kick = 9;
Press press = 10;
Release release = 11;
bool sustain = 12;
Heartbeat heartbeat = 13;
message Heartbeat {} message Heartbeat {}
Ban ban = 14;
message Ban { message Ban {
string id = 1; string id = 1;
uint32 minutes = 2; uint32 minutes = 2;
} }
string chown = 15;
} }
enum Role { enum Role {
USER = 0; USER = 0;
@ -62,43 +60,39 @@ enum Role {
} }
message ServerMessage { message ServerMessage {
enum EventType { enum EventType {
PONG = 0; CLEAR = 0;
CHAT = 1; PONG = 1;
ROOMS = 2; CHAT = 2;
WELCOME = 3; ROOMS = 3;
MOVE = 4; WELCOME = 4;
PRESS = 5; MOVE = 5;
RELEASE = 6; PRESS = 6;
SUSTAIN = 7; RELEASE = 7;
PROFILE = 8; SUSTAIN = 8;
JOIN = 9; PROFILE = 9;
LEAVE = 10; JOIN = 10;
RATELIMIT = 11; LEAVE = 11;
MESSAGE = 12; RATELIMIT = 12;
CHOWN = 13; MESSAGE = 13;
CLEAR = 14; CHOWN = 14;
} }
EventType event = 1; Profile clear = 1;
EventType event = 2;
Pong pong = 2; Profile pong = 3;
message Pong {} Chat chat = 4;
Chat chat = 3;
message Chat { message Chat {
string id = 1; string id = 1;
string content = 2; string content = 2;
string name = 3; string name = 3;
string color = 4; string color = 4;
} }
repeated Room rooms = 5;
repeated Room rooms = 4;
message Room { message Room {
string room = 1; string room = 1;
uint32 count = 2; uint32 count = 2;
} }
Welcome welcome = 6;
Welcome welcome = 5;
message Welcome { message Welcome {
string id = 1; string id = 1;
string name = 2; string name = 2;
@ -108,26 +102,21 @@ message ServerMessage {
repeated Chat chat = 6; repeated Chat chat = 6;
Role role = 7; Role role = 7;
} }
Move move = 7;
Press press = 8;
Release release = 9;
Move move = 6; Sustain sustain = 10;
Press press = 7;
Release release = 8;
Sustain sustain = 9;
message Sustain { message Sustain {
string id = 1; string id = 1;
bool enabled = 2; bool enabled = 2;
} }
Profile profile = 11;
Profile profile = 10; Profile join = 12;
Profile join = 11; string leave = 13;
string leave = 12; uint32 ratelimit = 14;
string message = 15;
int32 rateLimit = 13; string chown = 16;
string message = 14;
string chown = 15;
int32 clear = 16;
} }
message Profile { message Profile {

View file

@ -1,4 +1,4 @@
// PV version = 13661e19e8c210d990baa4d96aa8905430c709d5 // PV version = 9a65ffd093eefcad972f715896bf35d9d5058a2d
// @generated by protoc-gen-es v1.10.0 with parameter "target=ts" // @generated by protoc-gen-es v1.10.0 with parameter "target=ts"
// @generated from file pianoverse.proto (package pianoverse, syntax proto3) // @generated from file pianoverse.proto (package pianoverse, syntax proto3)
@ -39,74 +39,94 @@ proto3.util.setEnumType(Role, "pianoverse.Role", [
*/ */
export class ClientMessage extends Message<ClientMessage> { export class ClientMessage extends Message<ClientMessage> {
/** /**
* @generated from field: pianoverse.ClientMessage.EventType event = 1; * @generated from field: string chown = 1;
*/ */
event = ClientMessage_EventType.PING; chown = "";
/** /**
* @generated from field: pianoverse.ClientMessage.Room room = 3; * @generated from field: pianoverse.ClientMessage.EventType event = 2;
*/
event = ClientMessage_EventType.CHOWN;
/**
* @generated from field: pianoverse.ClientMessage.Heartbeat ping = 3;
*/
ping?: ClientMessage_Heartbeat;
/**
* @generated from field: pianoverse.ClientMessage.Room room = 4;
*/ */
room?: ClientMessage_Room; room?: ClientMessage_Room;
/** /**
* @generated from field: pianoverse.Profile profile = 4; * @generated from field: pianoverse.Profile profile = 5;
*/ */
profile?: Profile; profile?: Profile;
/** /**
* @generated from field: string chat = 5; * @generated from field: string chat = 6;
*/ */
chat = ""; chat = "";
/** /**
* @generated from field: pianoverse.Move move = 6; * @generated from field: pianoverse.Move move = 7;
*/ */
move?: Move; move?: Move;
/** /**
* @generated from field: string mute = 7; * @generated from field: string mute = 8;
*/ */
mute = ""; mute = "";
/** /**
* @generated from field: string unmute = 8; * @generated from field: string unmute = 9;
*/ */
unmute = ""; unmute = "";
/** /**
* @generated from field: string kick = 9; * @generated from field: string kick = 10;
*/ */
kick = ""; kick = "";
/** /**
* @generated from field: pianoverse.Press press = 10; * @generated from field: pianoverse.Press press = 11;
*/ */
press?: Press; press?: Press;
/** /**
* @generated from field: pianoverse.Release release = 11; * @generated from field: pianoverse.Release release = 12;
*/ */
release?: Release; release?: Release;
/** /**
* @generated from field: bool sustain = 12; * @generated from field: bool sustain = 13;
*/ */
sustain = false; sustain = false;
/** /**
* @generated from field: pianoverse.ClientMessage.Heartbeat heartbeat = 13; * @generated from field: pianoverse.ClientMessage.Heartbeat heartbeat = 14;
*/ */
heartbeat?: ClientMessage_Heartbeat; heartbeat?: ClientMessage_Heartbeat;
/** /**
* @generated from field: pianoverse.ClientMessage.Ban ban = 14; * @generated from field: pianoverse.ClientMessage.Ban ban = 15;
*/ */
ban?: ClientMessage_Ban; ban?: ClientMessage_Ban;
/** /**
* @generated from field: string chown = 15; * @generated from field: string ipban = 16;
*/ */
chown = ""; ipban = "";
/**
* @generated from field: string mod = 17;
*/
mod = "";
/**
* @generated from field: string unmod = 18;
*/
unmod = "";
constructor(data?: PartialMessage<ClientMessage>) { constructor(data?: PartialMessage<ClientMessage>) {
super(); super();
@ -116,20 +136,24 @@ export class ClientMessage extends Message<ClientMessage> {
static readonly runtime: typeof proto3 = proto3; static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "pianoverse.ClientMessage"; static readonly typeName = "pianoverse.ClientMessage";
static readonly fields: FieldList = proto3.util.newFieldList(() => [ static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "event", kind: "enum", T: proto3.getEnumType(ClientMessage_EventType) }, { no: 1, name: "chown", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 3, name: "room", kind: "message", T: ClientMessage_Room }, { no: 2, name: "event", kind: "enum", T: proto3.getEnumType(ClientMessage_EventType) },
{ no: 4, name: "profile", kind: "message", T: Profile }, { no: 3, name: "ping", kind: "message", T: ClientMessage_Heartbeat },
{ no: 5, name: "chat", kind: "scalar", T: 9 /* ScalarType.STRING */ }, { no: 4, name: "room", kind: "message", T: ClientMessage_Room },
{ no: 6, name: "move", kind: "message", T: Move }, { no: 5, name: "profile", kind: "message", T: Profile },
{ no: 7, name: "mute", kind: "scalar", T: 9 /* ScalarType.STRING */ }, { no: 6, name: "chat", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 8, name: "unmute", kind: "scalar", T: 9 /* ScalarType.STRING */ }, { no: 7, name: "move", kind: "message", T: Move },
{ no: 9, name: "kick", kind: "scalar", T: 9 /* ScalarType.STRING */ }, { no: 8, name: "mute", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 10, name: "press", kind: "message", T: Press }, { no: 9, name: "unmute", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 11, name: "release", kind: "message", T: Release }, { no: 10, name: "kick", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 12, name: "sustain", kind: "scalar", T: 8 /* ScalarType.BOOL */ }, { no: 11, name: "press", kind: "message", T: Press },
{ no: 13, name: "heartbeat", kind: "message", T: ClientMessage_Heartbeat }, { no: 12, name: "release", kind: "message", T: Release },
{ no: 14, name: "ban", kind: "message", T: ClientMessage_Ban }, { no: 13, name: "sustain", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
{ no: 15, name: "chown", kind: "scalar", T: 9 /* ScalarType.STRING */ }, { no: 14, name: "heartbeat", kind: "message", T: ClientMessage_Heartbeat },
{ no: 15, name: "ban", kind: "message", T: ClientMessage_Ban },
{ no: 16, name: "ipban", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 17, name: "mod", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 18, name: "unmod", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]); ]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ClientMessage { static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ClientMessage {
@ -154,91 +178,109 @@ export class ClientMessage extends Message<ClientMessage> {
*/ */
export enum ClientMessage_EventType { export enum ClientMessage_EventType {
/** /**
* @generated from enum value: PING = 0; * @generated from enum value: CHOWN = 0;
*/ */
PING = 0, CHOWN = 0,
/** /**
* @generated from enum value: ROOM = 1; * @generated from enum value: PING = 1;
*/ */
ROOM = 1, PING = 1,
/** /**
* @generated from enum value: PROFILE = 2; * @generated from enum value: ROOM = 2;
*/ */
PROFILE = 2, ROOM = 2,
/** /**
* @generated from enum value: CHAT = 3; * @generated from enum value: PROFILE = 3;
*/ */
CHAT = 3, PROFILE = 3,
/** /**
* @generated from enum value: MOVE = 4; * @generated from enum value: CHAT = 4;
*/ */
MOVE = 4, CHAT = 4,
/** /**
* @generated from enum value: MUTE = 5; * @generated from enum value: MOVE = 5;
*/ */
MUTE = 5, MOVE = 5,
/** /**
* @generated from enum value: UNMUTE = 6; * @generated from enum value: MUTE = 6;
*/ */
UNMUTE = 6, MUTE = 6,
/** /**
* @generated from enum value: KICK = 7; * @generated from enum value: UNMUTE = 7;
*/ */
KICK = 7, UNMUTE = 7,
/** /**
* @generated from enum value: PRESS = 8; * @generated from enum value: KICK = 8;
*/ */
PRESS = 8, KICK = 8,
/** /**
* @generated from enum value: RELEASE = 9; * @generated from enum value: PRESS = 9;
*/ */
RELEASE = 9, PRESS = 9,
/** /**
* @generated from enum value: SUSTAIN = 10; * @generated from enum value: RELEASE = 10;
*/ */
SUSTAIN = 10, RELEASE = 10,
/** /**
* @generated from enum value: HEARTBEAT = 11; * @generated from enum value: SUSTAIN = 11;
*/ */
HEARTBEAT = 11, SUSTAIN = 11,
/** /**
* @generated from enum value: BAN = 12; * @generated from enum value: HEARTBEAT = 12;
*/ */
BAN = 12, HEARTBEAT = 12,
/** /**
* @generated from enum value: CHOWN = 13; * @generated from enum value: BAN = 13;
*/ */
CHOWN = 13, BAN = 13,
/**
* @generated from enum value: IPBAN = 14;
*/
IPBAN = 14,
/**
* @generated from enum value: MOD = 15;
*/
MOD = 15,
/**
* @generated from enum value: UNMOD = 16;
*/
UNMOD = 16,
} }
// Retrieve enum metadata with: proto3.getEnumType(ClientMessage_EventType) // Retrieve enum metadata with: proto3.getEnumType(ClientMessage_EventType)
proto3.util.setEnumType(ClientMessage_EventType, "pianoverse.ClientMessage.EventType", [ proto3.util.setEnumType(ClientMessage_EventType, "pianoverse.ClientMessage.EventType", [
{ no: 0, name: "PING" }, { no: 0, name: "CHOWN" },
{ no: 1, name: "ROOM" }, { no: 1, name: "PING" },
{ no: 2, name: "PROFILE" }, { no: 2, name: "ROOM" },
{ no: 3, name: "CHAT" }, { no: 3, name: "PROFILE" },
{ no: 4, name: "MOVE" }, { no: 4, name: "CHAT" },
{ no: 5, name: "MUTE" }, { no: 5, name: "MOVE" },
{ no: 6, name: "UNMUTE" }, { no: 6, name: "MUTE" },
{ no: 7, name: "KICK" }, { no: 7, name: "UNMUTE" },
{ no: 8, name: "PRESS" }, { no: 8, name: "KICK" },
{ no: 9, name: "RELEASE" }, { no: 9, name: "PRESS" },
{ no: 10, name: "SUSTAIN" }, { no: 10, name: "RELEASE" },
{ no: 11, name: "HEARTBEAT" }, { no: 11, name: "SUSTAIN" },
{ no: 12, name: "BAN" }, { no: 12, name: "HEARTBEAT" },
{ no: 13, name: "CHOWN" }, { no: 13, name: "BAN" },
{ no: 14, name: "IPBAN" },
{ no: 15, name: "MOD" },
{ no: 16, name: "UNMOD" },
]); ]);
/** /**
@ -363,85 +405,85 @@ export class ClientMessage_Ban extends Message<ClientMessage_Ban> {
*/ */
export class ServerMessage extends Message<ServerMessage> { export class ServerMessage extends Message<ServerMessage> {
/** /**
* @generated from field: pianoverse.ServerMessage.EventType event = 1; * @generated from field: pianoverse.Profile clear = 1;
*/ */
event = ServerMessage_EventType.PONG; clear?: Profile;
/** /**
* @generated from field: pianoverse.ServerMessage.Pong pong = 2; * @generated from field: pianoverse.ServerMessage.EventType event = 2;
*/ */
pong?: ServerMessage_Pong; event = ServerMessage_EventType.CLEAR;
/** /**
* @generated from field: pianoverse.ServerMessage.Chat chat = 3; * @generated from field: pianoverse.Profile pong = 3;
*/
pong?: Profile;
/**
* @generated from field: pianoverse.ServerMessage.Chat chat = 4;
*/ */
chat?: ServerMessage_Chat; chat?: ServerMessage_Chat;
/** /**
* @generated from field: repeated pianoverse.ServerMessage.Room rooms = 4; * @generated from field: repeated pianoverse.ServerMessage.Room rooms = 5;
*/ */
rooms: ServerMessage_Room[] = []; rooms: ServerMessage_Room[] = [];
/** /**
* @generated from field: pianoverse.ServerMessage.Welcome welcome = 5; * @generated from field: pianoverse.ServerMessage.Welcome welcome = 6;
*/ */
welcome?: ServerMessage_Welcome; welcome?: ServerMessage_Welcome;
/** /**
* @generated from field: pianoverse.Move move = 6; * @generated from field: pianoverse.Move move = 7;
*/ */
move?: Move; move?: Move;
/** /**
* @generated from field: pianoverse.Press press = 7; * @generated from field: pianoverse.Press press = 8;
*/ */
press?: Press; press?: Press;
/** /**
* @generated from field: pianoverse.Release release = 8; * @generated from field: pianoverse.Release release = 9;
*/ */
release?: Release; release?: Release;
/** /**
* @generated from field: pianoverse.ServerMessage.Sustain sustain = 9; * @generated from field: pianoverse.ServerMessage.Sustain sustain = 10;
*/ */
sustain?: ServerMessage_Sustain; sustain?: ServerMessage_Sustain;
/** /**
* @generated from field: pianoverse.Profile profile = 10; * @generated from field: pianoverse.Profile profile = 11;
*/ */
profile?: Profile; profile?: Profile;
/** /**
* @generated from field: pianoverse.Profile join = 11; * @generated from field: pianoverse.Profile join = 12;
*/ */
join?: Profile; join?: Profile;
/** /**
* @generated from field: string leave = 12; * @generated from field: string leave = 13;
*/ */
leave = ""; leave = "";
/** /**
* @generated from field: int32 rateLimit = 13; * @generated from field: uint32 ratelimit = 14;
*/ */
rateLimit = 0; ratelimit = 0;
/** /**
* @generated from field: string message = 14; * @generated from field: string message = 15;
*/ */
message = ""; message = "";
/** /**
* @generated from field: string chown = 15; * @generated from field: string chown = 16;
*/ */
chown = ""; chown = "";
/**
* @generated from field: int32 clear = 16;
*/
clear = 0;
constructor(data?: PartialMessage<ServerMessage>) { constructor(data?: PartialMessage<ServerMessage>) {
super(); super();
proto3.util.initPartial(data, this); proto3.util.initPartial(data, this);
@ -450,22 +492,22 @@ export class ServerMessage extends Message<ServerMessage> {
static readonly runtime: typeof proto3 = proto3; static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "pianoverse.ServerMessage"; static readonly typeName = "pianoverse.ServerMessage";
static readonly fields: FieldList = proto3.util.newFieldList(() => [ static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "event", kind: "enum", T: proto3.getEnumType(ServerMessage_EventType) }, { no: 1, name: "clear", kind: "message", T: Profile },
{ no: 2, name: "pong", kind: "message", T: ServerMessage_Pong }, { no: 2, name: "event", kind: "enum", T: proto3.getEnumType(ServerMessage_EventType) },
{ no: 3, name: "chat", kind: "message", T: ServerMessage_Chat }, { no: 3, name: "pong", kind: "message", T: Profile },
{ no: 4, name: "rooms", kind: "message", T: ServerMessage_Room, repeated: true }, { no: 4, name: "chat", kind: "message", T: ServerMessage_Chat },
{ no: 5, name: "welcome", kind: "message", T: ServerMessage_Welcome }, { no: 5, name: "rooms", kind: "message", T: ServerMessage_Room, repeated: true },
{ no: 6, name: "move", kind: "message", T: Move }, { no: 6, name: "welcome", kind: "message", T: ServerMessage_Welcome },
{ no: 7, name: "press", kind: "message", T: Press }, { no: 7, name: "move", kind: "message", T: Move },
{ no: 8, name: "release", kind: "message", T: Release }, { no: 8, name: "press", kind: "message", T: Press },
{ no: 9, name: "sustain", kind: "message", T: ServerMessage_Sustain }, { no: 9, name: "release", kind: "message", T: Release },
{ no: 10, name: "profile", kind: "message", T: Profile }, { no: 10, name: "sustain", kind: "message", T: ServerMessage_Sustain },
{ no: 11, name: "join", kind: "message", T: Profile }, { no: 11, name: "profile", kind: "message", T: Profile },
{ no: 12, name: "leave", kind: "scalar", T: 9 /* ScalarType.STRING */ }, { no: 12, name: "join", kind: "message", T: Profile },
{ no: 13, name: "rateLimit", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, { no: 13, name: "leave", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 14, name: "message", kind: "scalar", T: 9 /* ScalarType.STRING */ }, { no: 14, name: "ratelimit", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
{ no: 15, name: "chown", kind: "scalar", T: 9 /* ScalarType.STRING */ }, { no: 15, name: "message", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 16, name: "clear", kind: "scalar", T: 5 /* ScalarType.INT32 */ }, { no: 16, name: "chown", kind: "scalar", T: 9 /* ScalarType.STRING */ },
]); ]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ServerMessage { static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ServerMessage {
@ -490,130 +532,99 @@ export class ServerMessage extends Message<ServerMessage> {
*/ */
export enum ServerMessage_EventType { export enum ServerMessage_EventType {
/** /**
* @generated from enum value: PONG = 0; * @generated from enum value: CLEAR = 0;
*/ */
PONG = 0, CLEAR = 0,
/** /**
* @generated from enum value: CHAT = 1; * @generated from enum value: PONG = 1;
*/ */
CHAT = 1, PONG = 1,
/** /**
* @generated from enum value: ROOMS = 2; * @generated from enum value: CHAT = 2;
*/ */
ROOMS = 2, CHAT = 2,
/** /**
* @generated from enum value: WELCOME = 3; * @generated from enum value: ROOMS = 3;
*/ */
WELCOME = 3, ROOMS = 3,
/** /**
* @generated from enum value: MOVE = 4; * @generated from enum value: WELCOME = 4;
*/ */
MOVE = 4, WELCOME = 4,
/** /**
* @generated from enum value: PRESS = 5; * @generated from enum value: MOVE = 5;
*/ */
PRESS = 5, MOVE = 5,
/** /**
* @generated from enum value: RELEASE = 6; * @generated from enum value: PRESS = 6;
*/ */
RELEASE = 6, PRESS = 6,
/** /**
* @generated from enum value: SUSTAIN = 7; * @generated from enum value: RELEASE = 7;
*/ */
SUSTAIN = 7, RELEASE = 7,
/** /**
* @generated from enum value: PROFILE = 8; * @generated from enum value: SUSTAIN = 8;
*/ */
PROFILE = 8, SUSTAIN = 8,
/** /**
* @generated from enum value: JOIN = 9; * @generated from enum value: PROFILE = 9;
*/ */
JOIN = 9, PROFILE = 9,
/** /**
* @generated from enum value: LEAVE = 10; * @generated from enum value: JOIN = 10;
*/ */
LEAVE = 10, JOIN = 10,
/** /**
* @generated from enum value: RATELIMIT = 11; * @generated from enum value: LEAVE = 11;
*/ */
RATELIMIT = 11, LEAVE = 11,
/** /**
* @generated from enum value: MESSAGE = 12; * @generated from enum value: RATELIMIT = 12;
*/ */
MESSAGE = 12, RATELIMIT = 12,
/** /**
* @generated from enum value: CHOWN = 13; * @generated from enum value: MESSAGE = 13;
*/ */
CHOWN = 13, MESSAGE = 13,
/** /**
* @generated from enum value: CLEAR = 14; * @generated from enum value: CHOWN = 14;
*/ */
CLEAR = 14, CHOWN = 14,
} }
// Retrieve enum metadata with: proto3.getEnumType(ServerMessage_EventType) // Retrieve enum metadata with: proto3.getEnumType(ServerMessage_EventType)
proto3.util.setEnumType(ServerMessage_EventType, "pianoverse.ServerMessage.EventType", [ proto3.util.setEnumType(ServerMessage_EventType, "pianoverse.ServerMessage.EventType", [
{ no: 0, name: "PONG" }, { no: 0, name: "CLEAR" },
{ no: 1, name: "CHAT" }, { no: 1, name: "PONG" },
{ no: 2, name: "ROOMS" }, { no: 2, name: "CHAT" },
{ no: 3, name: "WELCOME" }, { no: 3, name: "ROOMS" },
{ no: 4, name: "MOVE" }, { no: 4, name: "WELCOME" },
{ no: 5, name: "PRESS" }, { no: 5, name: "MOVE" },
{ no: 6, name: "RELEASE" }, { no: 6, name: "PRESS" },
{ no: 7, name: "SUSTAIN" }, { no: 7, name: "RELEASE" },
{ no: 8, name: "PROFILE" }, { no: 8, name: "SUSTAIN" },
{ no: 9, name: "JOIN" }, { no: 9, name: "PROFILE" },
{ no: 10, name: "LEAVE" }, { no: 10, name: "JOIN" },
{ no: 11, name: "RATELIMIT" }, { no: 11, name: "LEAVE" },
{ no: 12, name: "MESSAGE" }, { no: 12, name: "RATELIMIT" },
{ no: 13, name: "CHOWN" }, { no: 13, name: "MESSAGE" },
{ no: 14, name: "CLEAR" }, { no: 14, name: "CHOWN" },
]); ]);
/**
* @generated from message pianoverse.ServerMessage.Pong
*/
export class ServerMessage_Pong extends Message<ServerMessage_Pong> {
constructor(data?: PartialMessage<ServerMessage_Pong>) {
super();
proto3.util.initPartial(data, this);
}
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "pianoverse.ServerMessage.Pong";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ServerMessage_Pong {
return new ServerMessage_Pong().fromBinary(bytes, options);
}
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ServerMessage_Pong {
return new ServerMessage_Pong().fromJson(jsonValue, options);
}
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ServerMessage_Pong {
return new ServerMessage_Pong().fromJsonString(jsonString, options);
}
static equals(a: ServerMessage_Pong | PlainMessage<ServerMessage_Pong> | undefined, b: ServerMessage_Pong | PlainMessage<ServerMessage_Pong> | undefined): boolean {
return proto3.util.equals(ServerMessage_Pong, a, b);
}
}
/** /**
* @generated from message pianoverse.ServerMessage.Chat * @generated from message pianoverse.ServerMessage.Chat
*/ */