Commit 0b982b1f authored by Chunchi Che's avatar Chunchi Che Committed by WANG HE

update idl/ocgcore.ts

parent 506c14e9
...@@ -5,8 +5,14 @@ ...@@ -5,8 +5,14 @@
* git: https://github.com/thesayyn/protoc-gen-ts */ * git: https://github.com/thesayyn/protoc-gen-ts */
import * as pb_1 from "google-protobuf"; import * as pb_1 from "google-protobuf";
export namespace ygopro { export namespace ygopro {
export enum HandType {
UNKNOWN = 0,
SCISSORS = 1,
ROCK = 2,
PAPER = 3,
}
export class YgoCtosMsg extends pb_1.Message { export class YgoCtosMsg extends pb_1.Message {
#one_of_decls: number[][] = [[1, 2, 3, 4, 5, 6, 7]]; #one_of_decls: number[][] = [[1, 2, 3, 4, 5, 6, 7, 8]];
constructor( constructor(
data?: data?:
| any[] | any[]
...@@ -19,6 +25,7 @@ export namespace ygopro { ...@@ -19,6 +25,7 @@ export namespace ygopro {
ctos_hs_start?: never; ctos_hs_start?: never;
ctos_hs_not_ready?: never; ctos_hs_not_ready?: never;
ctos_hand_result?: never; ctos_hand_result?: never;
ctos_tp_result?: never;
} }
| { | {
ctos_player_info?: never; ctos_player_info?: never;
...@@ -28,6 +35,7 @@ export namespace ygopro { ...@@ -28,6 +35,7 @@ export namespace ygopro {
ctos_hs_start?: never; ctos_hs_start?: never;
ctos_hs_not_ready?: never; ctos_hs_not_ready?: never;
ctos_hand_result?: never; ctos_hand_result?: never;
ctos_tp_result?: never;
} }
| { | {
ctos_player_info?: never; ctos_player_info?: never;
...@@ -37,6 +45,7 @@ export namespace ygopro { ...@@ -37,6 +45,7 @@ export namespace ygopro {
ctos_hs_start?: never; ctos_hs_start?: never;
ctos_hs_not_ready?: never; ctos_hs_not_ready?: never;
ctos_hand_result?: never; ctos_hand_result?: never;
ctos_tp_result?: never;
} }
| { | {
ctos_player_info?: never; ctos_player_info?: never;
...@@ -46,6 +55,7 @@ export namespace ygopro { ...@@ -46,6 +55,7 @@ export namespace ygopro {
ctos_hs_start?: never; ctos_hs_start?: never;
ctos_hs_not_ready?: never; ctos_hs_not_ready?: never;
ctos_hand_result?: never; ctos_hand_result?: never;
ctos_tp_result?: never;
} }
| { | {
ctos_player_info?: never; ctos_player_info?: never;
...@@ -55,6 +65,7 @@ export namespace ygopro { ...@@ -55,6 +65,7 @@ export namespace ygopro {
ctos_hs_start?: CtosHsStart; ctos_hs_start?: CtosHsStart;
ctos_hs_not_ready?: never; ctos_hs_not_ready?: never;
ctos_hand_result?: never; ctos_hand_result?: never;
ctos_tp_result?: never;
} }
| { | {
ctos_player_info?: never; ctos_player_info?: never;
...@@ -64,6 +75,7 @@ export namespace ygopro { ...@@ -64,6 +75,7 @@ export namespace ygopro {
ctos_hs_start?: never; ctos_hs_start?: never;
ctos_hs_not_ready?: CtosHsNotReady; ctos_hs_not_ready?: CtosHsNotReady;
ctos_hand_result?: never; ctos_hand_result?: never;
ctos_tp_result?: never;
} }
| { | {
ctos_player_info?: never; ctos_player_info?: never;
...@@ -73,6 +85,17 @@ export namespace ygopro { ...@@ -73,6 +85,17 @@ export namespace ygopro {
ctos_hs_start?: never; ctos_hs_start?: never;
ctos_hs_not_ready?: never; ctos_hs_not_ready?: never;
ctos_hand_result?: CtosHandResult; ctos_hand_result?: CtosHandResult;
ctos_tp_result?: never;
}
| {
ctos_player_info?: never;
ctos_join_game?: never;
ctos_update_deck?: never;
ctos_hs_ready?: never;
ctos_hs_start?: never;
ctos_hs_not_ready?: never;
ctos_hand_result?: never;
ctos_tp_result?: CtosTpResult;
} }
)) ))
) { ) {
...@@ -110,6 +133,9 @@ export namespace ygopro { ...@@ -110,6 +133,9 @@ export namespace ygopro {
if ("ctos_hand_result" in data && data.ctos_hand_result != undefined) { if ("ctos_hand_result" in data && data.ctos_hand_result != undefined) {
this.ctos_hand_result = data.ctos_hand_result; this.ctos_hand_result = data.ctos_hand_result;
} }
if ("ctos_tp_result" in data && data.ctos_tp_result != undefined) {
this.ctos_tp_result = data.ctos_tp_result;
}
} }
} }
get ctos_player_info() { get ctos_player_info() {
...@@ -195,6 +221,19 @@ export namespace ygopro { ...@@ -195,6 +221,19 @@ export namespace ygopro {
get has_ctos_hand_result() { get has_ctos_hand_result() {
return pb_1.Message.getField(this, 7) != null; return pb_1.Message.getField(this, 7) != null;
} }
get ctos_tp_result() {
return pb_1.Message.getWrapperField(
this,
CtosTpResult,
8
) as CtosTpResult;
}
set ctos_tp_result(value: CtosTpResult) {
pb_1.Message.setOneofWrapperField(this, 8, this.#one_of_decls[0], value);
}
get has_ctos_tp_result() {
return pb_1.Message.getField(this, 8) != null;
}
get msg() { get msg() {
const cases: { const cases: {
[index: number]: [index: number]:
...@@ -205,7 +244,8 @@ export namespace ygopro { ...@@ -205,7 +244,8 @@ export namespace ygopro {
| "ctos_hs_ready" | "ctos_hs_ready"
| "ctos_hs_start" | "ctos_hs_start"
| "ctos_hs_not_ready" | "ctos_hs_not_ready"
| "ctos_hand_result"; | "ctos_hand_result"
| "ctos_tp_result";
} = { } = {
0: "none", 0: "none",
1: "ctos_player_info", 1: "ctos_player_info",
...@@ -215,8 +255,11 @@ export namespace ygopro { ...@@ -215,8 +255,11 @@ export namespace ygopro {
5: "ctos_hs_start", 5: "ctos_hs_start",
6: "ctos_hs_not_ready", 6: "ctos_hs_not_ready",
7: "ctos_hand_result", 7: "ctos_hand_result",
8: "ctos_tp_result",
}; };
return cases[pb_1.Message.computeOneofCase(this, [1, 2, 3, 4, 5, 6, 7])]; return cases[
pb_1.Message.computeOneofCase(this, [1, 2, 3, 4, 5, 6, 7, 8])
];
} }
static fromObject(data: { static fromObject(data: {
ctos_player_info?: ReturnType<typeof CtosPlayerInfo.prototype.toObject>; ctos_player_info?: ReturnType<typeof CtosPlayerInfo.prototype.toObject>;
...@@ -226,6 +269,7 @@ export namespace ygopro { ...@@ -226,6 +269,7 @@ export namespace ygopro {
ctos_hs_start?: ReturnType<typeof CtosHsStart.prototype.toObject>; ctos_hs_start?: ReturnType<typeof CtosHsStart.prototype.toObject>;
ctos_hs_not_ready?: ReturnType<typeof CtosHsNotReady.prototype.toObject>; ctos_hs_not_ready?: ReturnType<typeof CtosHsNotReady.prototype.toObject>;
ctos_hand_result?: ReturnType<typeof CtosHandResult.prototype.toObject>; ctos_hand_result?: ReturnType<typeof CtosHandResult.prototype.toObject>;
ctos_tp_result?: ReturnType<typeof CtosTpResult.prototype.toObject>;
}): YgoCtosMsg { }): YgoCtosMsg {
const message = new YgoCtosMsg({}); const message = new YgoCtosMsg({});
if (data.ctos_player_info != null) { if (data.ctos_player_info != null) {
...@@ -257,6 +301,9 @@ export namespace ygopro { ...@@ -257,6 +301,9 @@ export namespace ygopro {
data.ctos_hand_result data.ctos_hand_result
); );
} }
if (data.ctos_tp_result != null) {
message.ctos_tp_result = CtosTpResult.fromObject(data.ctos_tp_result);
}
return message; return message;
} }
toObject() { toObject() {
...@@ -270,6 +317,7 @@ export namespace ygopro { ...@@ -270,6 +317,7 @@ export namespace ygopro {
typeof CtosHsNotReady.prototype.toObject typeof CtosHsNotReady.prototype.toObject
>; >;
ctos_hand_result?: ReturnType<typeof CtosHandResult.prototype.toObject>; ctos_hand_result?: ReturnType<typeof CtosHandResult.prototype.toObject>;
ctos_tp_result?: ReturnType<typeof CtosTpResult.prototype.toObject>;
} = {}; } = {};
if (this.ctos_player_info != null) { if (this.ctos_player_info != null) {
data.ctos_player_info = this.ctos_player_info.toObject(); data.ctos_player_info = this.ctos_player_info.toObject();
...@@ -292,6 +340,9 @@ export namespace ygopro { ...@@ -292,6 +340,9 @@ export namespace ygopro {
if (this.ctos_hand_result != null) { if (this.ctos_hand_result != null) {
data.ctos_hand_result = this.ctos_hand_result.toObject(); data.ctos_hand_result = this.ctos_hand_result.toObject();
} }
if (this.ctos_tp_result != null) {
data.ctos_tp_result = this.ctos_tp_result.toObject();
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
...@@ -326,6 +377,10 @@ export namespace ygopro { ...@@ -326,6 +377,10 @@ export namespace ygopro {
writer.writeMessage(7, this.ctos_hand_result, () => writer.writeMessage(7, this.ctos_hand_result, () =>
this.ctos_hand_result.serialize(writer) this.ctos_hand_result.serialize(writer)
); );
if (this.has_ctos_tp_result)
writer.writeMessage(8, this.ctos_tp_result, () =>
this.ctos_tp_result.serialize(writer)
);
if (!w) return writer.getResultBuffer(); if (!w) return writer.getResultBuffer();
} }
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): YgoCtosMsg { static deserialize(bytes: Uint8Array | pb_1.BinaryReader): YgoCtosMsg {
...@@ -383,6 +438,12 @@ export namespace ygopro { ...@@ -383,6 +438,12 @@ export namespace ygopro {
(message.ctos_hand_result = CtosHandResult.deserialize(reader)) (message.ctos_hand_result = CtosHandResult.deserialize(reader))
); );
break; break;
case 8:
reader.readMessage(
message.ctos_tp_result,
() => (message.ctos_tp_result = CtosTpResult.deserialize(reader))
);
break;
default: default:
reader.skipField(); reader.skipField();
} }
...@@ -397,7 +458,7 @@ export namespace ygopro { ...@@ -397,7 +458,7 @@ export namespace ygopro {
} }
} }
export class YgoStocMsg extends pb_1.Message { export class YgoStocMsg extends pb_1.Message {
#one_of_decls: number[][] = [[1, 2, 3, 4, 5, 6, 7]]; #one_of_decls: number[][] = [[1, 2, 3, 4, 5, 6, 7, 8, 9]];
constructor( constructor(
data?: data?:
| any[] | any[]
...@@ -410,6 +471,8 @@ export namespace ygopro { ...@@ -410,6 +471,8 @@ export namespace ygopro {
stoc_hs_player_change?: never; stoc_hs_player_change?: never;
stoc_hs_watch_change?: never; stoc_hs_watch_change?: never;
stoc_select_hand?: never; stoc_select_hand?: never;
stoc_hand_result?: never;
stoc_select_tp?: never;
} }
| { | {
stoc_join_game?: never; stoc_join_game?: never;
...@@ -419,6 +482,8 @@ export namespace ygopro { ...@@ -419,6 +482,8 @@ export namespace ygopro {
stoc_hs_player_change?: never; stoc_hs_player_change?: never;
stoc_hs_watch_change?: never; stoc_hs_watch_change?: never;
stoc_select_hand?: never; stoc_select_hand?: never;
stoc_hand_result?: never;
stoc_select_tp?: never;
} }
| { | {
stoc_join_game?: never; stoc_join_game?: never;
...@@ -428,6 +493,8 @@ export namespace ygopro { ...@@ -428,6 +493,8 @@ export namespace ygopro {
stoc_hs_player_change?: never; stoc_hs_player_change?: never;
stoc_hs_watch_change?: never; stoc_hs_watch_change?: never;
stoc_select_hand?: never; stoc_select_hand?: never;
stoc_hand_result?: never;
stoc_select_tp?: never;
} }
| { | {
stoc_join_game?: never; stoc_join_game?: never;
...@@ -437,6 +504,8 @@ export namespace ygopro { ...@@ -437,6 +504,8 @@ export namespace ygopro {
stoc_hs_player_change?: never; stoc_hs_player_change?: never;
stoc_hs_watch_change?: never; stoc_hs_watch_change?: never;
stoc_select_hand?: never; stoc_select_hand?: never;
stoc_hand_result?: never;
stoc_select_tp?: never;
} }
| { | {
stoc_join_game?: never; stoc_join_game?: never;
...@@ -446,6 +515,8 @@ export namespace ygopro { ...@@ -446,6 +515,8 @@ export namespace ygopro {
stoc_hs_player_change?: StocHsPlayerChange; stoc_hs_player_change?: StocHsPlayerChange;
stoc_hs_watch_change?: never; stoc_hs_watch_change?: never;
stoc_select_hand?: never; stoc_select_hand?: never;
stoc_hand_result?: never;
stoc_select_tp?: never;
} }
| { | {
stoc_join_game?: never; stoc_join_game?: never;
...@@ -455,6 +526,8 @@ export namespace ygopro { ...@@ -455,6 +526,8 @@ export namespace ygopro {
stoc_hs_player_change?: never; stoc_hs_player_change?: never;
stoc_hs_watch_change?: StocHsWatchChange; stoc_hs_watch_change?: StocHsWatchChange;
stoc_select_hand?: never; stoc_select_hand?: never;
stoc_hand_result?: never;
stoc_select_tp?: never;
} }
| { | {
stoc_join_game?: never; stoc_join_game?: never;
...@@ -464,6 +537,30 @@ export namespace ygopro { ...@@ -464,6 +537,30 @@ export namespace ygopro {
stoc_hs_player_change?: never; stoc_hs_player_change?: never;
stoc_hs_watch_change?: never; stoc_hs_watch_change?: never;
stoc_select_hand?: StocSelectHand; stoc_select_hand?: StocSelectHand;
stoc_hand_result?: never;
stoc_select_tp?: never;
}
| {
stoc_join_game?: never;
stoc_chat?: never;
stoc_hs_player_enter?: never;
stoc_type_change?: never;
stoc_hs_player_change?: never;
stoc_hs_watch_change?: never;
stoc_select_hand?: never;
stoc_hand_result?: StocHandResult;
stoc_select_tp?: never;
}
| {
stoc_join_game?: never;
stoc_chat?: never;
stoc_hs_player_enter?: never;
stoc_type_change?: never;
stoc_hs_player_change?: never;
stoc_hs_watch_change?: never;
stoc_select_hand?: never;
stoc_hand_result?: never;
stoc_select_tp?: StocSelectTp;
} }
)) ))
) { ) {
...@@ -507,6 +604,12 @@ export namespace ygopro { ...@@ -507,6 +604,12 @@ export namespace ygopro {
if ("stoc_select_hand" in data && data.stoc_select_hand != undefined) { if ("stoc_select_hand" in data && data.stoc_select_hand != undefined) {
this.stoc_select_hand = data.stoc_select_hand; this.stoc_select_hand = data.stoc_select_hand;
} }
if ("stoc_hand_result" in data && data.stoc_hand_result != undefined) {
this.stoc_hand_result = data.stoc_hand_result;
}
if ("stoc_select_tp" in data && data.stoc_select_tp != undefined) {
this.stoc_select_tp = data.stoc_select_tp;
}
} }
} }
get stoc_join_game() { get stoc_join_game() {
...@@ -596,6 +699,32 @@ export namespace ygopro { ...@@ -596,6 +699,32 @@ export namespace ygopro {
get has_stoc_select_hand() { get has_stoc_select_hand() {
return pb_1.Message.getField(this, 7) != null; return pb_1.Message.getField(this, 7) != null;
} }
get stoc_hand_result() {
return pb_1.Message.getWrapperField(
this,
StocHandResult,
8
) as StocHandResult;
}
set stoc_hand_result(value: StocHandResult) {
pb_1.Message.setOneofWrapperField(this, 8, this.#one_of_decls[0], value);
}
get has_stoc_hand_result() {
return pb_1.Message.getField(this, 8) != null;
}
get stoc_select_tp() {
return pb_1.Message.getWrapperField(
this,
StocSelectTp,
9
) as StocSelectTp;
}
set stoc_select_tp(value: StocSelectTp) {
pb_1.Message.setOneofWrapperField(this, 9, this.#one_of_decls[0], value);
}
get has_stoc_select_tp() {
return pb_1.Message.getField(this, 9) != null;
}
get msg() { get msg() {
const cases: { const cases: {
[index: number]: [index: number]:
...@@ -606,7 +735,9 @@ export namespace ygopro { ...@@ -606,7 +735,9 @@ export namespace ygopro {
| "stoc_type_change" | "stoc_type_change"
| "stoc_hs_player_change" | "stoc_hs_player_change"
| "stoc_hs_watch_change" | "stoc_hs_watch_change"
| "stoc_select_hand"; | "stoc_select_hand"
| "stoc_hand_result"
| "stoc_select_tp";
} = { } = {
0: "none", 0: "none",
1: "stoc_join_game", 1: "stoc_join_game",
...@@ -616,8 +747,12 @@ export namespace ygopro { ...@@ -616,8 +747,12 @@ export namespace ygopro {
5: "stoc_hs_player_change", 5: "stoc_hs_player_change",
6: "stoc_hs_watch_change", 6: "stoc_hs_watch_change",
7: "stoc_select_hand", 7: "stoc_select_hand",
8: "stoc_hand_result",
9: "stoc_select_tp",
}; };
return cases[pb_1.Message.computeOneofCase(this, [1, 2, 3, 4, 5, 6, 7])]; return cases[
pb_1.Message.computeOneofCase(this, [1, 2, 3, 4, 5, 6, 7, 8, 9])
];
} }
static fromObject(data: { static fromObject(data: {
stoc_join_game?: ReturnType<typeof StocJoinGame.prototype.toObject>; stoc_join_game?: ReturnType<typeof StocJoinGame.prototype.toObject>;
...@@ -633,6 +768,8 @@ export namespace ygopro { ...@@ -633,6 +768,8 @@ export namespace ygopro {
typeof StocHsWatchChange.prototype.toObject typeof StocHsWatchChange.prototype.toObject
>; >;
stoc_select_hand?: ReturnType<typeof StocSelectHand.prototype.toObject>; stoc_select_hand?: ReturnType<typeof StocSelectHand.prototype.toObject>;
stoc_hand_result?: ReturnType<typeof StocHandResult.prototype.toObject>;
stoc_select_tp?: ReturnType<typeof StocSelectTp.prototype.toObject>;
}): YgoStocMsg { }): YgoStocMsg {
const message = new YgoStocMsg({}); const message = new YgoStocMsg({});
if (data.stoc_join_game != null) { if (data.stoc_join_game != null) {
...@@ -666,6 +803,14 @@ export namespace ygopro { ...@@ -666,6 +803,14 @@ export namespace ygopro {
data.stoc_select_hand data.stoc_select_hand
); );
} }
if (data.stoc_hand_result != null) {
message.stoc_hand_result = StocHandResult.fromObject(
data.stoc_hand_result
);
}
if (data.stoc_select_tp != null) {
message.stoc_select_tp = StocSelectTp.fromObject(data.stoc_select_tp);
}
return message; return message;
} }
toObject() { toObject() {
...@@ -683,6 +828,8 @@ export namespace ygopro { ...@@ -683,6 +828,8 @@ export namespace ygopro {
typeof StocHsWatchChange.prototype.toObject typeof StocHsWatchChange.prototype.toObject
>; >;
stoc_select_hand?: ReturnType<typeof StocSelectHand.prototype.toObject>; stoc_select_hand?: ReturnType<typeof StocSelectHand.prototype.toObject>;
stoc_hand_result?: ReturnType<typeof StocHandResult.prototype.toObject>;
stoc_select_tp?: ReturnType<typeof StocSelectTp.prototype.toObject>;
} = {}; } = {};
if (this.stoc_join_game != null) { if (this.stoc_join_game != null) {
data.stoc_join_game = this.stoc_join_game.toObject(); data.stoc_join_game = this.stoc_join_game.toObject();
...@@ -705,6 +852,12 @@ export namespace ygopro { ...@@ -705,6 +852,12 @@ export namespace ygopro {
if (this.stoc_select_hand != null) { if (this.stoc_select_hand != null) {
data.stoc_select_hand = this.stoc_select_hand.toObject(); data.stoc_select_hand = this.stoc_select_hand.toObject();
} }
if (this.stoc_hand_result != null) {
data.stoc_hand_result = this.stoc_hand_result.toObject();
}
if (this.stoc_select_tp != null) {
data.stoc_select_tp = this.stoc_select_tp.toObject();
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
...@@ -739,6 +892,14 @@ export namespace ygopro { ...@@ -739,6 +892,14 @@ export namespace ygopro {
writer.writeMessage(7, this.stoc_select_hand, () => writer.writeMessage(7, this.stoc_select_hand, () =>
this.stoc_select_hand.serialize(writer) this.stoc_select_hand.serialize(writer)
); );
if (this.has_stoc_hand_result)
writer.writeMessage(8, this.stoc_hand_result, () =>
this.stoc_hand_result.serialize(writer)
);
if (this.has_stoc_select_tp)
writer.writeMessage(9, this.stoc_select_tp, () =>
this.stoc_select_tp.serialize(writer)
);
if (!w) return writer.getResultBuffer(); if (!w) return writer.getResultBuffer();
} }
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): YgoStocMsg { static deserialize(bytes: Uint8Array | pb_1.BinaryReader): YgoStocMsg {
...@@ -800,6 +961,19 @@ export namespace ygopro { ...@@ -800,6 +961,19 @@ export namespace ygopro {
(message.stoc_select_hand = StocSelectHand.deserialize(reader)) (message.stoc_select_hand = StocSelectHand.deserialize(reader))
); );
break; break;
case 8:
reader.readMessage(
message.stoc_hand_result,
() =>
(message.stoc_hand_result = StocHandResult.deserialize(reader))
);
break;
case 9:
reader.readMessage(
message.stoc_select_tp,
() => (message.stoc_select_tp = StocSelectTp.deserialize(reader))
);
break;
default: default:
reader.skipField(); reader.skipField();
} }
...@@ -1298,7 +1472,7 @@ export namespace ygopro { ...@@ -1298,7 +1472,7 @@ export namespace ygopro {
data?: data?:
| any[] | any[]
| { | {
hand?: CtosHandResult.HandType; hand?: HandType;
} }
) { ) {
super(); super();
...@@ -1320,15 +1494,13 @@ export namespace ygopro { ...@@ -1320,15 +1494,13 @@ export namespace ygopro {
return pb_1.Message.getFieldWithDefault( return pb_1.Message.getFieldWithDefault(
this, this,
1, 1,
CtosHandResult.HandType.UNKNOWN HandType.UNKNOWN
) as CtosHandResult.HandType; ) as HandType;
} }
set hand(value: CtosHandResult.HandType) { set hand(value: HandType) {
pb_1.Message.setField(this, 1, value); pb_1.Message.setField(this, 1, value);
} }
static fromObject(data: { static fromObject(data: { hand?: HandType }): CtosHandResult {
hand?: CtosHandResult.HandType;
}): CtosHandResult {
const message = new CtosHandResult({}); const message = new CtosHandResult({});
if (data.hand != null) { if (data.hand != null) {
message.hand = data.hand; message.hand = data.hand;
...@@ -1337,7 +1509,7 @@ export namespace ygopro { ...@@ -1337,7 +1509,7 @@ export namespace ygopro {
} }
toObject() { toObject() {
const data: { const data: {
hand?: CtosHandResult.HandType; hand?: HandType;
} = {}; } = {};
if (this.hand != null) { if (this.hand != null) {
data.hand = this.hand; data.hand = this.hand;
...@@ -1348,8 +1520,7 @@ export namespace ygopro { ...@@ -1348,8 +1520,7 @@ export namespace ygopro {
serialize(w: pb_1.BinaryWriter): void; serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void { serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter(); const writer = w || new pb_1.BinaryWriter();
if (this.hand != CtosHandResult.HandType.UNKNOWN) if (this.hand != HandType.UNKNOWN) writer.writeEnum(1, this.hand);
writer.writeEnum(1, this.hand);
if (!w) return writer.getResultBuffer(); if (!w) return writer.getResultBuffer();
} }
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CtosHandResult { static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CtosHandResult {
...@@ -1377,12 +1548,93 @@ export namespace ygopro { ...@@ -1377,12 +1548,93 @@ export namespace ygopro {
return CtosHandResult.deserialize(bytes); return CtosHandResult.deserialize(bytes);
} }
} }
export namespace CtosHandResult { export class CtosTpResult extends pb_1.Message {
export enum HandType { #one_of_decls: number[][] = [];
constructor(
data?:
| any[]
| {
tp?: CtosTpResult.TpType;
}
) {
super();
pb_1.Message.initialize(
this,
Array.isArray(data) ? data : [],
0,
-1,
[],
this.#one_of_decls
);
if (!Array.isArray(data) && typeof data == "object") {
if ("tp" in data && data.tp != undefined) {
this.tp = data.tp;
}
}
}
get tp() {
return pb_1.Message.getFieldWithDefault(
this,
1,
CtosTpResult.TpType.UNKNOWN
) as CtosTpResult.TpType;
}
set tp(value: CtosTpResult.TpType) {
pb_1.Message.setField(this, 1, value);
}
static fromObject(data: { tp?: CtosTpResult.TpType }): CtosTpResult {
const message = new CtosTpResult({});
if (data.tp != null) {
message.tp = data.tp;
}
return message;
}
toObject() {
const data: {
tp?: CtosTpResult.TpType;
} = {};
if (this.tp != null) {
data.tp = this.tp;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.tp != CtosTpResult.TpType.UNKNOWN) writer.writeEnum(1, this.tp);
if (!w) return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CtosTpResult {
const reader =
bytes instanceof pb_1.BinaryReader
? bytes
: new pb_1.BinaryReader(bytes),
message = new CtosTpResult();
while (reader.nextField()) {
if (reader.isEndGroup()) break;
switch (reader.getFieldNumber()) {
case 1:
message.tp = reader.readEnum();
break;
default:
reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): CtosTpResult {
return CtosTpResult.deserialize(bytes);
}
}
export namespace CtosTpResult {
export enum TpType {
UNKNOWN = 0, UNKNOWN = 0,
SCISSORS = 1, FIRST = 1,
ROCK = 2, SECOND = 2,
PAPER = 3,
} }
} }
export class StocJoinGame extends pb_1.Message { export class StocJoinGame extends pb_1.Message {
...@@ -2258,4 +2510,165 @@ export namespace ygopro { ...@@ -2258,4 +2510,165 @@ export namespace ygopro {
return StocSelectHand.deserialize(bytes); return StocSelectHand.deserialize(bytes);
} }
} }
export class StocHandResult extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(
data?:
| any[]
| {
meResult?: HandType;
opResult?: HandType;
}
) {
super();
pb_1.Message.initialize(
this,
Array.isArray(data) ? data : [],
0,
-1,
[],
this.#one_of_decls
);
if (!Array.isArray(data) && typeof data == "object") {
if ("meResult" in data && data.meResult != undefined) {
this.meResult = data.meResult;
}
if ("opResult" in data && data.opResult != undefined) {
this.opResult = data.opResult;
}
}
}
get meResult() {
return pb_1.Message.getFieldWithDefault(
this,
1,
HandType.UNKNOWN
) as HandType;
}
set meResult(value: HandType) {
pb_1.Message.setField(this, 1, value);
}
get opResult() {
return pb_1.Message.getFieldWithDefault(
this,
2,
HandType.UNKNOWN
) as HandType;
}
set opResult(value: HandType) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: {
meResult?: HandType;
opResult?: HandType;
}): StocHandResult {
const message = new StocHandResult({});
if (data.meResult != null) {
message.meResult = data.meResult;
}
if (data.opResult != null) {
message.opResult = data.opResult;
}
return message;
}
toObject() {
const data: {
meResult?: HandType;
opResult?: HandType;
} = {};
if (this.meResult != null) {
data.meResult = this.meResult;
}
if (this.opResult != null) {
data.opResult = this.opResult;
}
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (this.meResult != HandType.UNKNOWN) writer.writeEnum(1, this.meResult);
if (this.opResult != HandType.UNKNOWN) writer.writeEnum(2, this.opResult);
if (!w) return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): StocHandResult {
const reader =
bytes instanceof pb_1.BinaryReader
? bytes
: new pb_1.BinaryReader(bytes),
message = new StocHandResult();
while (reader.nextField()) {
if (reader.isEndGroup()) break;
switch (reader.getFieldNumber()) {
case 1:
message.meResult = reader.readEnum();
break;
case 2:
message.opResult = reader.readEnum();
break;
default:
reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): StocHandResult {
return StocHandResult.deserialize(bytes);
}
}
export class StocSelectTp extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(data?: any[] | {}) {
super();
pb_1.Message.initialize(
this,
Array.isArray(data) ? data : [],
0,
-1,
[],
this.#one_of_decls
);
if (!Array.isArray(data) && typeof data == "object") {
}
}
static fromObject(data: {}): StocSelectTp {
const message = new StocSelectTp({});
return message;
}
toObject() {
const data: {} = {};
return data;
}
serialize(): Uint8Array;
serialize(w: pb_1.BinaryWriter): void;
serialize(w?: pb_1.BinaryWriter): Uint8Array | void {
const writer = w || new pb_1.BinaryWriter();
if (!w) return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): StocSelectTp {
const reader =
bytes instanceof pb_1.BinaryReader
? bytes
: new pb_1.BinaryReader(bytes),
message = new StocSelectTp();
while (reader.nextField()) {
if (reader.isEndGroup()) break;
switch (reader.getFieldNumber()) {
default:
reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): StocSelectTp {
return StocSelectTp.deserialize(bytes);
}
}
} }
...@@ -18,17 +18,17 @@ export default class CtosHandResultPacket extends ygoProPacket { ...@@ -18,17 +18,17 @@ export default class CtosHandResultPacket extends ygoProPacket {
const dataView = new DataView(exData.buffer); const dataView = new DataView(exData.buffer);
switch (hand) { switch (hand) {
case ygopro.CtosHandResult.HandType.SCISSORS: { case ygopro.HandType.SCISSORS: {
dataView.setUint8(0, 1); dataView.setUint8(0, 1);
break; break;
} }
case ygopro.CtosHandResult.HandType.ROCK: { case ygopro.HandType.ROCK: {
dataView.setUint8(0, 2); dataView.setUint8(0, 2);
break; break;
} }
case ygopro.CtosHandResult.HandType.PAPER: { case ygopro.HandType.PAPER: {
dataView.setUint8(0, 3); dataView.setUint8(0, 3);
break; break;
......
...@@ -70,13 +70,13 @@ export function sendJoinGame(ws: WebSocket, version: number, passWd: string) { ...@@ -70,13 +70,13 @@ export function sendJoinGame(ws: WebSocket, version: number, passWd: string) {
} }
export function sendHandResult(result: string) { export function sendHandResult(result: string) {
let hand = ygopro.CtosHandResult.HandType.UNKNOWN; let hand = ygopro.HandType.UNKNOWN;
if (result === "scissors") { if (result === "scissors") {
hand = ygopro.CtosHandResult.HandType.SCISSORS; hand = ygopro.HandType.SCISSORS;
} else if (result === "rock") { } else if (result === "rock") {
hand = ygopro.CtosHandResult.HandType.ROCK; hand = ygopro.HandType.ROCK;
} else if (result === "paper") { } else if (result === "paper") {
hand = ygopro.CtosHandResult.HandType.PAPER; hand = ygopro.HandType.PAPER;
} }
const handResult = new ygopro.YgoCtosMsg({ const handResult = new ygopro.YgoCtosMsg({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment