Commit 4854ced0 authored by Chunchi Che's avatar Chunchi Che

handle MSG_SORT_CARD

parent 2725d7aa
......@@ -55,3 +55,4 @@ export const MSG_SELECT_SUM = 23;
export const MSG_ADD_COUNTER = 101;
export const MSG_REMOVE_COUNTER = 102;
export const MSG_SELECT_COUNTER = 22;
export const MSG_SORT_CARD = 25;
......@@ -31,6 +31,7 @@ import MsgSelectSum from "./selectSum";
import MsgAddCounter from "./addCounter";
import MsgRemoveCounter from "./removeCounter";
import MsgSelectCounter from "./selectCounter";
import MsgSortCard from "./sortCard";
import PENETRATE from "./penetrate";
/*
......@@ -184,6 +185,11 @@ export default class GameMsgAdapter implements StocAdapter {
break;
}
case GAME_MSG.MSG_SORT_CARD: {
gameMsg.sort_card = MsgSortCard(gameData);
break;
}
default: {
gameMsg.unimplemented = new ygopro.StocGameMessage.MsgUnimplemented({
command: func,
......
import { ygopro } from "../../../idl/ocgcore";
import { BufferReaderExt } from "../../bufferIO";
import MsgSortCard = ygopro.StocGameMessage.MsgSortCard;
/*
*
* Msg Sort Card
*
* @param - TODO
* @usage - TODO
* */
export default (data: Uint8Array) => {
const reader = new BufferReaderExt(data);
const player = reader.inner.readUint8();
const msg = new MsgSortCard({
player,
options: [],
});
const count = reader.inner.readUint8();
for (let i = 0; i < count; i++) {
const code = reader.inner.readUint32();
const location = reader.readCardShortLocation();
msg.options.push(
new MsgSortCard.Info({
code,
location,
response: i,
})
);
}
return msg;
};
......@@ -28,6 +28,7 @@ import onMsgSelectSum from "./selectSum";
import onMsgSelectTribute from "./selectTribute";
import onMsgUpdateCounter from "./updateCounter";
import onMsgSelectCounter from "./selectCounter";
import onMsgSortCard from "./sortCard";
import { setWaiting } from "../../reducers/duel/mod";
const ActiveList = [
......@@ -187,6 +188,11 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
break;
}
case "sort_card": {
onMsgSortCard(msg.sort_card, dispatch);
break;
}
case "unimplemented": {
onUnimplemented(msg.unimplemented, dispatch);
......
import { ygopro } from "../../api/ocgcore/idl/ocgcore";
import { AppDispatch } from "../../store";
import MsgSortCard = ygopro.StocGameMessage.MsgSortCard;
export default (sortCard: MsgSortCard, dispatch: AppDispatch) => {
console.log(sortCard);
};
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