Commit 6ea90f89 authored by chechunchi's avatar chechunchi

add announceAttribute adapter

parent b616e231
Pipeline #21822 passed with stages
in 14 minutes and 1 second
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 < 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,
});
};
......@@ -7,6 +7,7 @@ import { ygopro } from "../../../idl/ocgcore";
import { StocAdapter, YgoProPacket } from "../../packet";
import * as GAME_MSG from "../../protoDecl";
import MsgAddCounter from "./addCounter";
import MsgAnnounceAttribute from "./announceAttrib";
import MsgAnnounceRace from "./announceRace";
import MsgAttack from "./attack";
import MsgDamage from "./damage";
......@@ -202,6 +203,11 @@ export default class GameMsgAdapter implements StocAdapter {
break;
}
case GAME_MSG.MSG_ANNOUNCE_ATTRIB: {
gameMsg.announceAttrib = MsgAnnounceAttribute(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