ygopro-msg-encode 1.0.4 → 1.0.5
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 +66 -3
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +66 -3
- package/dist/index.mjs.map +2 -2
- package/dist/src/protos/msg/proto/announce-attrib.d.ts +1 -0
- package/dist/src/protos/msg/proto/announce-card.d.ts +1 -0
- package/dist/src/protos/msg/proto/announce-number.d.ts +1 -0
- package/dist/src/protos/msg/proto/announce-race.d.ts +1 -0
- package/dist/src/protos/msg/proto/select-battlecmd.d.ts +1 -0
- package/dist/src/protos/msg/proto/select-card.d.ts +1 -0
- package/dist/src/protos/msg/proto/select-chain.d.ts +1 -0
- package/dist/src/protos/msg/proto/select-counter.d.ts +1 -0
- package/dist/src/protos/msg/proto/select-disfield.d.ts +1 -0
- package/dist/src/protos/msg/proto/select-effectyn.d.ts +1 -0
- package/dist/src/protos/msg/proto/select-idlecmd.d.ts +1 -0
- package/dist/src/protos/msg/proto/select-option.d.ts +1 -0
- package/dist/src/protos/msg/proto/select-place.d.ts +1 -0
- package/dist/src/protos/msg/proto/select-position.d.ts +1 -0
- package/dist/src/protos/msg/proto/select-sum.d.ts +1 -0
- package/dist/src/protos/msg/proto/select-tribute.d.ts +1 -0
- package/dist/src/protos/msg/proto/select-unselect-card.d.ts +1 -0
- package/dist/src/protos/msg/proto/select-yesno.d.ts +1 -0
- package/dist/src/protos/msg/proto/sort-card.d.ts +1 -0
- package/dist/src/protos/msg/with-response-base.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1415,6 +1415,9 @@ var YGOProMsgResponseBase = class extends YGOProMsgBase {
|
|
|
1415
1415
|
|
|
1416
1416
|
// src/protos/msg/proto/announce-attrib.ts
|
|
1417
1417
|
var YGOProMsgAnnounceAttrib = class extends YGOProMsgResponseBase {
|
|
1418
|
+
responsePlayer() {
|
|
1419
|
+
return this.player;
|
|
1420
|
+
}
|
|
1418
1421
|
prepareResponse(attributes) {
|
|
1419
1422
|
const buffer = new Uint8Array(4);
|
|
1420
1423
|
const view = new DataView(buffer.buffer);
|
|
@@ -1435,6 +1438,9 @@ __decorateClass([
|
|
|
1435
1438
|
|
|
1436
1439
|
// src/protos/msg/proto/announce-card.ts
|
|
1437
1440
|
var YGOProMsgAnnounceCard = class extends YGOProMsgResponseBase {
|
|
1441
|
+
responsePlayer() {
|
|
1442
|
+
return this.player;
|
|
1443
|
+
}
|
|
1438
1444
|
prepareResponse(cardCode) {
|
|
1439
1445
|
const buffer = new Uint8Array(4);
|
|
1440
1446
|
const view = new DataView(buffer.buffer);
|
|
@@ -1465,6 +1471,9 @@ var isIndexResponse = (obj) => {
|
|
|
1465
1471
|
|
|
1466
1472
|
// src/protos/msg/proto/announce-number.ts
|
|
1467
1473
|
var YGOProMsgAnnounceNumber = class extends YGOProMsgResponseBase {
|
|
1474
|
+
responsePlayer() {
|
|
1475
|
+
return this.player;
|
|
1476
|
+
}
|
|
1468
1477
|
prepareResponse(option) {
|
|
1469
1478
|
let index;
|
|
1470
1479
|
if (isIndexResponse(option)) {
|
|
@@ -1497,6 +1506,9 @@ __decorateClass([
|
|
|
1497
1506
|
|
|
1498
1507
|
// src/protos/msg/proto/announce-race.ts
|
|
1499
1508
|
var YGOProMsgAnnounceRace = class extends YGOProMsgResponseBase {
|
|
1509
|
+
responsePlayer() {
|
|
1510
|
+
return this.player;
|
|
1511
|
+
}
|
|
1500
1512
|
prepareResponse(races) {
|
|
1501
1513
|
const buffer = new Uint8Array(4);
|
|
1502
1514
|
const view = new DataView(buffer.buffer);
|
|
@@ -2709,6 +2721,9 @@ __decorateClass([
|
|
|
2709
2721
|
BinaryField("u8", 7)
|
|
2710
2722
|
], YGOProMsgSelectBattleCmd_AttackableInfo.prototype, "directAttack", 2);
|
|
2711
2723
|
var YGOProMsgSelectBattleCmd = class extends YGOProMsgResponseBase {
|
|
2724
|
+
responsePlayer() {
|
|
2725
|
+
return this.player;
|
|
2726
|
+
}
|
|
2712
2727
|
prepareResponse(type, option) {
|
|
2713
2728
|
let sequence;
|
|
2714
2729
|
if (type === 0 /* ACTIVATE */) {
|
|
@@ -2824,6 +2839,9 @@ __decorateClass([
|
|
|
2824
2839
|
BinaryField("u8", 7)
|
|
2825
2840
|
], YGOProMsgSelectCard_CardInfo.prototype, "subsequence", 2);
|
|
2826
2841
|
var YGOProMsgSelectCard = class extends YGOProMsgResponseBase {
|
|
2842
|
+
responsePlayer() {
|
|
2843
|
+
return this.player;
|
|
2844
|
+
}
|
|
2827
2845
|
defaultResponse() {
|
|
2828
2846
|
if (this.cancelable === 0) {
|
|
2829
2847
|
return void 0;
|
|
@@ -2838,6 +2856,7 @@ var YGOProMsgSelectCard = class extends YGOProMsgResponseBase {
|
|
|
2838
2856
|
return buffer2;
|
|
2839
2857
|
}
|
|
2840
2858
|
const indices = [];
|
|
2859
|
+
const usedIndices = /* @__PURE__ */ new Set();
|
|
2841
2860
|
for (const option of cardOptions) {
|
|
2842
2861
|
let index;
|
|
2843
2862
|
if (isIndexResponse(option)) {
|
|
@@ -2847,13 +2866,14 @@ var YGOProMsgSelectCard = class extends YGOProMsgResponseBase {
|
|
|
2847
2866
|
}
|
|
2848
2867
|
} else {
|
|
2849
2868
|
index = this.cards.findIndex(
|
|
2850
|
-
(card) => (option.code == null || card.code === option.code) && (option.controller == null || card.controller === option.controller) && (option.location == null || card.location === option.location) && (option.sequence == null || card.sequence === option.sequence)
|
|
2869
|
+
(card, idx) => !usedIndices.has(idx) && (option.code == null || card.code === option.code) && (option.controller == null || card.controller === option.controller) && (option.location == null || card.location === option.location) && (option.sequence == null || card.sequence === option.sequence)
|
|
2851
2870
|
);
|
|
2852
2871
|
if (index === -1) {
|
|
2853
2872
|
throw new TypeError("Card not found");
|
|
2854
2873
|
}
|
|
2855
2874
|
}
|
|
2856
2875
|
indices.push(index);
|
|
2876
|
+
usedIndices.add(index);
|
|
2857
2877
|
}
|
|
2858
2878
|
const buffer = new Uint8Array(1 + indices.length);
|
|
2859
2879
|
buffer[0] = indices.length;
|
|
@@ -2911,6 +2931,9 @@ __decorateClass([
|
|
|
2911
2931
|
BinaryField("i32", 10)
|
|
2912
2932
|
], YGOProMsgSelectChain_ChainInfo.prototype, "desc", 2);
|
|
2913
2933
|
var YGOProMsgSelectChain = class extends YGOProMsgResponseBase {
|
|
2934
|
+
responsePlayer() {
|
|
2935
|
+
return this.player;
|
|
2936
|
+
}
|
|
2914
2937
|
defaultResponse() {
|
|
2915
2938
|
const hasForced = this.chains.some((chain) => chain.forced !== 0);
|
|
2916
2939
|
if (hasForced) {
|
|
@@ -2980,6 +3003,9 @@ __decorateClass([
|
|
|
2980
3003
|
BinaryField("u16", 7)
|
|
2981
3004
|
], YGOProMsgSelectCounter_CardInfo.prototype, "counterCount", 2);
|
|
2982
3005
|
var YGOProMsgSelectCounter = class extends YGOProMsgResponseBase {
|
|
3006
|
+
responsePlayer() {
|
|
3007
|
+
return this.player;
|
|
3008
|
+
}
|
|
2983
3009
|
prepareResponse(counterOptions) {
|
|
2984
3010
|
const counterCounts = new Array(this.count).fill(0);
|
|
2985
3011
|
for (const option of counterOptions) {
|
|
@@ -3027,6 +3053,9 @@ __decorateClass([
|
|
|
3027
3053
|
|
|
3028
3054
|
// src/protos/msg/proto/select-disfield.ts
|
|
3029
3055
|
var YGOProMsgSelectDisField = class extends YGOProMsgResponseBase {
|
|
3056
|
+
responsePlayer() {
|
|
3057
|
+
return this.player;
|
|
3058
|
+
}
|
|
3030
3059
|
prepareResponse(places) {
|
|
3031
3060
|
const buffer = new Uint8Array(places.length * 3);
|
|
3032
3061
|
places.forEach((place, i) => {
|
|
@@ -3050,6 +3079,9 @@ __decorateClass([
|
|
|
3050
3079
|
|
|
3051
3080
|
// src/protos/msg/proto/select-effectyn.ts
|
|
3052
3081
|
var YGOProMsgSelectEffectYn = class extends YGOProMsgResponseBase {
|
|
3082
|
+
responsePlayer() {
|
|
3083
|
+
return this.player;
|
|
3084
|
+
}
|
|
3053
3085
|
defaultResponse() {
|
|
3054
3086
|
return this.prepareResponse(false);
|
|
3055
3087
|
}
|
|
@@ -3128,6 +3160,9 @@ __decorateClass([
|
|
|
3128
3160
|
BinaryField("i32", 7)
|
|
3129
3161
|
], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "desc", 2);
|
|
3130
3162
|
var YGOProMsgSelectIdleCmd = class extends YGOProMsgResponseBase {
|
|
3163
|
+
responsePlayer() {
|
|
3164
|
+
return this.player;
|
|
3165
|
+
}
|
|
3131
3166
|
prepareResponse(type, option) {
|
|
3132
3167
|
let sequence;
|
|
3133
3168
|
if (type === 0 /* SUMMON */ || type === 1 /* SPSUMMON */ || type === 2 /* REPOS */ || type === 3 /* MSET */ || type === 4 /* SSET */ || type === 5 /* ACTIVATE */) {
|
|
@@ -3297,6 +3332,9 @@ __decorateClass([
|
|
|
3297
3332
|
|
|
3298
3333
|
// src/protos/msg/proto/select-option.ts
|
|
3299
3334
|
var YGOProMsgSelectOption = class extends YGOProMsgResponseBase {
|
|
3335
|
+
responsePlayer() {
|
|
3336
|
+
return this.player;
|
|
3337
|
+
}
|
|
3300
3338
|
prepareResponse(option) {
|
|
3301
3339
|
let index;
|
|
3302
3340
|
if (isIndexResponse(option)) {
|
|
@@ -3329,6 +3367,9 @@ __decorateClass([
|
|
|
3329
3367
|
|
|
3330
3368
|
// src/protos/msg/proto/select-place.ts
|
|
3331
3369
|
var YGOProMsgSelectPlace = class extends YGOProMsgResponseBase {
|
|
3370
|
+
responsePlayer() {
|
|
3371
|
+
return this.player;
|
|
3372
|
+
}
|
|
3332
3373
|
prepareResponse(places) {
|
|
3333
3374
|
const buffer = new Uint8Array(places.length * 3);
|
|
3334
3375
|
places.forEach((place, i) => {
|
|
@@ -3352,6 +3393,9 @@ __decorateClass([
|
|
|
3352
3393
|
|
|
3353
3394
|
// src/protos/msg/proto/select-position.ts
|
|
3354
3395
|
var YGOProMsgSelectPosition = class extends YGOProMsgResponseBase {
|
|
3396
|
+
responsePlayer() {
|
|
3397
|
+
return this.player;
|
|
3398
|
+
}
|
|
3355
3399
|
prepareResponse(position) {
|
|
3356
3400
|
const buffer = new Uint8Array(4);
|
|
3357
3401
|
const view = new DataView(buffer.buffer);
|
|
@@ -3389,6 +3433,9 @@ __decorateClass([
|
|
|
3389
3433
|
BinaryField("i32", 7)
|
|
3390
3434
|
], YGOProMsgSelectSum_CardInfo.prototype, "opParam", 2);
|
|
3391
3435
|
var YGOProMsgSelectSum = class extends YGOProMsgResponseBase {
|
|
3436
|
+
responsePlayer() {
|
|
3437
|
+
return this.player;
|
|
3438
|
+
}
|
|
3392
3439
|
prepareResponse(cardOptions) {
|
|
3393
3440
|
const indices = [];
|
|
3394
3441
|
for (const option of cardOptions) {
|
|
@@ -3476,6 +3523,9 @@ __decorateClass([
|
|
|
3476
3523
|
BinaryField("u8", 7)
|
|
3477
3524
|
], YGOProMsgSelectTribute_CardInfo.prototype, "releaseParam", 2);
|
|
3478
3525
|
var YGOProMsgSelectTribute = class extends YGOProMsgResponseBase {
|
|
3526
|
+
responsePlayer() {
|
|
3527
|
+
return this.player;
|
|
3528
|
+
}
|
|
3479
3529
|
defaultResponse() {
|
|
3480
3530
|
if (this.cancelable === 0) {
|
|
3481
3531
|
return void 0;
|
|
@@ -3490,6 +3540,7 @@ var YGOProMsgSelectTribute = class extends YGOProMsgResponseBase {
|
|
|
3490
3540
|
return buffer2;
|
|
3491
3541
|
}
|
|
3492
3542
|
const indices = [];
|
|
3543
|
+
const usedIndices = /* @__PURE__ */ new Set();
|
|
3493
3544
|
for (const option of cardOptions) {
|
|
3494
3545
|
let index;
|
|
3495
3546
|
if (isIndexResponse(option)) {
|
|
@@ -3499,13 +3550,14 @@ var YGOProMsgSelectTribute = class extends YGOProMsgResponseBase {
|
|
|
3499
3550
|
}
|
|
3500
3551
|
} else {
|
|
3501
3552
|
index = this.cards.findIndex(
|
|
3502
|
-
(card) => (option.code == null || card.code === option.code) && (option.controller == null || card.controller === option.controller) && (option.location == null || card.location === option.location) && (option.sequence == null || card.sequence === option.sequence)
|
|
3553
|
+
(card, idx) => !usedIndices.has(idx) && (option.code == null || card.code === option.code) && (option.controller == null || card.controller === option.controller) && (option.location == null || card.location === option.location) && (option.sequence == null || card.sequence === option.sequence)
|
|
3503
3554
|
);
|
|
3504
3555
|
if (index === -1) {
|
|
3505
3556
|
throw new TypeError("Card not found");
|
|
3506
3557
|
}
|
|
3507
3558
|
}
|
|
3508
3559
|
indices.push(index);
|
|
3560
|
+
usedIndices.add(index);
|
|
3509
3561
|
}
|
|
3510
3562
|
const buffer = new Uint8Array(1 + indices.length);
|
|
3511
3563
|
buffer[0] = indices.length;
|
|
@@ -3554,6 +3606,9 @@ __decorateClass([
|
|
|
3554
3606
|
BinaryField("u8", 7)
|
|
3555
3607
|
], YGOProMsgSelectUnselectCard_CardInfo.prototype, "subsequence", 2);
|
|
3556
3608
|
var YGOProMsgSelectUnselectCard = class extends YGOProMsgResponseBase {
|
|
3609
|
+
responsePlayer() {
|
|
3610
|
+
return this.player;
|
|
3611
|
+
}
|
|
3557
3612
|
defaultResponse() {
|
|
3558
3613
|
if (this.cancelable === 0 && this.finishable === 0) {
|
|
3559
3614
|
return void 0;
|
|
@@ -3637,6 +3692,9 @@ __decorateClass([
|
|
|
3637
3692
|
|
|
3638
3693
|
// src/protos/msg/proto/select-yesno.ts
|
|
3639
3694
|
var YGOProMsgSelectYesNo = class extends YGOProMsgResponseBase {
|
|
3695
|
+
responsePlayer() {
|
|
3696
|
+
return this.player;
|
|
3697
|
+
}
|
|
3640
3698
|
defaultResponse() {
|
|
3641
3699
|
return this.prepareResponse(false);
|
|
3642
3700
|
}
|
|
@@ -3768,6 +3826,9 @@ __decorateClass([
|
|
|
3768
3826
|
BinaryField("u8", 6)
|
|
3769
3827
|
], YGOProMsgSortCard_CardInfo.prototype, "sequence", 2);
|
|
3770
3828
|
var YGOProMsgSortCard = class extends YGOProMsgResponseBase {
|
|
3829
|
+
responsePlayer() {
|
|
3830
|
+
return this.player;
|
|
3831
|
+
}
|
|
3771
3832
|
defaultResponse() {
|
|
3772
3833
|
return this.prepareResponse(null);
|
|
3773
3834
|
}
|
|
@@ -3776,6 +3837,7 @@ var YGOProMsgSortCard = class extends YGOProMsgResponseBase {
|
|
|
3776
3837
|
return new Uint8Array([255]);
|
|
3777
3838
|
}
|
|
3778
3839
|
const indices = [];
|
|
3840
|
+
const usedIndices = /* @__PURE__ */ new Set();
|
|
3779
3841
|
for (const option of sortedOptions) {
|
|
3780
3842
|
let index;
|
|
3781
3843
|
if (isIndexResponse(option)) {
|
|
@@ -3785,13 +3847,14 @@ var YGOProMsgSortCard = class extends YGOProMsgResponseBase {
|
|
|
3785
3847
|
}
|
|
3786
3848
|
} else {
|
|
3787
3849
|
index = this.cards.findIndex(
|
|
3788
|
-
(card) => (option.code == null || card.code === option.code) && (option.controller == null || card.controller === option.controller) && (option.location == null || card.location === option.location) && (option.sequence == null || card.sequence === option.sequence)
|
|
3850
|
+
(card, idx) => !usedIndices.has(idx) && (option.code == null || card.code === option.code) && (option.controller == null || card.controller === option.controller) && (option.location == null || card.location === option.location) && (option.sequence == null || card.sequence === option.sequence)
|
|
3789
3851
|
);
|
|
3790
3852
|
if (index === -1) {
|
|
3791
3853
|
throw new TypeError("Card not found");
|
|
3792
3854
|
}
|
|
3793
3855
|
}
|
|
3794
3856
|
indices.push(index);
|
|
3857
|
+
usedIndices.add(index);
|
|
3795
3858
|
}
|
|
3796
3859
|
const buffer = new Uint8Array(indices.length);
|
|
3797
3860
|
indices.forEach((idx, i) => {
|