ygopro-msg-encode 1.1.29 → 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 +36 -19
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +36 -19
- package/dist/index.mjs.map +2 -2
- package/dist/src/protos/common/card-query.d.ts +4 -0
- package/package.json +4 -1
- package/tsconfig.json +5 -1
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.
|
|
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.
|
|
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.
|
|
1428
|
+
view.setUint32(offset, (source.reasonCardData || 0) >>> 0, true);
|
|
1423
1429
|
offset += 4;
|
|
1424
1430
|
}
|
|
1425
1431
|
if (flags & OcgcoreCommonConstants.QUERY_EQUIP_CARD) {
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
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 (
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
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
|
}
|