ygopro-msg-encode 1.1.28 → 1.1.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1201,7 +1201,8 @@ var _CardQuery = class _CardQuery {
1201
1201
  offset += 4;
1202
1202
  }
1203
1203
  if (this.flags & OcgcoreCommonConstants.QUERY_POSITION) {
1204
- const pdata = view.getInt32(offset, true);
1204
+ const pdata = view.getUint32(offset, true);
1205
+ this.positionData = pdata;
1205
1206
  this.position = (pdata >>> 24 & 255) >>> 0;
1206
1207
  offset += 4;
1207
1208
  }
@@ -1250,9 +1251,12 @@ var _CardQuery = class _CardQuery {
1250
1251
  offset += 4;
1251
1252
  }
1252
1253
  if (this.flags & OcgcoreCommonConstants.QUERY_REASON_CARD) {
1254
+ this.reasonCardData = view.getUint32(offset, true);
1253
1255
  offset += 4;
1254
1256
  }
1255
1257
  if (this.flags & OcgcoreCommonConstants.QUERY_EQUIP_CARD) {
1258
+ const pdata = view.getUint32(offset, true);
1259
+ this.equipCardData = pdata;
1256
1260
  this.equipCard = {
1257
1261
  controller: view.getUint8(offset),
1258
1262
  location: view.getUint8(offset + 1),
@@ -1264,7 +1268,9 @@ var _CardQuery = class _CardQuery {
1264
1268
  const count = view.getInt32(offset, true);
1265
1269
  offset += 4;
1266
1270
  this.targetCards = [];
1271
+ this.targetCardData = [];
1267
1272
  for (let i = 0; i < count; i++) {
1273
+ this.targetCardData.push(view.getUint32(offset, true));
1268
1274
  this.targetCards.push({
1269
1275
  controller: view.getUint8(offset),
1270
1276
  location: view.getUint8(offset + 1),
@@ -1370,8 +1376,8 @@ function serializeCardQuery(card) {
1370
1376
  offset += 4;
1371
1377
  }
1372
1378
  if (flags & OcgcoreCommonConstants.QUERY_POSITION) {
1373
- const pdata = (source.position || 0) << 24 >>> 0;
1374
- view.setInt32(offset, pdata, true);
1379
+ const pdata = source.positionData !== void 0 ? source.positionData >>> 0 : (source.position || 0) << 24 >>> 0;
1380
+ view.setUint32(offset, pdata, true);
1375
1381
  offset += 4;
1376
1382
  }
1377
1383
  if (flags & OcgcoreCommonConstants.QUERY_ALIAS) {
@@ -1419,30 +1425,41 @@ function serializeCardQuery(card) {
1419
1425
  offset += 4;
1420
1426
  }
1421
1427
  if (flags & OcgcoreCommonConstants.QUERY_REASON_CARD) {
1422
- view.setInt32(offset, 0, true);
1428
+ view.setUint32(offset, (source.reasonCardData || 0) >>> 0, true);
1423
1429
  offset += 4;
1424
1430
  }
1425
1431
  if (flags & OcgcoreCommonConstants.QUERY_EQUIP_CARD) {
1426
- const equipCard = source.equipCard || {
1427
- controller: 0,
1428
- location: 0,
1429
- sequence: 0
1430
- };
1431
- view.setUint8(offset, equipCard.controller);
1432
- view.setUint8(offset + 1, equipCard.location);
1433
- view.setUint8(offset + 2, equipCard.sequence);
1434
- view.setUint8(offset + 3, 0);
1435
- offset += 4;
1432
+ if (source.equipCardData !== void 0) {
1433
+ view.setUint32(offset, source.equipCardData >>> 0, true);
1434
+ offset += 4;
1435
+ } else {
1436
+ const equipCard = source.equipCard || {
1437
+ controller: 0,
1438
+ location: 0,
1439
+ sequence: 0
1440
+ };
1441
+ view.setUint8(offset, equipCard.controller);
1442
+ view.setUint8(offset + 1, equipCard.location);
1443
+ view.setUint8(offset + 2, equipCard.sequence);
1444
+ view.setUint8(offset + 3, 0);
1445
+ offset += 4;
1446
+ }
1436
1447
  }
1437
1448
  if (flags & OcgcoreCommonConstants.QUERY_TARGET_CARD) {
1438
1449
  const targets = source.targetCards || [];
1439
1450
  view.setInt32(offset, targets.length, true);
1440
1451
  offset += 4;
1441
- for (const target of targets) {
1442
- view.setUint8(offset, target.controller);
1443
- view.setUint8(offset + 1, target.location);
1444
- view.setUint8(offset + 2, target.sequence);
1445
- view.setUint8(offset + 3, 0);
1452
+ for (let i = 0; i < targets.length; i++) {
1453
+ const target = targets[i];
1454
+ const rawTarget = source.targetCardData?.[i];
1455
+ if (rawTarget !== void 0) {
1456
+ view.setUint32(offset, rawTarget >>> 0, true);
1457
+ } else {
1458
+ view.setUint8(offset, target.controller);
1459
+ view.setUint8(offset + 1, target.location);
1460
+ view.setUint8(offset + 2, target.sequence);
1461
+ view.setUint8(offset + 3, 0);
1462
+ }
1446
1463
  offset += 4;
1447
1464
  }
1448
1465
  }
@@ -3872,16 +3889,7 @@ var _YGOProMsgMove = class _YGOProMsgMove extends YGOProMsgBase {
3872
3889
  return view;
3873
3890
  }
3874
3891
  teammateView() {
3875
- const view = this.copy();
3876
- const cl = view.current.location;
3877
- const cp = view.current.position;
3878
- if (cl & (OcgcoreScriptConstants.LOCATION_GRAVE | OcgcoreScriptConstants.LOCATION_OVERLAY)) {
3879
- return view;
3880
- }
3881
- if (cl & (OcgcoreScriptConstants.LOCATION_DECK | OcgcoreScriptConstants.LOCATION_HAND)) {
3882
- view.code = 0;
3883
- }
3884
- return view;
3892
+ return this.opponentView();
3885
3893
  }
3886
3894
  playerView(playerId) {
3887
3895
  if (playerId === 7 /* OBSERVER */) {