Commit 9e794fb0 authored by Chunchi Che's avatar Chunchi Che

handle selectTribute

parent 04d77b54
Pipeline #20771 passed with stages
in 13 minutes and 43 seconds
......@@ -37,6 +37,7 @@ export const MSG_SELECT_IDLE_CMD = 11;
export const MSG_SELECT_PLACE = 18;
export const MSG_MOVE = 50;
export const MSG_SELECT_CARD = 15;
export const MSG_SELECT_TRIBUTE = 20;
export const MSG_SELECT_CHAIN = 16;
export const MSG_SELECT_EFFECTYN = 12;
export const MSG_SELECT_POSITION = 19;
......
......@@ -14,6 +14,7 @@ import MsgHintAdapter from "./hint";
import MsgSelectIdleCmdAdapter from "./selectIdleCmd";
import MsgSelectPlaceAdapter from "./selectPlace";
import MsgSelectCardAdapter from "./selectCard";
import MsgSelectTributeAdapter from "./selectTribute";
import MsgSelectChainAdapter from "./selectChain";
import MsgSelectEffectYnAdapter from "./selectEffectYn";
import MsgSelectPositionAdapter from "./selectPosition";
......@@ -90,6 +91,11 @@ export default class GameMsgAdapter implements StocAdapter {
break;
}
case GAME_MSG.MSG_SELECT_TRIBUTE: {
gameMsg.select_card = MsgSelectTributeAdapter(gameData);
break;
}
case GAME_MSG.MSG_SELECT_CHAIN: {
gameMsg.select_chain = MsgSelectChainAdapter(gameData);
......
import { ygopro } from "../../../idl/ocgcore";
import { BufferReaderExt } from "../../bufferIO";
import MsgSelectCard = ygopro.StocGameMessage.MsgSelectCard;
/*
* Msg Select Tribute
*
* @param - see: https://code.mycard.moe/mycard/neos-protobuf/-/blob/main/idl/ocgcore.neos-protobuf
* @usage - 玩家可选择的祭品
* */
export default (data: Uint8Array) => {
const reader = new BufferReaderExt(data);
const player = reader.inner.readUint8();
const cancelable = reader.inner.readUint8() != 0;
const min = reader.inner.readUint8();
const max = reader.inner.readUint8();
const count = reader.inner.readUint8();
const msg = new MsgSelectCard({ player, cancelable, min, max });
for (let i = 0; i < count; i++) {
const code = reader.inner.readUint32();
const controler = reader.inner.readUint8();
const location = reader.inner.readUint8();
const sequence = reader.inner.readUint8();
const release_param = reader.inner.readUint8();
msg.cards.push(
new MsgSelectCard.SelectAbleCard({
code,
location: new ygopro.CardLocation({
controler,
location,
sequence,
}),
response: i,
release_param,
})
);
}
return msg;
};
......@@ -16,6 +16,8 @@ export default (selectCard: MsgSelectCard, dispatch: AppDispatch) => {
const max = selectCard.max;
const cards = selectCard.cards;
// TODO: handle release_param
dispatch(setCheckCardModalMinMax({ min, max }));
dispatch(setCheckCardModalOnSubmit("sendSelectCardResponse"));
......
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