Commit 3459e7b8 authored by Chunchi Che's avatar Chunchi Che

fix readCardLocation

parent 414cfd54
Pipeline #20046 passed with stages
in 4 minutes and 50 seconds
...@@ -6,6 +6,7 @@ const OFFSET_INT8 = 1; ...@@ -6,6 +6,7 @@ const OFFSET_INT8 = 1;
const OFFSET_UINT16 = 2; const OFFSET_UINT16 = 2;
const OFFSET_UINT32 = 4; const OFFSET_UINT32 = 4;
const OFFSET_INT32 = 4; const OFFSET_INT32 = 4;
const LOCATION_OVERLAY = 0x80;
export class BufferReader { export class BufferReader {
dataView: DataView; dataView: DataView;
...@@ -67,28 +68,28 @@ export class BufferReader { ...@@ -67,28 +68,28 @@ export class BufferReader {
}); });
} }
readCardLocation(overlay?: boolean): ygopro.CardLocation { readCardLocation(): ygopro.CardLocation {
const controler = this.readUint8(); const controler = this.readUint8();
const location = this.readUint8(); const location = this.readUint8();
const sequence = this.readUint8(); const sequence = this.readUint8();
const ss = this.readUint8(); const ss = this.readUint8();
const cardLocation = new ygopro.CardLocation({ if (location & LOCATION_OVERLAY) {
controler, // 超量素材
location: numberToCardZone(location), return new ygopro.CardLocation({
sequence, controler,
}); location: ygopro.CardZone.OVERLAY,
sequence,
if (overlay && overlay) { overlay_sequence: ss,
cardLocation.overlay_sequence = ss; });
} else { } else {
const position = numberToCardPosition(ss); return new ygopro.CardLocation({
if (position) { controler,
cardLocation.position = position; location: numberToCardZone(location),
} sequence,
position: numberToCardPosition(ss),
});
} }
return cardLocation;
} }
} }
......
...@@ -20,6 +20,7 @@ export default (move: MsgMove, dispatch: AppDispatch) => { ...@@ -20,6 +20,7 @@ export default (move: MsgMove, dispatch: AppDispatch) => {
const code = move.code; const code = move.code;
const from = move.from; const from = move.from;
const to = move.to; const to = move.to;
console.log(to);
// TODO: reason // TODO: reason
switch (from.location) { switch (from.location) {
......
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