ygopro-msg-encode 1.1.3 → 1.1.4
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 +770 -707
- package/dist/index.cjs.map +3 -3
- package/dist/index.mjs +806 -743
- package/dist/index.mjs.map +3 -3
- package/dist/src/protos/msg/proto/move.d.ts +3 -0
- package/dist/src/protos/msg/proto/spsummoning.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1962,6 +1962,9 @@ var YGOProMsgBase = class extends PayloadBase {
|
|
|
1962
1962
|
return this.opponentView();
|
|
1963
1963
|
}
|
|
1964
1964
|
playerView(playerId) {
|
|
1965
|
+
if (playerId === 7 /* OBSERVER */) {
|
|
1966
|
+
return this.observerView();
|
|
1967
|
+
}
|
|
1965
1968
|
if (typeof this["player"] === "number") {
|
|
1966
1969
|
const selfPlayerId = this["player"];
|
|
1967
1970
|
if (selfPlayerId === playerId) {
|
|
@@ -2421,6 +2424,7 @@ var YGOProMsgConfirmDeckTop = class extends YGOProMsgBase {
|
|
|
2421
2424
|
});
|
|
2422
2425
|
return view;
|
|
2423
2426
|
}
|
|
2427
|
+
// confirm-decktop 使用基类的 playerView (基于 player 字段)
|
|
2424
2428
|
};
|
|
2425
2429
|
YGOProMsgConfirmDeckTop.identifier = OcgcoreCommonConstants.MSG_CONFIRM_DECKTOP;
|
|
2426
2430
|
__decorateClass([
|
|
@@ -2461,6 +2465,7 @@ var YGOProMsgConfirmExtraTop = class extends YGOProMsgBase {
|
|
|
2461
2465
|
});
|
|
2462
2466
|
return view;
|
|
2463
2467
|
}
|
|
2468
|
+
// confirm-extratop 使用基类的 playerView (基于 player 字段)
|
|
2464
2469
|
};
|
|
2465
2470
|
YGOProMsgConfirmExtraTop.identifier = OcgcoreCommonConstants.MSG_CONFIRM_EXTRATOP;
|
|
2466
2471
|
__decorateClass([
|
|
@@ -2504,6 +2509,7 @@ var YGOProMsgDeckTop = class extends YGOProMsgBase {
|
|
|
2504
2509
|
}
|
|
2505
2510
|
return view;
|
|
2506
2511
|
}
|
|
2512
|
+
// deck-top 使用基类的 playerView (基于 player 字段)
|
|
2507
2513
|
};
|
|
2508
2514
|
YGOProMsgDeckTop.identifier = OcgcoreCommonConstants.MSG_DECK_TOP;
|
|
2509
2515
|
__decorateClass([
|
|
@@ -2668,712 +2674,6 @@ __decorateClass([
|
|
|
2668
2674
|
BinaryField("i32", 5)
|
|
2669
2675
|
], YGOProMsgMissedEffect.prototype, "desc", 2);
|
|
2670
2676
|
|
|
2671
|
-
// src/protos/msg/proto/move.ts
|
|
2672
|
-
var YGOProMsgMove_CardLocation = class {
|
|
2673
|
-
};
|
|
2674
|
-
__decorateClass([
|
|
2675
|
-
BinaryField("u8", 0)
|
|
2676
|
-
], YGOProMsgMove_CardLocation.prototype, "controller", 2);
|
|
2677
|
-
__decorateClass([
|
|
2678
|
-
BinaryField("u8", 1)
|
|
2679
|
-
], YGOProMsgMove_CardLocation.prototype, "location", 2);
|
|
2680
|
-
__decorateClass([
|
|
2681
|
-
BinaryField("u8", 2)
|
|
2682
|
-
], YGOProMsgMove_CardLocation.prototype, "sequence", 2);
|
|
2683
|
-
__decorateClass([
|
|
2684
|
-
BinaryField("u8", 3)
|
|
2685
|
-
], YGOProMsgMove_CardLocation.prototype, "position", 2);
|
|
2686
|
-
var YGOProMsgMove = class extends YGOProMsgBase {
|
|
2687
|
-
};
|
|
2688
|
-
YGOProMsgMove.identifier = OcgcoreCommonConstants.MSG_MOVE;
|
|
2689
|
-
__decorateClass([
|
|
2690
|
-
BinaryField("i32", 0)
|
|
2691
|
-
], YGOProMsgMove.prototype, "code", 2);
|
|
2692
|
-
__decorateClass([
|
|
2693
|
-
BinaryField(() => YGOProMsgMove_CardLocation, 4)
|
|
2694
|
-
], YGOProMsgMove.prototype, "previous", 2);
|
|
2695
|
-
__decorateClass([
|
|
2696
|
-
BinaryField(() => YGOProMsgMove_CardLocation, 8)
|
|
2697
|
-
], YGOProMsgMove.prototype, "current", 2);
|
|
2698
|
-
__decorateClass([
|
|
2699
|
-
BinaryField("i32", 12)
|
|
2700
|
-
], YGOProMsgMove.prototype, "reason", 2);
|
|
2701
|
-
|
|
2702
|
-
// src/protos/msg/proto/new-phase.ts
|
|
2703
|
-
var YGOProMsgNewPhase = class extends YGOProMsgBase {
|
|
2704
|
-
};
|
|
2705
|
-
YGOProMsgNewPhase.identifier = OcgcoreCommonConstants.MSG_NEW_PHASE;
|
|
2706
|
-
__decorateClass([
|
|
2707
|
-
BinaryField("u16", 0)
|
|
2708
|
-
], YGOProMsgNewPhase.prototype, "phase", 2);
|
|
2709
|
-
|
|
2710
|
-
// src/protos/msg/proto/new-turn.ts
|
|
2711
|
-
var YGOProMsgNewTurn = class extends YGOProMsgBase {
|
|
2712
|
-
};
|
|
2713
|
-
YGOProMsgNewTurn.identifier = OcgcoreCommonConstants.MSG_NEW_TURN;
|
|
2714
|
-
__decorateClass([
|
|
2715
|
-
BinaryField("u8", 0)
|
|
2716
|
-
], YGOProMsgNewTurn.prototype, "player", 2);
|
|
2717
|
-
|
|
2718
|
-
// src/protos/msg/proto/pay-lpcost.ts
|
|
2719
|
-
var YGOProMsgPayLpCost = class extends YGOProMsgBase {
|
|
2720
|
-
};
|
|
2721
|
-
YGOProMsgPayLpCost.identifier = OcgcoreCommonConstants.MSG_PAY_LPCOST;
|
|
2722
|
-
__decorateClass([
|
|
2723
|
-
BinaryField("u8", 0)
|
|
2724
|
-
], YGOProMsgPayLpCost.prototype, "player", 2);
|
|
2725
|
-
__decorateClass([
|
|
2726
|
-
BinaryField("i32", 1)
|
|
2727
|
-
], YGOProMsgPayLpCost.prototype, "cost", 2);
|
|
2728
|
-
|
|
2729
|
-
// src/protos/msg/proto/player-hint.ts
|
|
2730
|
-
var YGOProMsgPlayerHint = class extends YGOProMsgBase {
|
|
2731
|
-
};
|
|
2732
|
-
YGOProMsgPlayerHint.identifier = OcgcoreCommonConstants.MSG_PLAYER_HINT;
|
|
2733
|
-
__decorateClass([
|
|
2734
|
-
BinaryField("u8", 0)
|
|
2735
|
-
], YGOProMsgPlayerHint.prototype, "player", 2);
|
|
2736
|
-
__decorateClass([
|
|
2737
|
-
BinaryField("u8", 1)
|
|
2738
|
-
], YGOProMsgPlayerHint.prototype, "type", 2);
|
|
2739
|
-
__decorateClass([
|
|
2740
|
-
BinaryField("i32", 2)
|
|
2741
|
-
], YGOProMsgPlayerHint.prototype, "value", 2);
|
|
2742
|
-
|
|
2743
|
-
// src/protos/msg/proto/pos-change.ts
|
|
2744
|
-
var YGOProMsgPosChange_CardLocation = class {
|
|
2745
|
-
};
|
|
2746
|
-
__decorateClass([
|
|
2747
|
-
BinaryField("u8", 0)
|
|
2748
|
-
], YGOProMsgPosChange_CardLocation.prototype, "controller", 2);
|
|
2749
|
-
__decorateClass([
|
|
2750
|
-
BinaryField("u8", 1)
|
|
2751
|
-
], YGOProMsgPosChange_CardLocation.prototype, "location", 2);
|
|
2752
|
-
__decorateClass([
|
|
2753
|
-
BinaryField("u8", 2)
|
|
2754
|
-
], YGOProMsgPosChange_CardLocation.prototype, "sequence", 2);
|
|
2755
|
-
var YGOProMsgPosChange = class extends YGOProMsgBase {
|
|
2756
|
-
};
|
|
2757
|
-
YGOProMsgPosChange.identifier = OcgcoreCommonConstants.MSG_POS_CHANGE;
|
|
2758
|
-
__decorateClass([
|
|
2759
|
-
BinaryField(() => YGOProMsgPosChange_CardLocation, 0)
|
|
2760
|
-
], YGOProMsgPosChange.prototype, "card", 2);
|
|
2761
|
-
__decorateClass([
|
|
2762
|
-
BinaryField("u8", 3)
|
|
2763
|
-
], YGOProMsgPosChange.prototype, "previousPosition", 2);
|
|
2764
|
-
__decorateClass([
|
|
2765
|
-
BinaryField("u8", 4)
|
|
2766
|
-
], YGOProMsgPosChange.prototype, "currentPosition", 2);
|
|
2767
|
-
|
|
2768
|
-
// src/protos/msg/proto/random-selected.ts
|
|
2769
|
-
var YGOProMsgRandomSelected = class extends YGOProMsgBase {
|
|
2770
|
-
};
|
|
2771
|
-
YGOProMsgRandomSelected.identifier = OcgcoreCommonConstants.MSG_RANDOM_SELECTED;
|
|
2772
|
-
__decorateClass([
|
|
2773
|
-
BinaryField("u8", 0)
|
|
2774
|
-
], YGOProMsgRandomSelected.prototype, "player", 2);
|
|
2775
|
-
__decorateClass([
|
|
2776
|
-
BinaryField("u8", 1)
|
|
2777
|
-
], YGOProMsgRandomSelected.prototype, "count", 2);
|
|
2778
|
-
__decorateClass([
|
|
2779
|
-
BinaryField("i32", 2, (obj) => obj.count)
|
|
2780
|
-
], YGOProMsgRandomSelected.prototype, "cards", 2);
|
|
2781
|
-
|
|
2782
|
-
// src/protos/msg/proto/recover.ts
|
|
2783
|
-
var YGOProMsgRecover = class extends YGOProMsgBase {
|
|
2784
|
-
};
|
|
2785
|
-
YGOProMsgRecover.identifier = OcgcoreCommonConstants.MSG_RECOVER;
|
|
2786
|
-
__decorateClass([
|
|
2787
|
-
BinaryField("u8", 0)
|
|
2788
|
-
], YGOProMsgRecover.prototype, "player", 2);
|
|
2789
|
-
__decorateClass([
|
|
2790
|
-
BinaryField("i32", 1)
|
|
2791
|
-
], YGOProMsgRecover.prototype, "value", 2);
|
|
2792
|
-
|
|
2793
|
-
// src/protos/msg/proto/reload-field.ts
|
|
2794
|
-
var YGOProMsgReloadField_ZoneCard = class {
|
|
2795
|
-
};
|
|
2796
|
-
var YGOProMsgReloadField_PlayerInfo = class {
|
|
2797
|
-
};
|
|
2798
|
-
var YGOProMsgReloadField_ChainInfo = class {
|
|
2799
|
-
};
|
|
2800
|
-
var YGOProMsgReloadField = class extends YGOProMsgBase {
|
|
2801
|
-
fromPayload(data) {
|
|
2802
|
-
if (data.length < 1) {
|
|
2803
|
-
throw new Error("MSG data too short");
|
|
2804
|
-
}
|
|
2805
|
-
const msgType = data[0];
|
|
2806
|
-
if (msgType !== this.identifier) {
|
|
2807
|
-
throw new Error(
|
|
2808
|
-
`MSG type mismatch: expected ${this.identifier}, got ${msgType}`
|
|
2809
|
-
);
|
|
2810
|
-
}
|
|
2811
|
-
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
2812
|
-
let offset = 1;
|
|
2813
|
-
this.duelRule = view.getUint8(offset++);
|
|
2814
|
-
this.players = [];
|
|
2815
|
-
for (let i = 0; i < 2; i++) {
|
|
2816
|
-
const player = {
|
|
2817
|
-
lp: view.getInt32(offset, true),
|
|
2818
|
-
mzone: [],
|
|
2819
|
-
szone: [],
|
|
2820
|
-
deckCount: 0,
|
|
2821
|
-
handCount: 0,
|
|
2822
|
-
graveCount: 0,
|
|
2823
|
-
removedCount: 0,
|
|
2824
|
-
extraCount: 0,
|
|
2825
|
-
extraPCount: 0
|
|
2826
|
-
};
|
|
2827
|
-
offset += 4;
|
|
2828
|
-
for (let seq = 0; seq < 7; seq++) {
|
|
2829
|
-
const occupied = view.getUint8(offset++);
|
|
2830
|
-
const card = { occupied };
|
|
2831
|
-
if (occupied) {
|
|
2832
|
-
card.position = view.getUint8(offset++);
|
|
2833
|
-
card.xyzCount = view.getUint8(offset++);
|
|
2834
|
-
}
|
|
2835
|
-
player.mzone.push(card);
|
|
2836
|
-
}
|
|
2837
|
-
for (let seq = 0; seq < 8; seq++) {
|
|
2838
|
-
const occupied = view.getUint8(offset++);
|
|
2839
|
-
const card = { occupied };
|
|
2840
|
-
if (occupied) {
|
|
2841
|
-
card.position = view.getUint8(offset++);
|
|
2842
|
-
}
|
|
2843
|
-
player.szone.push(card);
|
|
2844
|
-
}
|
|
2845
|
-
player.deckCount = view.getUint8(offset++);
|
|
2846
|
-
player.handCount = view.getUint8(offset++);
|
|
2847
|
-
player.graveCount = view.getUint8(offset++);
|
|
2848
|
-
player.removedCount = view.getUint8(offset++);
|
|
2849
|
-
player.extraCount = view.getUint8(offset++);
|
|
2850
|
-
player.extraPCount = view.getUint8(offset++);
|
|
2851
|
-
this.players.push(player);
|
|
2852
|
-
}
|
|
2853
|
-
const chainCount = view.getUint8(offset++);
|
|
2854
|
-
this.chains = [];
|
|
2855
|
-
for (let i = 0; i < chainCount; i++) {
|
|
2856
|
-
const chain = {
|
|
2857
|
-
code: view.getInt32(offset, true),
|
|
2858
|
-
chainCardController: view.getUint8(offset + 4),
|
|
2859
|
-
chainCardLocation: view.getUint8(offset + 5),
|
|
2860
|
-
chainCardSequence: view.getUint8(offset + 6),
|
|
2861
|
-
chainCardSubsequence: view.getUint8(offset + 7),
|
|
2862
|
-
triggerController: view.getUint8(offset + 8),
|
|
2863
|
-
triggerLocation: view.getUint8(offset + 9),
|
|
2864
|
-
triggerSequence: view.getUint8(offset + 10),
|
|
2865
|
-
desc: view.getInt32(offset + 11, true)
|
|
2866
|
-
};
|
|
2867
|
-
offset += 15;
|
|
2868
|
-
this.chains.push(chain);
|
|
2869
|
-
}
|
|
2870
|
-
return this;
|
|
2871
|
-
}
|
|
2872
|
-
toPayload() {
|
|
2873
|
-
let size = 1 + 1;
|
|
2874
|
-
for (const player of this.players) {
|
|
2875
|
-
size += 4;
|
|
2876
|
-
for (const card of player.mzone) {
|
|
2877
|
-
size += 1;
|
|
2878
|
-
if (card.occupied) {
|
|
2879
|
-
size += 2;
|
|
2880
|
-
}
|
|
2881
|
-
}
|
|
2882
|
-
for (const card of player.szone) {
|
|
2883
|
-
size += 1;
|
|
2884
|
-
if (card.occupied) {
|
|
2885
|
-
size += 1;
|
|
2886
|
-
}
|
|
2887
|
-
}
|
|
2888
|
-
size += 6;
|
|
2889
|
-
}
|
|
2890
|
-
size += 1;
|
|
2891
|
-
size += this.chains.length * 15;
|
|
2892
|
-
const result = new Uint8Array(size);
|
|
2893
|
-
const view = new DataView(result.buffer);
|
|
2894
|
-
let offset = 0;
|
|
2895
|
-
result[offset++] = this.identifier;
|
|
2896
|
-
result[offset++] = this.duelRule;
|
|
2897
|
-
for (const player of this.players) {
|
|
2898
|
-
view.setInt32(offset, player.lp, true);
|
|
2899
|
-
offset += 4;
|
|
2900
|
-
for (const card of player.mzone) {
|
|
2901
|
-
result[offset++] = card.occupied;
|
|
2902
|
-
if (card.occupied) {
|
|
2903
|
-
result[offset++] = card.position || 0;
|
|
2904
|
-
result[offset++] = card.xyzCount || 0;
|
|
2905
|
-
}
|
|
2906
|
-
}
|
|
2907
|
-
for (const card of player.szone) {
|
|
2908
|
-
result[offset++] = card.occupied;
|
|
2909
|
-
if (card.occupied) {
|
|
2910
|
-
result[offset++] = card.position || 0;
|
|
2911
|
-
}
|
|
2912
|
-
}
|
|
2913
|
-
result[offset++] = player.deckCount;
|
|
2914
|
-
result[offset++] = player.handCount;
|
|
2915
|
-
result[offset++] = player.graveCount;
|
|
2916
|
-
result[offset++] = player.removedCount;
|
|
2917
|
-
result[offset++] = player.extraCount;
|
|
2918
|
-
result[offset++] = player.extraPCount;
|
|
2919
|
-
}
|
|
2920
|
-
result[offset++] = this.chains.length;
|
|
2921
|
-
for (const chain of this.chains) {
|
|
2922
|
-
view.setInt32(offset, chain.code, true);
|
|
2923
|
-
result[offset + 4] = chain.chainCardController;
|
|
2924
|
-
result[offset + 5] = chain.chainCardLocation;
|
|
2925
|
-
result[offset + 6] = chain.chainCardSequence;
|
|
2926
|
-
result[offset + 7] = chain.chainCardSubsequence;
|
|
2927
|
-
result[offset + 8] = chain.triggerController;
|
|
2928
|
-
result[offset + 9] = chain.triggerLocation;
|
|
2929
|
-
result[offset + 10] = chain.triggerSequence;
|
|
2930
|
-
view.setInt32(offset + 11, chain.desc, true);
|
|
2931
|
-
offset += 15;
|
|
2932
|
-
}
|
|
2933
|
-
return result;
|
|
2934
|
-
}
|
|
2935
|
-
};
|
|
2936
|
-
YGOProMsgReloadField.identifier = 162;
|
|
2937
|
-
|
|
2938
|
-
// src/protos/msg/proto/remove-counter.ts
|
|
2939
|
-
var YGOProMsgRemoveCounter = class extends YGOProMsgBase {
|
|
2940
|
-
};
|
|
2941
|
-
YGOProMsgRemoveCounter.identifier = OcgcoreCommonConstants.MSG_REMOVE_COUNTER;
|
|
2942
|
-
__decorateClass([
|
|
2943
|
-
BinaryField("u16", 0)
|
|
2944
|
-
], YGOProMsgRemoveCounter.prototype, "counterType", 2);
|
|
2945
|
-
__decorateClass([
|
|
2946
|
-
BinaryField("u8", 2)
|
|
2947
|
-
], YGOProMsgRemoveCounter.prototype, "controller", 2);
|
|
2948
|
-
__decorateClass([
|
|
2949
|
-
BinaryField("u8", 3)
|
|
2950
|
-
], YGOProMsgRemoveCounter.prototype, "location", 2);
|
|
2951
|
-
__decorateClass([
|
|
2952
|
-
BinaryField("u8", 4)
|
|
2953
|
-
], YGOProMsgRemoveCounter.prototype, "sequence", 2);
|
|
2954
|
-
__decorateClass([
|
|
2955
|
-
BinaryField("u16", 5)
|
|
2956
|
-
], YGOProMsgRemoveCounter.prototype, "count", 2);
|
|
2957
|
-
|
|
2958
|
-
// src/protos/msg/proto/reset-time.ts
|
|
2959
|
-
var YGOProMsgResetTime = class extends YGOProMsgBase {
|
|
2960
|
-
getSendTargets() {
|
|
2961
|
-
return [];
|
|
2962
|
-
}
|
|
2963
|
-
};
|
|
2964
|
-
YGOProMsgResetTime.identifier = OcgcoreCommonConstants.MSG_RESET_TIME;
|
|
2965
|
-
__decorateClass([
|
|
2966
|
-
BinaryField("i8", 0)
|
|
2967
|
-
], YGOProMsgResetTime.prototype, "player", 2);
|
|
2968
|
-
__decorateClass([
|
|
2969
|
-
BinaryField("i16", 1)
|
|
2970
|
-
], YGOProMsgResetTime.prototype, "time", 2);
|
|
2971
|
-
|
|
2972
|
-
// src/protos/msg/proto/retry.ts
|
|
2973
|
-
var YGOProMsgRetry = class extends YGOProMsgBase {
|
|
2974
|
-
getSendTargets() {
|
|
2975
|
-
return [];
|
|
2976
|
-
}
|
|
2977
|
-
};
|
|
2978
|
-
YGOProMsgRetry.identifier = OcgcoreCommonConstants.MSG_RETRY;
|
|
2979
|
-
|
|
2980
|
-
// src/protos/msg/proto/reverse-deck.ts
|
|
2981
|
-
var YGOProMsgReverseDeck = class extends YGOProMsgBase {
|
|
2982
|
-
};
|
|
2983
|
-
YGOProMsgReverseDeck.identifier = OcgcoreCommonConstants.MSG_REVERSE_DECK;
|
|
2984
|
-
|
|
2985
|
-
// src/protos/msg/proto/rock-paper-scissors.ts
|
|
2986
|
-
var YGOProMsgRockPaperScissors = class extends YGOProMsgResponseBase {
|
|
2987
|
-
responsePlayer() {
|
|
2988
|
-
return this.player;
|
|
2989
|
-
}
|
|
2990
|
-
prepareResponse(choice) {
|
|
2991
|
-
if (choice < 1 /* ROCK */ || choice > 3 /* PAPER */) {
|
|
2992
|
-
throw new TypeError(`Invalid choice: ${choice}. Must be 1 (ROCK), 2 (SCISSORS), or 3 (PAPER)`);
|
|
2993
|
-
}
|
|
2994
|
-
const buffer = new Uint8Array(1);
|
|
2995
|
-
buffer[0] = choice;
|
|
2996
|
-
return buffer;
|
|
2997
|
-
}
|
|
2998
|
-
};
|
|
2999
|
-
YGOProMsgRockPaperScissors.identifier = OcgcoreCommonConstants.MSG_ROCK_PAPER_SCISSORS;
|
|
3000
|
-
__decorateClass([
|
|
3001
|
-
BinaryField("u8", 0)
|
|
3002
|
-
], YGOProMsgRockPaperScissors.prototype, "player", 2);
|
|
3003
|
-
|
|
3004
|
-
// src/protos/msg/proto/select-battlecmd.ts
|
|
3005
|
-
var BattleCmdType = /* @__PURE__ */ ((BattleCmdType2) => {
|
|
3006
|
-
BattleCmdType2[BattleCmdType2["ACTIVATE"] = 0] = "ACTIVATE";
|
|
3007
|
-
BattleCmdType2[BattleCmdType2["ATTACK"] = 1] = "ATTACK";
|
|
3008
|
-
BattleCmdType2[BattleCmdType2["TO_M2"] = 2] = "TO_M2";
|
|
3009
|
-
BattleCmdType2[BattleCmdType2["TO_EP"] = 3] = "TO_EP";
|
|
3010
|
-
return BattleCmdType2;
|
|
3011
|
-
})(BattleCmdType || {});
|
|
3012
|
-
var YGOProMsgSelectBattleCmd_ActivatableInfo = class {
|
|
3013
|
-
};
|
|
3014
|
-
__decorateClass([
|
|
3015
|
-
BinaryField("i32", 0)
|
|
3016
|
-
], YGOProMsgSelectBattleCmd_ActivatableInfo.prototype, "code", 2);
|
|
3017
|
-
__decorateClass([
|
|
3018
|
-
BinaryField("u8", 4)
|
|
3019
|
-
], YGOProMsgSelectBattleCmd_ActivatableInfo.prototype, "controller", 2);
|
|
3020
|
-
__decorateClass([
|
|
3021
|
-
BinaryField("u8", 5)
|
|
3022
|
-
], YGOProMsgSelectBattleCmd_ActivatableInfo.prototype, "location", 2);
|
|
3023
|
-
__decorateClass([
|
|
3024
|
-
BinaryField("u8", 6)
|
|
3025
|
-
], YGOProMsgSelectBattleCmd_ActivatableInfo.prototype, "sequence", 2);
|
|
3026
|
-
__decorateClass([
|
|
3027
|
-
BinaryField("i32", 7)
|
|
3028
|
-
], YGOProMsgSelectBattleCmd_ActivatableInfo.prototype, "desc", 2);
|
|
3029
|
-
var YGOProMsgSelectBattleCmd_AttackableInfo = class {
|
|
3030
|
-
};
|
|
3031
|
-
__decorateClass([
|
|
3032
|
-
BinaryField("i32", 0)
|
|
3033
|
-
], YGOProMsgSelectBattleCmd_AttackableInfo.prototype, "code", 2);
|
|
3034
|
-
__decorateClass([
|
|
3035
|
-
BinaryField("u8", 4)
|
|
3036
|
-
], YGOProMsgSelectBattleCmd_AttackableInfo.prototype, "controller", 2);
|
|
3037
|
-
__decorateClass([
|
|
3038
|
-
BinaryField("u8", 5)
|
|
3039
|
-
], YGOProMsgSelectBattleCmd_AttackableInfo.prototype, "location", 2);
|
|
3040
|
-
__decorateClass([
|
|
3041
|
-
BinaryField("u8", 6)
|
|
3042
|
-
], YGOProMsgSelectBattleCmd_AttackableInfo.prototype, "sequence", 2);
|
|
3043
|
-
__decorateClass([
|
|
3044
|
-
BinaryField("u8", 7)
|
|
3045
|
-
], YGOProMsgSelectBattleCmd_AttackableInfo.prototype, "directAttack", 2);
|
|
3046
|
-
var YGOProMsgSelectBattleCmd = class extends YGOProMsgResponseBase {
|
|
3047
|
-
responsePlayer() {
|
|
3048
|
-
return this.player;
|
|
3049
|
-
}
|
|
3050
|
-
prepareResponse(type, option) {
|
|
3051
|
-
let sequence;
|
|
3052
|
-
if (type === 0 /* ACTIVATE */) {
|
|
3053
|
-
if (option == null) {
|
|
3054
|
-
throw new TypeError("Option required for ACTIVATE");
|
|
3055
|
-
}
|
|
3056
|
-
if (isIndexResponse(option)) {
|
|
3057
|
-
sequence = option.index;
|
|
3058
|
-
if (sequence < 0 || sequence >= this.activatableCount) {
|
|
3059
|
-
throw new TypeError(`Index out of range: ${sequence}`);
|
|
3060
|
-
}
|
|
3061
|
-
} else {
|
|
3062
|
-
const idx = this.activatableCards.findIndex(
|
|
3063
|
-
(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) && (option.desc == null || card.desc === option.desc)
|
|
3064
|
-
);
|
|
3065
|
-
if (idx === -1) {
|
|
3066
|
-
throw new TypeError("Activatable card not found");
|
|
3067
|
-
}
|
|
3068
|
-
sequence = idx;
|
|
3069
|
-
}
|
|
3070
|
-
} else if (type === 1 /* ATTACK */) {
|
|
3071
|
-
if (option == null) {
|
|
3072
|
-
throw new TypeError("Option required for ATTACK");
|
|
3073
|
-
}
|
|
3074
|
-
if (isIndexResponse(option)) {
|
|
3075
|
-
sequence = option.index;
|
|
3076
|
-
if (sequence < 0 || sequence >= this.attackableCount) {
|
|
3077
|
-
throw new TypeError(`Index out of range: ${sequence}`);
|
|
3078
|
-
}
|
|
3079
|
-
} else {
|
|
3080
|
-
const idx = this.attackableCards.findIndex(
|
|
3081
|
-
(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)
|
|
3082
|
-
);
|
|
3083
|
-
if (idx === -1) {
|
|
3084
|
-
throw new TypeError("Attackable card not found");
|
|
3085
|
-
}
|
|
3086
|
-
sequence = idx;
|
|
3087
|
-
}
|
|
3088
|
-
} else if (type === 2 /* TO_M2 */) {
|
|
3089
|
-
if (this.canM2 === 0) {
|
|
3090
|
-
throw new TypeError("Cannot go to M2");
|
|
3091
|
-
}
|
|
3092
|
-
sequence = 0;
|
|
3093
|
-
} else if (type === 3 /* TO_EP */) {
|
|
3094
|
-
if (this.canEp === 0) {
|
|
3095
|
-
throw new TypeError("Cannot go to EP");
|
|
3096
|
-
}
|
|
3097
|
-
sequence = 0;
|
|
3098
|
-
} else {
|
|
3099
|
-
throw new TypeError(`Unknown type: ${type}`);
|
|
3100
|
-
}
|
|
3101
|
-
const buffer = new Uint8Array(4);
|
|
3102
|
-
const view = new DataView(buffer.buffer);
|
|
3103
|
-
view.setUint32(0, sequence << 16 | type, true);
|
|
3104
|
-
return buffer;
|
|
3105
|
-
}
|
|
3106
|
-
};
|
|
3107
|
-
YGOProMsgSelectBattleCmd.identifier = OcgcoreCommonConstants.MSG_SELECT_BATTLECMD;
|
|
3108
|
-
__decorateClass([
|
|
3109
|
-
BinaryField("u8", 0)
|
|
3110
|
-
], YGOProMsgSelectBattleCmd.prototype, "player", 2);
|
|
3111
|
-
__decorateClass([
|
|
3112
|
-
BinaryField("u8", 1)
|
|
3113
|
-
], YGOProMsgSelectBattleCmd.prototype, "activatableCount", 2);
|
|
3114
|
-
__decorateClass([
|
|
3115
|
-
BinaryField(
|
|
3116
|
-
() => YGOProMsgSelectBattleCmd_ActivatableInfo,
|
|
3117
|
-
2,
|
|
3118
|
-
(obj) => obj.activatableCount
|
|
3119
|
-
)
|
|
3120
|
-
], YGOProMsgSelectBattleCmd.prototype, "activatableCards", 2);
|
|
3121
|
-
__decorateClass([
|
|
3122
|
-
BinaryField("u8", (obj) => {
|
|
3123
|
-
return 2 + obj.activatableCount * 11;
|
|
3124
|
-
})
|
|
3125
|
-
], YGOProMsgSelectBattleCmd.prototype, "attackableCount", 2);
|
|
3126
|
-
__decorateClass([
|
|
3127
|
-
BinaryField(
|
|
3128
|
-
() => YGOProMsgSelectBattleCmd_AttackableInfo,
|
|
3129
|
-
(obj) => {
|
|
3130
|
-
return 3 + obj.activatableCount * 11;
|
|
3131
|
-
},
|
|
3132
|
-
(obj) => obj.attackableCount
|
|
3133
|
-
)
|
|
3134
|
-
], YGOProMsgSelectBattleCmd.prototype, "attackableCards", 2);
|
|
3135
|
-
__decorateClass([
|
|
3136
|
-
BinaryField("u8", (obj) => {
|
|
3137
|
-
return 3 + obj.activatableCount * 11 + obj.attackableCount * 8;
|
|
3138
|
-
})
|
|
3139
|
-
], YGOProMsgSelectBattleCmd.prototype, "canM2", 2);
|
|
3140
|
-
__decorateClass([
|
|
3141
|
-
BinaryField("u8", (obj) => {
|
|
3142
|
-
return 4 + obj.activatableCount * 11 + obj.attackableCount * 8;
|
|
3143
|
-
})
|
|
3144
|
-
], YGOProMsgSelectBattleCmd.prototype, "canEp", 2);
|
|
3145
|
-
|
|
3146
|
-
// src/protos/msg/proto/select-card.ts
|
|
3147
|
-
var YGOProMsgSelectCard_CardInfo = class {
|
|
3148
|
-
};
|
|
3149
|
-
__decorateClass([
|
|
3150
|
-
BinaryField("i32", 0)
|
|
3151
|
-
], YGOProMsgSelectCard_CardInfo.prototype, "code", 2);
|
|
3152
|
-
__decorateClass([
|
|
3153
|
-
BinaryField("u8", 4)
|
|
3154
|
-
], YGOProMsgSelectCard_CardInfo.prototype, "controller", 2);
|
|
3155
|
-
__decorateClass([
|
|
3156
|
-
BinaryField("u8", 5)
|
|
3157
|
-
], YGOProMsgSelectCard_CardInfo.prototype, "location", 2);
|
|
3158
|
-
__decorateClass([
|
|
3159
|
-
BinaryField("u8", 6)
|
|
3160
|
-
], YGOProMsgSelectCard_CardInfo.prototype, "sequence", 2);
|
|
3161
|
-
__decorateClass([
|
|
3162
|
-
BinaryField("u8", 7)
|
|
3163
|
-
], YGOProMsgSelectCard_CardInfo.prototype, "subsequence", 2);
|
|
3164
|
-
var YGOProMsgSelectCard = class extends YGOProMsgResponseBase {
|
|
3165
|
-
responsePlayer() {
|
|
3166
|
-
return this.player;
|
|
3167
|
-
}
|
|
3168
|
-
defaultResponse() {
|
|
3169
|
-
if (this.cancelable === 0) {
|
|
3170
|
-
return void 0;
|
|
3171
|
-
}
|
|
3172
|
-
return this.prepareResponse(null);
|
|
3173
|
-
}
|
|
3174
|
-
prepareResponse(cardOptions) {
|
|
3175
|
-
if (cardOptions == null) {
|
|
3176
|
-
const buffer2 = new Uint8Array(4);
|
|
3177
|
-
const view = new DataView(buffer2.buffer);
|
|
3178
|
-
view.setInt32(0, -1, true);
|
|
3179
|
-
return buffer2;
|
|
3180
|
-
}
|
|
3181
|
-
const indices = [];
|
|
3182
|
-
const usedIndices = /* @__PURE__ */ new Set();
|
|
3183
|
-
for (const option of cardOptions) {
|
|
3184
|
-
let index;
|
|
3185
|
-
if (isIndexResponse(option)) {
|
|
3186
|
-
index = option.index;
|
|
3187
|
-
if (index < 0 || index >= this.count) {
|
|
3188
|
-
throw new TypeError(`Index out of range: ${index}`);
|
|
3189
|
-
}
|
|
3190
|
-
} else {
|
|
3191
|
-
index = this.cards.findIndex(
|
|
3192
|
-
(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)
|
|
3193
|
-
);
|
|
3194
|
-
if (index === -1) {
|
|
3195
|
-
throw new TypeError("Card not found");
|
|
3196
|
-
}
|
|
3197
|
-
}
|
|
3198
|
-
indices.push(index);
|
|
3199
|
-
usedIndices.add(index);
|
|
3200
|
-
}
|
|
3201
|
-
const buffer = new Uint8Array(1 + indices.length);
|
|
3202
|
-
buffer[0] = indices.length;
|
|
3203
|
-
indices.forEach((idx, i) => {
|
|
3204
|
-
buffer[1 + i] = idx;
|
|
3205
|
-
});
|
|
3206
|
-
return buffer;
|
|
3207
|
-
}
|
|
3208
|
-
};
|
|
3209
|
-
YGOProMsgSelectCard.identifier = OcgcoreCommonConstants.MSG_SELECT_CARD;
|
|
3210
|
-
__decorateClass([
|
|
3211
|
-
BinaryField("u8", 0)
|
|
3212
|
-
], YGOProMsgSelectCard.prototype, "player", 2);
|
|
3213
|
-
__decorateClass([
|
|
3214
|
-
BinaryField("u8", 1)
|
|
3215
|
-
], YGOProMsgSelectCard.prototype, "cancelable", 2);
|
|
3216
|
-
__decorateClass([
|
|
3217
|
-
BinaryField("u8", 2)
|
|
3218
|
-
], YGOProMsgSelectCard.prototype, "min", 2);
|
|
3219
|
-
__decorateClass([
|
|
3220
|
-
BinaryField("u8", 3)
|
|
3221
|
-
], YGOProMsgSelectCard.prototype, "max", 2);
|
|
3222
|
-
__decorateClass([
|
|
3223
|
-
BinaryField("u8", 4)
|
|
3224
|
-
], YGOProMsgSelectCard.prototype, "count", 2);
|
|
3225
|
-
__decorateClass([
|
|
3226
|
-
BinaryField(() => YGOProMsgSelectCard_CardInfo, 5, (obj) => obj.count)
|
|
3227
|
-
], YGOProMsgSelectCard.prototype, "cards", 2);
|
|
3228
|
-
|
|
3229
|
-
// src/protos/msg/proto/select-chain.ts
|
|
3230
|
-
var YGOProMsgSelectChain_ChainInfo = class {
|
|
3231
|
-
};
|
|
3232
|
-
__decorateClass([
|
|
3233
|
-
BinaryField("u8", 0)
|
|
3234
|
-
], YGOProMsgSelectChain_ChainInfo.prototype, "edesc", 2);
|
|
3235
|
-
__decorateClass([
|
|
3236
|
-
BinaryField("u8", 1)
|
|
3237
|
-
], YGOProMsgSelectChain_ChainInfo.prototype, "forced", 2);
|
|
3238
|
-
__decorateClass([
|
|
3239
|
-
BinaryField("i32", 2)
|
|
3240
|
-
], YGOProMsgSelectChain_ChainInfo.prototype, "code", 2);
|
|
3241
|
-
__decorateClass([
|
|
3242
|
-
BinaryField("u8", 6)
|
|
3243
|
-
], YGOProMsgSelectChain_ChainInfo.prototype, "controller", 2);
|
|
3244
|
-
__decorateClass([
|
|
3245
|
-
BinaryField("u8", 7)
|
|
3246
|
-
], YGOProMsgSelectChain_ChainInfo.prototype, "location", 2);
|
|
3247
|
-
__decorateClass([
|
|
3248
|
-
BinaryField("u8", 8)
|
|
3249
|
-
], YGOProMsgSelectChain_ChainInfo.prototype, "sequence", 2);
|
|
3250
|
-
__decorateClass([
|
|
3251
|
-
BinaryField("u8", 9)
|
|
3252
|
-
], YGOProMsgSelectChain_ChainInfo.prototype, "subsequence", 2);
|
|
3253
|
-
__decorateClass([
|
|
3254
|
-
BinaryField("i32", 10)
|
|
3255
|
-
], YGOProMsgSelectChain_ChainInfo.prototype, "desc", 2);
|
|
3256
|
-
var YGOProMsgSelectChain = class extends YGOProMsgResponseBase {
|
|
3257
|
-
responsePlayer() {
|
|
3258
|
-
return this.player;
|
|
3259
|
-
}
|
|
3260
|
-
defaultResponse() {
|
|
3261
|
-
const hasForced = this.chains.some((chain) => chain.forced !== 0);
|
|
3262
|
-
if (hasForced) {
|
|
3263
|
-
return void 0;
|
|
3264
|
-
}
|
|
3265
|
-
return this.prepareResponse(null);
|
|
3266
|
-
}
|
|
3267
|
-
prepareResponse(option) {
|
|
3268
|
-
let index;
|
|
3269
|
-
if (option == null) {
|
|
3270
|
-
index = -1;
|
|
3271
|
-
} else if (isIndexResponse(option)) {
|
|
3272
|
-
index = option.index;
|
|
3273
|
-
if (index < -1 || index >= this.count) {
|
|
3274
|
-
throw new TypeError(`Index out of range: ${index}`);
|
|
3275
|
-
}
|
|
3276
|
-
} else {
|
|
3277
|
-
index = this.chains.findIndex(
|
|
3278
|
-
(chain) => (option.code == null || chain.code === option.code) && (option.controller == null || chain.controller === option.controller) && (option.location == null || chain.location === option.location) && (option.sequence == null || chain.sequence === option.sequence) && (option.desc == null || chain.desc === option.desc)
|
|
3279
|
-
);
|
|
3280
|
-
if (index === -1) {
|
|
3281
|
-
throw new TypeError("Chain not found");
|
|
3282
|
-
}
|
|
3283
|
-
}
|
|
3284
|
-
const buffer = new Uint8Array(4);
|
|
3285
|
-
const view = new DataView(buffer.buffer);
|
|
3286
|
-
view.setInt32(0, index, true);
|
|
3287
|
-
return buffer;
|
|
3288
|
-
}
|
|
3289
|
-
};
|
|
3290
|
-
YGOProMsgSelectChain.identifier = OcgcoreCommonConstants.MSG_SELECT_CHAIN;
|
|
3291
|
-
__decorateClass([
|
|
3292
|
-
BinaryField("u8", 0)
|
|
3293
|
-
], YGOProMsgSelectChain.prototype, "player", 2);
|
|
3294
|
-
__decorateClass([
|
|
3295
|
-
BinaryField("u8", 1)
|
|
3296
|
-
], YGOProMsgSelectChain.prototype, "count", 2);
|
|
3297
|
-
__decorateClass([
|
|
3298
|
-
BinaryField("u8", 2)
|
|
3299
|
-
], YGOProMsgSelectChain.prototype, "specialCount", 2);
|
|
3300
|
-
__decorateClass([
|
|
3301
|
-
BinaryField("i32", 3)
|
|
3302
|
-
], YGOProMsgSelectChain.prototype, "hint0", 2);
|
|
3303
|
-
__decorateClass([
|
|
3304
|
-
BinaryField("i32", 7)
|
|
3305
|
-
], YGOProMsgSelectChain.prototype, "hint1", 2);
|
|
3306
|
-
__decorateClass([
|
|
3307
|
-
BinaryField(() => YGOProMsgSelectChain_ChainInfo, 11, (obj) => obj.count)
|
|
3308
|
-
], YGOProMsgSelectChain.prototype, "chains", 2);
|
|
3309
|
-
|
|
3310
|
-
// src/protos/msg/proto/select-counter.ts
|
|
3311
|
-
var YGOProMsgSelectCounter_CardInfo = class {
|
|
3312
|
-
};
|
|
3313
|
-
__decorateClass([
|
|
3314
|
-
BinaryField("i32", 0)
|
|
3315
|
-
], YGOProMsgSelectCounter_CardInfo.prototype, "code", 2);
|
|
3316
|
-
__decorateClass([
|
|
3317
|
-
BinaryField("u8", 4)
|
|
3318
|
-
], YGOProMsgSelectCounter_CardInfo.prototype, "controller", 2);
|
|
3319
|
-
__decorateClass([
|
|
3320
|
-
BinaryField("u8", 5)
|
|
3321
|
-
], YGOProMsgSelectCounter_CardInfo.prototype, "location", 2);
|
|
3322
|
-
__decorateClass([
|
|
3323
|
-
BinaryField("u8", 6)
|
|
3324
|
-
], YGOProMsgSelectCounter_CardInfo.prototype, "sequence", 2);
|
|
3325
|
-
__decorateClass([
|
|
3326
|
-
BinaryField("u16", 7)
|
|
3327
|
-
], YGOProMsgSelectCounter_CardInfo.prototype, "counterCount", 2);
|
|
3328
|
-
var YGOProMsgSelectCounter = class extends YGOProMsgResponseBase {
|
|
3329
|
-
responsePlayer() {
|
|
3330
|
-
return this.player;
|
|
3331
|
-
}
|
|
3332
|
-
prepareResponse(counterOptions) {
|
|
3333
|
-
const counterCounts = new Array(this.count).fill(0);
|
|
3334
|
-
for (const option of counterOptions) {
|
|
3335
|
-
let index;
|
|
3336
|
-
if (isIndexResponse(option.card)) {
|
|
3337
|
-
index = option.card.index;
|
|
3338
|
-
if (index < 0 || index >= this.count) {
|
|
3339
|
-
throw new TypeError(`Index out of range: ${index}`);
|
|
3340
|
-
}
|
|
3341
|
-
} else {
|
|
3342
|
-
const card = option.card;
|
|
3343
|
-
index = this.cards.findIndex(
|
|
3344
|
-
(card2) => (card2.code == null || card2.code === card2.code) && (card2.controller == null || card2.controller === card2.controller) && (card2.location == null || card2.location === card2.location) && (card2.sequence == null || card2.sequence === card2.sequence)
|
|
3345
|
-
);
|
|
3346
|
-
if (index === -1) {
|
|
3347
|
-
throw new TypeError("Card not found");
|
|
3348
|
-
}
|
|
3349
|
-
}
|
|
3350
|
-
counterCounts[index] = option.count;
|
|
3351
|
-
}
|
|
3352
|
-
const buffer = new Uint8Array(counterCounts.length * 2);
|
|
3353
|
-
const view = new DataView(buffer.buffer);
|
|
3354
|
-
counterCounts.forEach((count, i) => {
|
|
3355
|
-
view.setUint16(i * 2, count, true);
|
|
3356
|
-
});
|
|
3357
|
-
return buffer;
|
|
3358
|
-
}
|
|
3359
|
-
};
|
|
3360
|
-
YGOProMsgSelectCounter.identifier = OcgcoreCommonConstants.MSG_SELECT_COUNTER;
|
|
3361
|
-
__decorateClass([
|
|
3362
|
-
BinaryField("u8", 0)
|
|
3363
|
-
], YGOProMsgSelectCounter.prototype, "player", 2);
|
|
3364
|
-
__decorateClass([
|
|
3365
|
-
BinaryField("u16", 1)
|
|
3366
|
-
], YGOProMsgSelectCounter.prototype, "counterType", 2);
|
|
3367
|
-
__decorateClass([
|
|
3368
|
-
BinaryField("u16", 3)
|
|
3369
|
-
], YGOProMsgSelectCounter.prototype, "counterCount", 2);
|
|
3370
|
-
__decorateClass([
|
|
3371
|
-
BinaryField("u8", 5)
|
|
3372
|
-
], YGOProMsgSelectCounter.prototype, "count", 2);
|
|
3373
|
-
__decorateClass([
|
|
3374
|
-
BinaryField(() => YGOProMsgSelectCounter_CardInfo, 6, (obj) => obj.count)
|
|
3375
|
-
], YGOProMsgSelectCounter.prototype, "cards", 2);
|
|
3376
|
-
|
|
3377
2677
|
// src/vendor/script-constants.ts
|
|
3378
2678
|
var OcgcoreScriptConstants = {
|
|
3379
2679
|
ACTIVITY_ATTACK: 5,
|
|
@@ -4212,6 +3512,747 @@ var OcgcoreScriptConstants = {
|
|
|
4212
3512
|
TYPE_XYZ: 8388608
|
|
4213
3513
|
};
|
|
4214
3514
|
|
|
3515
|
+
// src/protos/msg/proto/move.ts
|
|
3516
|
+
var YGOProMsgMove_CardLocation = class {
|
|
3517
|
+
};
|
|
3518
|
+
__decorateClass([
|
|
3519
|
+
BinaryField("u8", 0)
|
|
3520
|
+
], YGOProMsgMove_CardLocation.prototype, "controller", 2);
|
|
3521
|
+
__decorateClass([
|
|
3522
|
+
BinaryField("u8", 1)
|
|
3523
|
+
], YGOProMsgMove_CardLocation.prototype, "location", 2);
|
|
3524
|
+
__decorateClass([
|
|
3525
|
+
BinaryField("u8", 2)
|
|
3526
|
+
], YGOProMsgMove_CardLocation.prototype, "sequence", 2);
|
|
3527
|
+
__decorateClass([
|
|
3528
|
+
BinaryField("u8", 3)
|
|
3529
|
+
], YGOProMsgMove_CardLocation.prototype, "position", 2);
|
|
3530
|
+
var YGOProMsgMove = class extends YGOProMsgBase {
|
|
3531
|
+
opponentView() {
|
|
3532
|
+
const view = this.copy();
|
|
3533
|
+
const cl = view.current.location;
|
|
3534
|
+
const cp = view.current.position;
|
|
3535
|
+
if (cl & (OcgcoreScriptConstants.LOCATION_GRAVE | OcgcoreScriptConstants.LOCATION_OVERLAY)) {
|
|
3536
|
+
return view;
|
|
3537
|
+
}
|
|
3538
|
+
if (cl & (OcgcoreScriptConstants.LOCATION_DECK | OcgcoreScriptConstants.LOCATION_HAND) || cp & OcgcoreCommonConstants.POS_FACEDOWN) {
|
|
3539
|
+
view.code = 0;
|
|
3540
|
+
}
|
|
3541
|
+
return view;
|
|
3542
|
+
}
|
|
3543
|
+
teammateView() {
|
|
3544
|
+
const view = this.copy();
|
|
3545
|
+
const cl = view.current.location;
|
|
3546
|
+
const cp = view.current.position;
|
|
3547
|
+
if (cl & (OcgcoreScriptConstants.LOCATION_GRAVE | OcgcoreScriptConstants.LOCATION_OVERLAY)) {
|
|
3548
|
+
return view;
|
|
3549
|
+
}
|
|
3550
|
+
if (cl & (OcgcoreScriptConstants.LOCATION_DECK | OcgcoreScriptConstants.LOCATION_HAND)) {
|
|
3551
|
+
view.code = 0;
|
|
3552
|
+
}
|
|
3553
|
+
return view;
|
|
3554
|
+
}
|
|
3555
|
+
playerView(playerId) {
|
|
3556
|
+
if (playerId === 7 /* OBSERVER */) {
|
|
3557
|
+
return this.observerView();
|
|
3558
|
+
}
|
|
3559
|
+
if (playerId === this.current.controller) {
|
|
3560
|
+
return this.copy();
|
|
3561
|
+
}
|
|
3562
|
+
return this.opponentView();
|
|
3563
|
+
}
|
|
3564
|
+
};
|
|
3565
|
+
YGOProMsgMove.identifier = OcgcoreCommonConstants.MSG_MOVE;
|
|
3566
|
+
__decorateClass([
|
|
3567
|
+
BinaryField("i32", 0)
|
|
3568
|
+
], YGOProMsgMove.prototype, "code", 2);
|
|
3569
|
+
__decorateClass([
|
|
3570
|
+
BinaryField(() => YGOProMsgMove_CardLocation, 4)
|
|
3571
|
+
], YGOProMsgMove.prototype, "previous", 2);
|
|
3572
|
+
__decorateClass([
|
|
3573
|
+
BinaryField(() => YGOProMsgMove_CardLocation, 8)
|
|
3574
|
+
], YGOProMsgMove.prototype, "current", 2);
|
|
3575
|
+
__decorateClass([
|
|
3576
|
+
BinaryField("i32", 12)
|
|
3577
|
+
], YGOProMsgMove.prototype, "reason", 2);
|
|
3578
|
+
|
|
3579
|
+
// src/protos/msg/proto/new-phase.ts
|
|
3580
|
+
var YGOProMsgNewPhase = class extends YGOProMsgBase {
|
|
3581
|
+
};
|
|
3582
|
+
YGOProMsgNewPhase.identifier = OcgcoreCommonConstants.MSG_NEW_PHASE;
|
|
3583
|
+
__decorateClass([
|
|
3584
|
+
BinaryField("u16", 0)
|
|
3585
|
+
], YGOProMsgNewPhase.prototype, "phase", 2);
|
|
3586
|
+
|
|
3587
|
+
// src/protos/msg/proto/new-turn.ts
|
|
3588
|
+
var YGOProMsgNewTurn = class extends YGOProMsgBase {
|
|
3589
|
+
};
|
|
3590
|
+
YGOProMsgNewTurn.identifier = OcgcoreCommonConstants.MSG_NEW_TURN;
|
|
3591
|
+
__decorateClass([
|
|
3592
|
+
BinaryField("u8", 0)
|
|
3593
|
+
], YGOProMsgNewTurn.prototype, "player", 2);
|
|
3594
|
+
|
|
3595
|
+
// src/protos/msg/proto/pay-lpcost.ts
|
|
3596
|
+
var YGOProMsgPayLpCost = class extends YGOProMsgBase {
|
|
3597
|
+
};
|
|
3598
|
+
YGOProMsgPayLpCost.identifier = OcgcoreCommonConstants.MSG_PAY_LPCOST;
|
|
3599
|
+
__decorateClass([
|
|
3600
|
+
BinaryField("u8", 0)
|
|
3601
|
+
], YGOProMsgPayLpCost.prototype, "player", 2);
|
|
3602
|
+
__decorateClass([
|
|
3603
|
+
BinaryField("i32", 1)
|
|
3604
|
+
], YGOProMsgPayLpCost.prototype, "cost", 2);
|
|
3605
|
+
|
|
3606
|
+
// src/protos/msg/proto/player-hint.ts
|
|
3607
|
+
var YGOProMsgPlayerHint = class extends YGOProMsgBase {
|
|
3608
|
+
};
|
|
3609
|
+
YGOProMsgPlayerHint.identifier = OcgcoreCommonConstants.MSG_PLAYER_HINT;
|
|
3610
|
+
__decorateClass([
|
|
3611
|
+
BinaryField("u8", 0)
|
|
3612
|
+
], YGOProMsgPlayerHint.prototype, "player", 2);
|
|
3613
|
+
__decorateClass([
|
|
3614
|
+
BinaryField("u8", 1)
|
|
3615
|
+
], YGOProMsgPlayerHint.prototype, "type", 2);
|
|
3616
|
+
__decorateClass([
|
|
3617
|
+
BinaryField("i32", 2)
|
|
3618
|
+
], YGOProMsgPlayerHint.prototype, "value", 2);
|
|
3619
|
+
|
|
3620
|
+
// src/protos/msg/proto/pos-change.ts
|
|
3621
|
+
var YGOProMsgPosChange_CardLocation = class {
|
|
3622
|
+
};
|
|
3623
|
+
__decorateClass([
|
|
3624
|
+
BinaryField("u8", 0)
|
|
3625
|
+
], YGOProMsgPosChange_CardLocation.prototype, "controller", 2);
|
|
3626
|
+
__decorateClass([
|
|
3627
|
+
BinaryField("u8", 1)
|
|
3628
|
+
], YGOProMsgPosChange_CardLocation.prototype, "location", 2);
|
|
3629
|
+
__decorateClass([
|
|
3630
|
+
BinaryField("u8", 2)
|
|
3631
|
+
], YGOProMsgPosChange_CardLocation.prototype, "sequence", 2);
|
|
3632
|
+
var YGOProMsgPosChange = class extends YGOProMsgBase {
|
|
3633
|
+
};
|
|
3634
|
+
YGOProMsgPosChange.identifier = OcgcoreCommonConstants.MSG_POS_CHANGE;
|
|
3635
|
+
__decorateClass([
|
|
3636
|
+
BinaryField(() => YGOProMsgPosChange_CardLocation, 0)
|
|
3637
|
+
], YGOProMsgPosChange.prototype, "card", 2);
|
|
3638
|
+
__decorateClass([
|
|
3639
|
+
BinaryField("u8", 3)
|
|
3640
|
+
], YGOProMsgPosChange.prototype, "previousPosition", 2);
|
|
3641
|
+
__decorateClass([
|
|
3642
|
+
BinaryField("u8", 4)
|
|
3643
|
+
], YGOProMsgPosChange.prototype, "currentPosition", 2);
|
|
3644
|
+
|
|
3645
|
+
// src/protos/msg/proto/random-selected.ts
|
|
3646
|
+
var YGOProMsgRandomSelected = class extends YGOProMsgBase {
|
|
3647
|
+
};
|
|
3648
|
+
YGOProMsgRandomSelected.identifier = OcgcoreCommonConstants.MSG_RANDOM_SELECTED;
|
|
3649
|
+
__decorateClass([
|
|
3650
|
+
BinaryField("u8", 0)
|
|
3651
|
+
], YGOProMsgRandomSelected.prototype, "player", 2);
|
|
3652
|
+
__decorateClass([
|
|
3653
|
+
BinaryField("u8", 1)
|
|
3654
|
+
], YGOProMsgRandomSelected.prototype, "count", 2);
|
|
3655
|
+
__decorateClass([
|
|
3656
|
+
BinaryField("i32", 2, (obj) => obj.count)
|
|
3657
|
+
], YGOProMsgRandomSelected.prototype, "cards", 2);
|
|
3658
|
+
|
|
3659
|
+
// src/protos/msg/proto/recover.ts
|
|
3660
|
+
var YGOProMsgRecover = class extends YGOProMsgBase {
|
|
3661
|
+
};
|
|
3662
|
+
YGOProMsgRecover.identifier = OcgcoreCommonConstants.MSG_RECOVER;
|
|
3663
|
+
__decorateClass([
|
|
3664
|
+
BinaryField("u8", 0)
|
|
3665
|
+
], YGOProMsgRecover.prototype, "player", 2);
|
|
3666
|
+
__decorateClass([
|
|
3667
|
+
BinaryField("i32", 1)
|
|
3668
|
+
], YGOProMsgRecover.prototype, "value", 2);
|
|
3669
|
+
|
|
3670
|
+
// src/protos/msg/proto/reload-field.ts
|
|
3671
|
+
var YGOProMsgReloadField_ZoneCard = class {
|
|
3672
|
+
};
|
|
3673
|
+
var YGOProMsgReloadField_PlayerInfo = class {
|
|
3674
|
+
};
|
|
3675
|
+
var YGOProMsgReloadField_ChainInfo = class {
|
|
3676
|
+
};
|
|
3677
|
+
var YGOProMsgReloadField = class extends YGOProMsgBase {
|
|
3678
|
+
fromPayload(data) {
|
|
3679
|
+
if (data.length < 1) {
|
|
3680
|
+
throw new Error("MSG data too short");
|
|
3681
|
+
}
|
|
3682
|
+
const msgType = data[0];
|
|
3683
|
+
if (msgType !== this.identifier) {
|
|
3684
|
+
throw new Error(
|
|
3685
|
+
`MSG type mismatch: expected ${this.identifier}, got ${msgType}`
|
|
3686
|
+
);
|
|
3687
|
+
}
|
|
3688
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
3689
|
+
let offset = 1;
|
|
3690
|
+
this.duelRule = view.getUint8(offset++);
|
|
3691
|
+
this.players = [];
|
|
3692
|
+
for (let i = 0; i < 2; i++) {
|
|
3693
|
+
const player = {
|
|
3694
|
+
lp: view.getInt32(offset, true),
|
|
3695
|
+
mzone: [],
|
|
3696
|
+
szone: [],
|
|
3697
|
+
deckCount: 0,
|
|
3698
|
+
handCount: 0,
|
|
3699
|
+
graveCount: 0,
|
|
3700
|
+
removedCount: 0,
|
|
3701
|
+
extraCount: 0,
|
|
3702
|
+
extraPCount: 0
|
|
3703
|
+
};
|
|
3704
|
+
offset += 4;
|
|
3705
|
+
for (let seq = 0; seq < 7; seq++) {
|
|
3706
|
+
const occupied = view.getUint8(offset++);
|
|
3707
|
+
const card = { occupied };
|
|
3708
|
+
if (occupied) {
|
|
3709
|
+
card.position = view.getUint8(offset++);
|
|
3710
|
+
card.xyzCount = view.getUint8(offset++);
|
|
3711
|
+
}
|
|
3712
|
+
player.mzone.push(card);
|
|
3713
|
+
}
|
|
3714
|
+
for (let seq = 0; seq < 8; seq++) {
|
|
3715
|
+
const occupied = view.getUint8(offset++);
|
|
3716
|
+
const card = { occupied };
|
|
3717
|
+
if (occupied) {
|
|
3718
|
+
card.position = view.getUint8(offset++);
|
|
3719
|
+
}
|
|
3720
|
+
player.szone.push(card);
|
|
3721
|
+
}
|
|
3722
|
+
player.deckCount = view.getUint8(offset++);
|
|
3723
|
+
player.handCount = view.getUint8(offset++);
|
|
3724
|
+
player.graveCount = view.getUint8(offset++);
|
|
3725
|
+
player.removedCount = view.getUint8(offset++);
|
|
3726
|
+
player.extraCount = view.getUint8(offset++);
|
|
3727
|
+
player.extraPCount = view.getUint8(offset++);
|
|
3728
|
+
this.players.push(player);
|
|
3729
|
+
}
|
|
3730
|
+
const chainCount = view.getUint8(offset++);
|
|
3731
|
+
this.chains = [];
|
|
3732
|
+
for (let i = 0; i < chainCount; i++) {
|
|
3733
|
+
const chain = {
|
|
3734
|
+
code: view.getInt32(offset, true),
|
|
3735
|
+
chainCardController: view.getUint8(offset + 4),
|
|
3736
|
+
chainCardLocation: view.getUint8(offset + 5),
|
|
3737
|
+
chainCardSequence: view.getUint8(offset + 6),
|
|
3738
|
+
chainCardSubsequence: view.getUint8(offset + 7),
|
|
3739
|
+
triggerController: view.getUint8(offset + 8),
|
|
3740
|
+
triggerLocation: view.getUint8(offset + 9),
|
|
3741
|
+
triggerSequence: view.getUint8(offset + 10),
|
|
3742
|
+
desc: view.getInt32(offset + 11, true)
|
|
3743
|
+
};
|
|
3744
|
+
offset += 15;
|
|
3745
|
+
this.chains.push(chain);
|
|
3746
|
+
}
|
|
3747
|
+
return this;
|
|
3748
|
+
}
|
|
3749
|
+
toPayload() {
|
|
3750
|
+
let size = 1 + 1;
|
|
3751
|
+
for (const player of this.players) {
|
|
3752
|
+
size += 4;
|
|
3753
|
+
for (const card of player.mzone) {
|
|
3754
|
+
size += 1;
|
|
3755
|
+
if (card.occupied) {
|
|
3756
|
+
size += 2;
|
|
3757
|
+
}
|
|
3758
|
+
}
|
|
3759
|
+
for (const card of player.szone) {
|
|
3760
|
+
size += 1;
|
|
3761
|
+
if (card.occupied) {
|
|
3762
|
+
size += 1;
|
|
3763
|
+
}
|
|
3764
|
+
}
|
|
3765
|
+
size += 6;
|
|
3766
|
+
}
|
|
3767
|
+
size += 1;
|
|
3768
|
+
size += this.chains.length * 15;
|
|
3769
|
+
const result = new Uint8Array(size);
|
|
3770
|
+
const view = new DataView(result.buffer);
|
|
3771
|
+
let offset = 0;
|
|
3772
|
+
result[offset++] = this.identifier;
|
|
3773
|
+
result[offset++] = this.duelRule;
|
|
3774
|
+
for (const player of this.players) {
|
|
3775
|
+
view.setInt32(offset, player.lp, true);
|
|
3776
|
+
offset += 4;
|
|
3777
|
+
for (const card of player.mzone) {
|
|
3778
|
+
result[offset++] = card.occupied;
|
|
3779
|
+
if (card.occupied) {
|
|
3780
|
+
result[offset++] = card.position || 0;
|
|
3781
|
+
result[offset++] = card.xyzCount || 0;
|
|
3782
|
+
}
|
|
3783
|
+
}
|
|
3784
|
+
for (const card of player.szone) {
|
|
3785
|
+
result[offset++] = card.occupied;
|
|
3786
|
+
if (card.occupied) {
|
|
3787
|
+
result[offset++] = card.position || 0;
|
|
3788
|
+
}
|
|
3789
|
+
}
|
|
3790
|
+
result[offset++] = player.deckCount;
|
|
3791
|
+
result[offset++] = player.handCount;
|
|
3792
|
+
result[offset++] = player.graveCount;
|
|
3793
|
+
result[offset++] = player.removedCount;
|
|
3794
|
+
result[offset++] = player.extraCount;
|
|
3795
|
+
result[offset++] = player.extraPCount;
|
|
3796
|
+
}
|
|
3797
|
+
result[offset++] = this.chains.length;
|
|
3798
|
+
for (const chain of this.chains) {
|
|
3799
|
+
view.setInt32(offset, chain.code, true);
|
|
3800
|
+
result[offset + 4] = chain.chainCardController;
|
|
3801
|
+
result[offset + 5] = chain.chainCardLocation;
|
|
3802
|
+
result[offset + 6] = chain.chainCardSequence;
|
|
3803
|
+
result[offset + 7] = chain.chainCardSubsequence;
|
|
3804
|
+
result[offset + 8] = chain.triggerController;
|
|
3805
|
+
result[offset + 9] = chain.triggerLocation;
|
|
3806
|
+
result[offset + 10] = chain.triggerSequence;
|
|
3807
|
+
view.setInt32(offset + 11, chain.desc, true);
|
|
3808
|
+
offset += 15;
|
|
3809
|
+
}
|
|
3810
|
+
return result;
|
|
3811
|
+
}
|
|
3812
|
+
};
|
|
3813
|
+
YGOProMsgReloadField.identifier = 162;
|
|
3814
|
+
|
|
3815
|
+
// src/protos/msg/proto/remove-counter.ts
|
|
3816
|
+
var YGOProMsgRemoveCounter = class extends YGOProMsgBase {
|
|
3817
|
+
};
|
|
3818
|
+
YGOProMsgRemoveCounter.identifier = OcgcoreCommonConstants.MSG_REMOVE_COUNTER;
|
|
3819
|
+
__decorateClass([
|
|
3820
|
+
BinaryField("u16", 0)
|
|
3821
|
+
], YGOProMsgRemoveCounter.prototype, "counterType", 2);
|
|
3822
|
+
__decorateClass([
|
|
3823
|
+
BinaryField("u8", 2)
|
|
3824
|
+
], YGOProMsgRemoveCounter.prototype, "controller", 2);
|
|
3825
|
+
__decorateClass([
|
|
3826
|
+
BinaryField("u8", 3)
|
|
3827
|
+
], YGOProMsgRemoveCounter.prototype, "location", 2);
|
|
3828
|
+
__decorateClass([
|
|
3829
|
+
BinaryField("u8", 4)
|
|
3830
|
+
], YGOProMsgRemoveCounter.prototype, "sequence", 2);
|
|
3831
|
+
__decorateClass([
|
|
3832
|
+
BinaryField("u16", 5)
|
|
3833
|
+
], YGOProMsgRemoveCounter.prototype, "count", 2);
|
|
3834
|
+
|
|
3835
|
+
// src/protos/msg/proto/reset-time.ts
|
|
3836
|
+
var YGOProMsgResetTime = class extends YGOProMsgBase {
|
|
3837
|
+
getSendTargets() {
|
|
3838
|
+
return [];
|
|
3839
|
+
}
|
|
3840
|
+
};
|
|
3841
|
+
YGOProMsgResetTime.identifier = OcgcoreCommonConstants.MSG_RESET_TIME;
|
|
3842
|
+
__decorateClass([
|
|
3843
|
+
BinaryField("i8", 0)
|
|
3844
|
+
], YGOProMsgResetTime.prototype, "player", 2);
|
|
3845
|
+
__decorateClass([
|
|
3846
|
+
BinaryField("i16", 1)
|
|
3847
|
+
], YGOProMsgResetTime.prototype, "time", 2);
|
|
3848
|
+
|
|
3849
|
+
// src/protos/msg/proto/retry.ts
|
|
3850
|
+
var YGOProMsgRetry = class extends YGOProMsgBase {
|
|
3851
|
+
getSendTargets() {
|
|
3852
|
+
return [];
|
|
3853
|
+
}
|
|
3854
|
+
};
|
|
3855
|
+
YGOProMsgRetry.identifier = OcgcoreCommonConstants.MSG_RETRY;
|
|
3856
|
+
|
|
3857
|
+
// src/protos/msg/proto/reverse-deck.ts
|
|
3858
|
+
var YGOProMsgReverseDeck = class extends YGOProMsgBase {
|
|
3859
|
+
};
|
|
3860
|
+
YGOProMsgReverseDeck.identifier = OcgcoreCommonConstants.MSG_REVERSE_DECK;
|
|
3861
|
+
|
|
3862
|
+
// src/protos/msg/proto/rock-paper-scissors.ts
|
|
3863
|
+
var YGOProMsgRockPaperScissors = class extends YGOProMsgResponseBase {
|
|
3864
|
+
responsePlayer() {
|
|
3865
|
+
return this.player;
|
|
3866
|
+
}
|
|
3867
|
+
prepareResponse(choice) {
|
|
3868
|
+
if (choice < 1 /* ROCK */ || choice > 3 /* PAPER */) {
|
|
3869
|
+
throw new TypeError(
|
|
3870
|
+
`Invalid choice: ${choice}. Must be 1 (ROCK), 2 (SCISSORS), or 3 (PAPER)`
|
|
3871
|
+
);
|
|
3872
|
+
}
|
|
3873
|
+
const buffer = new Uint8Array(1);
|
|
3874
|
+
buffer[0] = choice;
|
|
3875
|
+
return buffer;
|
|
3876
|
+
}
|
|
3877
|
+
};
|
|
3878
|
+
YGOProMsgRockPaperScissors.identifier = OcgcoreCommonConstants.MSG_ROCK_PAPER_SCISSORS;
|
|
3879
|
+
__decorateClass([
|
|
3880
|
+
BinaryField("u8", 0)
|
|
3881
|
+
], YGOProMsgRockPaperScissors.prototype, "player", 2);
|
|
3882
|
+
|
|
3883
|
+
// src/protos/msg/proto/select-battlecmd.ts
|
|
3884
|
+
var BattleCmdType = /* @__PURE__ */ ((BattleCmdType2) => {
|
|
3885
|
+
BattleCmdType2[BattleCmdType2["ACTIVATE"] = 0] = "ACTIVATE";
|
|
3886
|
+
BattleCmdType2[BattleCmdType2["ATTACK"] = 1] = "ATTACK";
|
|
3887
|
+
BattleCmdType2[BattleCmdType2["TO_M2"] = 2] = "TO_M2";
|
|
3888
|
+
BattleCmdType2[BattleCmdType2["TO_EP"] = 3] = "TO_EP";
|
|
3889
|
+
return BattleCmdType2;
|
|
3890
|
+
})(BattleCmdType || {});
|
|
3891
|
+
var YGOProMsgSelectBattleCmd_ActivatableInfo = class {
|
|
3892
|
+
};
|
|
3893
|
+
__decorateClass([
|
|
3894
|
+
BinaryField("i32", 0)
|
|
3895
|
+
], YGOProMsgSelectBattleCmd_ActivatableInfo.prototype, "code", 2);
|
|
3896
|
+
__decorateClass([
|
|
3897
|
+
BinaryField("u8", 4)
|
|
3898
|
+
], YGOProMsgSelectBattleCmd_ActivatableInfo.prototype, "controller", 2);
|
|
3899
|
+
__decorateClass([
|
|
3900
|
+
BinaryField("u8", 5)
|
|
3901
|
+
], YGOProMsgSelectBattleCmd_ActivatableInfo.prototype, "location", 2);
|
|
3902
|
+
__decorateClass([
|
|
3903
|
+
BinaryField("u8", 6)
|
|
3904
|
+
], YGOProMsgSelectBattleCmd_ActivatableInfo.prototype, "sequence", 2);
|
|
3905
|
+
__decorateClass([
|
|
3906
|
+
BinaryField("i32", 7)
|
|
3907
|
+
], YGOProMsgSelectBattleCmd_ActivatableInfo.prototype, "desc", 2);
|
|
3908
|
+
var YGOProMsgSelectBattleCmd_AttackableInfo = class {
|
|
3909
|
+
};
|
|
3910
|
+
__decorateClass([
|
|
3911
|
+
BinaryField("i32", 0)
|
|
3912
|
+
], YGOProMsgSelectBattleCmd_AttackableInfo.prototype, "code", 2);
|
|
3913
|
+
__decorateClass([
|
|
3914
|
+
BinaryField("u8", 4)
|
|
3915
|
+
], YGOProMsgSelectBattleCmd_AttackableInfo.prototype, "controller", 2);
|
|
3916
|
+
__decorateClass([
|
|
3917
|
+
BinaryField("u8", 5)
|
|
3918
|
+
], YGOProMsgSelectBattleCmd_AttackableInfo.prototype, "location", 2);
|
|
3919
|
+
__decorateClass([
|
|
3920
|
+
BinaryField("u8", 6)
|
|
3921
|
+
], YGOProMsgSelectBattleCmd_AttackableInfo.prototype, "sequence", 2);
|
|
3922
|
+
__decorateClass([
|
|
3923
|
+
BinaryField("u8", 7)
|
|
3924
|
+
], YGOProMsgSelectBattleCmd_AttackableInfo.prototype, "directAttack", 2);
|
|
3925
|
+
var YGOProMsgSelectBattleCmd = class extends YGOProMsgResponseBase {
|
|
3926
|
+
responsePlayer() {
|
|
3927
|
+
return this.player;
|
|
3928
|
+
}
|
|
3929
|
+
prepareResponse(type, option) {
|
|
3930
|
+
let sequence;
|
|
3931
|
+
if (type === 0 /* ACTIVATE */) {
|
|
3932
|
+
if (option == null) {
|
|
3933
|
+
throw new TypeError("Option required for ACTIVATE");
|
|
3934
|
+
}
|
|
3935
|
+
if (isIndexResponse(option)) {
|
|
3936
|
+
sequence = option.index;
|
|
3937
|
+
if (sequence < 0 || sequence >= this.activatableCount) {
|
|
3938
|
+
throw new TypeError(`Index out of range: ${sequence}`);
|
|
3939
|
+
}
|
|
3940
|
+
} else {
|
|
3941
|
+
const idx = this.activatableCards.findIndex(
|
|
3942
|
+
(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) && (option.desc == null || card.desc === option.desc)
|
|
3943
|
+
);
|
|
3944
|
+
if (idx === -1) {
|
|
3945
|
+
throw new TypeError("Activatable card not found");
|
|
3946
|
+
}
|
|
3947
|
+
sequence = idx;
|
|
3948
|
+
}
|
|
3949
|
+
} else if (type === 1 /* ATTACK */) {
|
|
3950
|
+
if (option == null) {
|
|
3951
|
+
throw new TypeError("Option required for ATTACK");
|
|
3952
|
+
}
|
|
3953
|
+
if (isIndexResponse(option)) {
|
|
3954
|
+
sequence = option.index;
|
|
3955
|
+
if (sequence < 0 || sequence >= this.attackableCount) {
|
|
3956
|
+
throw new TypeError(`Index out of range: ${sequence}`);
|
|
3957
|
+
}
|
|
3958
|
+
} else {
|
|
3959
|
+
const idx = this.attackableCards.findIndex(
|
|
3960
|
+
(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)
|
|
3961
|
+
);
|
|
3962
|
+
if (idx === -1) {
|
|
3963
|
+
throw new TypeError("Attackable card not found");
|
|
3964
|
+
}
|
|
3965
|
+
sequence = idx;
|
|
3966
|
+
}
|
|
3967
|
+
} else if (type === 2 /* TO_M2 */) {
|
|
3968
|
+
if (this.canM2 === 0) {
|
|
3969
|
+
throw new TypeError("Cannot go to M2");
|
|
3970
|
+
}
|
|
3971
|
+
sequence = 0;
|
|
3972
|
+
} else if (type === 3 /* TO_EP */) {
|
|
3973
|
+
if (this.canEp === 0) {
|
|
3974
|
+
throw new TypeError("Cannot go to EP");
|
|
3975
|
+
}
|
|
3976
|
+
sequence = 0;
|
|
3977
|
+
} else {
|
|
3978
|
+
throw new TypeError(`Unknown type: ${type}`);
|
|
3979
|
+
}
|
|
3980
|
+
const buffer = new Uint8Array(4);
|
|
3981
|
+
const view = new DataView(buffer.buffer);
|
|
3982
|
+
view.setUint32(0, sequence << 16 | type, true);
|
|
3983
|
+
return buffer;
|
|
3984
|
+
}
|
|
3985
|
+
};
|
|
3986
|
+
YGOProMsgSelectBattleCmd.identifier = OcgcoreCommonConstants.MSG_SELECT_BATTLECMD;
|
|
3987
|
+
__decorateClass([
|
|
3988
|
+
BinaryField("u8", 0)
|
|
3989
|
+
], YGOProMsgSelectBattleCmd.prototype, "player", 2);
|
|
3990
|
+
__decorateClass([
|
|
3991
|
+
BinaryField("u8", 1)
|
|
3992
|
+
], YGOProMsgSelectBattleCmd.prototype, "activatableCount", 2);
|
|
3993
|
+
__decorateClass([
|
|
3994
|
+
BinaryField(
|
|
3995
|
+
() => YGOProMsgSelectBattleCmd_ActivatableInfo,
|
|
3996
|
+
2,
|
|
3997
|
+
(obj) => obj.activatableCount
|
|
3998
|
+
)
|
|
3999
|
+
], YGOProMsgSelectBattleCmd.prototype, "activatableCards", 2);
|
|
4000
|
+
__decorateClass([
|
|
4001
|
+
BinaryField("u8", (obj) => {
|
|
4002
|
+
return 2 + obj.activatableCount * 11;
|
|
4003
|
+
})
|
|
4004
|
+
], YGOProMsgSelectBattleCmd.prototype, "attackableCount", 2);
|
|
4005
|
+
__decorateClass([
|
|
4006
|
+
BinaryField(
|
|
4007
|
+
() => YGOProMsgSelectBattleCmd_AttackableInfo,
|
|
4008
|
+
(obj) => {
|
|
4009
|
+
return 3 + obj.activatableCount * 11;
|
|
4010
|
+
},
|
|
4011
|
+
(obj) => obj.attackableCount
|
|
4012
|
+
)
|
|
4013
|
+
], YGOProMsgSelectBattleCmd.prototype, "attackableCards", 2);
|
|
4014
|
+
__decorateClass([
|
|
4015
|
+
BinaryField("u8", (obj) => {
|
|
4016
|
+
return 3 + obj.activatableCount * 11 + obj.attackableCount * 8;
|
|
4017
|
+
})
|
|
4018
|
+
], YGOProMsgSelectBattleCmd.prototype, "canM2", 2);
|
|
4019
|
+
__decorateClass([
|
|
4020
|
+
BinaryField("u8", (obj) => {
|
|
4021
|
+
return 4 + obj.activatableCount * 11 + obj.attackableCount * 8;
|
|
4022
|
+
})
|
|
4023
|
+
], YGOProMsgSelectBattleCmd.prototype, "canEp", 2);
|
|
4024
|
+
|
|
4025
|
+
// src/protos/msg/proto/select-card.ts
|
|
4026
|
+
var YGOProMsgSelectCard_CardInfo = class {
|
|
4027
|
+
};
|
|
4028
|
+
__decorateClass([
|
|
4029
|
+
BinaryField("i32", 0)
|
|
4030
|
+
], YGOProMsgSelectCard_CardInfo.prototype, "code", 2);
|
|
4031
|
+
__decorateClass([
|
|
4032
|
+
BinaryField("u8", 4)
|
|
4033
|
+
], YGOProMsgSelectCard_CardInfo.prototype, "controller", 2);
|
|
4034
|
+
__decorateClass([
|
|
4035
|
+
BinaryField("u8", 5)
|
|
4036
|
+
], YGOProMsgSelectCard_CardInfo.prototype, "location", 2);
|
|
4037
|
+
__decorateClass([
|
|
4038
|
+
BinaryField("u8", 6)
|
|
4039
|
+
], YGOProMsgSelectCard_CardInfo.prototype, "sequence", 2);
|
|
4040
|
+
__decorateClass([
|
|
4041
|
+
BinaryField("u8", 7)
|
|
4042
|
+
], YGOProMsgSelectCard_CardInfo.prototype, "subsequence", 2);
|
|
4043
|
+
var YGOProMsgSelectCard = class extends YGOProMsgResponseBase {
|
|
4044
|
+
responsePlayer() {
|
|
4045
|
+
return this.player;
|
|
4046
|
+
}
|
|
4047
|
+
defaultResponse() {
|
|
4048
|
+
if (this.cancelable === 0) {
|
|
4049
|
+
return void 0;
|
|
4050
|
+
}
|
|
4051
|
+
return this.prepareResponse(null);
|
|
4052
|
+
}
|
|
4053
|
+
prepareResponse(cardOptions) {
|
|
4054
|
+
if (cardOptions == null) {
|
|
4055
|
+
const buffer2 = new Uint8Array(4);
|
|
4056
|
+
const view = new DataView(buffer2.buffer);
|
|
4057
|
+
view.setInt32(0, -1, true);
|
|
4058
|
+
return buffer2;
|
|
4059
|
+
}
|
|
4060
|
+
const indices = [];
|
|
4061
|
+
const usedIndices = /* @__PURE__ */ new Set();
|
|
4062
|
+
for (const option of cardOptions) {
|
|
4063
|
+
let index;
|
|
4064
|
+
if (isIndexResponse(option)) {
|
|
4065
|
+
index = option.index;
|
|
4066
|
+
if (index < 0 || index >= this.count) {
|
|
4067
|
+
throw new TypeError(`Index out of range: ${index}`);
|
|
4068
|
+
}
|
|
4069
|
+
} else {
|
|
4070
|
+
index = this.cards.findIndex(
|
|
4071
|
+
(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)
|
|
4072
|
+
);
|
|
4073
|
+
if (index === -1) {
|
|
4074
|
+
throw new TypeError("Card not found");
|
|
4075
|
+
}
|
|
4076
|
+
}
|
|
4077
|
+
indices.push(index);
|
|
4078
|
+
usedIndices.add(index);
|
|
4079
|
+
}
|
|
4080
|
+
const buffer = new Uint8Array(1 + indices.length);
|
|
4081
|
+
buffer[0] = indices.length;
|
|
4082
|
+
indices.forEach((idx, i) => {
|
|
4083
|
+
buffer[1 + i] = idx;
|
|
4084
|
+
});
|
|
4085
|
+
return buffer;
|
|
4086
|
+
}
|
|
4087
|
+
};
|
|
4088
|
+
YGOProMsgSelectCard.identifier = OcgcoreCommonConstants.MSG_SELECT_CARD;
|
|
4089
|
+
__decorateClass([
|
|
4090
|
+
BinaryField("u8", 0)
|
|
4091
|
+
], YGOProMsgSelectCard.prototype, "player", 2);
|
|
4092
|
+
__decorateClass([
|
|
4093
|
+
BinaryField("u8", 1)
|
|
4094
|
+
], YGOProMsgSelectCard.prototype, "cancelable", 2);
|
|
4095
|
+
__decorateClass([
|
|
4096
|
+
BinaryField("u8", 2)
|
|
4097
|
+
], YGOProMsgSelectCard.prototype, "min", 2);
|
|
4098
|
+
__decorateClass([
|
|
4099
|
+
BinaryField("u8", 3)
|
|
4100
|
+
], YGOProMsgSelectCard.prototype, "max", 2);
|
|
4101
|
+
__decorateClass([
|
|
4102
|
+
BinaryField("u8", 4)
|
|
4103
|
+
], YGOProMsgSelectCard.prototype, "count", 2);
|
|
4104
|
+
__decorateClass([
|
|
4105
|
+
BinaryField(() => YGOProMsgSelectCard_CardInfo, 5, (obj) => obj.count)
|
|
4106
|
+
], YGOProMsgSelectCard.prototype, "cards", 2);
|
|
4107
|
+
|
|
4108
|
+
// src/protos/msg/proto/select-chain.ts
|
|
4109
|
+
var YGOProMsgSelectChain_ChainInfo = class {
|
|
4110
|
+
};
|
|
4111
|
+
__decorateClass([
|
|
4112
|
+
BinaryField("u8", 0)
|
|
4113
|
+
], YGOProMsgSelectChain_ChainInfo.prototype, "edesc", 2);
|
|
4114
|
+
__decorateClass([
|
|
4115
|
+
BinaryField("u8", 1)
|
|
4116
|
+
], YGOProMsgSelectChain_ChainInfo.prototype, "forced", 2);
|
|
4117
|
+
__decorateClass([
|
|
4118
|
+
BinaryField("i32", 2)
|
|
4119
|
+
], YGOProMsgSelectChain_ChainInfo.prototype, "code", 2);
|
|
4120
|
+
__decorateClass([
|
|
4121
|
+
BinaryField("u8", 6)
|
|
4122
|
+
], YGOProMsgSelectChain_ChainInfo.prototype, "controller", 2);
|
|
4123
|
+
__decorateClass([
|
|
4124
|
+
BinaryField("u8", 7)
|
|
4125
|
+
], YGOProMsgSelectChain_ChainInfo.prototype, "location", 2);
|
|
4126
|
+
__decorateClass([
|
|
4127
|
+
BinaryField("u8", 8)
|
|
4128
|
+
], YGOProMsgSelectChain_ChainInfo.prototype, "sequence", 2);
|
|
4129
|
+
__decorateClass([
|
|
4130
|
+
BinaryField("u8", 9)
|
|
4131
|
+
], YGOProMsgSelectChain_ChainInfo.prototype, "subsequence", 2);
|
|
4132
|
+
__decorateClass([
|
|
4133
|
+
BinaryField("i32", 10)
|
|
4134
|
+
], YGOProMsgSelectChain_ChainInfo.prototype, "desc", 2);
|
|
4135
|
+
var YGOProMsgSelectChain = class extends YGOProMsgResponseBase {
|
|
4136
|
+
responsePlayer() {
|
|
4137
|
+
return this.player;
|
|
4138
|
+
}
|
|
4139
|
+
defaultResponse() {
|
|
4140
|
+
const hasForced = this.chains.some((chain) => chain.forced !== 0);
|
|
4141
|
+
if (hasForced) {
|
|
4142
|
+
return void 0;
|
|
4143
|
+
}
|
|
4144
|
+
return this.prepareResponse(null);
|
|
4145
|
+
}
|
|
4146
|
+
prepareResponse(option) {
|
|
4147
|
+
let index;
|
|
4148
|
+
if (option == null) {
|
|
4149
|
+
index = -1;
|
|
4150
|
+
} else if (isIndexResponse(option)) {
|
|
4151
|
+
index = option.index;
|
|
4152
|
+
if (index < -1 || index >= this.count) {
|
|
4153
|
+
throw new TypeError(`Index out of range: ${index}`);
|
|
4154
|
+
}
|
|
4155
|
+
} else {
|
|
4156
|
+
index = this.chains.findIndex(
|
|
4157
|
+
(chain) => (option.code == null || chain.code === option.code) && (option.controller == null || chain.controller === option.controller) && (option.location == null || chain.location === option.location) && (option.sequence == null || chain.sequence === option.sequence) && (option.desc == null || chain.desc === option.desc)
|
|
4158
|
+
);
|
|
4159
|
+
if (index === -1) {
|
|
4160
|
+
throw new TypeError("Chain not found");
|
|
4161
|
+
}
|
|
4162
|
+
}
|
|
4163
|
+
const buffer = new Uint8Array(4);
|
|
4164
|
+
const view = new DataView(buffer.buffer);
|
|
4165
|
+
view.setInt32(0, index, true);
|
|
4166
|
+
return buffer;
|
|
4167
|
+
}
|
|
4168
|
+
};
|
|
4169
|
+
YGOProMsgSelectChain.identifier = OcgcoreCommonConstants.MSG_SELECT_CHAIN;
|
|
4170
|
+
__decorateClass([
|
|
4171
|
+
BinaryField("u8", 0)
|
|
4172
|
+
], YGOProMsgSelectChain.prototype, "player", 2);
|
|
4173
|
+
__decorateClass([
|
|
4174
|
+
BinaryField("u8", 1)
|
|
4175
|
+
], YGOProMsgSelectChain.prototype, "count", 2);
|
|
4176
|
+
__decorateClass([
|
|
4177
|
+
BinaryField("u8", 2)
|
|
4178
|
+
], YGOProMsgSelectChain.prototype, "specialCount", 2);
|
|
4179
|
+
__decorateClass([
|
|
4180
|
+
BinaryField("i32", 3)
|
|
4181
|
+
], YGOProMsgSelectChain.prototype, "hint0", 2);
|
|
4182
|
+
__decorateClass([
|
|
4183
|
+
BinaryField("i32", 7)
|
|
4184
|
+
], YGOProMsgSelectChain.prototype, "hint1", 2);
|
|
4185
|
+
__decorateClass([
|
|
4186
|
+
BinaryField(() => YGOProMsgSelectChain_ChainInfo, 11, (obj) => obj.count)
|
|
4187
|
+
], YGOProMsgSelectChain.prototype, "chains", 2);
|
|
4188
|
+
|
|
4189
|
+
// src/protos/msg/proto/select-counter.ts
|
|
4190
|
+
var YGOProMsgSelectCounter_CardInfo = class {
|
|
4191
|
+
};
|
|
4192
|
+
__decorateClass([
|
|
4193
|
+
BinaryField("i32", 0)
|
|
4194
|
+
], YGOProMsgSelectCounter_CardInfo.prototype, "code", 2);
|
|
4195
|
+
__decorateClass([
|
|
4196
|
+
BinaryField("u8", 4)
|
|
4197
|
+
], YGOProMsgSelectCounter_CardInfo.prototype, "controller", 2);
|
|
4198
|
+
__decorateClass([
|
|
4199
|
+
BinaryField("u8", 5)
|
|
4200
|
+
], YGOProMsgSelectCounter_CardInfo.prototype, "location", 2);
|
|
4201
|
+
__decorateClass([
|
|
4202
|
+
BinaryField("u8", 6)
|
|
4203
|
+
], YGOProMsgSelectCounter_CardInfo.prototype, "sequence", 2);
|
|
4204
|
+
__decorateClass([
|
|
4205
|
+
BinaryField("u16", 7)
|
|
4206
|
+
], YGOProMsgSelectCounter_CardInfo.prototype, "counterCount", 2);
|
|
4207
|
+
var YGOProMsgSelectCounter = class extends YGOProMsgResponseBase {
|
|
4208
|
+
responsePlayer() {
|
|
4209
|
+
return this.player;
|
|
4210
|
+
}
|
|
4211
|
+
prepareResponse(counterOptions) {
|
|
4212
|
+
const counterCounts = new Array(this.count).fill(0);
|
|
4213
|
+
for (const option of counterOptions) {
|
|
4214
|
+
let index;
|
|
4215
|
+
if (isIndexResponse(option.card)) {
|
|
4216
|
+
index = option.card.index;
|
|
4217
|
+
if (index < 0 || index >= this.count) {
|
|
4218
|
+
throw new TypeError(`Index out of range: ${index}`);
|
|
4219
|
+
}
|
|
4220
|
+
} else {
|
|
4221
|
+
const card = option.card;
|
|
4222
|
+
index = this.cards.findIndex(
|
|
4223
|
+
(card2) => (card2.code == null || card2.code === card2.code) && (card2.controller == null || card2.controller === card2.controller) && (card2.location == null || card2.location === card2.location) && (card2.sequence == null || card2.sequence === card2.sequence)
|
|
4224
|
+
);
|
|
4225
|
+
if (index === -1) {
|
|
4226
|
+
throw new TypeError("Card not found");
|
|
4227
|
+
}
|
|
4228
|
+
}
|
|
4229
|
+
counterCounts[index] = option.count;
|
|
4230
|
+
}
|
|
4231
|
+
const buffer = new Uint8Array(counterCounts.length * 2);
|
|
4232
|
+
const view = new DataView(buffer.buffer);
|
|
4233
|
+
counterCounts.forEach((count, i) => {
|
|
4234
|
+
view.setUint16(i * 2, count, true);
|
|
4235
|
+
});
|
|
4236
|
+
return buffer;
|
|
4237
|
+
}
|
|
4238
|
+
};
|
|
4239
|
+
YGOProMsgSelectCounter.identifier = OcgcoreCommonConstants.MSG_SELECT_COUNTER;
|
|
4240
|
+
__decorateClass([
|
|
4241
|
+
BinaryField("u8", 0)
|
|
4242
|
+
], YGOProMsgSelectCounter.prototype, "player", 2);
|
|
4243
|
+
__decorateClass([
|
|
4244
|
+
BinaryField("u16", 1)
|
|
4245
|
+
], YGOProMsgSelectCounter.prototype, "counterType", 2);
|
|
4246
|
+
__decorateClass([
|
|
4247
|
+
BinaryField("u16", 3)
|
|
4248
|
+
], YGOProMsgSelectCounter.prototype, "counterCount", 2);
|
|
4249
|
+
__decorateClass([
|
|
4250
|
+
BinaryField("u8", 5)
|
|
4251
|
+
], YGOProMsgSelectCounter.prototype, "count", 2);
|
|
4252
|
+
__decorateClass([
|
|
4253
|
+
BinaryField(() => YGOProMsgSelectCounter_CardInfo, 6, (obj) => obj.count)
|
|
4254
|
+
], YGOProMsgSelectCounter.prototype, "cards", 2);
|
|
4255
|
+
|
|
4215
4256
|
// src/protos/msg/proto/select-place-common.ts
|
|
4216
4257
|
var YGOProMsgSelectPlaceCommon = class extends YGOProMsgResponseBase {
|
|
4217
4258
|
getSelectablePlaces() {
|
|
@@ -5047,6 +5088,25 @@ YGOProMsgSpSummoned.identifier = OcgcoreCommonConstants.MSG_SPSUMMONED;
|
|
|
5047
5088
|
|
|
5048
5089
|
// src/protos/msg/proto/spsummoning.ts
|
|
5049
5090
|
var YGOProMsgSpSummoning = class extends YGOProMsgBase {
|
|
5091
|
+
opponentView() {
|
|
5092
|
+
const view = this.copy();
|
|
5093
|
+
if (view.position & OcgcoreCommonConstants.POS_FACEDOWN) {
|
|
5094
|
+
view.code = 0;
|
|
5095
|
+
}
|
|
5096
|
+
return view;
|
|
5097
|
+
}
|
|
5098
|
+
teammateView() {
|
|
5099
|
+
return this.copy();
|
|
5100
|
+
}
|
|
5101
|
+
playerView(playerId) {
|
|
5102
|
+
if (playerId === 7 /* OBSERVER */) {
|
|
5103
|
+
return this.observerView();
|
|
5104
|
+
}
|
|
5105
|
+
if (playerId === this.controller) {
|
|
5106
|
+
return this.copy();
|
|
5107
|
+
}
|
|
5108
|
+
return this.opponentView();
|
|
5109
|
+
}
|
|
5050
5110
|
};
|
|
5051
5111
|
YGOProMsgSpSummoning.identifier = OcgcoreCommonConstants.MSG_SPSUMMONING;
|
|
5052
5112
|
__decorateClass([
|
|
@@ -5265,6 +5325,9 @@ var YGOProMsgUpdateCard = class extends YGOProMsgBase {
|
|
|
5265
5325
|
}
|
|
5266
5326
|
}
|
|
5267
5327
|
playerView(playerId) {
|
|
5328
|
+
if (playerId === 7 /* OBSERVER */) {
|
|
5329
|
+
return this.observerView();
|
|
5330
|
+
}
|
|
5268
5331
|
if (this.controller === playerId) {
|
|
5269
5332
|
return this.copy();
|
|
5270
5333
|
}
|
|
@@ -5315,7 +5378,7 @@ var YGOProMsgUpdateCard = class extends YGOProMsgBase {
|
|
|
5315
5378
|
return result;
|
|
5316
5379
|
}
|
|
5317
5380
|
getSendTargets() {
|
|
5318
|
-
return [
|
|
5381
|
+
return [];
|
|
5319
5382
|
}
|
|
5320
5383
|
};
|
|
5321
5384
|
YGOProMsgUpdateCard.identifier = OcgcoreCommonConstants.MSG_UPDATE_CARD;
|