ygopro-msg-encode 1.0.4 → 1.1.0

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.
Files changed (27) hide show
  1. package/dist/index.cjs +1061 -991
  2. package/dist/index.cjs.map +3 -3
  3. package/dist/index.mjs +1112 -1043
  4. package/dist/index.mjs.map +3 -3
  5. package/dist/src/protos/msg/proto/announce-attrib.d.ts +1 -0
  6. package/dist/src/protos/msg/proto/announce-card.d.ts +1 -0
  7. package/dist/src/protos/msg/proto/announce-number.d.ts +1 -0
  8. package/dist/src/protos/msg/proto/announce-race.d.ts +1 -0
  9. package/dist/src/protos/msg/proto/index.d.ts +1 -0
  10. package/dist/src/protos/msg/proto/select-battlecmd.d.ts +1 -0
  11. package/dist/src/protos/msg/proto/select-card.d.ts +1 -0
  12. package/dist/src/protos/msg/proto/select-chain.d.ts +1 -0
  13. package/dist/src/protos/msg/proto/select-counter.d.ts +1 -0
  14. package/dist/src/protos/msg/proto/select-disfield.d.ts +2 -10
  15. package/dist/src/protos/msg/proto/select-effectyn.d.ts +1 -0
  16. package/dist/src/protos/msg/proto/select-idlecmd.d.ts +1 -0
  17. package/dist/src/protos/msg/proto/select-option.d.ts +1 -0
  18. package/dist/src/protos/msg/proto/select-place-common.d.ts +18 -0
  19. package/dist/src/protos/msg/proto/select-place.d.ts +2 -10
  20. package/dist/src/protos/msg/proto/select-position.d.ts +1 -0
  21. package/dist/src/protos/msg/proto/select-sum.d.ts +1 -0
  22. package/dist/src/protos/msg/proto/select-tribute.d.ts +1 -0
  23. package/dist/src/protos/msg/proto/select-unselect-card.d.ts +1 -0
  24. package/dist/src/protos/msg/proto/select-yesno.d.ts +1 -0
  25. package/dist/src/protos/msg/proto/sort-card.d.ts +1 -0
  26. package/dist/src/protos/msg/with-response-base.d.ts +1 -0
  27. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1242,6 +1242,9 @@ var YGOProMsgAnnounceAttrib = class extends YGOProMsgResponseBase {
1242
1242
  static {
1243
1243
  this.identifier = OcgcoreCommonConstants.MSG_ANNOUNCE_ATTRIB;
1244
1244
  }
1245
+ responsePlayer() {
1246
+ return this.player;
1247
+ }
1245
1248
  prepareResponse(attributes) {
1246
1249
  const buffer = new Uint8Array(4);
1247
1250
  const view = new DataView(buffer.buffer);
@@ -1264,6 +1267,9 @@ var YGOProMsgAnnounceCard = class extends YGOProMsgResponseBase {
1264
1267
  static {
1265
1268
  this.identifier = OcgcoreCommonConstants.MSG_ANNOUNCE_CARD;
1266
1269
  }
1270
+ responsePlayer() {
1271
+ return this.player;
1272
+ }
1267
1273
  prepareResponse(cardCode) {
1268
1274
  const buffer = new Uint8Array(4);
1269
1275
  const view = new DataView(buffer.buffer);
@@ -1296,6 +1302,9 @@ var YGOProMsgAnnounceNumber = class extends YGOProMsgResponseBase {
1296
1302
  static {
1297
1303
  this.identifier = OcgcoreCommonConstants.MSG_ANNOUNCE_NUMBER;
1298
1304
  }
1305
+ responsePlayer() {
1306
+ return this.player;
1307
+ }
1299
1308
  prepareResponse(option) {
1300
1309
  let index;
1301
1310
  if (isIndexResponse(option)) {
@@ -1330,6 +1339,9 @@ var YGOProMsgAnnounceRace = class extends YGOProMsgResponseBase {
1330
1339
  static {
1331
1340
  this.identifier = OcgcoreCommonConstants.MSG_ANNOUNCE_RACE;
1332
1341
  }
1342
+ responsePlayer() {
1343
+ return this.player;
1344
+ }
1333
1345
  prepareResponse(races) {
1334
1346
  const buffer = new Uint8Array(4);
1335
1347
  const view = new DataView(buffer.buffer);
@@ -2634,6 +2646,9 @@ var YGOProMsgSelectBattleCmd = class extends YGOProMsgResponseBase {
2634
2646
  static {
2635
2647
  this.identifier = OcgcoreCommonConstants.MSG_SELECT_BATTLECMD;
2636
2648
  }
2649
+ responsePlayer() {
2650
+ return this.player;
2651
+ }
2637
2652
  prepareResponse(type, option) {
2638
2653
  let sequence;
2639
2654
  if (type === 0 /* ACTIVATE */) {
@@ -2751,6 +2766,9 @@ var YGOProMsgSelectCard = class extends YGOProMsgResponseBase {
2751
2766
  static {
2752
2767
  this.identifier = OcgcoreCommonConstants.MSG_SELECT_CARD;
2753
2768
  }
2769
+ responsePlayer() {
2770
+ return this.player;
2771
+ }
2754
2772
  defaultResponse() {
2755
2773
  if (this.cancelable === 0) {
2756
2774
  return void 0;
@@ -2765,6 +2783,7 @@ var YGOProMsgSelectCard = class extends YGOProMsgResponseBase {
2765
2783
  return buffer2;
2766
2784
  }
2767
2785
  const indices = [];
2786
+ const usedIndices = /* @__PURE__ */ new Set();
2768
2787
  for (const option of cardOptions) {
2769
2788
  let index;
2770
2789
  if (isIndexResponse(option)) {
@@ -2774,13 +2793,14 @@ var YGOProMsgSelectCard = class extends YGOProMsgResponseBase {
2774
2793
  }
2775
2794
  } else {
2776
2795
  index = this.cards.findIndex(
2777
- (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)
2796
+ (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)
2778
2797
  );
2779
2798
  if (index === -1) {
2780
2799
  throw new TypeError("Card not found");
2781
2800
  }
2782
2801
  }
2783
2802
  indices.push(index);
2803
+ usedIndices.add(index);
2784
2804
  }
2785
2805
  const buffer = new Uint8Array(1 + indices.length);
2786
2806
  buffer[0] = indices.length;
@@ -2840,6 +2860,9 @@ var YGOProMsgSelectChain = class extends YGOProMsgResponseBase {
2840
2860
  static {
2841
2861
  this.identifier = OcgcoreCommonConstants.MSG_SELECT_CHAIN;
2842
2862
  }
2863
+ responsePlayer() {
2864
+ return this.player;
2865
+ }
2843
2866
  defaultResponse() {
2844
2867
  const hasForced = this.chains.some((chain) => chain.forced !== 0);
2845
2868
  if (hasForced) {
@@ -2911,6 +2934,9 @@ var YGOProMsgSelectCounter = class extends YGOProMsgResponseBase {
2911
2934
  static {
2912
2935
  this.identifier = OcgcoreCommonConstants.MSG_SELECT_COUNTER;
2913
2936
  }
2937
+ responsePlayer() {
2938
+ return this.player;
2939
+ }
2914
2940
  prepareResponse(counterOptions) {
2915
2941
  const counterCounts = new Array(this.count).fill(0);
2916
2942
  for (const option of counterOptions) {
@@ -2955,1048 +2981,6 @@ __decorateClass([
2955
2981
  BinaryField(() => YGOProMsgSelectCounter_CardInfo, 6, (obj) => obj.count)
2956
2982
  ], YGOProMsgSelectCounter.prototype, "cards", 2);
2957
2983
 
2958
- // src/protos/msg/proto/select-disfield.ts
2959
- var YGOProMsgSelectDisField = class extends YGOProMsgResponseBase {
2960
- static {
2961
- this.identifier = OcgcoreCommonConstants.MSG_SELECT_DISFIELD;
2962
- }
2963
- prepareResponse(places) {
2964
- const buffer = new Uint8Array(places.length * 3);
2965
- places.forEach((place, i) => {
2966
- buffer[i * 3] = place.player;
2967
- buffer[i * 3 + 1] = place.location;
2968
- buffer[i * 3 + 2] = place.sequence;
2969
- });
2970
- return buffer;
2971
- }
2972
- };
2973
- __decorateClass([
2974
- BinaryField("u8", 0)
2975
- ], YGOProMsgSelectDisField.prototype, "player", 2);
2976
- __decorateClass([
2977
- BinaryField("u8", 1)
2978
- ], YGOProMsgSelectDisField.prototype, "count", 2);
2979
- __decorateClass([
2980
- BinaryField("u32", 2)
2981
- ], YGOProMsgSelectDisField.prototype, "flag", 2);
2982
-
2983
- // src/protos/msg/proto/select-effectyn.ts
2984
- var YGOProMsgSelectEffectYn = class extends YGOProMsgResponseBase {
2985
- static {
2986
- this.identifier = OcgcoreCommonConstants.MSG_SELECT_EFFECTYN;
2987
- }
2988
- defaultResponse() {
2989
- return this.prepareResponse(false);
2990
- }
2991
- prepareResponse(yes) {
2992
- const buffer = new Uint8Array(4);
2993
- const view = new DataView(buffer.buffer);
2994
- view.setInt32(0, yes ? 1 : 0, true);
2995
- return buffer;
2996
- }
2997
- };
2998
- __decorateClass([
2999
- BinaryField("u8", 0)
3000
- ], YGOProMsgSelectEffectYn.prototype, "player", 2);
3001
- __decorateClass([
3002
- BinaryField("i32", 1)
3003
- ], YGOProMsgSelectEffectYn.prototype, "code", 2);
3004
- __decorateClass([
3005
- BinaryField("u8", 5)
3006
- ], YGOProMsgSelectEffectYn.prototype, "controller", 2);
3007
- __decorateClass([
3008
- BinaryField("u8", 6)
3009
- ], YGOProMsgSelectEffectYn.prototype, "location", 2);
3010
- __decorateClass([
3011
- BinaryField("u8", 7)
3012
- ], YGOProMsgSelectEffectYn.prototype, "sequence", 2);
3013
- __decorateClass([
3014
- BinaryField("u8", 8)
3015
- ], YGOProMsgSelectEffectYn.prototype, "position", 2);
3016
- __decorateClass([
3017
- BinaryField("i32", 9)
3018
- ], YGOProMsgSelectEffectYn.prototype, "desc", 2);
3019
-
3020
- // src/protos/msg/proto/select-idlecmd.ts
3021
- var IdleCmdType = /* @__PURE__ */ ((IdleCmdType2) => {
3022
- IdleCmdType2[IdleCmdType2["SUMMON"] = 0] = "SUMMON";
3023
- IdleCmdType2[IdleCmdType2["SPSUMMON"] = 1] = "SPSUMMON";
3024
- IdleCmdType2[IdleCmdType2["REPOS"] = 2] = "REPOS";
3025
- IdleCmdType2[IdleCmdType2["MSET"] = 3] = "MSET";
3026
- IdleCmdType2[IdleCmdType2["SSET"] = 4] = "SSET";
3027
- IdleCmdType2[IdleCmdType2["ACTIVATE"] = 5] = "ACTIVATE";
3028
- IdleCmdType2[IdleCmdType2["TO_BP"] = 6] = "TO_BP";
3029
- IdleCmdType2[IdleCmdType2["TO_EP"] = 7] = "TO_EP";
3030
- IdleCmdType2[IdleCmdType2["SHUFFLE"] = 8] = "SHUFFLE";
3031
- return IdleCmdType2;
3032
- })(IdleCmdType || {});
3033
- var YGOProMsgSelectIdleCmd_SimpleCardInfo = class {
3034
- };
3035
- __decorateClass([
3036
- BinaryField("i32", 0)
3037
- ], YGOProMsgSelectIdleCmd_SimpleCardInfo.prototype, "code", 2);
3038
- __decorateClass([
3039
- BinaryField("u8", 4)
3040
- ], YGOProMsgSelectIdleCmd_SimpleCardInfo.prototype, "controller", 2);
3041
- __decorateClass([
3042
- BinaryField("u8", 5)
3043
- ], YGOProMsgSelectIdleCmd_SimpleCardInfo.prototype, "location", 2);
3044
- __decorateClass([
3045
- BinaryField("u8", 6)
3046
- ], YGOProMsgSelectIdleCmd_SimpleCardInfo.prototype, "sequence", 2);
3047
- var YGOProMsgSelectIdleCmd_ActivatableInfo = class {
3048
- };
3049
- __decorateClass([
3050
- BinaryField("i32", 0)
3051
- ], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "code", 2);
3052
- __decorateClass([
3053
- BinaryField("u8", 4)
3054
- ], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "controller", 2);
3055
- __decorateClass([
3056
- BinaryField("u8", 5)
3057
- ], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "location", 2);
3058
- __decorateClass([
3059
- BinaryField("u8", 6)
3060
- ], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "sequence", 2);
3061
- __decorateClass([
3062
- BinaryField("i32", 7)
3063
- ], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "desc", 2);
3064
- var YGOProMsgSelectIdleCmd = class extends YGOProMsgResponseBase {
3065
- static {
3066
- this.identifier = OcgcoreCommonConstants.MSG_SELECT_IDLECMD;
3067
- }
3068
- prepareResponse(type, option) {
3069
- let sequence;
3070
- if (type === 0 /* SUMMON */ || type === 1 /* SPSUMMON */ || type === 2 /* REPOS */ || type === 3 /* MSET */ || type === 4 /* SSET */ || type === 5 /* ACTIVATE */) {
3071
- if (option == null) {
3072
- throw new TypeError(`Option required for ${IdleCmdType[type]}`);
3073
- }
3074
- let cards;
3075
- let maxCount;
3076
- let typeName;
3077
- if (type === 0 /* SUMMON */) {
3078
- cards = this.summonableCards;
3079
- maxCount = this.summonableCount;
3080
- typeName = "Summonable";
3081
- } else if (type === 1 /* SPSUMMON */) {
3082
- cards = this.spSummonableCards;
3083
- maxCount = this.spSummonableCount;
3084
- typeName = "Special summonable";
3085
- } else if (type === 2 /* REPOS */) {
3086
- cards = this.reposableCards;
3087
- maxCount = this.reposableCount;
3088
- typeName = "Repositionable";
3089
- } else if (type === 3 /* MSET */) {
3090
- cards = this.msetableCards;
3091
- maxCount = this.msetableCount;
3092
- typeName = "Monster settable";
3093
- } else if (type === 4 /* SSET */) {
3094
- cards = this.ssetableCards;
3095
- maxCount = this.ssetableCount;
3096
- typeName = "Spell/Trap settable";
3097
- } else {
3098
- cards = this.activatableCards;
3099
- maxCount = this.activatableCount;
3100
- typeName = "Activatable";
3101
- }
3102
- if (isIndexResponse(option)) {
3103
- sequence = option.index;
3104
- if (sequence < 0 || sequence >= maxCount) {
3105
- throw new TypeError(`Index out of range: ${sequence}`);
3106
- }
3107
- } else {
3108
- const idx = cards.findIndex(
3109
- (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)
3110
- );
3111
- if (idx === -1) {
3112
- throw new TypeError(`${typeName} card not found`);
3113
- }
3114
- sequence = idx;
3115
- }
3116
- } else if (type === 6 /* TO_BP */) {
3117
- if (this.canBp === 0) {
3118
- throw new TypeError("Cannot go to BP");
3119
- }
3120
- sequence = 0;
3121
- } else if (type === 7 /* TO_EP */) {
3122
- if (this.canEp === 0) {
3123
- throw new TypeError("Cannot go to EP");
3124
- }
3125
- sequence = 0;
3126
- } else if (type === 8 /* SHUFFLE */) {
3127
- if (this.canShuffle === 0) {
3128
- throw new TypeError("Cannot shuffle");
3129
- }
3130
- sequence = 0;
3131
- } else {
3132
- throw new TypeError(`Unknown type: ${type}`);
3133
- }
3134
- const buffer = new Uint8Array(4);
3135
- const view = new DataView(buffer.buffer);
3136
- view.setUint32(0, sequence << 16 | type, true);
3137
- return buffer;
3138
- }
3139
- };
3140
- __decorateClass([
3141
- BinaryField("u8", 0)
3142
- ], YGOProMsgSelectIdleCmd.prototype, "player", 2);
3143
- __decorateClass([
3144
- BinaryField("u8", 1)
3145
- ], YGOProMsgSelectIdleCmd.prototype, "summonableCount", 2);
3146
- __decorateClass([
3147
- BinaryField(
3148
- () => YGOProMsgSelectIdleCmd_SimpleCardInfo,
3149
- 2,
3150
- (obj) => obj.summonableCount
3151
- )
3152
- ], YGOProMsgSelectIdleCmd.prototype, "summonableCards", 2);
3153
- __decorateClass([
3154
- BinaryField("u8", (obj) => 2 + obj.summonableCount * 7)
3155
- ], YGOProMsgSelectIdleCmd.prototype, "spSummonableCount", 2);
3156
- __decorateClass([
3157
- BinaryField(
3158
- () => YGOProMsgSelectIdleCmd_SimpleCardInfo,
3159
- (obj) => 3 + obj.summonableCount * 7,
3160
- (obj) => obj.spSummonableCount
3161
- )
3162
- ], YGOProMsgSelectIdleCmd.prototype, "spSummonableCards", 2);
3163
- __decorateClass([
3164
- BinaryField(
3165
- "u8",
3166
- (obj) => 3 + obj.summonableCount * 7 + obj.spSummonableCount * 7
3167
- )
3168
- ], YGOProMsgSelectIdleCmd.prototype, "reposableCount", 2);
3169
- __decorateClass([
3170
- BinaryField(
3171
- () => YGOProMsgSelectIdleCmd_SimpleCardInfo,
3172
- (obj) => 4 + obj.summonableCount * 7 + obj.spSummonableCount * 7,
3173
- (obj) => obj.reposableCount
3174
- )
3175
- ], YGOProMsgSelectIdleCmd.prototype, "reposableCards", 2);
3176
- __decorateClass([
3177
- BinaryField(
3178
- "u8",
3179
- (obj) => 4 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7
3180
- )
3181
- ], YGOProMsgSelectIdleCmd.prototype, "msetableCount", 2);
3182
- __decorateClass([
3183
- BinaryField(
3184
- () => YGOProMsgSelectIdleCmd_SimpleCardInfo,
3185
- (obj) => 5 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7,
3186
- (obj) => obj.msetableCount
3187
- )
3188
- ], YGOProMsgSelectIdleCmd.prototype, "msetableCards", 2);
3189
- __decorateClass([
3190
- BinaryField(
3191
- "u8",
3192
- (obj) => 5 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7
3193
- )
3194
- ], YGOProMsgSelectIdleCmd.prototype, "ssetableCount", 2);
3195
- __decorateClass([
3196
- BinaryField(
3197
- () => YGOProMsgSelectIdleCmd_SimpleCardInfo,
3198
- (obj) => 6 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7,
3199
- (obj) => obj.ssetableCount
3200
- )
3201
- ], YGOProMsgSelectIdleCmd.prototype, "ssetableCards", 2);
3202
- __decorateClass([
3203
- BinaryField(
3204
- "u8",
3205
- (obj) => 6 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7 + obj.ssetableCount * 7
3206
- )
3207
- ], YGOProMsgSelectIdleCmd.prototype, "activatableCount", 2);
3208
- __decorateClass([
3209
- BinaryField(
3210
- () => YGOProMsgSelectIdleCmd_ActivatableInfo,
3211
- (obj) => 7 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7 + obj.ssetableCount * 7,
3212
- (obj) => obj.activatableCount
3213
- )
3214
- ], YGOProMsgSelectIdleCmd.prototype, "activatableCards", 2);
3215
- __decorateClass([
3216
- BinaryField(
3217
- "u8",
3218
- (obj) => 7 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7 + obj.ssetableCount * 7 + obj.activatableCount * 11
3219
- )
3220
- ], YGOProMsgSelectIdleCmd.prototype, "canBp", 2);
3221
- __decorateClass([
3222
- BinaryField(
3223
- "u8",
3224
- (obj) => 8 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7 + obj.ssetableCount * 7 + obj.activatableCount * 11
3225
- )
3226
- ], YGOProMsgSelectIdleCmd.prototype, "canEp", 2);
3227
- __decorateClass([
3228
- BinaryField(
3229
- "u8",
3230
- (obj) => 9 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7 + obj.ssetableCount * 7 + obj.activatableCount * 11
3231
- )
3232
- ], YGOProMsgSelectIdleCmd.prototype, "canShuffle", 2);
3233
-
3234
- // src/protos/msg/proto/select-option.ts
3235
- var YGOProMsgSelectOption = class extends YGOProMsgResponseBase {
3236
- static {
3237
- this.identifier = OcgcoreCommonConstants.MSG_SELECT_OPTION;
3238
- }
3239
- prepareResponse(option) {
3240
- let index;
3241
- if (isIndexResponse(option)) {
3242
- index = option.index;
3243
- if (index < 0 || index >= this.count) {
3244
- throw new TypeError(`Index out of range: ${index}`);
3245
- }
3246
- } else {
3247
- index = this.options.indexOf(option);
3248
- if (index === -1) {
3249
- throw new TypeError(`Option not found: ${option}`);
3250
- }
3251
- }
3252
- const buffer = new Uint8Array(4);
3253
- const view = new DataView(buffer.buffer);
3254
- view.setInt32(0, index, true);
3255
- return buffer;
3256
- }
3257
- };
3258
- __decorateClass([
3259
- BinaryField("u8", 0)
3260
- ], YGOProMsgSelectOption.prototype, "player", 2);
3261
- __decorateClass([
3262
- BinaryField("u8", 1)
3263
- ], YGOProMsgSelectOption.prototype, "count", 2);
3264
- __decorateClass([
3265
- BinaryField("i32", 2, (obj) => obj.count)
3266
- ], YGOProMsgSelectOption.prototype, "options", 2);
3267
-
3268
- // src/protos/msg/proto/select-place.ts
3269
- var YGOProMsgSelectPlace = class extends YGOProMsgResponseBase {
3270
- static {
3271
- this.identifier = OcgcoreCommonConstants.MSG_SELECT_PLACE;
3272
- }
3273
- prepareResponse(places) {
3274
- const buffer = new Uint8Array(places.length * 3);
3275
- places.forEach((place, i) => {
3276
- buffer[i * 3] = place.player;
3277
- buffer[i * 3 + 1] = place.location;
3278
- buffer[i * 3 + 2] = place.sequence;
3279
- });
3280
- return buffer;
3281
- }
3282
- };
3283
- __decorateClass([
3284
- BinaryField("u8", 0)
3285
- ], YGOProMsgSelectPlace.prototype, "player", 2);
3286
- __decorateClass([
3287
- BinaryField("u8", 1)
3288
- ], YGOProMsgSelectPlace.prototype, "count", 2);
3289
- __decorateClass([
3290
- BinaryField("u32", 2)
3291
- ], YGOProMsgSelectPlace.prototype, "flag", 2);
3292
-
3293
- // src/protos/msg/proto/select-position.ts
3294
- var YGOProMsgSelectPosition = class extends YGOProMsgResponseBase {
3295
- static {
3296
- this.identifier = OcgcoreCommonConstants.MSG_SELECT_POSITION;
3297
- }
3298
- prepareResponse(position) {
3299
- const buffer = new Uint8Array(4);
3300
- const view = new DataView(buffer.buffer);
3301
- view.setInt32(0, position, true);
3302
- return buffer;
3303
- }
3304
- };
3305
- __decorateClass([
3306
- BinaryField("u8", 0)
3307
- ], YGOProMsgSelectPosition.prototype, "player", 2);
3308
- __decorateClass([
3309
- BinaryField("i32", 1)
3310
- ], YGOProMsgSelectPosition.prototype, "code", 2);
3311
- __decorateClass([
3312
- BinaryField("u8", 5)
3313
- ], YGOProMsgSelectPosition.prototype, "positions", 2);
3314
-
3315
- // src/protos/msg/proto/select-sum.ts
3316
- var YGOProMsgSelectSum_CardInfo = class {
3317
- };
3318
- __decorateClass([
3319
- BinaryField("i32", 0)
3320
- ], YGOProMsgSelectSum_CardInfo.prototype, "code", 2);
3321
- __decorateClass([
3322
- BinaryField("u8", 4)
3323
- ], YGOProMsgSelectSum_CardInfo.prototype, "controller", 2);
3324
- __decorateClass([
3325
- BinaryField("u8", 5)
3326
- ], YGOProMsgSelectSum_CardInfo.prototype, "location", 2);
3327
- __decorateClass([
3328
- BinaryField("u8", 6)
3329
- ], YGOProMsgSelectSum_CardInfo.prototype, "sequence", 2);
3330
- __decorateClass([
3331
- BinaryField("i32", 7)
3332
- ], YGOProMsgSelectSum_CardInfo.prototype, "opParam", 2);
3333
- var YGOProMsgSelectSum = class extends YGOProMsgResponseBase {
3334
- static {
3335
- this.identifier = OcgcoreCommonConstants.MSG_SELECT_SUM;
3336
- }
3337
- prepareResponse(cardOptions) {
3338
- const indices = [];
3339
- for (const option of cardOptions) {
3340
- let index;
3341
- if (isIndexResponse(option)) {
3342
- index = option.index;
3343
- if (index < 0 || index >= this.count) {
3344
- throw new TypeError(`Index out of range: ${index}`);
3345
- }
3346
- } else {
3347
- index = this.cards.findIndex(
3348
- (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)
3349
- );
3350
- if (index === -1) {
3351
- throw new TypeError("Card not found");
3352
- }
3353
- }
3354
- indices.push(index);
3355
- }
3356
- const buffer = new Uint8Array(1 + indices.length);
3357
- buffer[0] = this.mustSelectCount + indices.length;
3358
- indices.forEach((idx, i) => {
3359
- buffer[1 + i] = idx;
3360
- });
3361
- return buffer;
3362
- }
3363
- };
3364
- __decorateClass([
3365
- BinaryField("u8", 0)
3366
- ], YGOProMsgSelectSum.prototype, "mode", 2);
3367
- __decorateClass([
3368
- BinaryField("u8", 1)
3369
- ], YGOProMsgSelectSum.prototype, "player", 2);
3370
- __decorateClass([
3371
- BinaryField("i32", 2)
3372
- ], YGOProMsgSelectSum.prototype, "sumVal", 2);
3373
- __decorateClass([
3374
- BinaryField("u8", 6)
3375
- ], YGOProMsgSelectSum.prototype, "min", 2);
3376
- __decorateClass([
3377
- BinaryField("u8", 7)
3378
- ], YGOProMsgSelectSum.prototype, "max", 2);
3379
- __decorateClass([
3380
- BinaryField("u8", 8)
3381
- ], YGOProMsgSelectSum.prototype, "mustSelectCount", 2);
3382
- __decorateClass([
3383
- BinaryField(
3384
- () => YGOProMsgSelectSum_CardInfo,
3385
- 9,
3386
- (obj) => obj.mustSelectCount
3387
- )
3388
- ], YGOProMsgSelectSum.prototype, "mustSelectCards", 2);
3389
- __decorateClass([
3390
- BinaryField("u8", (obj) => {
3391
- return 9 + obj.mustSelectCount * 11;
3392
- })
3393
- ], YGOProMsgSelectSum.prototype, "count", 2);
3394
- __decorateClass([
3395
- BinaryField(
3396
- () => YGOProMsgSelectSum_CardInfo,
3397
- (obj) => {
3398
- return 10 + obj.mustSelectCount * 11;
3399
- },
3400
- (obj) => obj.count
3401
- )
3402
- ], YGOProMsgSelectSum.prototype, "cards", 2);
3403
-
3404
- // src/protos/msg/proto/select-tribute.ts
3405
- var YGOProMsgSelectTribute_CardInfo = class {
3406
- };
3407
- __decorateClass([
3408
- BinaryField("i32", 0)
3409
- ], YGOProMsgSelectTribute_CardInfo.prototype, "code", 2);
3410
- __decorateClass([
3411
- BinaryField("u8", 4)
3412
- ], YGOProMsgSelectTribute_CardInfo.prototype, "controller", 2);
3413
- __decorateClass([
3414
- BinaryField("u8", 5)
3415
- ], YGOProMsgSelectTribute_CardInfo.prototype, "location", 2);
3416
- __decorateClass([
3417
- BinaryField("u8", 6)
3418
- ], YGOProMsgSelectTribute_CardInfo.prototype, "sequence", 2);
3419
- __decorateClass([
3420
- BinaryField("u8", 7)
3421
- ], YGOProMsgSelectTribute_CardInfo.prototype, "releaseParam", 2);
3422
- var YGOProMsgSelectTribute = class extends YGOProMsgResponseBase {
3423
- static {
3424
- this.identifier = OcgcoreCommonConstants.MSG_SELECT_TRIBUTE;
3425
- }
3426
- defaultResponse() {
3427
- if (this.cancelable === 0) {
3428
- return void 0;
3429
- }
3430
- return this.prepareResponse(null);
3431
- }
3432
- prepareResponse(cardOptions) {
3433
- if (cardOptions == null) {
3434
- const buffer2 = new Uint8Array(4);
3435
- const view = new DataView(buffer2.buffer);
3436
- view.setInt32(0, -1, true);
3437
- return buffer2;
3438
- }
3439
- const indices = [];
3440
- for (const option of cardOptions) {
3441
- let index;
3442
- if (isIndexResponse(option)) {
3443
- index = option.index;
3444
- if (index < 0 || index >= this.count) {
3445
- throw new TypeError(`Index out of range: ${index}`);
3446
- }
3447
- } else {
3448
- index = this.cards.findIndex(
3449
- (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)
3450
- );
3451
- if (index === -1) {
3452
- throw new TypeError("Card not found");
3453
- }
3454
- }
3455
- indices.push(index);
3456
- }
3457
- const buffer = new Uint8Array(1 + indices.length);
3458
- buffer[0] = indices.length;
3459
- indices.forEach((idx, i) => {
3460
- buffer[1 + i] = idx;
3461
- });
3462
- return buffer;
3463
- }
3464
- };
3465
- __decorateClass([
3466
- BinaryField("u8", 0)
3467
- ], YGOProMsgSelectTribute.prototype, "player", 2);
3468
- __decorateClass([
3469
- BinaryField("u8", 1)
3470
- ], YGOProMsgSelectTribute.prototype, "cancelable", 2);
3471
- __decorateClass([
3472
- BinaryField("u8", 2)
3473
- ], YGOProMsgSelectTribute.prototype, "min", 2);
3474
- __decorateClass([
3475
- BinaryField("u8", 3)
3476
- ], YGOProMsgSelectTribute.prototype, "max", 2);
3477
- __decorateClass([
3478
- BinaryField("u8", 4)
3479
- ], YGOProMsgSelectTribute.prototype, "count", 2);
3480
- __decorateClass([
3481
- BinaryField(() => YGOProMsgSelectTribute_CardInfo, 5, (obj) => obj.count)
3482
- ], YGOProMsgSelectTribute.prototype, "cards", 2);
3483
-
3484
- // src/protos/msg/proto/select-unselect-card.ts
3485
- var YGOProMsgSelectUnselectCard_CardInfo = class {
3486
- };
3487
- __decorateClass([
3488
- BinaryField("i32", 0)
3489
- ], YGOProMsgSelectUnselectCard_CardInfo.prototype, "code", 2);
3490
- __decorateClass([
3491
- BinaryField("u8", 4)
3492
- ], YGOProMsgSelectUnselectCard_CardInfo.prototype, "controller", 2);
3493
- __decorateClass([
3494
- BinaryField("u8", 5)
3495
- ], YGOProMsgSelectUnselectCard_CardInfo.prototype, "location", 2);
3496
- __decorateClass([
3497
- BinaryField("u8", 6)
3498
- ], YGOProMsgSelectUnselectCard_CardInfo.prototype, "sequence", 2);
3499
- __decorateClass([
3500
- BinaryField("u8", 7)
3501
- ], YGOProMsgSelectUnselectCard_CardInfo.prototype, "subsequence", 2);
3502
- var YGOProMsgSelectUnselectCard = class extends YGOProMsgResponseBase {
3503
- static {
3504
- this.identifier = OcgcoreCommonConstants.MSG_SELECT_UNSELECT_CARD;
3505
- }
3506
- defaultResponse() {
3507
- if (this.cancelable === 0 && this.finishable === 0) {
3508
- return void 0;
3509
- }
3510
- return this.prepareResponse(null);
3511
- }
3512
- prepareResponse(cardOption) {
3513
- if (cardOption == null) {
3514
- const buffer2 = new Uint8Array(4);
3515
- const view = new DataView(buffer2.buffer);
3516
- view.setInt32(0, -1, true);
3517
- return buffer2;
3518
- }
3519
- let index;
3520
- if (isIndexResponse(cardOption)) {
3521
- index = cardOption.index;
3522
- const totalCount = this.selectableCount + this.unselectableCount;
3523
- if (index < 0 || index >= totalCount) {
3524
- throw new TypeError(`Index out of range: ${index}`);
3525
- }
3526
- } else {
3527
- index = this.selectableCards.findIndex(
3528
- (card) => (cardOption.code == null || card.code === cardOption.code) && (cardOption.controller == null || card.controller === cardOption.controller) && (cardOption.location == null || card.location === cardOption.location) && (cardOption.sequence == null || card.sequence === cardOption.sequence)
3529
- );
3530
- if (index === -1) {
3531
- const unselectIndex = this.unselectableCards.findIndex(
3532
- (card) => (cardOption.code == null || card.code === cardOption.code) && (cardOption.controller == null || card.controller === cardOption.controller) && (cardOption.location == null || card.location === cardOption.location) && (cardOption.sequence == null || card.sequence === cardOption.sequence)
3533
- );
3534
- if (unselectIndex === -1) {
3535
- throw new TypeError("Card not found");
3536
- }
3537
- index = this.selectableCount + unselectIndex;
3538
- }
3539
- }
3540
- const buffer = new Uint8Array(2);
3541
- buffer[0] = 1;
3542
- buffer[1] = index;
3543
- return buffer;
3544
- }
3545
- };
3546
- __decorateClass([
3547
- BinaryField("u8", 0)
3548
- ], YGOProMsgSelectUnselectCard.prototype, "player", 2);
3549
- __decorateClass([
3550
- BinaryField("u8", 1)
3551
- ], YGOProMsgSelectUnselectCard.prototype, "finishable", 2);
3552
- __decorateClass([
3553
- BinaryField("u8", 2)
3554
- ], YGOProMsgSelectUnselectCard.prototype, "cancelable", 2);
3555
- __decorateClass([
3556
- BinaryField("u8", 3)
3557
- ], YGOProMsgSelectUnselectCard.prototype, "min", 2);
3558
- __decorateClass([
3559
- BinaryField("u8", 4)
3560
- ], YGOProMsgSelectUnselectCard.prototype, "max", 2);
3561
- __decorateClass([
3562
- BinaryField("u8", 5)
3563
- ], YGOProMsgSelectUnselectCard.prototype, "selectableCount", 2);
3564
- __decorateClass([
3565
- BinaryField(
3566
- () => YGOProMsgSelectUnselectCard_CardInfo,
3567
- 6,
3568
- (obj) => obj.selectableCount
3569
- )
3570
- ], YGOProMsgSelectUnselectCard.prototype, "selectableCards", 2);
3571
- __decorateClass([
3572
- BinaryField("u8", (obj) => {
3573
- return 6 + obj.selectableCount * 8;
3574
- })
3575
- ], YGOProMsgSelectUnselectCard.prototype, "unselectableCount", 2);
3576
- __decorateClass([
3577
- BinaryField(
3578
- () => YGOProMsgSelectUnselectCard_CardInfo,
3579
- (obj) => {
3580
- return 7 + obj.selectableCount * 8;
3581
- },
3582
- (obj) => obj.unselectableCount
3583
- )
3584
- ], YGOProMsgSelectUnselectCard.prototype, "unselectableCards", 2);
3585
-
3586
- // src/protos/msg/proto/select-yesno.ts
3587
- var YGOProMsgSelectYesNo = class extends YGOProMsgResponseBase {
3588
- static {
3589
- this.identifier = OcgcoreCommonConstants.MSG_SELECT_YESNO;
3590
- }
3591
- defaultResponse() {
3592
- return this.prepareResponse(false);
3593
- }
3594
- prepareResponse(yes) {
3595
- const buffer = new Uint8Array(4);
3596
- const view = new DataView(buffer.buffer);
3597
- view.setInt32(0, yes ? 1 : 0, true);
3598
- return buffer;
3599
- }
3600
- };
3601
- __decorateClass([
3602
- BinaryField("u8", 0)
3603
- ], YGOProMsgSelectYesNo.prototype, "player", 2);
3604
- __decorateClass([
3605
- BinaryField("i32", 1)
3606
- ], YGOProMsgSelectYesNo.prototype, "desc", 2);
3607
-
3608
- // src/protos/msg/proto/set.ts
3609
- var YGOProMsgSet = class extends YGOProMsgBase {
3610
- static {
3611
- this.identifier = OcgcoreCommonConstants.MSG_SET;
3612
- }
3613
- };
3614
- __decorateClass([
3615
- BinaryField("i32", 0)
3616
- ], YGOProMsgSet.prototype, "code", 2);
3617
-
3618
- // src/protos/msg/proto/shuffle-deck.ts
3619
- var YGOProMsgShuffleDeck = class extends YGOProMsgBase {
3620
- static {
3621
- this.identifier = OcgcoreCommonConstants.MSG_SHUFFLE_DECK;
3622
- }
3623
- };
3624
- __decorateClass([
3625
- BinaryField("u8", 0)
3626
- ], YGOProMsgShuffleDeck.prototype, "player", 2);
3627
-
3628
- // src/protos/msg/proto/shuffle-extra.ts
3629
- var YGOProMsgShuffleExtra = class extends YGOProMsgBase {
3630
- static {
3631
- this.identifier = OcgcoreCommonConstants.MSG_SHUFFLE_EXTRA;
3632
- }
3633
- // 对方视角需要隐藏额外卡组信息
3634
- opponentView() {
3635
- const view = this.copy();
3636
- view.cards = view.cards.map((card) => {
3637
- if (!(card & 2147483648)) {
3638
- return 0;
3639
- }
3640
- return card;
3641
- });
3642
- return view;
3643
- }
3644
- };
3645
- __decorateClass([
3646
- BinaryField("u8", 0)
3647
- ], YGOProMsgShuffleExtra.prototype, "player", 2);
3648
- __decorateClass([
3649
- BinaryField("u8", 1)
3650
- ], YGOProMsgShuffleExtra.prototype, "count", 2);
3651
- __decorateClass([
3652
- BinaryField("i32", 2, (obj) => obj.count)
3653
- ], YGOProMsgShuffleExtra.prototype, "cards", 2);
3654
-
3655
- // src/protos/msg/proto/shuffle-hand.ts
3656
- var YGOProMsgShuffleHand = class extends YGOProMsgBase {
3657
- static {
3658
- this.identifier = OcgcoreCommonConstants.MSG_SHUFFLE_HAND;
3659
- }
3660
- // 对方视角需要隐藏手牌信息
3661
- opponentView() {
3662
- const view = this.copy();
3663
- view.cards = view.cards.map(() => 0);
3664
- return view;
3665
- }
3666
- };
3667
- __decorateClass([
3668
- BinaryField("u8", 0)
3669
- ], YGOProMsgShuffleHand.prototype, "player", 2);
3670
- __decorateClass([
3671
- BinaryField("u8", 1)
3672
- ], YGOProMsgShuffleHand.prototype, "count", 2);
3673
- __decorateClass([
3674
- BinaryField("i32", 2, (obj) => obj.count)
3675
- ], YGOProMsgShuffleHand.prototype, "cards", 2);
3676
-
3677
- // src/protos/msg/proto/shuffle-set-card.ts
3678
- var YGOProMsgShuffleSetCard_CardLocation = class {
3679
- };
3680
- __decorateClass([
3681
- BinaryField("u8", 0)
3682
- ], YGOProMsgShuffleSetCard_CardLocation.prototype, "controller", 2);
3683
- __decorateClass([
3684
- BinaryField("u8", 1)
3685
- ], YGOProMsgShuffleSetCard_CardLocation.prototype, "location", 2);
3686
- __decorateClass([
3687
- BinaryField("u8", 2)
3688
- ], YGOProMsgShuffleSetCard_CardLocation.prototype, "sequence", 2);
3689
- __decorateClass([
3690
- BinaryField("u8", 3)
3691
- ], YGOProMsgShuffleSetCard_CardLocation.prototype, "position", 2);
3692
- var YGOProMsgShuffleSetCard_SetCardInfo = class {
3693
- };
3694
- __decorateClass([
3695
- BinaryField(() => YGOProMsgShuffleSetCard_CardLocation, 0)
3696
- ], YGOProMsgShuffleSetCard_SetCardInfo.prototype, "oldLocation", 2);
3697
- __decorateClass([
3698
- BinaryField(() => YGOProMsgShuffleSetCard_CardLocation, 4)
3699
- ], YGOProMsgShuffleSetCard_SetCardInfo.prototype, "newLocation", 2);
3700
- var YGOProMsgShuffleSetCard = class extends YGOProMsgBase {
3701
- static {
3702
- this.identifier = OcgcoreCommonConstants.MSG_SHUFFLE_SET_CARD;
3703
- }
3704
- };
3705
- __decorateClass([
3706
- BinaryField("u8", 0)
3707
- ], YGOProMsgShuffleSetCard.prototype, "location", 2);
3708
- __decorateClass([
3709
- BinaryField("u8", 1)
3710
- ], YGOProMsgShuffleSetCard.prototype, "count", 2);
3711
- __decorateClass([
3712
- BinaryField(() => YGOProMsgShuffleSetCard_SetCardInfo, 2, (obj) => obj.count)
3713
- ], YGOProMsgShuffleSetCard.prototype, "cards", 2);
3714
-
3715
- // src/protos/msg/proto/sort-card.ts
3716
- var YGOProMsgSortCard_CardInfo = class {
3717
- };
3718
- __decorateClass([
3719
- BinaryField("i32", 0)
3720
- ], YGOProMsgSortCard_CardInfo.prototype, "code", 2);
3721
- __decorateClass([
3722
- BinaryField("u8", 4)
3723
- ], YGOProMsgSortCard_CardInfo.prototype, "controller", 2);
3724
- __decorateClass([
3725
- BinaryField("u8", 5)
3726
- ], YGOProMsgSortCard_CardInfo.prototype, "location", 2);
3727
- __decorateClass([
3728
- BinaryField("u8", 6)
3729
- ], YGOProMsgSortCard_CardInfo.prototype, "sequence", 2);
3730
- var YGOProMsgSortCard = class extends YGOProMsgResponseBase {
3731
- static {
3732
- this.identifier = OcgcoreCommonConstants.MSG_SORT_CARD;
3733
- }
3734
- defaultResponse() {
3735
- return this.prepareResponse(null);
3736
- }
3737
- prepareResponse(sortedOptions) {
3738
- if (sortedOptions == null) {
3739
- return new Uint8Array([255]);
3740
- }
3741
- const indices = [];
3742
- for (const option of sortedOptions) {
3743
- let index;
3744
- if (isIndexResponse(option)) {
3745
- index = option.index;
3746
- if (index < 0 || index >= this.count) {
3747
- throw new TypeError(`Index out of range: ${index}`);
3748
- }
3749
- } else {
3750
- index = this.cards.findIndex(
3751
- (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)
3752
- );
3753
- if (index === -1) {
3754
- throw new TypeError("Card not found");
3755
- }
3756
- }
3757
- indices.push(index);
3758
- }
3759
- const buffer = new Uint8Array(indices.length);
3760
- indices.forEach((idx, i) => {
3761
- buffer[i] = idx;
3762
- });
3763
- return buffer;
3764
- }
3765
- };
3766
- __decorateClass([
3767
- BinaryField("u8", 0)
3768
- ], YGOProMsgSortCard.prototype, "player", 2);
3769
- __decorateClass([
3770
- BinaryField("u8", 1)
3771
- ], YGOProMsgSortCard.prototype, "count", 2);
3772
- __decorateClass([
3773
- BinaryField(() => YGOProMsgSortCard_CardInfo, 2, (obj) => obj.count)
3774
- ], YGOProMsgSortCard.prototype, "cards", 2);
3775
-
3776
- // src/protos/msg/proto/spsummoned.ts
3777
- var YGOProMsgSpSummoned = class extends YGOProMsgBase {
3778
- static {
3779
- this.identifier = OcgcoreCommonConstants.MSG_SPSUMMONED;
3780
- }
3781
- };
3782
-
3783
- // src/protos/msg/proto/spsummoning.ts
3784
- var YGOProMsgSpSummoning = class extends YGOProMsgBase {
3785
- static {
3786
- this.identifier = OcgcoreCommonConstants.MSG_SPSUMMONING;
3787
- }
3788
- };
3789
- __decorateClass([
3790
- BinaryField("i32", 0)
3791
- ], YGOProMsgSpSummoning.prototype, "code", 2);
3792
- __decorateClass([
3793
- BinaryField("u8", 4)
3794
- ], YGOProMsgSpSummoning.prototype, "controller", 2);
3795
- __decorateClass([
3796
- BinaryField("u8", 5)
3797
- ], YGOProMsgSpSummoning.prototype, "location", 2);
3798
- __decorateClass([
3799
- BinaryField("u8", 6)
3800
- ], YGOProMsgSpSummoning.prototype, "sequence", 2);
3801
- __decorateClass([
3802
- BinaryField("u8", 7)
3803
- ], YGOProMsgSpSummoning.prototype, "position", 2);
3804
-
3805
- // src/protos/msg/proto/start.ts
3806
- var YGOProMsgStart_PlayerInfo = class {
3807
- };
3808
- __decorateClass([
3809
- BinaryField("u16", 0)
3810
- ], YGOProMsgStart_PlayerInfo.prototype, "deckCount", 2);
3811
- __decorateClass([
3812
- BinaryField("u16", 2)
3813
- ], YGOProMsgStart_PlayerInfo.prototype, "extraCount", 2);
3814
- var YGOProMsgStart = class extends YGOProMsgBase {
3815
- static {
3816
- this.identifier = 4;
3817
- }
3818
- /**
3819
- * Get/Set player number (low 4 bits, 0-3)
3820
- */
3821
- get playerNumber() {
3822
- return this.playerType & 15;
3823
- }
3824
- set playerNumber(value) {
3825
- this.playerType = this.playerType & 240 | value & 15;
3826
- }
3827
- /**
3828
- * Get/Set observer flag (high 4 bits, 0x00 or 0x10)
3829
- */
3830
- get observerFlag() {
3831
- return this.playerType & 240;
3832
- }
3833
- set observerFlag(value) {
3834
- this.playerType = this.playerType & 15 | value & 240;
3835
- }
3836
- };
3837
- __decorateClass([
3838
- BinaryField("u8", 0)
3839
- ], YGOProMsgStart.prototype, "playerType", 2);
3840
- __decorateClass([
3841
- BinaryField("u8", 1)
3842
- ], YGOProMsgStart.prototype, "duelRule", 2);
3843
- __decorateClass([
3844
- BinaryField("i32", 2)
3845
- ], YGOProMsgStart.prototype, "startLp0", 2);
3846
- __decorateClass([
3847
- BinaryField("i32", 6)
3848
- ], YGOProMsgStart.prototype, "startLp1", 2);
3849
- __decorateClass([
3850
- BinaryField(() => YGOProMsgStart_PlayerInfo, 10)
3851
- ], YGOProMsgStart.prototype, "player0", 2);
3852
- __decorateClass([
3853
- BinaryField(() => YGOProMsgStart_PlayerInfo, 14)
3854
- ], YGOProMsgStart.prototype, "player1", 2);
3855
-
3856
- // src/protos/msg/proto/summoned.ts
3857
- var YGOProMsgSummoned = class extends YGOProMsgBase {
3858
- static {
3859
- this.identifier = OcgcoreCommonConstants.MSG_SUMMONED;
3860
- }
3861
- };
3862
-
3863
- // src/protos/msg/proto/summoning.ts
3864
- var YGOProMsgSummoning = class extends YGOProMsgBase {
3865
- static {
3866
- this.identifier = OcgcoreCommonConstants.MSG_SUMMONING;
3867
- }
3868
- };
3869
- __decorateClass([
3870
- BinaryField("i32", 0)
3871
- ], YGOProMsgSummoning.prototype, "code", 2);
3872
- __decorateClass([
3873
- BinaryField("u8", 4)
3874
- ], YGOProMsgSummoning.prototype, "controller", 2);
3875
- __decorateClass([
3876
- BinaryField("u8", 5)
3877
- ], YGOProMsgSummoning.prototype, "location", 2);
3878
- __decorateClass([
3879
- BinaryField("u8", 6)
3880
- ], YGOProMsgSummoning.prototype, "sequence", 2);
3881
- __decorateClass([
3882
- BinaryField("u8", 7)
3883
- ], YGOProMsgSummoning.prototype, "position", 2);
3884
-
3885
- // src/protos/msg/proto/swap.ts
3886
- var YGOProMsgSwap_CardLocation = class {
3887
- };
3888
- __decorateClass([
3889
- BinaryField("u8", 0)
3890
- ], YGOProMsgSwap_CardLocation.prototype, "controller", 2);
3891
- __decorateClass([
3892
- BinaryField("u8", 1)
3893
- ], YGOProMsgSwap_CardLocation.prototype, "location", 2);
3894
- __decorateClass([
3895
- BinaryField("u8", 2)
3896
- ], YGOProMsgSwap_CardLocation.prototype, "sequence", 2);
3897
- __decorateClass([
3898
- BinaryField("u8", 3)
3899
- ], YGOProMsgSwap_CardLocation.prototype, "position", 2);
3900
- var YGOProMsgSwap = class extends YGOProMsgBase {
3901
- static {
3902
- this.identifier = OcgcoreCommonConstants.MSG_SWAP;
3903
- }
3904
- };
3905
- __decorateClass([
3906
- BinaryField(() => YGOProMsgSwap_CardLocation, 0)
3907
- ], YGOProMsgSwap.prototype, "card1", 2);
3908
- __decorateClass([
3909
- BinaryField(() => YGOProMsgSwap_CardLocation, 4)
3910
- ], YGOProMsgSwap.prototype, "card2", 2);
3911
-
3912
- // src/protos/msg/proto/swap-grave-deck.ts
3913
- var YGOProMsgSwapGraveDeck = class extends YGOProMsgBase {
3914
- static {
3915
- this.identifier = OcgcoreCommonConstants.MSG_SWAP_GRAVE_DECK;
3916
- }
3917
- };
3918
- __decorateClass([
3919
- BinaryField("u8", 0)
3920
- ], YGOProMsgSwapGraveDeck.prototype, "player", 2);
3921
-
3922
- // src/protos/msg/proto/tag-swap.ts
3923
- var YGOProMsgTagSwap = class extends YGOProMsgBase {
3924
- static {
3925
- this.identifier = OcgcoreCommonConstants.MSG_TAG_SWAP;
3926
- }
3927
- // 对方和队友视角需要隐藏手牌和额外卡组信息
3928
- opponentView() {
3929
- const view = this.copy();
3930
- view.handCards = view.handCards.map(() => 0);
3931
- view.extraCards = view.extraCards.map((card) => {
3932
- if (!(card & 2147483648)) {
3933
- return 0;
3934
- }
3935
- return card;
3936
- });
3937
- return view;
3938
- }
3939
- teammateView() {
3940
- return this.opponentView();
3941
- }
3942
- };
3943
- __decorateClass([
3944
- BinaryField("u8", 0)
3945
- ], YGOProMsgTagSwap.prototype, "player", 2);
3946
- __decorateClass([
3947
- BinaryField("u8", 1)
3948
- ], YGOProMsgTagSwap.prototype, "mzoneCount", 2);
3949
- __decorateClass([
3950
- BinaryField("u8", 2)
3951
- ], YGOProMsgTagSwap.prototype, "extraCount", 2);
3952
- __decorateClass([
3953
- BinaryField("u8", 3)
3954
- ], YGOProMsgTagSwap.prototype, "pzoneCount", 2);
3955
- __decorateClass([
3956
- BinaryField("u8", 4)
3957
- ], YGOProMsgTagSwap.prototype, "handCount", 2);
3958
- __decorateClass([
3959
- BinaryField("i32", 5, (obj) => obj.handCount)
3960
- ], YGOProMsgTagSwap.prototype, "handCards", 2);
3961
- __decorateClass([
3962
- BinaryField("i32", (obj) => 5 + obj.handCount * 4, (obj) => obj.extraCount)
3963
- ], YGOProMsgTagSwap.prototype, "extraCards", 2);
3964
- __decorateClass([
3965
- BinaryField("u32", (obj) => 5 + obj.handCount * 4 + obj.extraCount * 4)
3966
- ], YGOProMsgTagSwap.prototype, "mzoneFlags", 2);
3967
-
3968
- // src/protos/msg/proto/toss-coin.ts
3969
- var YGOProMsgTossCoin = class extends YGOProMsgBase {
3970
- static {
3971
- this.identifier = OcgcoreCommonConstants.MSG_TOSS_COIN;
3972
- }
3973
- };
3974
- __decorateClass([
3975
- BinaryField("u8", 0)
3976
- ], YGOProMsgTossCoin.prototype, "player", 2);
3977
- __decorateClass([
3978
- BinaryField("u8", 1)
3979
- ], YGOProMsgTossCoin.prototype, "count", 2);
3980
- __decorateClass([
3981
- BinaryField("u8", 2, (obj) => obj.count)
3982
- ], YGOProMsgTossCoin.prototype, "results", 2);
3983
-
3984
- // src/protos/msg/proto/toss-dice.ts
3985
- var YGOProMsgTossDice = class extends YGOProMsgBase {
3986
- static {
3987
- this.identifier = OcgcoreCommonConstants.MSG_TOSS_DICE;
3988
- }
3989
- };
3990
- __decorateClass([
3991
- BinaryField("u8", 0)
3992
- ], YGOProMsgTossDice.prototype, "player", 2);
3993
- __decorateClass([
3994
- BinaryField("u8", 1)
3995
- ], YGOProMsgTossDice.prototype, "count", 2);
3996
- __decorateClass([
3997
- BinaryField("u8", 2, (obj) => obj.count)
3998
- ], YGOProMsgTossDice.prototype, "results", 2);
3999
-
4000
2984
  // src/vendor/script-constants.ts
4001
2985
  var OcgcoreScriptConstants = {
4002
2986
  ACTIVITY_ATTACK: 5,
@@ -4835,6 +3819,1090 @@ var OcgcoreScriptConstants = {
4835
3819
  TYPE_XYZ: 8388608
4836
3820
  };
4837
3821
 
3822
+ // src/protos/msg/proto/select-place-common.ts
3823
+ var YGOProMsgSelectPlaceCommon = class extends YGOProMsgResponseBase {
3824
+ getSelectablePlaces() {
3825
+ const places = [];
3826
+ const mask = this.flag >>> 0;
3827
+ let pos = 0;
3828
+ for (const player of [this.player, 1 - this.player]) {
3829
+ for (const location of [
3830
+ OcgcoreScriptConstants.LOCATION_MZONE,
3831
+ OcgcoreScriptConstants.LOCATION_SZONE
3832
+ ]) {
3833
+ for (let sequence = 0; sequence < 8; sequence++) {
3834
+ if (!(mask & 1 << pos >>> 0)) {
3835
+ places.push({ player, location, sequence });
3836
+ }
3837
+ ++pos;
3838
+ }
3839
+ }
3840
+ }
3841
+ return places;
3842
+ }
3843
+ responsePlayer() {
3844
+ return this.player;
3845
+ }
3846
+ prepareResponse(places) {
3847
+ const buffer = new Uint8Array(places.length * 3);
3848
+ places.forEach((place, i) => {
3849
+ if (this.flag >>> 0 & 1 << (place.player === this.player ? 0 : 16) + (place.location === OcgcoreScriptConstants.LOCATION_MZONE ? 0 : 8) + place.sequence >>> 0) {
3850
+ throw new Error("Selected place is not available");
3851
+ }
3852
+ buffer[i * 3] = place.player;
3853
+ buffer[i * 3 + 1] = place.location;
3854
+ buffer[i * 3 + 2] = place.sequence;
3855
+ });
3856
+ return buffer;
3857
+ }
3858
+ };
3859
+ __decorateClass([
3860
+ BinaryField("u8", 0)
3861
+ ], YGOProMsgSelectPlaceCommon.prototype, "player", 2);
3862
+ __decorateClass([
3863
+ BinaryField("u8", 1)
3864
+ ], YGOProMsgSelectPlaceCommon.prototype, "count", 2);
3865
+ __decorateClass([
3866
+ BinaryField("u32", 2)
3867
+ ], YGOProMsgSelectPlaceCommon.prototype, "flag", 2);
3868
+
3869
+ // src/protos/msg/proto/select-disfield.ts
3870
+ var YGOProMsgSelectDisField = class extends YGOProMsgSelectPlaceCommon {
3871
+ static {
3872
+ this.identifier = OcgcoreCommonConstants.MSG_SELECT_DISFIELD;
3873
+ }
3874
+ };
3875
+
3876
+ // src/protos/msg/proto/select-effectyn.ts
3877
+ var YGOProMsgSelectEffectYn = class extends YGOProMsgResponseBase {
3878
+ static {
3879
+ this.identifier = OcgcoreCommonConstants.MSG_SELECT_EFFECTYN;
3880
+ }
3881
+ responsePlayer() {
3882
+ return this.player;
3883
+ }
3884
+ defaultResponse() {
3885
+ return this.prepareResponse(false);
3886
+ }
3887
+ prepareResponse(yes) {
3888
+ const buffer = new Uint8Array(4);
3889
+ const view = new DataView(buffer.buffer);
3890
+ view.setInt32(0, yes ? 1 : 0, true);
3891
+ return buffer;
3892
+ }
3893
+ };
3894
+ __decorateClass([
3895
+ BinaryField("u8", 0)
3896
+ ], YGOProMsgSelectEffectYn.prototype, "player", 2);
3897
+ __decorateClass([
3898
+ BinaryField("i32", 1)
3899
+ ], YGOProMsgSelectEffectYn.prototype, "code", 2);
3900
+ __decorateClass([
3901
+ BinaryField("u8", 5)
3902
+ ], YGOProMsgSelectEffectYn.prototype, "controller", 2);
3903
+ __decorateClass([
3904
+ BinaryField("u8", 6)
3905
+ ], YGOProMsgSelectEffectYn.prototype, "location", 2);
3906
+ __decorateClass([
3907
+ BinaryField("u8", 7)
3908
+ ], YGOProMsgSelectEffectYn.prototype, "sequence", 2);
3909
+ __decorateClass([
3910
+ BinaryField("u8", 8)
3911
+ ], YGOProMsgSelectEffectYn.prototype, "position", 2);
3912
+ __decorateClass([
3913
+ BinaryField("i32", 9)
3914
+ ], YGOProMsgSelectEffectYn.prototype, "desc", 2);
3915
+
3916
+ // src/protos/msg/proto/select-idlecmd.ts
3917
+ var IdleCmdType = /* @__PURE__ */ ((IdleCmdType2) => {
3918
+ IdleCmdType2[IdleCmdType2["SUMMON"] = 0] = "SUMMON";
3919
+ IdleCmdType2[IdleCmdType2["SPSUMMON"] = 1] = "SPSUMMON";
3920
+ IdleCmdType2[IdleCmdType2["REPOS"] = 2] = "REPOS";
3921
+ IdleCmdType2[IdleCmdType2["MSET"] = 3] = "MSET";
3922
+ IdleCmdType2[IdleCmdType2["SSET"] = 4] = "SSET";
3923
+ IdleCmdType2[IdleCmdType2["ACTIVATE"] = 5] = "ACTIVATE";
3924
+ IdleCmdType2[IdleCmdType2["TO_BP"] = 6] = "TO_BP";
3925
+ IdleCmdType2[IdleCmdType2["TO_EP"] = 7] = "TO_EP";
3926
+ IdleCmdType2[IdleCmdType2["SHUFFLE"] = 8] = "SHUFFLE";
3927
+ return IdleCmdType2;
3928
+ })(IdleCmdType || {});
3929
+ var YGOProMsgSelectIdleCmd_SimpleCardInfo = class {
3930
+ };
3931
+ __decorateClass([
3932
+ BinaryField("i32", 0)
3933
+ ], YGOProMsgSelectIdleCmd_SimpleCardInfo.prototype, "code", 2);
3934
+ __decorateClass([
3935
+ BinaryField("u8", 4)
3936
+ ], YGOProMsgSelectIdleCmd_SimpleCardInfo.prototype, "controller", 2);
3937
+ __decorateClass([
3938
+ BinaryField("u8", 5)
3939
+ ], YGOProMsgSelectIdleCmd_SimpleCardInfo.prototype, "location", 2);
3940
+ __decorateClass([
3941
+ BinaryField("u8", 6)
3942
+ ], YGOProMsgSelectIdleCmd_SimpleCardInfo.prototype, "sequence", 2);
3943
+ var YGOProMsgSelectIdleCmd_ActivatableInfo = class {
3944
+ };
3945
+ __decorateClass([
3946
+ BinaryField("i32", 0)
3947
+ ], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "code", 2);
3948
+ __decorateClass([
3949
+ BinaryField("u8", 4)
3950
+ ], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "controller", 2);
3951
+ __decorateClass([
3952
+ BinaryField("u8", 5)
3953
+ ], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "location", 2);
3954
+ __decorateClass([
3955
+ BinaryField("u8", 6)
3956
+ ], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "sequence", 2);
3957
+ __decorateClass([
3958
+ BinaryField("i32", 7)
3959
+ ], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "desc", 2);
3960
+ var YGOProMsgSelectIdleCmd = class extends YGOProMsgResponseBase {
3961
+ static {
3962
+ this.identifier = OcgcoreCommonConstants.MSG_SELECT_IDLECMD;
3963
+ }
3964
+ responsePlayer() {
3965
+ return this.player;
3966
+ }
3967
+ prepareResponse(type, option) {
3968
+ let sequence;
3969
+ if (type === 0 /* SUMMON */ || type === 1 /* SPSUMMON */ || type === 2 /* REPOS */ || type === 3 /* MSET */ || type === 4 /* SSET */ || type === 5 /* ACTIVATE */) {
3970
+ if (option == null) {
3971
+ throw new TypeError(`Option required for ${IdleCmdType[type]}`);
3972
+ }
3973
+ let cards;
3974
+ let maxCount;
3975
+ let typeName;
3976
+ if (type === 0 /* SUMMON */) {
3977
+ cards = this.summonableCards;
3978
+ maxCount = this.summonableCount;
3979
+ typeName = "Summonable";
3980
+ } else if (type === 1 /* SPSUMMON */) {
3981
+ cards = this.spSummonableCards;
3982
+ maxCount = this.spSummonableCount;
3983
+ typeName = "Special summonable";
3984
+ } else if (type === 2 /* REPOS */) {
3985
+ cards = this.reposableCards;
3986
+ maxCount = this.reposableCount;
3987
+ typeName = "Repositionable";
3988
+ } else if (type === 3 /* MSET */) {
3989
+ cards = this.msetableCards;
3990
+ maxCount = this.msetableCount;
3991
+ typeName = "Monster settable";
3992
+ } else if (type === 4 /* SSET */) {
3993
+ cards = this.ssetableCards;
3994
+ maxCount = this.ssetableCount;
3995
+ typeName = "Spell/Trap settable";
3996
+ } else {
3997
+ cards = this.activatableCards;
3998
+ maxCount = this.activatableCount;
3999
+ typeName = "Activatable";
4000
+ }
4001
+ if (isIndexResponse(option)) {
4002
+ sequence = option.index;
4003
+ if (sequence < 0 || sequence >= maxCount) {
4004
+ throw new TypeError(`Index out of range: ${sequence}`);
4005
+ }
4006
+ } else {
4007
+ const idx = cards.findIndex(
4008
+ (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)
4009
+ );
4010
+ if (idx === -1) {
4011
+ throw new TypeError(`${typeName} card not found`);
4012
+ }
4013
+ sequence = idx;
4014
+ }
4015
+ } else if (type === 6 /* TO_BP */) {
4016
+ if (this.canBp === 0) {
4017
+ throw new TypeError("Cannot go to BP");
4018
+ }
4019
+ sequence = 0;
4020
+ } else if (type === 7 /* TO_EP */) {
4021
+ if (this.canEp === 0) {
4022
+ throw new TypeError("Cannot go to EP");
4023
+ }
4024
+ sequence = 0;
4025
+ } else if (type === 8 /* SHUFFLE */) {
4026
+ if (this.canShuffle === 0) {
4027
+ throw new TypeError("Cannot shuffle");
4028
+ }
4029
+ sequence = 0;
4030
+ } else {
4031
+ throw new TypeError(`Unknown type: ${type}`);
4032
+ }
4033
+ const buffer = new Uint8Array(4);
4034
+ const view = new DataView(buffer.buffer);
4035
+ view.setUint32(0, sequence << 16 | type, true);
4036
+ return buffer;
4037
+ }
4038
+ };
4039
+ __decorateClass([
4040
+ BinaryField("u8", 0)
4041
+ ], YGOProMsgSelectIdleCmd.prototype, "player", 2);
4042
+ __decorateClass([
4043
+ BinaryField("u8", 1)
4044
+ ], YGOProMsgSelectIdleCmd.prototype, "summonableCount", 2);
4045
+ __decorateClass([
4046
+ BinaryField(
4047
+ () => YGOProMsgSelectIdleCmd_SimpleCardInfo,
4048
+ 2,
4049
+ (obj) => obj.summonableCount
4050
+ )
4051
+ ], YGOProMsgSelectIdleCmd.prototype, "summonableCards", 2);
4052
+ __decorateClass([
4053
+ BinaryField("u8", (obj) => 2 + obj.summonableCount * 7)
4054
+ ], YGOProMsgSelectIdleCmd.prototype, "spSummonableCount", 2);
4055
+ __decorateClass([
4056
+ BinaryField(
4057
+ () => YGOProMsgSelectIdleCmd_SimpleCardInfo,
4058
+ (obj) => 3 + obj.summonableCount * 7,
4059
+ (obj) => obj.spSummonableCount
4060
+ )
4061
+ ], YGOProMsgSelectIdleCmd.prototype, "spSummonableCards", 2);
4062
+ __decorateClass([
4063
+ BinaryField(
4064
+ "u8",
4065
+ (obj) => 3 + obj.summonableCount * 7 + obj.spSummonableCount * 7
4066
+ )
4067
+ ], YGOProMsgSelectIdleCmd.prototype, "reposableCount", 2);
4068
+ __decorateClass([
4069
+ BinaryField(
4070
+ () => YGOProMsgSelectIdleCmd_SimpleCardInfo,
4071
+ (obj) => 4 + obj.summonableCount * 7 + obj.spSummonableCount * 7,
4072
+ (obj) => obj.reposableCount
4073
+ )
4074
+ ], YGOProMsgSelectIdleCmd.prototype, "reposableCards", 2);
4075
+ __decorateClass([
4076
+ BinaryField(
4077
+ "u8",
4078
+ (obj) => 4 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7
4079
+ )
4080
+ ], YGOProMsgSelectIdleCmd.prototype, "msetableCount", 2);
4081
+ __decorateClass([
4082
+ BinaryField(
4083
+ () => YGOProMsgSelectIdleCmd_SimpleCardInfo,
4084
+ (obj) => 5 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7,
4085
+ (obj) => obj.msetableCount
4086
+ )
4087
+ ], YGOProMsgSelectIdleCmd.prototype, "msetableCards", 2);
4088
+ __decorateClass([
4089
+ BinaryField(
4090
+ "u8",
4091
+ (obj) => 5 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7
4092
+ )
4093
+ ], YGOProMsgSelectIdleCmd.prototype, "ssetableCount", 2);
4094
+ __decorateClass([
4095
+ BinaryField(
4096
+ () => YGOProMsgSelectIdleCmd_SimpleCardInfo,
4097
+ (obj) => 6 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7,
4098
+ (obj) => obj.ssetableCount
4099
+ )
4100
+ ], YGOProMsgSelectIdleCmd.prototype, "ssetableCards", 2);
4101
+ __decorateClass([
4102
+ BinaryField(
4103
+ "u8",
4104
+ (obj) => 6 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7 + obj.ssetableCount * 7
4105
+ )
4106
+ ], YGOProMsgSelectIdleCmd.prototype, "activatableCount", 2);
4107
+ __decorateClass([
4108
+ BinaryField(
4109
+ () => YGOProMsgSelectIdleCmd_ActivatableInfo,
4110
+ (obj) => 7 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7 + obj.ssetableCount * 7,
4111
+ (obj) => obj.activatableCount
4112
+ )
4113
+ ], YGOProMsgSelectIdleCmd.prototype, "activatableCards", 2);
4114
+ __decorateClass([
4115
+ BinaryField(
4116
+ "u8",
4117
+ (obj) => 7 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7 + obj.ssetableCount * 7 + obj.activatableCount * 11
4118
+ )
4119
+ ], YGOProMsgSelectIdleCmd.prototype, "canBp", 2);
4120
+ __decorateClass([
4121
+ BinaryField(
4122
+ "u8",
4123
+ (obj) => 8 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7 + obj.ssetableCount * 7 + obj.activatableCount * 11
4124
+ )
4125
+ ], YGOProMsgSelectIdleCmd.prototype, "canEp", 2);
4126
+ __decorateClass([
4127
+ BinaryField(
4128
+ "u8",
4129
+ (obj) => 9 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7 + obj.ssetableCount * 7 + obj.activatableCount * 11
4130
+ )
4131
+ ], YGOProMsgSelectIdleCmd.prototype, "canShuffle", 2);
4132
+
4133
+ // src/protos/msg/proto/select-option.ts
4134
+ var YGOProMsgSelectOption = class extends YGOProMsgResponseBase {
4135
+ static {
4136
+ this.identifier = OcgcoreCommonConstants.MSG_SELECT_OPTION;
4137
+ }
4138
+ responsePlayer() {
4139
+ return this.player;
4140
+ }
4141
+ prepareResponse(option) {
4142
+ let index;
4143
+ if (isIndexResponse(option)) {
4144
+ index = option.index;
4145
+ if (index < 0 || index >= this.count) {
4146
+ throw new TypeError(`Index out of range: ${index}`);
4147
+ }
4148
+ } else {
4149
+ index = this.options.indexOf(option);
4150
+ if (index === -1) {
4151
+ throw new TypeError(`Option not found: ${option}`);
4152
+ }
4153
+ }
4154
+ const buffer = new Uint8Array(4);
4155
+ const view = new DataView(buffer.buffer);
4156
+ view.setInt32(0, index, true);
4157
+ return buffer;
4158
+ }
4159
+ };
4160
+ __decorateClass([
4161
+ BinaryField("u8", 0)
4162
+ ], YGOProMsgSelectOption.prototype, "player", 2);
4163
+ __decorateClass([
4164
+ BinaryField("u8", 1)
4165
+ ], YGOProMsgSelectOption.prototype, "count", 2);
4166
+ __decorateClass([
4167
+ BinaryField("i32", 2, (obj) => obj.count)
4168
+ ], YGOProMsgSelectOption.prototype, "options", 2);
4169
+
4170
+ // src/protos/msg/proto/select-place.ts
4171
+ var YGOProMsgSelectPlace = class extends YGOProMsgSelectPlaceCommon {
4172
+ static {
4173
+ this.identifier = OcgcoreCommonConstants.MSG_SELECT_PLACE;
4174
+ }
4175
+ };
4176
+
4177
+ // src/protos/msg/proto/select-position.ts
4178
+ var YGOProMsgSelectPosition = class extends YGOProMsgResponseBase {
4179
+ static {
4180
+ this.identifier = OcgcoreCommonConstants.MSG_SELECT_POSITION;
4181
+ }
4182
+ responsePlayer() {
4183
+ return this.player;
4184
+ }
4185
+ prepareResponse(position) {
4186
+ const buffer = new Uint8Array(4);
4187
+ const view = new DataView(buffer.buffer);
4188
+ view.setInt32(0, position, true);
4189
+ return buffer;
4190
+ }
4191
+ };
4192
+ __decorateClass([
4193
+ BinaryField("u8", 0)
4194
+ ], YGOProMsgSelectPosition.prototype, "player", 2);
4195
+ __decorateClass([
4196
+ BinaryField("i32", 1)
4197
+ ], YGOProMsgSelectPosition.prototype, "code", 2);
4198
+ __decorateClass([
4199
+ BinaryField("u8", 5)
4200
+ ], YGOProMsgSelectPosition.prototype, "positions", 2);
4201
+
4202
+ // src/protos/msg/proto/select-sum.ts
4203
+ var YGOProMsgSelectSum_CardInfo = class {
4204
+ };
4205
+ __decorateClass([
4206
+ BinaryField("i32", 0)
4207
+ ], YGOProMsgSelectSum_CardInfo.prototype, "code", 2);
4208
+ __decorateClass([
4209
+ BinaryField("u8", 4)
4210
+ ], YGOProMsgSelectSum_CardInfo.prototype, "controller", 2);
4211
+ __decorateClass([
4212
+ BinaryField("u8", 5)
4213
+ ], YGOProMsgSelectSum_CardInfo.prototype, "location", 2);
4214
+ __decorateClass([
4215
+ BinaryField("u8", 6)
4216
+ ], YGOProMsgSelectSum_CardInfo.prototype, "sequence", 2);
4217
+ __decorateClass([
4218
+ BinaryField("i32", 7)
4219
+ ], YGOProMsgSelectSum_CardInfo.prototype, "opParam", 2);
4220
+ var YGOProMsgSelectSum = class extends YGOProMsgResponseBase {
4221
+ static {
4222
+ this.identifier = OcgcoreCommonConstants.MSG_SELECT_SUM;
4223
+ }
4224
+ responsePlayer() {
4225
+ return this.player;
4226
+ }
4227
+ prepareResponse(cardOptions) {
4228
+ const indices = [];
4229
+ for (const option of cardOptions) {
4230
+ let index;
4231
+ if (isIndexResponse(option)) {
4232
+ index = option.index;
4233
+ if (index < 0 || index >= this.count) {
4234
+ throw new TypeError(`Index out of range: ${index}`);
4235
+ }
4236
+ } else {
4237
+ index = this.cards.findIndex(
4238
+ (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)
4239
+ );
4240
+ if (index === -1) {
4241
+ throw new TypeError("Card not found");
4242
+ }
4243
+ }
4244
+ indices.push(index);
4245
+ }
4246
+ const buffer = new Uint8Array(1 + indices.length);
4247
+ buffer[0] = this.mustSelectCount + indices.length;
4248
+ indices.forEach((idx, i) => {
4249
+ buffer[1 + i] = idx;
4250
+ });
4251
+ return buffer;
4252
+ }
4253
+ };
4254
+ __decorateClass([
4255
+ BinaryField("u8", 0)
4256
+ ], YGOProMsgSelectSum.prototype, "mode", 2);
4257
+ __decorateClass([
4258
+ BinaryField("u8", 1)
4259
+ ], YGOProMsgSelectSum.prototype, "player", 2);
4260
+ __decorateClass([
4261
+ BinaryField("i32", 2)
4262
+ ], YGOProMsgSelectSum.prototype, "sumVal", 2);
4263
+ __decorateClass([
4264
+ BinaryField("u8", 6)
4265
+ ], YGOProMsgSelectSum.prototype, "min", 2);
4266
+ __decorateClass([
4267
+ BinaryField("u8", 7)
4268
+ ], YGOProMsgSelectSum.prototype, "max", 2);
4269
+ __decorateClass([
4270
+ BinaryField("u8", 8)
4271
+ ], YGOProMsgSelectSum.prototype, "mustSelectCount", 2);
4272
+ __decorateClass([
4273
+ BinaryField(
4274
+ () => YGOProMsgSelectSum_CardInfo,
4275
+ 9,
4276
+ (obj) => obj.mustSelectCount
4277
+ )
4278
+ ], YGOProMsgSelectSum.prototype, "mustSelectCards", 2);
4279
+ __decorateClass([
4280
+ BinaryField("u8", (obj) => {
4281
+ return 9 + obj.mustSelectCount * 11;
4282
+ })
4283
+ ], YGOProMsgSelectSum.prototype, "count", 2);
4284
+ __decorateClass([
4285
+ BinaryField(
4286
+ () => YGOProMsgSelectSum_CardInfo,
4287
+ (obj) => {
4288
+ return 10 + obj.mustSelectCount * 11;
4289
+ },
4290
+ (obj) => obj.count
4291
+ )
4292
+ ], YGOProMsgSelectSum.prototype, "cards", 2);
4293
+
4294
+ // src/protos/msg/proto/select-tribute.ts
4295
+ var YGOProMsgSelectTribute_CardInfo = class {
4296
+ };
4297
+ __decorateClass([
4298
+ BinaryField("i32", 0)
4299
+ ], YGOProMsgSelectTribute_CardInfo.prototype, "code", 2);
4300
+ __decorateClass([
4301
+ BinaryField("u8", 4)
4302
+ ], YGOProMsgSelectTribute_CardInfo.prototype, "controller", 2);
4303
+ __decorateClass([
4304
+ BinaryField("u8", 5)
4305
+ ], YGOProMsgSelectTribute_CardInfo.prototype, "location", 2);
4306
+ __decorateClass([
4307
+ BinaryField("u8", 6)
4308
+ ], YGOProMsgSelectTribute_CardInfo.prototype, "sequence", 2);
4309
+ __decorateClass([
4310
+ BinaryField("u8", 7)
4311
+ ], YGOProMsgSelectTribute_CardInfo.prototype, "releaseParam", 2);
4312
+ var YGOProMsgSelectTribute = class extends YGOProMsgResponseBase {
4313
+ static {
4314
+ this.identifier = OcgcoreCommonConstants.MSG_SELECT_TRIBUTE;
4315
+ }
4316
+ responsePlayer() {
4317
+ return this.player;
4318
+ }
4319
+ defaultResponse() {
4320
+ if (this.cancelable === 0) {
4321
+ return void 0;
4322
+ }
4323
+ return this.prepareResponse(null);
4324
+ }
4325
+ prepareResponse(cardOptions) {
4326
+ if (cardOptions == null) {
4327
+ const buffer2 = new Uint8Array(4);
4328
+ const view = new DataView(buffer2.buffer);
4329
+ view.setInt32(0, -1, true);
4330
+ return buffer2;
4331
+ }
4332
+ const indices = [];
4333
+ const usedIndices = /* @__PURE__ */ new Set();
4334
+ for (const option of cardOptions) {
4335
+ let index;
4336
+ if (isIndexResponse(option)) {
4337
+ index = option.index;
4338
+ if (index < 0 || index >= this.count) {
4339
+ throw new TypeError(`Index out of range: ${index}`);
4340
+ }
4341
+ } else {
4342
+ index = this.cards.findIndex(
4343
+ (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)
4344
+ );
4345
+ if (index === -1) {
4346
+ throw new TypeError("Card not found");
4347
+ }
4348
+ }
4349
+ indices.push(index);
4350
+ usedIndices.add(index);
4351
+ }
4352
+ const buffer = new Uint8Array(1 + indices.length);
4353
+ buffer[0] = indices.length;
4354
+ indices.forEach((idx, i) => {
4355
+ buffer[1 + i] = idx;
4356
+ });
4357
+ return buffer;
4358
+ }
4359
+ };
4360
+ __decorateClass([
4361
+ BinaryField("u8", 0)
4362
+ ], YGOProMsgSelectTribute.prototype, "player", 2);
4363
+ __decorateClass([
4364
+ BinaryField("u8", 1)
4365
+ ], YGOProMsgSelectTribute.prototype, "cancelable", 2);
4366
+ __decorateClass([
4367
+ BinaryField("u8", 2)
4368
+ ], YGOProMsgSelectTribute.prototype, "min", 2);
4369
+ __decorateClass([
4370
+ BinaryField("u8", 3)
4371
+ ], YGOProMsgSelectTribute.prototype, "max", 2);
4372
+ __decorateClass([
4373
+ BinaryField("u8", 4)
4374
+ ], YGOProMsgSelectTribute.prototype, "count", 2);
4375
+ __decorateClass([
4376
+ BinaryField(() => YGOProMsgSelectTribute_CardInfo, 5, (obj) => obj.count)
4377
+ ], YGOProMsgSelectTribute.prototype, "cards", 2);
4378
+
4379
+ // src/protos/msg/proto/select-unselect-card.ts
4380
+ var YGOProMsgSelectUnselectCard_CardInfo = class {
4381
+ };
4382
+ __decorateClass([
4383
+ BinaryField("i32", 0)
4384
+ ], YGOProMsgSelectUnselectCard_CardInfo.prototype, "code", 2);
4385
+ __decorateClass([
4386
+ BinaryField("u8", 4)
4387
+ ], YGOProMsgSelectUnselectCard_CardInfo.prototype, "controller", 2);
4388
+ __decorateClass([
4389
+ BinaryField("u8", 5)
4390
+ ], YGOProMsgSelectUnselectCard_CardInfo.prototype, "location", 2);
4391
+ __decorateClass([
4392
+ BinaryField("u8", 6)
4393
+ ], YGOProMsgSelectUnselectCard_CardInfo.prototype, "sequence", 2);
4394
+ __decorateClass([
4395
+ BinaryField("u8", 7)
4396
+ ], YGOProMsgSelectUnselectCard_CardInfo.prototype, "subsequence", 2);
4397
+ var YGOProMsgSelectUnselectCard = class extends YGOProMsgResponseBase {
4398
+ static {
4399
+ this.identifier = OcgcoreCommonConstants.MSG_SELECT_UNSELECT_CARD;
4400
+ }
4401
+ responsePlayer() {
4402
+ return this.player;
4403
+ }
4404
+ defaultResponse() {
4405
+ if (this.cancelable === 0 && this.finishable === 0) {
4406
+ return void 0;
4407
+ }
4408
+ return this.prepareResponse(null);
4409
+ }
4410
+ prepareResponse(cardOption) {
4411
+ if (cardOption == null) {
4412
+ const buffer2 = new Uint8Array(4);
4413
+ const view = new DataView(buffer2.buffer);
4414
+ view.setInt32(0, -1, true);
4415
+ return buffer2;
4416
+ }
4417
+ let index;
4418
+ if (isIndexResponse(cardOption)) {
4419
+ index = cardOption.index;
4420
+ const totalCount = this.selectableCount + this.unselectableCount;
4421
+ if (index < 0 || index >= totalCount) {
4422
+ throw new TypeError(`Index out of range: ${index}`);
4423
+ }
4424
+ } else {
4425
+ index = this.selectableCards.findIndex(
4426
+ (card) => (cardOption.code == null || card.code === cardOption.code) && (cardOption.controller == null || card.controller === cardOption.controller) && (cardOption.location == null || card.location === cardOption.location) && (cardOption.sequence == null || card.sequence === cardOption.sequence)
4427
+ );
4428
+ if (index === -1) {
4429
+ const unselectIndex = this.unselectableCards.findIndex(
4430
+ (card) => (cardOption.code == null || card.code === cardOption.code) && (cardOption.controller == null || card.controller === cardOption.controller) && (cardOption.location == null || card.location === cardOption.location) && (cardOption.sequence == null || card.sequence === cardOption.sequence)
4431
+ );
4432
+ if (unselectIndex === -1) {
4433
+ throw new TypeError("Card not found");
4434
+ }
4435
+ index = this.selectableCount + unselectIndex;
4436
+ }
4437
+ }
4438
+ const buffer = new Uint8Array(2);
4439
+ buffer[0] = 1;
4440
+ buffer[1] = index;
4441
+ return buffer;
4442
+ }
4443
+ };
4444
+ __decorateClass([
4445
+ BinaryField("u8", 0)
4446
+ ], YGOProMsgSelectUnselectCard.prototype, "player", 2);
4447
+ __decorateClass([
4448
+ BinaryField("u8", 1)
4449
+ ], YGOProMsgSelectUnselectCard.prototype, "finishable", 2);
4450
+ __decorateClass([
4451
+ BinaryField("u8", 2)
4452
+ ], YGOProMsgSelectUnselectCard.prototype, "cancelable", 2);
4453
+ __decorateClass([
4454
+ BinaryField("u8", 3)
4455
+ ], YGOProMsgSelectUnselectCard.prototype, "min", 2);
4456
+ __decorateClass([
4457
+ BinaryField("u8", 4)
4458
+ ], YGOProMsgSelectUnselectCard.prototype, "max", 2);
4459
+ __decorateClass([
4460
+ BinaryField("u8", 5)
4461
+ ], YGOProMsgSelectUnselectCard.prototype, "selectableCount", 2);
4462
+ __decorateClass([
4463
+ BinaryField(
4464
+ () => YGOProMsgSelectUnselectCard_CardInfo,
4465
+ 6,
4466
+ (obj) => obj.selectableCount
4467
+ )
4468
+ ], YGOProMsgSelectUnselectCard.prototype, "selectableCards", 2);
4469
+ __decorateClass([
4470
+ BinaryField("u8", (obj) => {
4471
+ return 6 + obj.selectableCount * 8;
4472
+ })
4473
+ ], YGOProMsgSelectUnselectCard.prototype, "unselectableCount", 2);
4474
+ __decorateClass([
4475
+ BinaryField(
4476
+ () => YGOProMsgSelectUnselectCard_CardInfo,
4477
+ (obj) => {
4478
+ return 7 + obj.selectableCount * 8;
4479
+ },
4480
+ (obj) => obj.unselectableCount
4481
+ )
4482
+ ], YGOProMsgSelectUnselectCard.prototype, "unselectableCards", 2);
4483
+
4484
+ // src/protos/msg/proto/select-yesno.ts
4485
+ var YGOProMsgSelectYesNo = class extends YGOProMsgResponseBase {
4486
+ static {
4487
+ this.identifier = OcgcoreCommonConstants.MSG_SELECT_YESNO;
4488
+ }
4489
+ responsePlayer() {
4490
+ return this.player;
4491
+ }
4492
+ defaultResponse() {
4493
+ return this.prepareResponse(false);
4494
+ }
4495
+ prepareResponse(yes) {
4496
+ const buffer = new Uint8Array(4);
4497
+ const view = new DataView(buffer.buffer);
4498
+ view.setInt32(0, yes ? 1 : 0, true);
4499
+ return buffer;
4500
+ }
4501
+ };
4502
+ __decorateClass([
4503
+ BinaryField("u8", 0)
4504
+ ], YGOProMsgSelectYesNo.prototype, "player", 2);
4505
+ __decorateClass([
4506
+ BinaryField("i32", 1)
4507
+ ], YGOProMsgSelectYesNo.prototype, "desc", 2);
4508
+
4509
+ // src/protos/msg/proto/set.ts
4510
+ var YGOProMsgSet = class extends YGOProMsgBase {
4511
+ static {
4512
+ this.identifier = OcgcoreCommonConstants.MSG_SET;
4513
+ }
4514
+ };
4515
+ __decorateClass([
4516
+ BinaryField("i32", 0)
4517
+ ], YGOProMsgSet.prototype, "code", 2);
4518
+
4519
+ // src/protos/msg/proto/shuffle-deck.ts
4520
+ var YGOProMsgShuffleDeck = class extends YGOProMsgBase {
4521
+ static {
4522
+ this.identifier = OcgcoreCommonConstants.MSG_SHUFFLE_DECK;
4523
+ }
4524
+ };
4525
+ __decorateClass([
4526
+ BinaryField("u8", 0)
4527
+ ], YGOProMsgShuffleDeck.prototype, "player", 2);
4528
+
4529
+ // src/protos/msg/proto/shuffle-extra.ts
4530
+ var YGOProMsgShuffleExtra = class extends YGOProMsgBase {
4531
+ static {
4532
+ this.identifier = OcgcoreCommonConstants.MSG_SHUFFLE_EXTRA;
4533
+ }
4534
+ // 对方视角需要隐藏额外卡组信息
4535
+ opponentView() {
4536
+ const view = this.copy();
4537
+ view.cards = view.cards.map((card) => {
4538
+ if (!(card & 2147483648)) {
4539
+ return 0;
4540
+ }
4541
+ return card;
4542
+ });
4543
+ return view;
4544
+ }
4545
+ };
4546
+ __decorateClass([
4547
+ BinaryField("u8", 0)
4548
+ ], YGOProMsgShuffleExtra.prototype, "player", 2);
4549
+ __decorateClass([
4550
+ BinaryField("u8", 1)
4551
+ ], YGOProMsgShuffleExtra.prototype, "count", 2);
4552
+ __decorateClass([
4553
+ BinaryField("i32", 2, (obj) => obj.count)
4554
+ ], YGOProMsgShuffleExtra.prototype, "cards", 2);
4555
+
4556
+ // src/protos/msg/proto/shuffle-hand.ts
4557
+ var YGOProMsgShuffleHand = class extends YGOProMsgBase {
4558
+ static {
4559
+ this.identifier = OcgcoreCommonConstants.MSG_SHUFFLE_HAND;
4560
+ }
4561
+ // 对方视角需要隐藏手牌信息
4562
+ opponentView() {
4563
+ const view = this.copy();
4564
+ view.cards = view.cards.map(() => 0);
4565
+ return view;
4566
+ }
4567
+ };
4568
+ __decorateClass([
4569
+ BinaryField("u8", 0)
4570
+ ], YGOProMsgShuffleHand.prototype, "player", 2);
4571
+ __decorateClass([
4572
+ BinaryField("u8", 1)
4573
+ ], YGOProMsgShuffleHand.prototype, "count", 2);
4574
+ __decorateClass([
4575
+ BinaryField("i32", 2, (obj) => obj.count)
4576
+ ], YGOProMsgShuffleHand.prototype, "cards", 2);
4577
+
4578
+ // src/protos/msg/proto/shuffle-set-card.ts
4579
+ var YGOProMsgShuffleSetCard_CardLocation = class {
4580
+ };
4581
+ __decorateClass([
4582
+ BinaryField("u8", 0)
4583
+ ], YGOProMsgShuffleSetCard_CardLocation.prototype, "controller", 2);
4584
+ __decorateClass([
4585
+ BinaryField("u8", 1)
4586
+ ], YGOProMsgShuffleSetCard_CardLocation.prototype, "location", 2);
4587
+ __decorateClass([
4588
+ BinaryField("u8", 2)
4589
+ ], YGOProMsgShuffleSetCard_CardLocation.prototype, "sequence", 2);
4590
+ __decorateClass([
4591
+ BinaryField("u8", 3)
4592
+ ], YGOProMsgShuffleSetCard_CardLocation.prototype, "position", 2);
4593
+ var YGOProMsgShuffleSetCard_SetCardInfo = class {
4594
+ };
4595
+ __decorateClass([
4596
+ BinaryField(() => YGOProMsgShuffleSetCard_CardLocation, 0)
4597
+ ], YGOProMsgShuffleSetCard_SetCardInfo.prototype, "oldLocation", 2);
4598
+ __decorateClass([
4599
+ BinaryField(() => YGOProMsgShuffleSetCard_CardLocation, 4)
4600
+ ], YGOProMsgShuffleSetCard_SetCardInfo.prototype, "newLocation", 2);
4601
+ var YGOProMsgShuffleSetCard = class extends YGOProMsgBase {
4602
+ static {
4603
+ this.identifier = OcgcoreCommonConstants.MSG_SHUFFLE_SET_CARD;
4604
+ }
4605
+ };
4606
+ __decorateClass([
4607
+ BinaryField("u8", 0)
4608
+ ], YGOProMsgShuffleSetCard.prototype, "location", 2);
4609
+ __decorateClass([
4610
+ BinaryField("u8", 1)
4611
+ ], YGOProMsgShuffleSetCard.prototype, "count", 2);
4612
+ __decorateClass([
4613
+ BinaryField(() => YGOProMsgShuffleSetCard_SetCardInfo, 2, (obj) => obj.count)
4614
+ ], YGOProMsgShuffleSetCard.prototype, "cards", 2);
4615
+
4616
+ // src/protos/msg/proto/sort-card.ts
4617
+ var YGOProMsgSortCard_CardInfo = class {
4618
+ };
4619
+ __decorateClass([
4620
+ BinaryField("i32", 0)
4621
+ ], YGOProMsgSortCard_CardInfo.prototype, "code", 2);
4622
+ __decorateClass([
4623
+ BinaryField("u8", 4)
4624
+ ], YGOProMsgSortCard_CardInfo.prototype, "controller", 2);
4625
+ __decorateClass([
4626
+ BinaryField("u8", 5)
4627
+ ], YGOProMsgSortCard_CardInfo.prototype, "location", 2);
4628
+ __decorateClass([
4629
+ BinaryField("u8", 6)
4630
+ ], YGOProMsgSortCard_CardInfo.prototype, "sequence", 2);
4631
+ var YGOProMsgSortCard = class extends YGOProMsgResponseBase {
4632
+ static {
4633
+ this.identifier = OcgcoreCommonConstants.MSG_SORT_CARD;
4634
+ }
4635
+ responsePlayer() {
4636
+ return this.player;
4637
+ }
4638
+ defaultResponse() {
4639
+ return this.prepareResponse(null);
4640
+ }
4641
+ prepareResponse(sortedOptions) {
4642
+ if (sortedOptions == null) {
4643
+ return new Uint8Array([255]);
4644
+ }
4645
+ const indices = [];
4646
+ const usedIndices = /* @__PURE__ */ new Set();
4647
+ for (const option of sortedOptions) {
4648
+ let index;
4649
+ if (isIndexResponse(option)) {
4650
+ index = option.index;
4651
+ if (index < 0 || index >= this.count) {
4652
+ throw new TypeError(`Index out of range: ${index}`);
4653
+ }
4654
+ } else {
4655
+ index = this.cards.findIndex(
4656
+ (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)
4657
+ );
4658
+ if (index === -1) {
4659
+ throw new TypeError("Card not found");
4660
+ }
4661
+ }
4662
+ indices.push(index);
4663
+ usedIndices.add(index);
4664
+ }
4665
+ const buffer = new Uint8Array(indices.length);
4666
+ indices.forEach((idx, i) => {
4667
+ buffer[i] = idx;
4668
+ });
4669
+ return buffer;
4670
+ }
4671
+ };
4672
+ __decorateClass([
4673
+ BinaryField("u8", 0)
4674
+ ], YGOProMsgSortCard.prototype, "player", 2);
4675
+ __decorateClass([
4676
+ BinaryField("u8", 1)
4677
+ ], YGOProMsgSortCard.prototype, "count", 2);
4678
+ __decorateClass([
4679
+ BinaryField(() => YGOProMsgSortCard_CardInfo, 2, (obj) => obj.count)
4680
+ ], YGOProMsgSortCard.prototype, "cards", 2);
4681
+
4682
+ // src/protos/msg/proto/spsummoned.ts
4683
+ var YGOProMsgSpSummoned = class extends YGOProMsgBase {
4684
+ static {
4685
+ this.identifier = OcgcoreCommonConstants.MSG_SPSUMMONED;
4686
+ }
4687
+ };
4688
+
4689
+ // src/protos/msg/proto/spsummoning.ts
4690
+ var YGOProMsgSpSummoning = class extends YGOProMsgBase {
4691
+ static {
4692
+ this.identifier = OcgcoreCommonConstants.MSG_SPSUMMONING;
4693
+ }
4694
+ };
4695
+ __decorateClass([
4696
+ BinaryField("i32", 0)
4697
+ ], YGOProMsgSpSummoning.prototype, "code", 2);
4698
+ __decorateClass([
4699
+ BinaryField("u8", 4)
4700
+ ], YGOProMsgSpSummoning.prototype, "controller", 2);
4701
+ __decorateClass([
4702
+ BinaryField("u8", 5)
4703
+ ], YGOProMsgSpSummoning.prototype, "location", 2);
4704
+ __decorateClass([
4705
+ BinaryField("u8", 6)
4706
+ ], YGOProMsgSpSummoning.prototype, "sequence", 2);
4707
+ __decorateClass([
4708
+ BinaryField("u8", 7)
4709
+ ], YGOProMsgSpSummoning.prototype, "position", 2);
4710
+
4711
+ // src/protos/msg/proto/start.ts
4712
+ var YGOProMsgStart_PlayerInfo = class {
4713
+ };
4714
+ __decorateClass([
4715
+ BinaryField("u16", 0)
4716
+ ], YGOProMsgStart_PlayerInfo.prototype, "deckCount", 2);
4717
+ __decorateClass([
4718
+ BinaryField("u16", 2)
4719
+ ], YGOProMsgStart_PlayerInfo.prototype, "extraCount", 2);
4720
+ var YGOProMsgStart = class extends YGOProMsgBase {
4721
+ static {
4722
+ this.identifier = 4;
4723
+ }
4724
+ /**
4725
+ * Get/Set player number (low 4 bits, 0-3)
4726
+ */
4727
+ get playerNumber() {
4728
+ return this.playerType & 15;
4729
+ }
4730
+ set playerNumber(value) {
4731
+ this.playerType = this.playerType & 240 | value & 15;
4732
+ }
4733
+ /**
4734
+ * Get/Set observer flag (high 4 bits, 0x00 or 0x10)
4735
+ */
4736
+ get observerFlag() {
4737
+ return this.playerType & 240;
4738
+ }
4739
+ set observerFlag(value) {
4740
+ this.playerType = this.playerType & 15 | value & 240;
4741
+ }
4742
+ };
4743
+ __decorateClass([
4744
+ BinaryField("u8", 0)
4745
+ ], YGOProMsgStart.prototype, "playerType", 2);
4746
+ __decorateClass([
4747
+ BinaryField("u8", 1)
4748
+ ], YGOProMsgStart.prototype, "duelRule", 2);
4749
+ __decorateClass([
4750
+ BinaryField("i32", 2)
4751
+ ], YGOProMsgStart.prototype, "startLp0", 2);
4752
+ __decorateClass([
4753
+ BinaryField("i32", 6)
4754
+ ], YGOProMsgStart.prototype, "startLp1", 2);
4755
+ __decorateClass([
4756
+ BinaryField(() => YGOProMsgStart_PlayerInfo, 10)
4757
+ ], YGOProMsgStart.prototype, "player0", 2);
4758
+ __decorateClass([
4759
+ BinaryField(() => YGOProMsgStart_PlayerInfo, 14)
4760
+ ], YGOProMsgStart.prototype, "player1", 2);
4761
+
4762
+ // src/protos/msg/proto/summoned.ts
4763
+ var YGOProMsgSummoned = class extends YGOProMsgBase {
4764
+ static {
4765
+ this.identifier = OcgcoreCommonConstants.MSG_SUMMONED;
4766
+ }
4767
+ };
4768
+
4769
+ // src/protos/msg/proto/summoning.ts
4770
+ var YGOProMsgSummoning = class extends YGOProMsgBase {
4771
+ static {
4772
+ this.identifier = OcgcoreCommonConstants.MSG_SUMMONING;
4773
+ }
4774
+ };
4775
+ __decorateClass([
4776
+ BinaryField("i32", 0)
4777
+ ], YGOProMsgSummoning.prototype, "code", 2);
4778
+ __decorateClass([
4779
+ BinaryField("u8", 4)
4780
+ ], YGOProMsgSummoning.prototype, "controller", 2);
4781
+ __decorateClass([
4782
+ BinaryField("u8", 5)
4783
+ ], YGOProMsgSummoning.prototype, "location", 2);
4784
+ __decorateClass([
4785
+ BinaryField("u8", 6)
4786
+ ], YGOProMsgSummoning.prototype, "sequence", 2);
4787
+ __decorateClass([
4788
+ BinaryField("u8", 7)
4789
+ ], YGOProMsgSummoning.prototype, "position", 2);
4790
+
4791
+ // src/protos/msg/proto/swap.ts
4792
+ var YGOProMsgSwap_CardLocation = class {
4793
+ };
4794
+ __decorateClass([
4795
+ BinaryField("u8", 0)
4796
+ ], YGOProMsgSwap_CardLocation.prototype, "controller", 2);
4797
+ __decorateClass([
4798
+ BinaryField("u8", 1)
4799
+ ], YGOProMsgSwap_CardLocation.prototype, "location", 2);
4800
+ __decorateClass([
4801
+ BinaryField("u8", 2)
4802
+ ], YGOProMsgSwap_CardLocation.prototype, "sequence", 2);
4803
+ __decorateClass([
4804
+ BinaryField("u8", 3)
4805
+ ], YGOProMsgSwap_CardLocation.prototype, "position", 2);
4806
+ var YGOProMsgSwap = class extends YGOProMsgBase {
4807
+ static {
4808
+ this.identifier = OcgcoreCommonConstants.MSG_SWAP;
4809
+ }
4810
+ };
4811
+ __decorateClass([
4812
+ BinaryField(() => YGOProMsgSwap_CardLocation, 0)
4813
+ ], YGOProMsgSwap.prototype, "card1", 2);
4814
+ __decorateClass([
4815
+ BinaryField(() => YGOProMsgSwap_CardLocation, 4)
4816
+ ], YGOProMsgSwap.prototype, "card2", 2);
4817
+
4818
+ // src/protos/msg/proto/swap-grave-deck.ts
4819
+ var YGOProMsgSwapGraveDeck = class extends YGOProMsgBase {
4820
+ static {
4821
+ this.identifier = OcgcoreCommonConstants.MSG_SWAP_GRAVE_DECK;
4822
+ }
4823
+ };
4824
+ __decorateClass([
4825
+ BinaryField("u8", 0)
4826
+ ], YGOProMsgSwapGraveDeck.prototype, "player", 2);
4827
+
4828
+ // src/protos/msg/proto/tag-swap.ts
4829
+ var YGOProMsgTagSwap = class extends YGOProMsgBase {
4830
+ static {
4831
+ this.identifier = OcgcoreCommonConstants.MSG_TAG_SWAP;
4832
+ }
4833
+ // 对方和队友视角需要隐藏手牌和额外卡组信息
4834
+ opponentView() {
4835
+ const view = this.copy();
4836
+ view.handCards = view.handCards.map(() => 0);
4837
+ view.extraCards = view.extraCards.map((card) => {
4838
+ if (!(card & 2147483648)) {
4839
+ return 0;
4840
+ }
4841
+ return card;
4842
+ });
4843
+ return view;
4844
+ }
4845
+ teammateView() {
4846
+ return this.opponentView();
4847
+ }
4848
+ };
4849
+ __decorateClass([
4850
+ BinaryField("u8", 0)
4851
+ ], YGOProMsgTagSwap.prototype, "player", 2);
4852
+ __decorateClass([
4853
+ BinaryField("u8", 1)
4854
+ ], YGOProMsgTagSwap.prototype, "mzoneCount", 2);
4855
+ __decorateClass([
4856
+ BinaryField("u8", 2)
4857
+ ], YGOProMsgTagSwap.prototype, "extraCount", 2);
4858
+ __decorateClass([
4859
+ BinaryField("u8", 3)
4860
+ ], YGOProMsgTagSwap.prototype, "pzoneCount", 2);
4861
+ __decorateClass([
4862
+ BinaryField("u8", 4)
4863
+ ], YGOProMsgTagSwap.prototype, "handCount", 2);
4864
+ __decorateClass([
4865
+ BinaryField("i32", 5, (obj) => obj.handCount)
4866
+ ], YGOProMsgTagSwap.prototype, "handCards", 2);
4867
+ __decorateClass([
4868
+ BinaryField("i32", (obj) => 5 + obj.handCount * 4, (obj) => obj.extraCount)
4869
+ ], YGOProMsgTagSwap.prototype, "extraCards", 2);
4870
+ __decorateClass([
4871
+ BinaryField("u32", (obj) => 5 + obj.handCount * 4 + obj.extraCount * 4)
4872
+ ], YGOProMsgTagSwap.prototype, "mzoneFlags", 2);
4873
+
4874
+ // src/protos/msg/proto/toss-coin.ts
4875
+ var YGOProMsgTossCoin = class extends YGOProMsgBase {
4876
+ static {
4877
+ this.identifier = OcgcoreCommonConstants.MSG_TOSS_COIN;
4878
+ }
4879
+ };
4880
+ __decorateClass([
4881
+ BinaryField("u8", 0)
4882
+ ], YGOProMsgTossCoin.prototype, "player", 2);
4883
+ __decorateClass([
4884
+ BinaryField("u8", 1)
4885
+ ], YGOProMsgTossCoin.prototype, "count", 2);
4886
+ __decorateClass([
4887
+ BinaryField("u8", 2, (obj) => obj.count)
4888
+ ], YGOProMsgTossCoin.prototype, "results", 2);
4889
+
4890
+ // src/protos/msg/proto/toss-dice.ts
4891
+ var YGOProMsgTossDice = class extends YGOProMsgBase {
4892
+ static {
4893
+ this.identifier = OcgcoreCommonConstants.MSG_TOSS_DICE;
4894
+ }
4895
+ };
4896
+ __decorateClass([
4897
+ BinaryField("u8", 0)
4898
+ ], YGOProMsgTossDice.prototype, "player", 2);
4899
+ __decorateClass([
4900
+ BinaryField("u8", 1)
4901
+ ], YGOProMsgTossDice.prototype, "count", 2);
4902
+ __decorateClass([
4903
+ BinaryField("u8", 2, (obj) => obj.count)
4904
+ ], YGOProMsgTossDice.prototype, "results", 2);
4905
+
4838
4906
  // src/protos/msg/proto/update-card.ts
4839
4907
  var YGOProMsgUpdateCard = class extends YGOProMsgBase {
4840
4908
  static {
@@ -5741,6 +5809,7 @@ export {
5741
5809
  YGOProMsgSelectIdleCmd_SimpleCardInfo,
5742
5810
  YGOProMsgSelectOption,
5743
5811
  YGOProMsgSelectPlace,
5812
+ YGOProMsgSelectPlaceCommon,
5744
5813
  YGOProMsgSelectPosition,
5745
5814
  YGOProMsgSelectSum,
5746
5815
  YGOProMsgSelectSum_CardInfo,