Commit b3d6aa61 authored by chechunchi's avatar chechunchi

add announceNumber adapter

parent 2be93920
Pipeline #21824 passed with stages
in 12 minutes and 17 seconds
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,
});
};
......@@ -9,6 +9,7 @@ import * as GAME_MSG from "../../protoDecl";
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 MsgDamage from "./damage";
......@@ -214,6 +215,11 @@ export default class GameMsgAdapter implements StocAdapter {
break;
}
case GAME_MSG.MSG_ANNOUNCE_NUMBER: {
gameMsg.announceNumber = MsgAnnounceNumber(gameData);
break;
}
default: {
gameMsg.unimplemented = new ygopro.StocGameMessage.MsgUnimplemented({
command: func,
......
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