~starkingdoms/starkingdoms

ref: f73656c66fcec95e0957a7500c291926e0dcab2e starkingdoms/client/src/protocol/goodbye_reason.ts -rw-r--r-- 1.6 KiB
f73656c6 — core the server currently does much nothing 2 years ago
                                                                                
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
//@ts-nocheck

export const protobufPackage = "protocol.goodbye_reason";

export enum GoodbyeReason {
  UNKNOWN = 0,
  UnsupportedProtocol = 1,
  UnexpectedPacket = 2,
  UnexpectedNextState = 3,
  UsernameTaken = 4,
  PingPongTimeout = 5,
  Done = 6,
  UNRECOGNIZED = -1,
}

export function goodbyeReasonFromJSON(object: any): GoodbyeReason {
  switch (object) {
    case 0:
    case "UNKNOWN":
      return GoodbyeReason.UNKNOWN;
    case 1:
    case "UnsupportedProtocol":
      return GoodbyeReason.UnsupportedProtocol;
    case 2:
    case "UnexpectedPacket":
      return GoodbyeReason.UnexpectedPacket;
    case 3:
    case "UnexpectedNextState":
      return GoodbyeReason.UnexpectedNextState;
    case 4:
    case "UsernameTaken":
      return GoodbyeReason.UsernameTaken;
    case 5:
    case "PingPongTimeout":
      return GoodbyeReason.PingPongTimeout;
    case 6:
    case "Done":
      return GoodbyeReason.Done;
    case -1:
    case "UNRECOGNIZED":
    default:
      return GoodbyeReason.UNRECOGNIZED;
  }
}

export function goodbyeReasonToJSON(object: GoodbyeReason): string {
  switch (object) {
    case GoodbyeReason.UNKNOWN:
      return "UNKNOWN";
    case GoodbyeReason.UnsupportedProtocol:
      return "UnsupportedProtocol";
    case GoodbyeReason.UnexpectedPacket:
      return "UnexpectedPacket";
    case GoodbyeReason.UnexpectedNextState:
      return "UnexpectedNextState";
    case GoodbyeReason.UsernameTaken:
      return "UsernameTaken";
    case GoodbyeReason.PingPongTimeout:
      return "PingPongTimeout";
    case GoodbyeReason.Done:
      return "Done";
    case GoodbyeReason.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}