Commit 338628fd authored by chechunchi's avatar chechunchi

add MsgShuffleHandExtra

parent e585e471
......@@ -67,3 +67,5 @@ export const MSG_TOSS_DICE = 131;
export const MSG_SHUFFLE_SET_CARD = 36;
export const MSG_FIELD_DISABLED = 56;
export const MSG_HAND_RES = 133;
export const MSG_SHUFFLE_HAND = 33;
export const MSG_SHUFFLE_EXTRA = 39;
......@@ -35,6 +35,7 @@ import MsgSelectPositionAdapter from "./selectPosition";
import MsgSelectSum from "./selectSum";
import MsgSelectTributeAdapter from "./selectTribute";
import MsgSelectUnselectCardAdapter from "./selectUnselectCard";
import MsgShuffleHandExtraAdapter from "./shuffleHandExtra";
import MsgShuffleSetCard from "./shuffleSetCard";
import MsgSortCard from "./sortCard";
import MsgStartAdapter from "./start";
......@@ -256,6 +257,22 @@ export default class GameMsgAdapter implements StocAdapter {
break;
}
case GAME_MSG.MSG_SHUFFLE_HAND: {
gameMsg.shuffle_hand_extra = MsgShuffleHandExtraAdapter(
gameData,
false
);
break;
}
case GAME_MSG.MSG_SHUFFLE_EXTRA: {
gameMsg.shuffle_hand_extra = MsgShuffleHandExtraAdapter(
gameData,
true
);
break;
}
default: {
gameMsg.unimplemented = new ygopro.StocGameMessage.MsgUnimplemented({
command: func,
......
import { ygopro } from "@/api/ocgcore/idl/ocgcore";
import { BufferReader } from "../../../../../../rust-src/pkg/rust_src";
import MsgShuffleHandExtra = ygopro.StocGameMessage.MsgShuffleHandExtra;
/*
* Msg Shuffle Hand or Extra
* @param - TODO
*
* @usage - 手牌/额外卡组切洗
* */
export default (data: Uint8Array, isExtra: boolean) => {
const reader = new BufferReader(data);
const zone = isExtra ? ygopro.CardZone.EXTRA : ygopro.CardZone.HAND;
const player = reader.readUint8();
const count = reader.readUint8();
const cards = [];
for (let i = 0; i < count; i++) {
cards.push(reader.readUint32());
}
return new MsgShuffleHandExtra({
player,
zone,
cards,
});
};
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