Commit 6c82ffbb authored by chechunchi's avatar chechunchi

add select battle cmd ctos response adapter and helper

parent 7307fd14
Pipeline #19623 passed with stages
in 6 minutes and 29 seconds
......@@ -8,6 +8,7 @@ import adaptSelectChainResponse from "./selectChain";
import adaptSelectEffectYnResponse from "./selectEffectYn";
import adaptSelectPositionResponse from "./selectPosition";
import adaptSelectOptionResponse from "./selectOption";
import adaptSelectBattleCmdResponse from "./selectBattleCmd";
/*
* CTOS CTOS_RESPONSE
......@@ -58,6 +59,11 @@ export default class CtosResponsePacket extends YgoProPacket {
break;
}
case "select_battle_cmd": {
extraData = adaptSelectBattleCmdResponse(response.select_battle_cmd);
break;
}
default: {
break;
}
......
import { ygopro } from "../../../idl/ocgcore";
import { BufferWriter } from "../../bufferIO";
export default (
response: ygopro.CtosGameMsgResponse.SelectBattleCmdResponse
) => {
const array = new Uint8Array(4);
const writer = new BufferWriter(array, true);
writer.writeUint32(response.selected_cmd);
return array;
};
......@@ -215,3 +215,18 @@ export function sendSelectOptionResponse(value: number) {
socketMiddleWare({ cmd: socketCmd.SEND, payload });
}
export function sendSelectBattleCmdResponse(value: number) {
const response = new ygopro.YgoCtosMsg({
ctos_response: new ygopro.CtosGameMsgResponse({
select_battle_cmd: new ygopro.CtosGameMsgResponse.SelectBattleCmdResponse(
{
selected_cmd: value,
}
),
}),
});
const payload = new GameMsgResponse(response).serialize();
socketMiddleWare({ cmd: socketCmd.SEND, payload });
}
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