ygopro-msg-encode 1.1.25 → 1.1.27
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 +201 -81
- package/dist/index.cjs.map +3 -3
- package/dist/index.mjs +199 -81
- package/dist/index.mjs.map +3 -3
- package/dist/src/protos/common/card-query.d.ts +12 -0
- package/dist/src/protos/msg/proto/cancel-target.d.ts +1 -0
- package/dist/src/protos/msg/proto/card-target.d.ts +1 -0
- package/dist/src/protos/msg/proto/equip.d.ts +1 -1
- package/dist/src/protos/msg/proto/index.d.ts +1 -0
- package/dist/src/protos/msg/proto/swap.d.ts +2 -0
- package/dist/src/protos/msg/proto/unequip.d.ts +11 -0
- package/dist/src/protos/msg/proto/update-data.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -199,6 +199,8 @@ __export(index_exports, {
|
|
|
199
199
|
YGOProMsgTagSwap: () => YGOProMsgTagSwap,
|
|
200
200
|
YGOProMsgTossCoin: () => YGOProMsgTossCoin,
|
|
201
201
|
YGOProMsgTossDice: () => YGOProMsgTossDice,
|
|
202
|
+
YGOProMsgUnequip: () => YGOProMsgUnequip,
|
|
203
|
+
YGOProMsgUnequip_CardLocation: () => YGOProMsgUnequip_CardLocation,
|
|
202
204
|
YGOProMsgUpdateCard: () => YGOProMsgUpdateCard,
|
|
203
205
|
YGOProMsgUpdateData: () => YGOProMsgUpdateData,
|
|
204
206
|
YGOProMsgWaiting: () => YGOProMsgWaiting,
|
|
@@ -231,9 +233,13 @@ __export(index_exports, {
|
|
|
231
233
|
YGOProStocTpResult: () => YGOProStocTpResult,
|
|
232
234
|
YGOProStocTypeChange: () => YGOProStocTypeChange,
|
|
233
235
|
YGOProStocWaitingSide: () => YGOProStocWaitingSide,
|
|
236
|
+
createClearedCardQuery: () => createClearedCardQuery,
|
|
237
|
+
createCodeHiddenCardQuery: () => createCodeHiddenCardQuery,
|
|
234
238
|
fillBinaryFields: () => fillBinaryFields,
|
|
235
239
|
isIndexResponse: () => isIndexResponse,
|
|
240
|
+
parseCardQueryChunk: () => parseCardQueryChunk,
|
|
236
241
|
serializeCardQuery: () => serializeCardQuery,
|
|
242
|
+
serializeCardQueryChunk: () => serializeCardQueryChunk,
|
|
237
243
|
toBinaryFields: () => toBinaryFields
|
|
238
244
|
});
|
|
239
245
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -1484,6 +1490,60 @@ function serializeCardQuery(card) {
|
|
|
1484
1490
|
return new Uint8Array(view.buffer, view.byteOffset, offset);
|
|
1485
1491
|
}
|
|
1486
1492
|
__name(serializeCardQuery, "serializeCardQuery");
|
|
1493
|
+
function parseCardQueryChunk(data, offset = 0, context = "CardQuery") {
|
|
1494
|
+
if (offset + 4 > data.length) {
|
|
1495
|
+
throw new Error(`${context} chunk header truncated`);
|
|
1496
|
+
}
|
|
1497
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
1498
|
+
const length = view.getInt32(offset, true);
|
|
1499
|
+
if (length < 4) {
|
|
1500
|
+
throw new Error(`${context} invalid chunk length: ${length}`);
|
|
1501
|
+
}
|
|
1502
|
+
if (offset + length > data.length) {
|
|
1503
|
+
throw new Error(`${context} chunk payload truncated`);
|
|
1504
|
+
}
|
|
1505
|
+
const card = new CardQuery();
|
|
1506
|
+
card.queryLength = length;
|
|
1507
|
+
if (length === 4) {
|
|
1508
|
+
card.flags = 0;
|
|
1509
|
+
card.empty = true;
|
|
1510
|
+
return { card, length };
|
|
1511
|
+
}
|
|
1512
|
+
const payload = data.slice(offset + 4, offset + length);
|
|
1513
|
+
card.fromPayload(payload);
|
|
1514
|
+
return { card, length };
|
|
1515
|
+
}
|
|
1516
|
+
__name(parseCardQueryChunk, "parseCardQueryChunk");
|
|
1517
|
+
function serializeCardQueryChunk(card) {
|
|
1518
|
+
const flags = card?.flags ?? 0;
|
|
1519
|
+
const queryLength = card?.queryLength;
|
|
1520
|
+
if (flags === 0 && card?.empty && (!queryLength || queryLength <= 4)) {
|
|
1521
|
+
return { length: 4, payload: new Uint8Array(0) };
|
|
1522
|
+
}
|
|
1523
|
+
if (flags === 0 && queryLength && queryLength > 4) {
|
|
1524
|
+
return { length: queryLength, payload: new Uint8Array(queryLength - 4) };
|
|
1525
|
+
}
|
|
1526
|
+
const payload = serializeCardQuery(card);
|
|
1527
|
+
return { length: 4 + payload.length, payload };
|
|
1528
|
+
}
|
|
1529
|
+
__name(serializeCardQueryChunk, "serializeCardQueryChunk");
|
|
1530
|
+
function createClearedCardQuery(source) {
|
|
1531
|
+
const card = new CardQuery();
|
|
1532
|
+
card.flags = 0;
|
|
1533
|
+
card.empty = true;
|
|
1534
|
+
card.queryLength = source?.queryLength;
|
|
1535
|
+
return card;
|
|
1536
|
+
}
|
|
1537
|
+
__name(createClearedCardQuery, "createClearedCardQuery");
|
|
1538
|
+
function createCodeHiddenCardQuery(source) {
|
|
1539
|
+
const card = new CardQuery();
|
|
1540
|
+
card.flags = OcgcoreCommonConstants.QUERY_CODE;
|
|
1541
|
+
card.code = 0;
|
|
1542
|
+
card.empty = false;
|
|
1543
|
+
card.queryLength = source?.queryLength;
|
|
1544
|
+
return card;
|
|
1545
|
+
}
|
|
1546
|
+
__name(createCodeHiddenCardQuery, "createCodeHiddenCardQuery");
|
|
1487
1547
|
|
|
1488
1548
|
// src/proto-base/ygopro-proto-base.ts
|
|
1489
1549
|
var _YGOProProtoBase = class _YGOProProtoBase extends PayloadBase {
|
|
@@ -2362,6 +2422,9 @@ __decorateClass([
|
|
|
2362
2422
|
__decorateClass([
|
|
2363
2423
|
BinaryField("u8", 2)
|
|
2364
2424
|
], _YGOProMsgCancelTarget_CardLocation.prototype, "sequence", 2);
|
|
2425
|
+
__decorateClass([
|
|
2426
|
+
BinaryField("u8", 3)
|
|
2427
|
+
], _YGOProMsgCancelTarget_CardLocation.prototype, "position", 2);
|
|
2365
2428
|
var YGOProMsgCancelTarget_CardLocation = _YGOProMsgCancelTarget_CardLocation;
|
|
2366
2429
|
var _YGOProMsgCancelTarget = class _YGOProMsgCancelTarget extends YGOProMsgBase {
|
|
2367
2430
|
};
|
|
@@ -2371,7 +2434,7 @@ __decorateClass([
|
|
|
2371
2434
|
BinaryField(() => YGOProMsgCancelTarget_CardLocation, 0)
|
|
2372
2435
|
], _YGOProMsgCancelTarget.prototype, "card1", 2);
|
|
2373
2436
|
__decorateClass([
|
|
2374
|
-
BinaryField(() => YGOProMsgCancelTarget_CardLocation,
|
|
2437
|
+
BinaryField(() => YGOProMsgCancelTarget_CardLocation, 4)
|
|
2375
2438
|
], _YGOProMsgCancelTarget.prototype, "card2", 2);
|
|
2376
2439
|
var YGOProMsgCancelTarget = _YGOProMsgCancelTarget;
|
|
2377
2440
|
|
|
@@ -2413,6 +2476,9 @@ __decorateClass([
|
|
|
2413
2476
|
__decorateClass([
|
|
2414
2477
|
BinaryField("u8", 2)
|
|
2415
2478
|
], _YGOProMsgCardTarget_CardLocation.prototype, "sequence", 2);
|
|
2479
|
+
__decorateClass([
|
|
2480
|
+
BinaryField("u8", 3)
|
|
2481
|
+
], _YGOProMsgCardTarget_CardLocation.prototype, "position", 2);
|
|
2416
2482
|
var YGOProMsgCardTarget_CardLocation = _YGOProMsgCardTarget_CardLocation;
|
|
2417
2483
|
var _YGOProMsgCardTarget = class _YGOProMsgCardTarget extends YGOProMsgBase {
|
|
2418
2484
|
};
|
|
@@ -2422,7 +2488,7 @@ __decorateClass([
|
|
|
2422
2488
|
BinaryField(() => YGOProMsgCardTarget_CardLocation, 0)
|
|
2423
2489
|
], _YGOProMsgCardTarget.prototype, "card1", 2);
|
|
2424
2490
|
__decorateClass([
|
|
2425
|
-
BinaryField(() => YGOProMsgCardTarget_CardLocation,
|
|
2491
|
+
BinaryField(() => YGOProMsgCardTarget_CardLocation, 4)
|
|
2426
2492
|
], _YGOProMsgCardTarget.prototype, "card2", 2);
|
|
2427
2493
|
var YGOProMsgCardTarget = _YGOProMsgCardTarget;
|
|
2428
2494
|
|
|
@@ -3598,6 +3664,9 @@ __decorateClass([
|
|
|
3598
3664
|
__decorateClass([
|
|
3599
3665
|
BinaryField("u8", 2)
|
|
3600
3666
|
], _YGOProMsgEquip_CardLocation.prototype, "sequence", 2);
|
|
3667
|
+
__decorateClass([
|
|
3668
|
+
BinaryField("u8", 3)
|
|
3669
|
+
], _YGOProMsgEquip_CardLocation.prototype, "position", 2);
|
|
3601
3670
|
var YGOProMsgEquip_CardLocation = _YGOProMsgEquip_CardLocation;
|
|
3602
3671
|
var _YGOProMsgEquip = class _YGOProMsgEquip extends YGOProMsgBase {
|
|
3603
3672
|
};
|
|
@@ -3607,11 +3676,8 @@ __decorateClass([
|
|
|
3607
3676
|
BinaryField(() => YGOProMsgEquip_CardLocation, 0)
|
|
3608
3677
|
], _YGOProMsgEquip.prototype, "equip", 2);
|
|
3609
3678
|
__decorateClass([
|
|
3610
|
-
BinaryField(() => YGOProMsgEquip_CardLocation,
|
|
3679
|
+
BinaryField(() => YGOProMsgEquip_CardLocation, 4)
|
|
3611
3680
|
], _YGOProMsgEquip.prototype, "target", 2);
|
|
3612
|
-
__decorateClass([
|
|
3613
|
-
BinaryField("u8", 6)
|
|
3614
|
-
], _YGOProMsgEquip.prototype, "position", 2);
|
|
3615
3681
|
var YGOProMsgEquip = _YGOProMsgEquip;
|
|
3616
3682
|
|
|
3617
3683
|
// src/protos/msg/proto/field-disabled.ts
|
|
@@ -5768,10 +5834,16 @@ var _YGOProMsgSwap = class _YGOProMsgSwap extends YGOProMsgBase {
|
|
|
5768
5834
|
__name(_YGOProMsgSwap, "YGOProMsgSwap");
|
|
5769
5835
|
_YGOProMsgSwap.identifier = OcgcoreCommonConstants.MSG_SWAP;
|
|
5770
5836
|
__decorateClass([
|
|
5771
|
-
BinaryField(
|
|
5772
|
-
], _YGOProMsgSwap.prototype, "
|
|
5837
|
+
BinaryField("i32", 0)
|
|
5838
|
+
], _YGOProMsgSwap.prototype, "code1", 2);
|
|
5773
5839
|
__decorateClass([
|
|
5774
5840
|
BinaryField(() => YGOProMsgSwap_CardLocation, 4)
|
|
5841
|
+
], _YGOProMsgSwap.prototype, "card1", 2);
|
|
5842
|
+
__decorateClass([
|
|
5843
|
+
BinaryField("i32", 8)
|
|
5844
|
+
], _YGOProMsgSwap.prototype, "code2", 2);
|
|
5845
|
+
__decorateClass([
|
|
5846
|
+
BinaryField(() => YGOProMsgSwap_CardLocation, 12)
|
|
5775
5847
|
], _YGOProMsgSwap.prototype, "card2", 2);
|
|
5776
5848
|
var YGOProMsgSwap = _YGOProMsgSwap;
|
|
5777
5849
|
|
|
@@ -5875,16 +5947,38 @@ __decorateClass([
|
|
|
5875
5947
|
], _YGOProMsgTossDice.prototype, "results", 2);
|
|
5876
5948
|
var YGOProMsgTossDice = _YGOProMsgTossDice;
|
|
5877
5949
|
|
|
5950
|
+
// src/protos/msg/proto/unequip.ts
|
|
5951
|
+
var _YGOProMsgUnequip_CardLocation = class _YGOProMsgUnequip_CardLocation {
|
|
5952
|
+
};
|
|
5953
|
+
__name(_YGOProMsgUnequip_CardLocation, "YGOProMsgUnequip_CardLocation");
|
|
5954
|
+
__decorateClass([
|
|
5955
|
+
BinaryField("u8", 0)
|
|
5956
|
+
], _YGOProMsgUnequip_CardLocation.prototype, "controller", 2);
|
|
5957
|
+
__decorateClass([
|
|
5958
|
+
BinaryField("u8", 1)
|
|
5959
|
+
], _YGOProMsgUnequip_CardLocation.prototype, "location", 2);
|
|
5960
|
+
__decorateClass([
|
|
5961
|
+
BinaryField("u8", 2)
|
|
5962
|
+
], _YGOProMsgUnequip_CardLocation.prototype, "sequence", 2);
|
|
5963
|
+
__decorateClass([
|
|
5964
|
+
BinaryField("u8", 3)
|
|
5965
|
+
], _YGOProMsgUnequip_CardLocation.prototype, "position", 2);
|
|
5966
|
+
var YGOProMsgUnequip_CardLocation = _YGOProMsgUnequip_CardLocation;
|
|
5967
|
+
var _YGOProMsgUnequip = class _YGOProMsgUnequip extends YGOProMsgBase {
|
|
5968
|
+
};
|
|
5969
|
+
__name(_YGOProMsgUnequip, "YGOProMsgUnequip");
|
|
5970
|
+
_YGOProMsgUnequip.identifier = 95;
|
|
5971
|
+
__decorateClass([
|
|
5972
|
+
BinaryField(() => YGOProMsgUnequip_CardLocation, 0)
|
|
5973
|
+
], _YGOProMsgUnequip.prototype, "card", 2);
|
|
5974
|
+
var YGOProMsgUnequip = _YGOProMsgUnequip;
|
|
5975
|
+
|
|
5878
5976
|
// src/protos/msg/proto/update-card.ts
|
|
5879
5977
|
var _YGOProMsgUpdateCard = class _YGOProMsgUpdateCard extends YGOProMsgBase {
|
|
5880
5978
|
opponentView() {
|
|
5881
5979
|
const copy = this.copy();
|
|
5882
5980
|
if (copy.card?.position && copy.card.position & OcgcoreCommonConstants.POS_FACEDOWN) {
|
|
5883
|
-
|
|
5884
|
-
clearedCard.flags = OcgcoreCommonConstants.QUERY_CODE;
|
|
5885
|
-
clearedCard.code = 0;
|
|
5886
|
-
clearedCard.empty = false;
|
|
5887
|
-
copy.card = clearedCard;
|
|
5981
|
+
copy.card = createCodeHiddenCardQuery(copy.card);
|
|
5888
5982
|
}
|
|
5889
5983
|
return copy;
|
|
5890
5984
|
}
|
|
@@ -5917,31 +6011,26 @@ var _YGOProMsgUpdateCard = class _YGOProMsgUpdateCard extends YGOProMsgBase {
|
|
|
5917
6011
|
this.location = data[2];
|
|
5918
6012
|
this.sequence = data[3];
|
|
5919
6013
|
const queryDataWithLength = data.slice(4);
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
queryDataWithLength.buffer,
|
|
5925
|
-
queryDataWithLength.byteOffset,
|
|
5926
|
-
queryDataWithLength.byteLength
|
|
6014
|
+
const { card } = parseCardQueryChunk(
|
|
6015
|
+
queryDataWithLength,
|
|
6016
|
+
0,
|
|
6017
|
+
"MSG_UPDATE_CARD"
|
|
5927
6018
|
);
|
|
5928
|
-
|
|
5929
|
-
const cardQueryData = queryDataWithLength.slice(4, length);
|
|
5930
|
-
this.card = new CardQuery();
|
|
5931
|
-
this.card.fromPayload(cardQueryData);
|
|
6019
|
+
this.card = card;
|
|
5932
6020
|
return this;
|
|
5933
6021
|
}
|
|
5934
6022
|
toPayload() {
|
|
5935
|
-
const
|
|
5936
|
-
const
|
|
5937
|
-
const result = new Uint8Array(4 + length);
|
|
6023
|
+
const chunk = serializeCardQueryChunk(this.card);
|
|
6024
|
+
const result = new Uint8Array(4 + chunk.length);
|
|
5938
6025
|
const view = new DataView(result.buffer);
|
|
5939
6026
|
result[0] = this.identifier;
|
|
5940
6027
|
result[1] = this.controller;
|
|
5941
6028
|
result[2] = this.location;
|
|
5942
6029
|
result[3] = this.sequence;
|
|
5943
|
-
view.setInt32(4, length, true);
|
|
5944
|
-
|
|
6030
|
+
view.setInt32(4, chunk.length, true);
|
|
6031
|
+
if (chunk.payload.length > 0) {
|
|
6032
|
+
result.set(chunk.payload, 8);
|
|
6033
|
+
}
|
|
5945
6034
|
return result;
|
|
5946
6035
|
}
|
|
5947
6036
|
getRequireRefreshCards() {
|
|
@@ -5960,15 +6049,42 @@ var YGOProMsgUpdateCard = _YGOProMsgUpdateCard;
|
|
|
5960
6049
|
|
|
5961
6050
|
// src/protos/msg/proto/update-data.ts
|
|
5962
6051
|
var _YGOProMsgUpdateData = class _YGOProMsgUpdateData extends YGOProMsgBase {
|
|
6052
|
+
getFixedSlotCount() {
|
|
6053
|
+
if (this.location === OcgcoreScriptConstants.LOCATION_MZONE) {
|
|
6054
|
+
return 7;
|
|
6055
|
+
}
|
|
6056
|
+
if (this.location === OcgcoreScriptConstants.LOCATION_SZONE) {
|
|
6057
|
+
return 8;
|
|
6058
|
+
}
|
|
6059
|
+
return void 0;
|
|
6060
|
+
}
|
|
6061
|
+
shouldHideForOpponent(card) {
|
|
6062
|
+
if (this.location === OcgcoreScriptConstants.LOCATION_GRAVE) {
|
|
6063
|
+
return false;
|
|
6064
|
+
}
|
|
6065
|
+
if (this.location === OcgcoreScriptConstants.LOCATION_HAND) {
|
|
6066
|
+
return !card.position || !(card.position & OcgcoreCommonConstants.POS_FACEUP);
|
|
6067
|
+
}
|
|
6068
|
+
return !!(card.position && card.position & OcgcoreCommonConstants.POS_FACEDOWN);
|
|
6069
|
+
}
|
|
6070
|
+
shouldHideForTeammate(card) {
|
|
6071
|
+
if (this.location === OcgcoreScriptConstants.LOCATION_MZONE || this.location === OcgcoreScriptConstants.LOCATION_SZONE || this.location === OcgcoreScriptConstants.LOCATION_REMOVED || this.location === OcgcoreScriptConstants.LOCATION_GRAVE) {
|
|
6072
|
+
return false;
|
|
6073
|
+
}
|
|
6074
|
+
if (this.location === OcgcoreScriptConstants.LOCATION_HAND) {
|
|
6075
|
+
return !card.position || !(card.position & OcgcoreCommonConstants.POS_FACEUP);
|
|
6076
|
+
}
|
|
6077
|
+
if (this.location === OcgcoreScriptConstants.LOCATION_EXTRA) {
|
|
6078
|
+
return !!(card.position && card.position & OcgcoreCommonConstants.POS_FACEDOWN);
|
|
6079
|
+
}
|
|
6080
|
+
return false;
|
|
6081
|
+
}
|
|
5963
6082
|
opponentView() {
|
|
5964
6083
|
const copy = this.copy();
|
|
5965
6084
|
if (copy.cards) {
|
|
5966
6085
|
copy.cards = copy.cards.map((card) => {
|
|
5967
|
-
if (
|
|
5968
|
-
|
|
5969
|
-
clearedCard.flags = 0;
|
|
5970
|
-
clearedCard.empty = true;
|
|
5971
|
-
return clearedCard;
|
|
6086
|
+
if (this.shouldHideForOpponent(card)) {
|
|
6087
|
+
return createClearedCardQuery(card);
|
|
5972
6088
|
}
|
|
5973
6089
|
return card;
|
|
5974
6090
|
});
|
|
@@ -5976,25 +6092,16 @@ var _YGOProMsgUpdateData = class _YGOProMsgUpdateData extends YGOProMsgBase {
|
|
|
5976
6092
|
return copy;
|
|
5977
6093
|
}
|
|
5978
6094
|
teammateView() {
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
clearedCard.flags = 0;
|
|
5988
|
-
clearedCard.empty = true;
|
|
5989
|
-
return clearedCard;
|
|
5990
|
-
}
|
|
5991
|
-
return card;
|
|
5992
|
-
});
|
|
5993
|
-
}
|
|
5994
|
-
return copy;
|
|
5995
|
-
} else {
|
|
5996
|
-
return this.copy();
|
|
6095
|
+
const copy = this.copy();
|
|
6096
|
+
if (copy.cards) {
|
|
6097
|
+
copy.cards = copy.cards.map((card) => {
|
|
6098
|
+
if (this.shouldHideForTeammate(card)) {
|
|
6099
|
+
return createClearedCardQuery(card);
|
|
6100
|
+
}
|
|
6101
|
+
return card;
|
|
6102
|
+
});
|
|
5997
6103
|
}
|
|
6104
|
+
return copy;
|
|
5998
6105
|
}
|
|
5999
6106
|
fromPayload(data) {
|
|
6000
6107
|
if (data.length < 1) {
|
|
@@ -6013,35 +6120,40 @@ var _YGOProMsgUpdateData = class _YGOProMsgUpdateData extends YGOProMsgBase {
|
|
|
6013
6120
|
this.location = data[2];
|
|
6014
6121
|
this.cards = [];
|
|
6015
6122
|
let offset = 3;
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
const card = new CardQuery();
|
|
6025
|
-
card.flags = 0;
|
|
6026
|
-
card.empty = true;
|
|
6027
|
-
this.cards.push(card);
|
|
6028
|
-
} else {
|
|
6029
|
-
const cardQueryData = data.slice(offset + 4, end);
|
|
6030
|
-
const card = new CardQuery();
|
|
6031
|
-
card.fromPayload(cardQueryData);
|
|
6032
|
-
this.cards.push(card);
|
|
6033
|
-
}
|
|
6034
|
-
offset += chunkLen;
|
|
6123
|
+
while (offset < data.length) {
|
|
6124
|
+
const { card, length } = parseCardQueryChunk(
|
|
6125
|
+
data,
|
|
6126
|
+
offset,
|
|
6127
|
+
"MSG_UPDATE_DATA"
|
|
6128
|
+
);
|
|
6129
|
+
this.cards.push(card);
|
|
6130
|
+
offset += length;
|
|
6035
6131
|
}
|
|
6036
6132
|
return this;
|
|
6037
6133
|
}
|
|
6038
6134
|
toPayload() {
|
|
6135
|
+
const inputCards = this.cards || [];
|
|
6136
|
+
const fixedSlotCount = this.getFixedSlotCount();
|
|
6137
|
+
let cardsToEncode = inputCards;
|
|
6138
|
+
if (fixedSlotCount !== void 0) {
|
|
6139
|
+
if (inputCards.length > fixedSlotCount) {
|
|
6140
|
+
throw new Error(
|
|
6141
|
+
`MSG_UPDATE_DATA location ${this.location} expects at most ${fixedSlotCount} chunks, got ${inputCards.length}`
|
|
6142
|
+
);
|
|
6143
|
+
}
|
|
6144
|
+
if (inputCards.length < fixedSlotCount) {
|
|
6145
|
+
cardsToEncode = inputCards.slice();
|
|
6146
|
+
for (let i = inputCards.length; i < fixedSlotCount; i++) {
|
|
6147
|
+
cardsToEncode.push(createClearedCardQuery());
|
|
6148
|
+
}
|
|
6149
|
+
}
|
|
6150
|
+
}
|
|
6039
6151
|
let totalSize = 3;
|
|
6040
|
-
const
|
|
6041
|
-
for (const card of
|
|
6042
|
-
const
|
|
6043
|
-
|
|
6044
|
-
totalSize +=
|
|
6152
|
+
const chunks = [];
|
|
6153
|
+
for (const card of cardsToEncode) {
|
|
6154
|
+
const chunk = serializeCardQueryChunk(card);
|
|
6155
|
+
chunks.push(chunk);
|
|
6156
|
+
totalSize += chunk.length;
|
|
6045
6157
|
}
|
|
6046
6158
|
const result = new Uint8Array(totalSize);
|
|
6047
6159
|
const view = new DataView(result.buffer);
|
|
@@ -6049,12 +6161,13 @@ var _YGOProMsgUpdateData = class _YGOProMsgUpdateData extends YGOProMsgBase {
|
|
|
6049
6161
|
result[offset++] = this.identifier;
|
|
6050
6162
|
result[offset++] = this.player;
|
|
6051
6163
|
result[offset++] = this.location;
|
|
6052
|
-
for (const
|
|
6053
|
-
|
|
6054
|
-
view.setInt32(offset, length, true);
|
|
6164
|
+
for (const chunk of chunks) {
|
|
6165
|
+
view.setInt32(offset, chunk.length, true);
|
|
6055
6166
|
offset += 4;
|
|
6056
|
-
|
|
6057
|
-
|
|
6167
|
+
if (chunk.payload.length > 0) {
|
|
6168
|
+
result.set(chunk.payload, offset);
|
|
6169
|
+
offset += chunk.payload.length;
|
|
6170
|
+
}
|
|
6058
6171
|
}
|
|
6059
6172
|
return result;
|
|
6060
6173
|
}
|
|
@@ -6143,6 +6256,7 @@ YGOProMessages.register(YGOProMsgDraw);
|
|
|
6143
6256
|
YGOProMessages.register(YGOProMsgDamage);
|
|
6144
6257
|
YGOProMessages.register(YGOProMsgRecover);
|
|
6145
6258
|
YGOProMessages.register(YGOProMsgEquip);
|
|
6259
|
+
YGOProMessages.register(YGOProMsgUnequip);
|
|
6146
6260
|
YGOProMessages.register(YGOProMsgLpUpdate);
|
|
6147
6261
|
YGOProMessages.register(YGOProMsgCardTarget);
|
|
6148
6262
|
YGOProMessages.register(YGOProMsgCancelTarget);
|
|
@@ -6756,6 +6870,8 @@ YGOProStoc.register(YGOProStocSrvproRoomlist);
|
|
|
6756
6870
|
YGOProMsgTagSwap,
|
|
6757
6871
|
YGOProMsgTossCoin,
|
|
6758
6872
|
YGOProMsgTossDice,
|
|
6873
|
+
YGOProMsgUnequip,
|
|
6874
|
+
YGOProMsgUnequip_CardLocation,
|
|
6759
6875
|
YGOProMsgUpdateCard,
|
|
6760
6876
|
YGOProMsgUpdateData,
|
|
6761
6877
|
YGOProMsgWaiting,
|
|
@@ -6788,9 +6904,13 @@ YGOProStoc.register(YGOProStocSrvproRoomlist);
|
|
|
6788
6904
|
YGOProStocTpResult,
|
|
6789
6905
|
YGOProStocTypeChange,
|
|
6790
6906
|
YGOProStocWaitingSide,
|
|
6907
|
+
createClearedCardQuery,
|
|
6908
|
+
createCodeHiddenCardQuery,
|
|
6791
6909
|
fillBinaryFields,
|
|
6792
6910
|
isIndexResponse,
|
|
6911
|
+
parseCardQueryChunk,
|
|
6793
6912
|
serializeCardQuery,
|
|
6913
|
+
serializeCardQueryChunk,
|
|
6794
6914
|
toBinaryFields
|
|
6795
6915
|
});
|
|
6796
6916
|
//# sourceMappingURL=index.cjs.map
|