Commit b616e231 authored by chechunchi's avatar chechunchi

add announceRace adapter

parent 4f431ae8
Pipeline #21821 passed with stages
in 12 minutes and 19 seconds
......@@ -57,3 +57,7 @@ export const MSG_REMOVE_COUNTER = 102;
export const MSG_SELECT_COUNTER = 22;
export const MSG_SORT_CARD = 25;
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 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,7 @@ import { ygopro } from "../../../idl/ocgcore";
import { StocAdapter, YgoProPacket } from "../../packet";
import * as GAME_MSG from "../../protoDecl";
import MsgAddCounter from "./addCounter";
import MsgAnnounceRace from "./announceRace";
import MsgAttack from "./attack";
import MsgDamage from "./damage";
import MsgDrawAdapter from "./draw";
......@@ -196,6 +197,11 @@ export default class GameMsgAdapter implements StocAdapter {
break;
}
case GAME_MSG.MSG_ANNOUNCE_RACE: {
gameMsg.announceRace = MsgAnnounceRace(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