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