~starkingdoms/starkingdoms

ref: 06bf8871a9654d0f1cbef43db57f67d62b8838c1 starkingdoms/client/src/protocol/goodbye_reason.ts -rw-r--r-- 1.5 KiB
06bf8871 — ghostlyzsh fixed cargo bounding boxes and weights 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
/* eslint-disable */

export const protobufPackage = "protocol.goodbye_reason";

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

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

export function goodbyeReasonToJSON(object: GoodbyeReason): string {
  switch (object) {
    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";
  }
}