Commit 06cbef40 authored by Chunchi Che's avatar Chunchi Che

migrate BufferReader

parent fba2301f
Pipeline #20714 failed with stages
in 24 minutes and 58 seconds
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
import { BufferReader } from "../../bufferIO"; // @ts-ignore
import { BufferReader } from "rust-src";
const LITTLE_ENDIAN = true;
/* /*
* MSG Draw * MSG Draw
...@@ -11,7 +10,7 @@ const LITTLE_ENDIAN = true; ...@@ -11,7 +10,7 @@ const LITTLE_ENDIAN = true;
* @usage - 玩家抽卡内容 * @usage - 玩家抽卡内容
* */ * */
export default (data: Uint8Array) => { export default (data: Uint8Array) => {
const reader = new BufferReader(data, LITTLE_ENDIAN); const reader = new BufferReader(data);
const player = reader.readUint8(); const player = reader.readUint8();
const count = reader.readUint8(); const count = reader.readUint8();
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
import { BufferReader } from "../../bufferIO"; // @ts-ignore
import { BufferReader } from "rust-src";
const LITTLE_ENDIAN = true;
/* /*
* Msg Hint * Msg Hint
...@@ -14,7 +13,7 @@ const LITTLE_ENDIAN = true; ...@@ -14,7 +13,7 @@ const LITTLE_ENDIAN = true;
* */ * */
export default (data: Uint8Array) => { export default (data: Uint8Array) => {
const reader = new BufferReader(data, LITTLE_ENDIAN); const reader = new BufferReader(data);
const hintCommand = reader.readUint8(); const hintCommand = reader.readUint8();
const hintPlayer = reader.readUint8(); const hintPlayer = reader.readUint8();
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
import { BufferReader } from "../../bufferIO"; // @ts-ignore
import { BufferReader } from "rust-src";
const LITTLE_ENDIAN = true;
/* /*
* Msg New Phase * Msg New Phase
...@@ -12,7 +11,7 @@ const LITTLE_ENDIAN = true; ...@@ -12,7 +11,7 @@ const LITTLE_ENDIAN = true;
* */ * */
export default (data: Uint8Array) => { export default (data: Uint8Array) => {
const reader = new BufferReader(data, LITTLE_ENDIAN); const reader = new BufferReader(data);
const phase = reader.readUint16(); const phase = reader.readUint16();
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
import { BufferReader } from "../../bufferIO"; // @ts-ignore
import { BufferReader } from "rust-src";
const LITTLE_ENDIAN = true;
/* /*
* MSG New Turn * MSG New Turn
...@@ -12,7 +11,7 @@ const LITTLE_ENDIAN = true; ...@@ -12,7 +11,7 @@ const LITTLE_ENDIAN = true;
* */ * */
export default (data: Uint8Array) => { export default (data: Uint8Array) => {
const reader = new BufferReader(data, LITTLE_ENDIAN); const reader = new BufferReader(data);
const player = reader.readUint8(); const player = reader.readUint8();
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
import { BufferReader } from "../../bufferIO"; // @ts-ignore
import { BufferReader } from "rust-src";
/* /*
* Msg Recover * Msg Recover
...@@ -8,7 +9,7 @@ import { BufferReader } from "../../bufferIO"; ...@@ -8,7 +9,7 @@ import { BufferReader } from "../../bufferIO";
* @param value - 回复的Hp数值 * @param value - 回复的Hp数值
* */ * */
export default (data: Uint8Array) => { export default (data: Uint8Array) => {
const reader = new BufferReader(data, true); const reader = new BufferReader(data);
const player = reader.readUint8(); const player = reader.readUint8();
const value = reader.readInt32(); const value = reader.readInt32();
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
import { BufferReader } from "../../bufferIO"; // @ts-ignore
import { BufferReader } from "rust-src";
import MsgSelectOption = ygopro.StocGameMessage.MsgSelectOption; import MsgSelectOption = ygopro.StocGameMessage.MsgSelectOption;
/* /*
...@@ -11,7 +12,7 @@ import MsgSelectOption = ygopro.StocGameMessage.MsgSelectOption; ...@@ -11,7 +12,7 @@ import MsgSelectOption = ygopro.StocGameMessage.MsgSelectOption;
* */ * */
export default (data: Uint8Array) => { export default (data: Uint8Array) => {
const reader = new BufferReader(data, true); const reader = new BufferReader(data);
const player = reader.readUint8(); const player = reader.readUint8();
const count = reader.readUint8(); const count = reader.readUint8();
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
import { BufferReader } from "../../bufferIO"; // @ts-ignore
import { BufferReader } from "rust-src";
import MsgSelectPlace = ygopro.StocGameMessage.MsgSelectPlace; import MsgSelectPlace = ygopro.StocGameMessage.MsgSelectPlace;
/* /*
...@@ -11,7 +12,7 @@ import MsgSelectPlace = ygopro.StocGameMessage.MsgSelectPlace; ...@@ -11,7 +12,7 @@ import MsgSelectPlace = ygopro.StocGameMessage.MsgSelectPlace;
* */ * */
export default (data: Uint8Array) => { export default (data: Uint8Array) => {
const reader = new BufferReader(data, true); const reader = new BufferReader(data);
const player = reader.readUint8(); const player = reader.readUint8();
let count = reader.readUint8(); let count = reader.readUint8();
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
import { BufferReader } from "../../bufferIO"; // @ts-ignore
import { BufferReader } from "rust-src";
import MsgSelectPosition = ygopro.StocGameMessage.MsgSelectPosition; import MsgSelectPosition = ygopro.StocGameMessage.MsgSelectPosition;
/* /*
...@@ -11,7 +12,7 @@ import MsgSelectPosition = ygopro.StocGameMessage.MsgSelectPosition; ...@@ -11,7 +12,7 @@ import MsgSelectPosition = ygopro.StocGameMessage.MsgSelectPosition;
* */ * */
export default (data: Uint8Array) => { export default (data: Uint8Array) => {
const reader = new BufferReader(data, true); const reader = new BufferReader(data);
const player = reader.readUint8(); const player = reader.readUint8();
const code = reader.readUint32(); const code = reader.readUint32();
......
import { ygopro } from "../../../idl/ocgcore"; import { ygopro } from "../../../idl/ocgcore";
import { BufferReader } from "../../bufferIO"; // @ts-ignore
import { BufferReader } from "rust-src";
import MsgWin = ygopro.StocGameMessage.MsgWin; import MsgWin = ygopro.StocGameMessage.MsgWin;
/* /*
...@@ -9,7 +10,7 @@ import MsgWin = ygopro.StocGameMessage.MsgWin; ...@@ -9,7 +10,7 @@ import MsgWin = ygopro.StocGameMessage.MsgWin;
* @param winType - 结果类型 * @param winType - 结果类型
* */ * */
export default (data: Uint8Array) => { export default (data: Uint8Array) => {
const reader = new BufferReader(data, true); const reader = new BufferReader(data);
const player = reader.readUint8(); const player = reader.readUint8();
const winType = reader.readUint8(); const winType = reader.readUint8();
......
import { ygopro } from "../../idl/ocgcore"; import { ygopro } from "../../idl/ocgcore";
import { YgoProPacket, StocAdapter } from "../packet"; import { YgoProPacket, StocAdapter } from "../packet";
import { BufferReader } from "../bufferIO"; // @ts-ignore
import { BufferReader } from "rust-src";
/* /*
* STOC TimeLimit * STOC TimeLimit
...@@ -16,7 +17,7 @@ export default class TimeLimit implements StocAdapter { ...@@ -16,7 +17,7 @@ export default class TimeLimit implements StocAdapter {
} }
upcast(): ygopro.YgoStocMsg { upcast(): ygopro.YgoStocMsg {
const reader = new BufferReader(this.packet.exData, true); const reader = new BufferReader(this.packet.exData);
const player = reader.readInt8(); const player = reader.readInt8();
const leftTime = reader.readUint16(); const leftTime = reader.readUint16();
......
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