Commit 00bbfcce authored by Chunchi Che's avatar Chunchi Che

Merge branch 'feat/announce' into 'main'

Feat/announce

See merge request !208
parents 255aa6df e14b2781
neos-protobuf @ ee85cb1d
Subproject commit 48be6a827024995962fc479db1ec69bde38a72f6 Subproject commit ee85cb1d1f71ad6b44f1daf1877b63fa2ac1991f
/** /**
* Generated by the protoc-gen-ts. DO NOT EDIT! * Generated by the protoc-gen-ts. DO NOT EDIT!
* compiler version: 3.21.5 * compiler version: 3.19.4
* source: idl/ocgcore.proto * source: idl/ocgcore.proto
* 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";
...@@ -5567,7 +5567,7 @@ export namespace ygopro { ...@@ -5567,7 +5567,7 @@ export namespace ygopro {
[ [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 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, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 39, 40, 41, 42, 43,
], ],
]; ];
constructor( constructor(
...@@ -5617,6 +5617,7 @@ export namespace ygopro { ...@@ -5617,6 +5617,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5661,6 +5662,7 @@ export namespace ygopro { ...@@ -5661,6 +5662,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5705,6 +5707,7 @@ export namespace ygopro { ...@@ -5705,6 +5707,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5749,6 +5752,7 @@ export namespace ygopro { ...@@ -5749,6 +5752,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5793,6 +5797,7 @@ export namespace ygopro { ...@@ -5793,6 +5797,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5837,6 +5842,7 @@ export namespace ygopro { ...@@ -5837,6 +5842,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5881,6 +5887,7 @@ export namespace ygopro { ...@@ -5881,6 +5887,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5925,6 +5932,7 @@ export namespace ygopro { ...@@ -5925,6 +5932,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -5969,6 +5977,7 @@ export namespace ygopro { ...@@ -5969,6 +5977,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6013,6 +6022,7 @@ export namespace ygopro { ...@@ -6013,6 +6022,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6057,6 +6067,7 @@ export namespace ygopro { ...@@ -6057,6 +6067,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6101,6 +6112,7 @@ export namespace ygopro { ...@@ -6101,6 +6112,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6145,6 +6157,7 @@ export namespace ygopro { ...@@ -6145,6 +6157,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6189,6 +6202,7 @@ export namespace ygopro { ...@@ -6189,6 +6202,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6233,6 +6247,7 @@ export namespace ygopro { ...@@ -6233,6 +6247,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6277,6 +6292,7 @@ export namespace ygopro { ...@@ -6277,6 +6292,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6321,6 +6337,7 @@ export namespace ygopro { ...@@ -6321,6 +6337,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6365,6 +6382,7 @@ export namespace ygopro { ...@@ -6365,6 +6382,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6409,6 +6427,7 @@ export namespace ygopro { ...@@ -6409,6 +6427,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6453,6 +6472,7 @@ export namespace ygopro { ...@@ -6453,6 +6472,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6497,6 +6517,7 @@ export namespace ygopro { ...@@ -6497,6 +6517,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6541,6 +6562,7 @@ export namespace ygopro { ...@@ -6541,6 +6562,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6585,6 +6607,7 @@ export namespace ygopro { ...@@ -6585,6 +6607,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6629,6 +6652,7 @@ export namespace ygopro { ...@@ -6629,6 +6652,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6673,6 +6697,7 @@ export namespace ygopro { ...@@ -6673,6 +6697,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6717,6 +6742,7 @@ export namespace ygopro { ...@@ -6717,6 +6742,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6761,6 +6787,7 @@ export namespace ygopro { ...@@ -6761,6 +6787,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6805,6 +6832,7 @@ export namespace ygopro { ...@@ -6805,6 +6832,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6849,6 +6877,7 @@ export namespace ygopro { ...@@ -6849,6 +6877,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6893,6 +6922,7 @@ export namespace ygopro { ...@@ -6893,6 +6922,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6937,6 +6967,7 @@ export namespace ygopro { ...@@ -6937,6 +6967,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -6981,6 +7012,7 @@ export namespace ygopro { ...@@ -6981,6 +7012,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7025,6 +7057,7 @@ export namespace ygopro { ...@@ -7025,6 +7057,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7069,6 +7102,7 @@ export namespace ygopro { ...@@ -7069,6 +7102,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7113,6 +7147,7 @@ export namespace ygopro { ...@@ -7113,6 +7147,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7157,6 +7192,7 @@ export namespace ygopro { ...@@ -7157,6 +7192,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7201,6 +7237,7 @@ export namespace ygopro { ...@@ -7201,6 +7237,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7245,6 +7282,7 @@ export namespace ygopro { ...@@ -7245,6 +7282,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7289,6 +7327,7 @@ export namespace ygopro { ...@@ -7289,6 +7327,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7333,6 +7372,7 @@ export namespace ygopro { ...@@ -7333,6 +7372,7 @@ export namespace ygopro {
attack_disable?: StocGameMessage.MsgAttackDisabled; attack_disable?: StocGameMessage.MsgAttackDisabled;
chain_solved?: never; chain_solved?: never;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7377,6 +7417,7 @@ export namespace ygopro { ...@@ -7377,6 +7417,7 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: StocGameMessage.MsgChainSolved; chain_solved?: StocGameMessage.MsgChainSolved;
chain_end?: never; chain_end?: never;
announce?: never;
} }
| { | {
start?: never; start?: never;
...@@ -7421,6 +7462,52 @@ export namespace ygopro { ...@@ -7421,6 +7462,52 @@ export namespace ygopro {
attack_disable?: never; attack_disable?: never;
chain_solved?: never; chain_solved?: never;
chain_end?: StocGameMessage.MsgChainEnd; chain_end?: StocGameMessage.MsgChainEnd;
announce?: never;
}
| {
start?: never;
draw?: never;
new_turn?: never;
new_phase?: never;
hint?: never;
select_idle_cmd?: never;
select_place?: never;
move?: never;
select_card?: never;
select_chain?: never;
select_effect_yn?: never;
select_position?: never;
select_option?: never;
shuffle_hand?: never;
select_battle_cmd?: never;
pos_change?: never;
select_unselect_card?: never;
select_yes_no?: never;
update_hp?: never;
win?: never;
wait?: never;
unimplemented?: never;
update_data?: never;
reload_field?: never;
select_sum?: never;
select_tribute?: never;
update_counter?: never;
select_counter?: never;
sort_card?: never;
set?: never;
swap?: never;
summoning?: never;
summoned?: never;
flip_summoning?: never;
flip_summoned?: never;
sp_summoning?: never;
sp_summoned?: never;
chaining?: never;
attack?: never;
attack_disable?: never;
chain_solved?: never;
chain_end?: never;
announce?: StocGameMessage.MsgAnnounce;
} }
)) ))
) { ) {
...@@ -7566,6 +7653,9 @@ export namespace ygopro { ...@@ -7566,6 +7653,9 @@ export namespace ygopro {
if ("chain_end" in data && data.chain_end != undefined) { if ("chain_end" in data && data.chain_end != undefined) {
this.chain_end = data.chain_end; this.chain_end = data.chain_end;
} }
if ("announce" in data && data.announce != undefined) {
this.announce = data.announce;
}
} }
} }
get start() { get start() {
...@@ -8114,6 +8204,19 @@ export namespace ygopro { ...@@ -8114,6 +8204,19 @@ export namespace ygopro {
get has_chain_end() { get has_chain_end() {
return pb_1.Message.getField(this, 42) != null; return pb_1.Message.getField(this, 42) != null;
} }
get announce() {
return pb_1.Message.getWrapperField(
this,
StocGameMessage.MsgAnnounce,
43
) as StocGameMessage.MsgAnnounce;
}
set announce(value: StocGameMessage.MsgAnnounce) {
pb_1.Message.setOneofWrapperField(this, 43, this.#one_of_decls[0], value);
}
get has_announce() {
return pb_1.Message.getField(this, 43) != null;
}
get gameMsg() { get gameMsg() {
const cases: { const cases: {
[index: number]: [index: number]:
...@@ -8159,7 +8262,8 @@ export namespace ygopro { ...@@ -8159,7 +8262,8 @@ export namespace ygopro {
| "attack" | "attack"
| "attack_disable" | "attack_disable"
| "chain_solved" | "chain_solved"
| "chain_end"; | "chain_end"
| "announce";
} = { } = {
0: "none", 0: "none",
1: "start", 1: "start",
...@@ -8204,6 +8308,7 @@ export namespace ygopro { ...@@ -8204,6 +8308,7 @@ export namespace ygopro {
40: "attack_disable", 40: "attack_disable",
41: "chain_solved", 41: "chain_solved",
42: "chain_end", 42: "chain_end",
43: "announce",
}; };
return cases[ return cases[
pb_1.Message.computeOneofCase( pb_1.Message.computeOneofCase(
...@@ -8211,7 +8316,7 @@ export namespace ygopro { ...@@ -8211,7 +8316,7 @@ export namespace ygopro {
[ [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 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, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 37, 38, 39, 40, 41, 42, 43,
] ]
) )
]; ];
...@@ -8325,6 +8430,9 @@ export namespace ygopro { ...@@ -8325,6 +8430,9 @@ export namespace ygopro {
chain_end?: ReturnType< chain_end?: ReturnType<
typeof StocGameMessage.MsgChainEnd.prototype.toObject typeof StocGameMessage.MsgChainEnd.prototype.toObject
>; >;
announce?: ReturnType<
typeof StocGameMessage.MsgAnnounce.prototype.toObject
>;
}): StocGameMessage { }): StocGameMessage {
const message = new StocGameMessage({}); const message = new StocGameMessage({});
if (data.start != null) { if (data.start != null) {
...@@ -8517,6 +8625,11 @@ export namespace ygopro { ...@@ -8517,6 +8625,11 @@ export namespace ygopro {
data.chain_end data.chain_end
); );
} }
if (data.announce != null) {
message.announce = StocGameMessage.MsgAnnounce.fromObject(
data.announce
);
}
return message; return message;
} }
toObject() { toObject() {
...@@ -8631,6 +8744,9 @@ export namespace ygopro { ...@@ -8631,6 +8744,9 @@ export namespace ygopro {
chain_end?: ReturnType< chain_end?: ReturnType<
typeof StocGameMessage.MsgChainEnd.prototype.toObject typeof StocGameMessage.MsgChainEnd.prototype.toObject
>; >;
announce?: ReturnType<
typeof StocGameMessage.MsgAnnounce.prototype.toObject
>;
} = {}; } = {};
if (this.start != null) { if (this.start != null) {
data.start = this.start.toObject(); data.start = this.start.toObject();
...@@ -8758,6 +8874,9 @@ export namespace ygopro { ...@@ -8758,6 +8874,9 @@ export namespace ygopro {
if (this.chain_end != null) { if (this.chain_end != null) {
data.chain_end = this.chain_end.toObject(); data.chain_end = this.chain_end.toObject();
} }
if (this.announce != null) {
data.announce = this.announce.toObject();
}
return data; return data;
} }
serialize(): Uint8Array; serialize(): Uint8Array;
...@@ -8916,6 +9035,10 @@ export namespace ygopro { ...@@ -8916,6 +9035,10 @@ export namespace ygopro {
writer.writeMessage(42, this.chain_end, () => writer.writeMessage(42, this.chain_end, () =>
this.chain_end.serialize(writer) this.chain_end.serialize(writer)
); );
if (this.has_announce)
writer.writeMessage(43, this.announce, () =>
this.announce.serialize(writer)
);
if (!w) return writer.getResultBuffer(); if (!w) return writer.getResultBuffer();
} }
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): StocGameMessage { static deserialize(bytes: Uint8Array | pb_1.BinaryReader): StocGameMessage {
...@@ -9247,6 +9370,14 @@ export namespace ygopro { ...@@ -9247,6 +9370,14 @@ export namespace ygopro {
StocGameMessage.MsgChainEnd.deserialize(reader)) StocGameMessage.MsgChainEnd.deserialize(reader))
); );
break; break;
case 43:
reader.readMessage(
message.announce,
() =>
(message.announce =
StocGameMessage.MsgAnnounce.deserialize(reader))
);
break;
default: default:
reader.skipField(); reader.skipField();
} }
...@@ -17353,6 +17484,291 @@ export namespace ygopro { ...@@ -17353,6 +17484,291 @@ export namespace ygopro {
return MsgAttackDisabled.deserialize(bytes); return MsgAttackDisabled.deserialize(bytes);
} }
} }
export class MsgAnnounce extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(
data?:
| any[]
| {
player?: number;
announce_type?: StocGameMessage.MsgAnnounce.AnnounceType;
min?: number;
options?: StocGameMessage.MsgAnnounce.Option[];
}
) {
super();
pb_1.Message.initialize(
this,
Array.isArray(data) ? data : [],
0,
-1,
[4],
this.#one_of_decls
);
if (!Array.isArray(data) && typeof data == "object") {
if ("player" in data && data.player != undefined) {
this.player = data.player;
}
if ("announce_type" in data && data.announce_type != undefined) {
this.announce_type = data.announce_type;
}
if ("min" in data && data.min != undefined) {
this.min = data.min;
}
if ("options" in data && data.options != undefined) {
this.options = data.options;
}
}
}
get player() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set player(value: number) {
pb_1.Message.setField(this, 1, value);
}
get announce_type() {
return pb_1.Message.getFieldWithDefault(
this,
2,
StocGameMessage.MsgAnnounce.AnnounceType.UNKNOWN
) as StocGameMessage.MsgAnnounce.AnnounceType;
}
set announce_type(value: StocGameMessage.MsgAnnounce.AnnounceType) {
pb_1.Message.setField(this, 2, value);
}
get min() {
return pb_1.Message.getFieldWithDefault(this, 3, 0) as number;
}
set min(value: number) {
pb_1.Message.setField(this, 3, value);
}
get options() {
return pb_1.Message.getRepeatedWrapperField(
this,
StocGameMessage.MsgAnnounce.Option,
4
) as StocGameMessage.MsgAnnounce.Option[];
}
set options(value: StocGameMessage.MsgAnnounce.Option[]) {
pb_1.Message.setRepeatedWrapperField(this, 4, value);
}
static fromObject(data: {
player?: number;
announce_type?: StocGameMessage.MsgAnnounce.AnnounceType;
min?: number;
options?: ReturnType<
typeof StocGameMessage.MsgAnnounce.Option.prototype.toObject
>[];
}): MsgAnnounce {
const message = new MsgAnnounce({});
if (data.player != null) {
message.player = data.player;
}
if (data.announce_type != null) {
message.announce_type = data.announce_type;
}
if (data.min != null) {
message.min = data.min;
}
if (data.options != null) {
message.options = data.options.map((item) =>
StocGameMessage.MsgAnnounce.Option.fromObject(item)
);
}
return message;
}
toObject() {
const data: {
player?: number;
announce_type?: StocGameMessage.MsgAnnounce.AnnounceType;
min?: number;
options?: ReturnType<
typeof StocGameMessage.MsgAnnounce.Option.prototype.toObject
>[];
} = {};
if (this.player != null) {
data.player = this.player;
}
if (this.announce_type != null) {
data.announce_type = this.announce_type;
}
if (this.min != null) {
data.min = this.min;
}
if (this.options != null) {
data.options = this.options.map(
(item: StocGameMessage.MsgAnnounce.Option) => item.toObject()
);
}
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.player != 0) writer.writeInt32(1, this.player);
if (
this.announce_type != StocGameMessage.MsgAnnounce.AnnounceType.UNKNOWN
)
writer.writeEnum(2, this.announce_type);
if (this.min != 0) writer.writeInt32(3, this.min);
if (this.options.length)
writer.writeRepeatedMessage(
4,
this.options,
(item: StocGameMessage.MsgAnnounce.Option) => item.serialize(writer)
);
if (!w) return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MsgAnnounce {
const reader =
bytes instanceof pb_1.BinaryReader
? bytes
: new pb_1.BinaryReader(bytes),
message = new MsgAnnounce();
while (reader.nextField()) {
if (reader.isEndGroup()) break;
switch (reader.getFieldNumber()) {
case 1:
message.player = reader.readInt32();
break;
case 2:
message.announce_type = reader.readEnum();
break;
case 3:
message.min = reader.readInt32();
break;
case 4:
reader.readMessage(message.options, () =>
pb_1.Message.addToRepeatedWrapperField(
message,
4,
StocGameMessage.MsgAnnounce.Option.deserialize(reader),
StocGameMessage.MsgAnnounce.Option
)
);
break;
default:
reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): MsgAnnounce {
return MsgAnnounce.deserialize(bytes);
}
}
export namespace MsgAnnounce {
export enum AnnounceType {
UNKNOWN = 0,
RACE = 1,
Attribute = 2,
Card = 3,
Number = 4,
}
export class Option extends pb_1.Message {
#one_of_decls: number[][] = [];
constructor(
data?:
| any[]
| {
code?: number;
response?: number;
}
) {
super();
pb_1.Message.initialize(
this,
Array.isArray(data) ? data : [],
0,
-1,
[],
this.#one_of_decls
);
if (!Array.isArray(data) && typeof data == "object") {
if ("code" in data && data.code != undefined) {
this.code = data.code;
}
if ("response" in data && data.response != undefined) {
this.response = data.response;
}
}
}
get code() {
return pb_1.Message.getFieldWithDefault(this, 1, 0) as number;
}
set code(value: number) {
pb_1.Message.setField(this, 1, value);
}
get response() {
return pb_1.Message.getFieldWithDefault(this, 2, 0) as number;
}
set response(value: number) {
pb_1.Message.setField(this, 2, value);
}
static fromObject(data: { code?: number; response?: number }): Option {
const message = new Option({});
if (data.code != null) {
message.code = data.code;
}
if (data.response != null) {
message.response = data.response;
}
return message;
}
toObject() {
const data: {
code?: number;
response?: number;
} = {};
if (this.code != null) {
data.code = this.code;
}
if (this.response != null) {
data.response = this.response;
}
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.code != 0) writer.writeInt32(1, this.code);
if (this.response != 0) writer.writeInt32(2, this.response);
if (!w) return writer.getResultBuffer();
}
static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Option {
const reader =
bytes instanceof pb_1.BinaryReader
? bytes
: new pb_1.BinaryReader(bytes),
message = new Option();
while (reader.nextField()) {
if (reader.isEndGroup()) break;
switch (reader.getFieldNumber()) {
case 1:
message.code = reader.readInt32();
break;
case 2:
message.response = reader.readInt32();
break;
default:
reader.skipField();
}
}
return message;
}
serializeBinary(): Uint8Array {
return this.serialize();
}
static deserializeBinary(bytes: Uint8Array): Option {
return Option.deserialize(bytes);
}
}
}
export class MsgReloadField extends pb_1.Message { export class MsgReloadField extends pb_1.Message {
#one_of_decls: number[][] = []; #one_of_decls: number[][] = [];
constructor( constructor(
......
...@@ -57,3 +57,7 @@ export const MSG_REMOVE_COUNTER = 102; ...@@ -57,3 +57,7 @@ export const MSG_REMOVE_COUNTER = 102;
export const MSG_SELECT_COUNTER = 22; export const MSG_SELECT_COUNTER = 22;
export const MSG_SORT_CARD = 25; export const MSG_SORT_CARD = 25;
export const MSG_ATTACK = 110; export const MSG_ATTACK = 110;
export const MSG_ANNOUNCE_RACE = 140;
export const MSG_ANNOUNCE_ATTRIB = 141;
export const MSG_ANNOUNCE_CARD = 142;
export const MSG_ANNOUNCE_NUMBER = 143;
import { BufferReader } from "rust-src";
import { ygopro } from "@/api/ocgcore/idl/ocgcore";
import MsgAnnounce = ygopro.StocGameMessage.MsgAnnounce;
/*
* Announce Attribute
*
* @param - TODO
* @usage - 声明属性
* */
export default (data: Uint8Array) => {
const reader = new BufferReader(data);
const player = reader.readUint8();
const min = reader.readUint8();
const avaiable = reader.readUint32();
const options = [];
for (let i = 0; i < 7; i++) {
if ((avaiable & (1 << i)) > 0) {
options.push(
new MsgAnnounce.Option({
code: i,
response: 1 << i,
})
);
}
}
return new MsgAnnounce({
player,
announce_type: MsgAnnounce.AnnounceType.Attribute,
min,
options,
});
};
import { BufferReader } from "rust-src";
import { ygopro } from "@/api/ocgcore/idl/ocgcore";
import MsgAnnounce = ygopro.StocGameMessage.MsgAnnounce;
/*
* Announce Card
*
* @param - TODO
* @usage - 声明卡片
* */
export default (data: Uint8Array) => {
const reader = new BufferReader(data);
const player = reader.readUint8();
const count = reader.readUint8();
const options = [];
for (let i = 0; i < count; i++) {
const code = reader.readUint32();
options.push(
new MsgAnnounce.Option({
code,
response: code,
})
);
}
return new MsgAnnounce({
player,
announce_type: MsgAnnounce.AnnounceType.Card,
options,
});
};
import { BufferReader } from "rust-src";
import { ygopro } from "@/api/ocgcore/idl/ocgcore";
import MsgAnnounce = ygopro.StocGameMessage.MsgAnnounce;
/*
* Announce Number
*
* @param - TODO
* @usage - 声明数字
* */
export default (data: Uint8Array) => {
const reader = new BufferReader(data);
const player = reader.readUint8();
const count = reader.readUint8();
const options = [];
for (let i = 0; i < count; i++) {
const num = reader.readUint32();
options.push(
new MsgAnnounce.Option({
code: num,
response: i,
})
);
}
return new MsgAnnounce({
player,
announce_type: MsgAnnounce.AnnounceType.Number,
options,
});
};
import { BufferReader } from "rust-src";
import { ygopro } from "@/api/ocgcore/idl/ocgcore";
import MsgAnnounce = ygopro.StocGameMessage.MsgAnnounce;
/*
* Announce Race
*
* @param - TODO
* @usage - 声明种族
* */
export default (data: Uint8Array) => {
const reader = new BufferReader(data);
const player = reader.readUint8();
const min = reader.readUint8();
const avaiable = reader.readUint32();
const options = [];
for (let i = 0; i < 25; i++) {
if ((avaiable & (1 << i)) > 0) {
options.push(
new MsgAnnounce.Option({
code: i,
response: 1 << i,
})
);
}
}
return new MsgAnnounce({
player,
announce_type: MsgAnnounce.AnnounceType.RACE,
min,
options,
});
};
...@@ -7,6 +7,10 @@ import { ygopro } from "../../../idl/ocgcore"; ...@@ -7,6 +7,10 @@ import { ygopro } from "../../../idl/ocgcore";
import { StocAdapter, YgoProPacket } from "../../packet"; import { StocAdapter, YgoProPacket } from "../../packet";
import * as GAME_MSG from "../../protoDecl"; import * as GAME_MSG from "../../protoDecl";
import MsgAddCounter from "./addCounter"; import MsgAddCounter from "./addCounter";
import MsgAnnounceAttribute from "./announceAttrib";
import MsgAnnounceCard from "./announceCard";
import MsgAnnounceNumber from "./announceNumber";
import MsgAnnounceRace from "./announceRace";
import MsgAttack from "./attack"; import MsgAttack from "./attack";
import MsgDamage from "./damage"; import MsgDamage from "./damage";
import MsgDrawAdapter from "./draw"; import MsgDrawAdapter from "./draw";
...@@ -196,6 +200,26 @@ export default class GameMsgAdapter implements StocAdapter { ...@@ -196,6 +200,26 @@ export default class GameMsgAdapter implements StocAdapter {
break; break;
} }
case GAME_MSG.MSG_ANNOUNCE_RACE: {
gameMsg.announce = MsgAnnounceRace(gameData);
break;
}
case GAME_MSG.MSG_ANNOUNCE_ATTRIB: {
gameMsg.announce = MsgAnnounceAttribute(gameData);
break;
}
case GAME_MSG.MSG_ANNOUNCE_CARD: {
gameMsg.announce = MsgAnnounceCard(gameData);
break;
}
case GAME_MSG.MSG_ANNOUNCE_NUMBER: {
gameMsg.announce = MsgAnnounceNumber(gameData);
break;
}
default: { default: {
gameMsg.unimplemented = new ygopro.StocGameMessage.MsgUnimplemented({ gameMsg.unimplemented = new ygopro.StocGameMessage.MsgUnimplemented({
command: func, command: func,
......
import { fetchCard, fetchStrings, ygopro } from "@/api";
import { messageStore } from "@/stores";
import MsgAnnounce = ygopro.StocGameMessage.MsgAnnounce;
const { announceModal } = messageStore;
export default async (announce: MsgAnnounce) => {
const type_ = announce.announce_type;
let min = announce.min;
if (
type_ == MsgAnnounce.AnnounceType.Card ||
type_ == MsgAnnounce.AnnounceType.Number
) {
min = 1;
}
announceModal.min = min;
switch (type_) {
case MsgAnnounce.AnnounceType.RACE: {
announceModal.title = fetchStrings("!system", 563);
announceModal.options = announce.options.map((option) => ({
info: fetchStrings("!system", 1200 + option.code),
response: option.response,
}));
announceModal.isOpen = true;
break;
}
case MsgAnnounce.AnnounceType.Attribute: {
announceModal.title = fetchStrings("!system", 562);
announceModal.options = announce.options.map((option) => ({
info: fetchStrings("!system", 1010 + option.code),
response: option.response,
}));
announceModal.isOpen = true;
break;
}
case MsgAnnounce.AnnounceType.Card: {
announceModal.title = fetchStrings("!system", 564);
announceModal.options = await Promise.all(
announce.options.map(async (option) => ({
info: await fetchCard(option.code).then(
(meta) => meta.text.name ?? "[?]"
),
response: option.response,
}))
);
announceModal.isOpen = true;
break;
}
case MsgAnnounce.AnnounceType.Number: {
announceModal.title = fetchStrings("!system", 565);
announceModal.options = announce.options.map((option) => ({
info: option.code.toString(),
response: option.response,
}));
announceModal.isOpen = true;
break;
}
default: {
console.warn(`Unknown announce_type = ${type_}`);
}
}
};
import { ygopro } from "@/api"; import { ygopro } from "@/api";
import { matStore } from "@/stores"; import { matStore } from "@/stores";
import onAnnounce from "./announce";
import onMsgAttack from "./attack"; import onMsgAttack from "./attack";
import onMsgAttackDisable from "./attackDisable"; import onMsgAttackDisable from "./attackDisable";
import onMsgChainEnd from "./chainEnd"; import onMsgChainEnd from "./chainEnd";
...@@ -270,6 +271,11 @@ export default async function handleGameMsg(pb: ygopro.YgoStocMsg) { ...@@ -270,6 +271,11 @@ export default async function handleGameMsg(pb: ygopro.YgoStocMsg) {
break; break;
} }
case "announce": {
await onAnnounce(msg.announce);
break;
}
case "unimplemented": { case "unimplemented": {
onUnimplemented(msg.unimplemented); onUnimplemented(msg.unimplemented);
......
...@@ -25,6 +25,11 @@ export const messageStore = proxy<ModalState>({ ...@@ -25,6 +25,11 @@ export const messageStore = proxy<ModalState>({
isOpen: false, isOpen: false,
options: [], options: [],
}, },
announceModal: {
isOpen: false,
min: 1,
options: [],
},
}); });
// >>> modal types >>> // >>> modal types >>>
...@@ -87,4 +87,14 @@ export interface ModalState { ...@@ -87,4 +87,14 @@ export interface ModalState {
response: number; response: number;
}[]; }[];
}; };
// 宣言弹窗
announceModal: {
isOpen: boolean;
title?: string;
min: number;
options: {
info: string;
response: number;
}[];
};
} }
...@@ -2,6 +2,7 @@ import React from "react"; ...@@ -2,6 +2,7 @@ import React from "react";
import { import {
Alert, Alert,
AnnounceModal,
CardListModal, CardListModal,
CardModal, CardModal,
CheckCounterModal, CheckCounterModal,
...@@ -28,6 +29,7 @@ const NeosDuel = () => { ...@@ -28,6 +29,7 @@ const NeosDuel = () => {
<OptionModal /> <OptionModal />
<CheckCounterModal /> <CheckCounterModal />
<SortCardModal /> <SortCardModal />
<AnnounceModal />
</> </>
); );
}; };
......
import { CheckCard } from "@ant-design/pro-components";
import { Button } from "antd";
import React, { useState } from "react";
import { useSnapshot } from "valtio";
import { sendSelectOptionResponse } from "@/api";
import { messageStore } from "@/stores";
import { DragModal } from "./DragModal";
const { announceModal } = messageStore;
export const AnnounceModal = () => {
const snap = useSnapshot(announceModal);
const isOpen = snap.isOpen;
const title = snap.title;
const min = snap.min;
const options = snap.options;
const [selected, setSelected] = useState<number[]>([]);
return (
<DragModal
title={title}
open={isOpen}
closable={false}
footer={
<Button
disabled={selected.length != min}
onClick={() => {
let response = selected.reduce((res, current) => res | current, 0); // 多个选择求或
sendSelectOptionResponse(response);
announceModal.isOpen = false;
announceModal.title = undefined;
announceModal.options = [];
}}
>
submit
</Button>
}
>
<CheckCard.Group
bordered
multiple
size="small"
onChange={(value: any) => {
setSelected(value);
}}
>
{options.map((option, idx) => (
<CheckCard key={idx} title={option.info} value={option.response} />
))}
</CheckCard.Group>
</DragModal>
);
};
export * from "./Alert"; export * from "./Alert";
export * from "./AnnounceModal";
export * from "./CardListModal"; export * from "./CardListModal";
export * from "./CardModal"; export * from "./CardModal";
export * from "./CheckCounterModal"; export * from "./CheckCounterModal";
......
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