Commit 2984f1c7 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'feat/select_counter' into 'main'

Feat/select counter

See merge request mycard/Neos!158
parents 9511809e b0599432
Pipeline #21019 passed with stages
in 18 minutes and 28 seconds
neos-protobuf @ ff89698e
Subproject commit 76135099fbeb0a69b7f8562bd755975593794e4b
Subproject commit ff89698e6fb11829a7170fdf38de646e720bd96d
This diff is collapsed.
......@@ -54,3 +54,4 @@ export const MSG_RELOAD_FIELD = 162;
export const MSG_SELECT_SUM = 23;
export const MSG_ADD_COUNTER = 101;
export const MSG_REMOVE_COUNTER = 102;
export const MSG_SELECT_COUNTER = 22;
......@@ -30,6 +30,7 @@ import MsgReloadFieldAdapter from "./reloadField";
import MsgSelectSum from "./selectSum";
import MsgAddCounter from "./addCounter";
import MsgRemoveCounter from "./removeCounter";
import MsgSelectCounter from "./selectCounter";
import PENETRATE from "./penetrate";
/*
......@@ -178,6 +179,11 @@ export default class GameMsgAdapter implements StocAdapter {
break;
}
case GAME_MSG.MSG_SELECT_COUNTER: {
gameMsg.select_counter = MsgSelectCounter(gameData);
break;
}
default: {
gameMsg.unimplemented = new ygopro.StocGameMessage.MsgUnimplemented({
command: func,
......
import { ygopro } from "../../../idl/ocgcore";
import { BufferReaderExt } from "../../bufferIO";
import MsgSelectCounter = ygopro.StocGameMessage.MsgSelectCounter;
/*
* Msg Select Counter
*
* @param - TODO
* @usage - TODO
**/
export default (data: Uint8Array) => {
const reader = new BufferReaderExt(data);
const player = reader.inner.readUint8();
const counterType = reader.inner.readUint16();
const min = reader.inner.readUint16();
const msg = new MsgSelectCounter({
player,
counter_type: counterType,
min,
options: [],
});
const count = reader.inner.readUint8();
for (let i = 0; i < count; i++) {
const code = reader.inner.readUint32();
const location = reader.readCardShortLocation();
const counterCount = reader.inner.readUint16();
msg.options.push(
new MsgSelectCounter.Info({
code,
location,
counter_count: counterCount,
})
);
}
return msg;
};
......@@ -27,6 +27,7 @@ import onMsgReloadField from "./reloadField";
import onMsgSelectSum from "./selectSum";
import onMsgSelectTribute from "./selectTribute";
import onMsgUpdateCounter from "./updateCounter";
import onMsgSelectCounter from "./selectCounter";
import { setWaiting } from "../../reducers/duel/mod";
const ActiveList = [
......@@ -181,6 +182,11 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
break;
}
case "select_counter": {
onMsgSelectCounter(msg.select_counter, dispatch);
break;
}
case "unimplemented": {
onUnimplemented(msg.unimplemented, dispatch);
......
import { ygopro } from "../../api/ocgcore/idl/ocgcore";
import { AppDispatch } from "../../store";
import MsgSelectCounter = ygopro.StocGameMessage.MsgSelectCounter;
export default (selectCounter: MsgSelectCounter, dispatch: AppDispatch) => {
console.log(selectCounter);
};
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