Commit 2be93920 authored by chechunchi's avatar chechunchi

add announceCard adapter

parent 6ea90f89
Pipeline #21823 passed with stages
in 17 minutes and 3 seconds
......@@ -4,7 +4,7 @@ import { ygopro } from "@/api/ocgcore/idl/ocgcore";
import MsgAnnounce = ygopro.StocGameMessage.MsgAnnounce;
/*
* Announce Race
* Announce Attribute
*
* @param - TODO
* @usage - 声明属性
......
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,
});
};
......@@ -8,6 +8,7 @@ import { StocAdapter, YgoProPacket } from "../../packet";
import * as GAME_MSG from "../../protoDecl";
import MsgAddCounter from "./addCounter";
import MsgAnnounceAttribute from "./announceAttrib";
import MsgAnnounceCard from "./announceCard";
import MsgAnnounceRace from "./announceRace";
import MsgAttack from "./attack";
import MsgDamage from "./damage";
......@@ -208,6 +209,11 @@ export default class GameMsgAdapter implements StocAdapter {
break;
}
case GAME_MSG.MSG_ANNOUNCE_CARD: {
gameMsg.announceCard = MsgAnnounceCard(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