Commit 435fedfd authored by chechunchi's avatar chechunchi

update MsgSelectChainAdapter

parent 8e31a226
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
import { BufferReader } from "../../bufferIO"; import { BufferReader } from "../../bufferIO";
import MsgSelectChain = ygopro.StocGameMessage.MsgSelectChain; import MsgSelectChain = ygopro.StocGameMessage.MsgSelectChain;
import { numberToChainFlag } from "../../util";
/* /*
* Msg Select Chain * Msg Select Chain
...@@ -37,7 +38,7 @@ export default (data: Uint8Array) => { ...@@ -37,7 +38,7 @@ export default (data: Uint8Array) => {
msg.chains.push( msg.chains.push(
new MsgSelectChain.Chain({ new MsgSelectChain.Chain({
flag, flag: numberToChainFlag(flag),
code, code,
location, location,
effect_description: effect_desc, effect_description: effect_desc,
......
...@@ -191,3 +191,22 @@ export function numberToCardPosition( ...@@ -191,3 +191,22 @@ export function numberToCardPosition(
} }
} }
} }
export function numberToChainFlag(
flag: number
): ygopro.StocGameMessage.MsgSelectChain.ChainFlag | undefined {
switch (flag) {
case 0: {
return ygopro.StocGameMessage.MsgSelectChain.ChainFlag.COMMON;
}
case 1: {
return ygopro.StocGameMessage.MsgSelectChain.ChainFlag.EDESC_OPERATION;
}
case 2: {
return ygopro.StocGameMessage.MsgSelectChain.ChainFlag.EDESC_RESET;
}
default: {
return undefined;
}
}
}
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