ygopro-msg-encode 1.0.5 → 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.
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,
@@ -3051,1033 +3052,6 @@ __decorateClass([
3051
3052
  BinaryField(() => YGOProMsgSelectCounter_CardInfo, 6, (obj) => obj.count)
3052
3053
  ], YGOProMsgSelectCounter.prototype, "cards", 2);
3053
3054
 
3054
- // src/protos/msg/proto/select-disfield.ts
3055
- var YGOProMsgSelectDisField = class extends YGOProMsgResponseBase {
3056
- responsePlayer() {
3057
- return this.player;
3058
- }
3059
- prepareResponse(places) {
3060
- const buffer = new Uint8Array(places.length * 3);
3061
- places.forEach((place, i) => {
3062
- buffer[i * 3] = place.player;
3063
- buffer[i * 3 + 1] = place.location;
3064
- buffer[i * 3 + 2] = place.sequence;
3065
- });
3066
- return buffer;
3067
- }
3068
- };
3069
- YGOProMsgSelectDisField.identifier = OcgcoreCommonConstants.MSG_SELECT_DISFIELD;
3070
- __decorateClass([
3071
- BinaryField("u8", 0)
3072
- ], YGOProMsgSelectDisField.prototype, "player", 2);
3073
- __decorateClass([
3074
- BinaryField("u8", 1)
3075
- ], YGOProMsgSelectDisField.prototype, "count", 2);
3076
- __decorateClass([
3077
- BinaryField("u32", 2)
3078
- ], YGOProMsgSelectDisField.prototype, "flag", 2);
3079
-
3080
- // src/protos/msg/proto/select-effectyn.ts
3081
- var YGOProMsgSelectEffectYn = class extends YGOProMsgResponseBase {
3082
- responsePlayer() {
3083
- return this.player;
3084
- }
3085
- defaultResponse() {
3086
- return this.prepareResponse(false);
3087
- }
3088
- prepareResponse(yes) {
3089
- const buffer = new Uint8Array(4);
3090
- const view = new DataView(buffer.buffer);
3091
- view.setInt32(0, yes ? 1 : 0, true);
3092
- return buffer;
3093
- }
3094
- };
3095
- YGOProMsgSelectEffectYn.identifier = OcgcoreCommonConstants.MSG_SELECT_EFFECTYN;
3096
- __decorateClass([
3097
- BinaryField("u8", 0)
3098
- ], YGOProMsgSelectEffectYn.prototype, "player", 2);
3099
- __decorateClass([
3100
- BinaryField("i32", 1)
3101
- ], YGOProMsgSelectEffectYn.prototype, "code", 2);
3102
- __decorateClass([
3103
- BinaryField("u8", 5)
3104
- ], YGOProMsgSelectEffectYn.prototype, "controller", 2);
3105
- __decorateClass([
3106
- BinaryField("u8", 6)
3107
- ], YGOProMsgSelectEffectYn.prototype, "location", 2);
3108
- __decorateClass([
3109
- BinaryField("u8", 7)
3110
- ], YGOProMsgSelectEffectYn.prototype, "sequence", 2);
3111
- __decorateClass([
3112
- BinaryField("u8", 8)
3113
- ], YGOProMsgSelectEffectYn.prototype, "position", 2);
3114
- __decorateClass([
3115
- BinaryField("i32", 9)
3116
- ], YGOProMsgSelectEffectYn.prototype, "desc", 2);
3117
-
3118
- // src/protos/msg/proto/select-idlecmd.ts
3119
- var IdleCmdType = /* @__PURE__ */ ((IdleCmdType2) => {
3120
- IdleCmdType2[IdleCmdType2["SUMMON"] = 0] = "SUMMON";
3121
- IdleCmdType2[IdleCmdType2["SPSUMMON"] = 1] = "SPSUMMON";
3122
- IdleCmdType2[IdleCmdType2["REPOS"] = 2] = "REPOS";
3123
- IdleCmdType2[IdleCmdType2["MSET"] = 3] = "MSET";
3124
- IdleCmdType2[IdleCmdType2["SSET"] = 4] = "SSET";
3125
- IdleCmdType2[IdleCmdType2["ACTIVATE"] = 5] = "ACTIVATE";
3126
- IdleCmdType2[IdleCmdType2["TO_BP"] = 6] = "TO_BP";
3127
- IdleCmdType2[IdleCmdType2["TO_EP"] = 7] = "TO_EP";
3128
- IdleCmdType2[IdleCmdType2["SHUFFLE"] = 8] = "SHUFFLE";
3129
- return IdleCmdType2;
3130
- })(IdleCmdType || {});
3131
- var YGOProMsgSelectIdleCmd_SimpleCardInfo = class {
3132
- };
3133
- __decorateClass([
3134
- BinaryField("i32", 0)
3135
- ], YGOProMsgSelectIdleCmd_SimpleCardInfo.prototype, "code", 2);
3136
- __decorateClass([
3137
- BinaryField("u8", 4)
3138
- ], YGOProMsgSelectIdleCmd_SimpleCardInfo.prototype, "controller", 2);
3139
- __decorateClass([
3140
- BinaryField("u8", 5)
3141
- ], YGOProMsgSelectIdleCmd_SimpleCardInfo.prototype, "location", 2);
3142
- __decorateClass([
3143
- BinaryField("u8", 6)
3144
- ], YGOProMsgSelectIdleCmd_SimpleCardInfo.prototype, "sequence", 2);
3145
- var YGOProMsgSelectIdleCmd_ActivatableInfo = class {
3146
- };
3147
- __decorateClass([
3148
- BinaryField("i32", 0)
3149
- ], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "code", 2);
3150
- __decorateClass([
3151
- BinaryField("u8", 4)
3152
- ], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "controller", 2);
3153
- __decorateClass([
3154
- BinaryField("u8", 5)
3155
- ], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "location", 2);
3156
- __decorateClass([
3157
- BinaryField("u8", 6)
3158
- ], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "sequence", 2);
3159
- __decorateClass([
3160
- BinaryField("i32", 7)
3161
- ], YGOProMsgSelectIdleCmd_ActivatableInfo.prototype, "desc", 2);
3162
- var YGOProMsgSelectIdleCmd = class extends YGOProMsgResponseBase {
3163
- responsePlayer() {
3164
- return this.player;
3165
- }
3166
- prepareResponse(type, option) {
3167
- let sequence;
3168
- if (type === 0 /* SUMMON */ || type === 1 /* SPSUMMON */ || type === 2 /* REPOS */ || type === 3 /* MSET */ || type === 4 /* SSET */ || type === 5 /* ACTIVATE */) {
3169
- if (option == null) {
3170
- throw new TypeError(`Option required for ${IdleCmdType[type]}`);
3171
- }
3172
- let cards;
3173
- let maxCount;
3174
- let typeName;
3175
- if (type === 0 /* SUMMON */) {
3176
- cards = this.summonableCards;
3177
- maxCount = this.summonableCount;
3178
- typeName = "Summonable";
3179
- } else if (type === 1 /* SPSUMMON */) {
3180
- cards = this.spSummonableCards;
3181
- maxCount = this.spSummonableCount;
3182
- typeName = "Special summonable";
3183
- } else if (type === 2 /* REPOS */) {
3184
- cards = this.reposableCards;
3185
- maxCount = this.reposableCount;
3186
- typeName = "Repositionable";
3187
- } else if (type === 3 /* MSET */) {
3188
- cards = this.msetableCards;
3189
- maxCount = this.msetableCount;
3190
- typeName = "Monster settable";
3191
- } else if (type === 4 /* SSET */) {
3192
- cards = this.ssetableCards;
3193
- maxCount = this.ssetableCount;
3194
- typeName = "Spell/Trap settable";
3195
- } else {
3196
- cards = this.activatableCards;
3197
- maxCount = this.activatableCount;
3198
- typeName = "Activatable";
3199
- }
3200
- if (isIndexResponse(option)) {
3201
- sequence = option.index;
3202
- if (sequence < 0 || sequence >= maxCount) {
3203
- throw new TypeError(`Index out of range: ${sequence}`);
3204
- }
3205
- } else {
3206
- const idx = cards.findIndex(
3207
- (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)
3208
- );
3209
- if (idx === -1) {
3210
- throw new TypeError(`${typeName} card not found`);
3211
- }
3212
- sequence = idx;
3213
- }
3214
- } else if (type === 6 /* TO_BP */) {
3215
- if (this.canBp === 0) {
3216
- throw new TypeError("Cannot go to BP");
3217
- }
3218
- sequence = 0;
3219
- } else if (type === 7 /* TO_EP */) {
3220
- if (this.canEp === 0) {
3221
- throw new TypeError("Cannot go to EP");
3222
- }
3223
- sequence = 0;
3224
- } else if (type === 8 /* SHUFFLE */) {
3225
- if (this.canShuffle === 0) {
3226
- throw new TypeError("Cannot shuffle");
3227
- }
3228
- sequence = 0;
3229
- } else {
3230
- throw new TypeError(`Unknown type: ${type}`);
3231
- }
3232
- const buffer = new Uint8Array(4);
3233
- const view = new DataView(buffer.buffer);
3234
- view.setUint32(0, sequence << 16 | type, true);
3235
- return buffer;
3236
- }
3237
- };
3238
- YGOProMsgSelectIdleCmd.identifier = OcgcoreCommonConstants.MSG_SELECT_IDLECMD;
3239
- __decorateClass([
3240
- BinaryField("u8", 0)
3241
- ], YGOProMsgSelectIdleCmd.prototype, "player", 2);
3242
- __decorateClass([
3243
- BinaryField("u8", 1)
3244
- ], YGOProMsgSelectIdleCmd.prototype, "summonableCount", 2);
3245
- __decorateClass([
3246
- BinaryField(
3247
- () => YGOProMsgSelectIdleCmd_SimpleCardInfo,
3248
- 2,
3249
- (obj) => obj.summonableCount
3250
- )
3251
- ], YGOProMsgSelectIdleCmd.prototype, "summonableCards", 2);
3252
- __decorateClass([
3253
- BinaryField("u8", (obj) => 2 + obj.summonableCount * 7)
3254
- ], YGOProMsgSelectIdleCmd.prototype, "spSummonableCount", 2);
3255
- __decorateClass([
3256
- BinaryField(
3257
- () => YGOProMsgSelectIdleCmd_SimpleCardInfo,
3258
- (obj) => 3 + obj.summonableCount * 7,
3259
- (obj) => obj.spSummonableCount
3260
- )
3261
- ], YGOProMsgSelectIdleCmd.prototype, "spSummonableCards", 2);
3262
- __decorateClass([
3263
- BinaryField(
3264
- "u8",
3265
- (obj) => 3 + obj.summonableCount * 7 + obj.spSummonableCount * 7
3266
- )
3267
- ], YGOProMsgSelectIdleCmd.prototype, "reposableCount", 2);
3268
- __decorateClass([
3269
- BinaryField(
3270
- () => YGOProMsgSelectIdleCmd_SimpleCardInfo,
3271
- (obj) => 4 + obj.summonableCount * 7 + obj.spSummonableCount * 7,
3272
- (obj) => obj.reposableCount
3273
- )
3274
- ], YGOProMsgSelectIdleCmd.prototype, "reposableCards", 2);
3275
- __decorateClass([
3276
- BinaryField(
3277
- "u8",
3278
- (obj) => 4 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7
3279
- )
3280
- ], YGOProMsgSelectIdleCmd.prototype, "msetableCount", 2);
3281
- __decorateClass([
3282
- BinaryField(
3283
- () => YGOProMsgSelectIdleCmd_SimpleCardInfo,
3284
- (obj) => 5 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7,
3285
- (obj) => obj.msetableCount
3286
- )
3287
- ], YGOProMsgSelectIdleCmd.prototype, "msetableCards", 2);
3288
- __decorateClass([
3289
- BinaryField(
3290
- "u8",
3291
- (obj) => 5 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7
3292
- )
3293
- ], YGOProMsgSelectIdleCmd.prototype, "ssetableCount", 2);
3294
- __decorateClass([
3295
- BinaryField(
3296
- () => YGOProMsgSelectIdleCmd_SimpleCardInfo,
3297
- (obj) => 6 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7,
3298
- (obj) => obj.ssetableCount
3299
- )
3300
- ], YGOProMsgSelectIdleCmd.prototype, "ssetableCards", 2);
3301
- __decorateClass([
3302
- BinaryField(
3303
- "u8",
3304
- (obj) => 6 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7 + obj.ssetableCount * 7
3305
- )
3306
- ], YGOProMsgSelectIdleCmd.prototype, "activatableCount", 2);
3307
- __decorateClass([
3308
- BinaryField(
3309
- () => YGOProMsgSelectIdleCmd_ActivatableInfo,
3310
- (obj) => 7 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7 + obj.ssetableCount * 7,
3311
- (obj) => obj.activatableCount
3312
- )
3313
- ], YGOProMsgSelectIdleCmd.prototype, "activatableCards", 2);
3314
- __decorateClass([
3315
- BinaryField(
3316
- "u8",
3317
- (obj) => 7 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7 + obj.ssetableCount * 7 + obj.activatableCount * 11
3318
- )
3319
- ], YGOProMsgSelectIdleCmd.prototype, "canBp", 2);
3320
- __decorateClass([
3321
- BinaryField(
3322
- "u8",
3323
- (obj) => 8 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7 + obj.ssetableCount * 7 + obj.activatableCount * 11
3324
- )
3325
- ], YGOProMsgSelectIdleCmd.prototype, "canEp", 2);
3326
- __decorateClass([
3327
- BinaryField(
3328
- "u8",
3329
- (obj) => 9 + obj.summonableCount * 7 + obj.spSummonableCount * 7 + obj.reposableCount * 7 + obj.msetableCount * 7 + obj.ssetableCount * 7 + obj.activatableCount * 11
3330
- )
3331
- ], YGOProMsgSelectIdleCmd.prototype, "canShuffle", 2);
3332
-
3333
- // src/protos/msg/proto/select-option.ts
3334
- var YGOProMsgSelectOption = class extends YGOProMsgResponseBase {
3335
- responsePlayer() {
3336
- return this.player;
3337
- }
3338
- prepareResponse(option) {
3339
- let index;
3340
- if (isIndexResponse(option)) {
3341
- index = option.index;
3342
- if (index < 0 || index >= this.count) {
3343
- throw new TypeError(`Index out of range: ${index}`);
3344
- }
3345
- } else {
3346
- index = this.options.indexOf(option);
3347
- if (index === -1) {
3348
- throw new TypeError(`Option not found: ${option}`);
3349
- }
3350
- }
3351
- const buffer = new Uint8Array(4);
3352
- const view = new DataView(buffer.buffer);
3353
- view.setInt32(0, index, true);
3354
- return buffer;
3355
- }
3356
- };
3357
- YGOProMsgSelectOption.identifier = OcgcoreCommonConstants.MSG_SELECT_OPTION;
3358
- __decorateClass([
3359
- BinaryField("u8", 0)
3360
- ], YGOProMsgSelectOption.prototype, "player", 2);
3361
- __decorateClass([
3362
- BinaryField("u8", 1)
3363
- ], YGOProMsgSelectOption.prototype, "count", 2);
3364
- __decorateClass([
3365
- BinaryField("i32", 2, (obj) => obj.count)
3366
- ], YGOProMsgSelectOption.prototype, "options", 2);
3367
-
3368
- // src/protos/msg/proto/select-place.ts
3369
- var YGOProMsgSelectPlace = class extends YGOProMsgResponseBase {
3370
- responsePlayer() {
3371
- return this.player;
3372
- }
3373
- prepareResponse(places) {
3374
- const buffer = new Uint8Array(places.length * 3);
3375
- places.forEach((place, i) => {
3376
- buffer[i * 3] = place.player;
3377
- buffer[i * 3 + 1] = place.location;
3378
- buffer[i * 3 + 2] = place.sequence;
3379
- });
3380
- return buffer;
3381
- }
3382
- };
3383
- YGOProMsgSelectPlace.identifier = OcgcoreCommonConstants.MSG_SELECT_PLACE;
3384
- __decorateClass([
3385
- BinaryField("u8", 0)
3386
- ], YGOProMsgSelectPlace.prototype, "player", 2);
3387
- __decorateClass([
3388
- BinaryField("u8", 1)
3389
- ], YGOProMsgSelectPlace.prototype, "count", 2);
3390
- __decorateClass([
3391
- BinaryField("u32", 2)
3392
- ], YGOProMsgSelectPlace.prototype, "flag", 2);
3393
-
3394
- // src/protos/msg/proto/select-position.ts
3395
- var YGOProMsgSelectPosition = class extends YGOProMsgResponseBase {
3396
- responsePlayer() {
3397
- return this.player;
3398
- }
3399
- prepareResponse(position) {
3400
- const buffer = new Uint8Array(4);
3401
- const view = new DataView(buffer.buffer);
3402
- view.setInt32(0, position, true);
3403
- return buffer;
3404
- }
3405
- };
3406
- YGOProMsgSelectPosition.identifier = OcgcoreCommonConstants.MSG_SELECT_POSITION;
3407
- __decorateClass([
3408
- BinaryField("u8", 0)
3409
- ], YGOProMsgSelectPosition.prototype, "player", 2);
3410
- __decorateClass([
3411
- BinaryField("i32", 1)
3412
- ], YGOProMsgSelectPosition.prototype, "code", 2);
3413
- __decorateClass([
3414
- BinaryField("u8", 5)
3415
- ], YGOProMsgSelectPosition.prototype, "positions", 2);
3416
-
3417
- // src/protos/msg/proto/select-sum.ts
3418
- var YGOProMsgSelectSum_CardInfo = class {
3419
- };
3420
- __decorateClass([
3421
- BinaryField("i32", 0)
3422
- ], YGOProMsgSelectSum_CardInfo.prototype, "code", 2);
3423
- __decorateClass([
3424
- BinaryField("u8", 4)
3425
- ], YGOProMsgSelectSum_CardInfo.prototype, "controller", 2);
3426
- __decorateClass([
3427
- BinaryField("u8", 5)
3428
- ], YGOProMsgSelectSum_CardInfo.prototype, "location", 2);
3429
- __decorateClass([
3430
- BinaryField("u8", 6)
3431
- ], YGOProMsgSelectSum_CardInfo.prototype, "sequence", 2);
3432
- __decorateClass([
3433
- BinaryField("i32", 7)
3434
- ], YGOProMsgSelectSum_CardInfo.prototype, "opParam", 2);
3435
- var YGOProMsgSelectSum = class extends YGOProMsgResponseBase {
3436
- responsePlayer() {
3437
- return this.player;
3438
- }
3439
- prepareResponse(cardOptions) {
3440
- const indices = [];
3441
- for (const option of cardOptions) {
3442
- let index;
3443
- if (isIndexResponse(option)) {
3444
- index = option.index;
3445
- if (index < 0 || index >= this.count) {
3446
- throw new TypeError(`Index out of range: ${index}`);
3447
- }
3448
- } else {
3449
- index = this.cards.findIndex(
3450
- (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)
3451
- );
3452
- if (index === -1) {
3453
- throw new TypeError("Card not found");
3454
- }
3455
- }
3456
- indices.push(index);
3457
- }
3458
- const buffer = new Uint8Array(1 + indices.length);
3459
- buffer[0] = this.mustSelectCount + indices.length;
3460
- indices.forEach((idx, i) => {
3461
- buffer[1 + i] = idx;
3462
- });
3463
- return buffer;
3464
- }
3465
- };
3466
- YGOProMsgSelectSum.identifier = OcgcoreCommonConstants.MSG_SELECT_SUM;
3467
- __decorateClass([
3468
- BinaryField("u8", 0)
3469
- ], YGOProMsgSelectSum.prototype, "mode", 2);
3470
- __decorateClass([
3471
- BinaryField("u8", 1)
3472
- ], YGOProMsgSelectSum.prototype, "player", 2);
3473
- __decorateClass([
3474
- BinaryField("i32", 2)
3475
- ], YGOProMsgSelectSum.prototype, "sumVal", 2);
3476
- __decorateClass([
3477
- BinaryField("u8", 6)
3478
- ], YGOProMsgSelectSum.prototype, "min", 2);
3479
- __decorateClass([
3480
- BinaryField("u8", 7)
3481
- ], YGOProMsgSelectSum.prototype, "max", 2);
3482
- __decorateClass([
3483
- BinaryField("u8", 8)
3484
- ], YGOProMsgSelectSum.prototype, "mustSelectCount", 2);
3485
- __decorateClass([
3486
- BinaryField(
3487
- () => YGOProMsgSelectSum_CardInfo,
3488
- 9,
3489
- (obj) => obj.mustSelectCount
3490
- )
3491
- ], YGOProMsgSelectSum.prototype, "mustSelectCards", 2);
3492
- __decorateClass([
3493
- BinaryField("u8", (obj) => {
3494
- return 9 + obj.mustSelectCount * 11;
3495
- })
3496
- ], YGOProMsgSelectSum.prototype, "count", 2);
3497
- __decorateClass([
3498
- BinaryField(
3499
- () => YGOProMsgSelectSum_CardInfo,
3500
- (obj) => {
3501
- return 10 + obj.mustSelectCount * 11;
3502
- },
3503
- (obj) => obj.count
3504
- )
3505
- ], YGOProMsgSelectSum.prototype, "cards", 2);
3506
-
3507
- // src/protos/msg/proto/select-tribute.ts
3508
- var YGOProMsgSelectTribute_CardInfo = class {
3509
- };
3510
- __decorateClass([
3511
- BinaryField("i32", 0)
3512
- ], YGOProMsgSelectTribute_CardInfo.prototype, "code", 2);
3513
- __decorateClass([
3514
- BinaryField("u8", 4)
3515
- ], YGOProMsgSelectTribute_CardInfo.prototype, "controller", 2);
3516
- __decorateClass([
3517
- BinaryField("u8", 5)
3518
- ], YGOProMsgSelectTribute_CardInfo.prototype, "location", 2);
3519
- __decorateClass([
3520
- BinaryField("u8", 6)
3521
- ], YGOProMsgSelectTribute_CardInfo.prototype, "sequence", 2);
3522
- __decorateClass([
3523
- BinaryField("u8", 7)
3524
- ], YGOProMsgSelectTribute_CardInfo.prototype, "releaseParam", 2);
3525
- var YGOProMsgSelectTribute = class extends YGOProMsgResponseBase {
3526
- responsePlayer() {
3527
- return this.player;
3528
- }
3529
- defaultResponse() {
3530
- if (this.cancelable === 0) {
3531
- return void 0;
3532
- }
3533
- return this.prepareResponse(null);
3534
- }
3535
- prepareResponse(cardOptions) {
3536
- if (cardOptions == null) {
3537
- const buffer2 = new Uint8Array(4);
3538
- const view = new DataView(buffer2.buffer);
3539
- view.setInt32(0, -1, true);
3540
- return buffer2;
3541
- }
3542
- const indices = [];
3543
- const usedIndices = /* @__PURE__ */ new Set();
3544
- for (const option of cardOptions) {
3545
- let index;
3546
- if (isIndexResponse(option)) {
3547
- index = option.index;
3548
- if (index < 0 || index >= this.count) {
3549
- throw new TypeError(`Index out of range: ${index}`);
3550
- }
3551
- } else {
3552
- index = this.cards.findIndex(
3553
- (card, idx) => !usedIndices.has(idx) && (option.code == null || card.code === option.code) && (option.controller == null || card.controller === option.controller) && (option.location == null || card.location === option.location) && (option.sequence == null || card.sequence === option.sequence)
3554
- );
3555
- if (index === -1) {
3556
- throw new TypeError("Card not found");
3557
- }
3558
- }
3559
- indices.push(index);
3560
- usedIndices.add(index);
3561
- }
3562
- const buffer = new Uint8Array(1 + indices.length);
3563
- buffer[0] = indices.length;
3564
- indices.forEach((idx, i) => {
3565
- buffer[1 + i] = idx;
3566
- });
3567
- return buffer;
3568
- }
3569
- };
3570
- YGOProMsgSelectTribute.identifier = OcgcoreCommonConstants.MSG_SELECT_TRIBUTE;
3571
- __decorateClass([
3572
- BinaryField("u8", 0)
3573
- ], YGOProMsgSelectTribute.prototype, "player", 2);
3574
- __decorateClass([
3575
- BinaryField("u8", 1)
3576
- ], YGOProMsgSelectTribute.prototype, "cancelable", 2);
3577
- __decorateClass([
3578
- BinaryField("u8", 2)
3579
- ], YGOProMsgSelectTribute.prototype, "min", 2);
3580
- __decorateClass([
3581
- BinaryField("u8", 3)
3582
- ], YGOProMsgSelectTribute.prototype, "max", 2);
3583
- __decorateClass([
3584
- BinaryField("u8", 4)
3585
- ], YGOProMsgSelectTribute.prototype, "count", 2);
3586
- __decorateClass([
3587
- BinaryField(() => YGOProMsgSelectTribute_CardInfo, 5, (obj) => obj.count)
3588
- ], YGOProMsgSelectTribute.prototype, "cards", 2);
3589
-
3590
- // src/protos/msg/proto/select-unselect-card.ts
3591
- var YGOProMsgSelectUnselectCard_CardInfo = class {
3592
- };
3593
- __decorateClass([
3594
- BinaryField("i32", 0)
3595
- ], YGOProMsgSelectUnselectCard_CardInfo.prototype, "code", 2);
3596
- __decorateClass([
3597
- BinaryField("u8", 4)
3598
- ], YGOProMsgSelectUnselectCard_CardInfo.prototype, "controller", 2);
3599
- __decorateClass([
3600
- BinaryField("u8", 5)
3601
- ], YGOProMsgSelectUnselectCard_CardInfo.prototype, "location", 2);
3602
- __decorateClass([
3603
- BinaryField("u8", 6)
3604
- ], YGOProMsgSelectUnselectCard_CardInfo.prototype, "sequence", 2);
3605
- __decorateClass([
3606
- BinaryField("u8", 7)
3607
- ], YGOProMsgSelectUnselectCard_CardInfo.prototype, "subsequence", 2);
3608
- var YGOProMsgSelectUnselectCard = class extends YGOProMsgResponseBase {
3609
- responsePlayer() {
3610
- return this.player;
3611
- }
3612
- defaultResponse() {
3613
- if (this.cancelable === 0 && this.finishable === 0) {
3614
- return void 0;
3615
- }
3616
- return this.prepareResponse(null);
3617
- }
3618
- prepareResponse(cardOption) {
3619
- if (cardOption == null) {
3620
- const buffer2 = new Uint8Array(4);
3621
- const view = new DataView(buffer2.buffer);
3622
- view.setInt32(0, -1, true);
3623
- return buffer2;
3624
- }
3625
- let index;
3626
- if (isIndexResponse(cardOption)) {
3627
- index = cardOption.index;
3628
- const totalCount = this.selectableCount + this.unselectableCount;
3629
- if (index < 0 || index >= totalCount) {
3630
- throw new TypeError(`Index out of range: ${index}`);
3631
- }
3632
- } else {
3633
- index = this.selectableCards.findIndex(
3634
- (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)
3635
- );
3636
- if (index === -1) {
3637
- const unselectIndex = this.unselectableCards.findIndex(
3638
- (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)
3639
- );
3640
- if (unselectIndex === -1) {
3641
- throw new TypeError("Card not found");
3642
- }
3643
- index = this.selectableCount + unselectIndex;
3644
- }
3645
- }
3646
- const buffer = new Uint8Array(2);
3647
- buffer[0] = 1;
3648
- buffer[1] = index;
3649
- return buffer;
3650
- }
3651
- };
3652
- YGOProMsgSelectUnselectCard.identifier = OcgcoreCommonConstants.MSG_SELECT_UNSELECT_CARD;
3653
- __decorateClass([
3654
- BinaryField("u8", 0)
3655
- ], YGOProMsgSelectUnselectCard.prototype, "player", 2);
3656
- __decorateClass([
3657
- BinaryField("u8", 1)
3658
- ], YGOProMsgSelectUnselectCard.prototype, "finishable", 2);
3659
- __decorateClass([
3660
- BinaryField("u8", 2)
3661
- ], YGOProMsgSelectUnselectCard.prototype, "cancelable", 2);
3662
- __decorateClass([
3663
- BinaryField("u8", 3)
3664
- ], YGOProMsgSelectUnselectCard.prototype, "min", 2);
3665
- __decorateClass([
3666
- BinaryField("u8", 4)
3667
- ], YGOProMsgSelectUnselectCard.prototype, "max", 2);
3668
- __decorateClass([
3669
- BinaryField("u8", 5)
3670
- ], YGOProMsgSelectUnselectCard.prototype, "selectableCount", 2);
3671
- __decorateClass([
3672
- BinaryField(
3673
- () => YGOProMsgSelectUnselectCard_CardInfo,
3674
- 6,
3675
- (obj) => obj.selectableCount
3676
- )
3677
- ], YGOProMsgSelectUnselectCard.prototype, "selectableCards", 2);
3678
- __decorateClass([
3679
- BinaryField("u8", (obj) => {
3680
- return 6 + obj.selectableCount * 8;
3681
- })
3682
- ], YGOProMsgSelectUnselectCard.prototype, "unselectableCount", 2);
3683
- __decorateClass([
3684
- BinaryField(
3685
- () => YGOProMsgSelectUnselectCard_CardInfo,
3686
- (obj) => {
3687
- return 7 + obj.selectableCount * 8;
3688
- },
3689
- (obj) => obj.unselectableCount
3690
- )
3691
- ], YGOProMsgSelectUnselectCard.prototype, "unselectableCards", 2);
3692
-
3693
- // src/protos/msg/proto/select-yesno.ts
3694
- var YGOProMsgSelectYesNo = class extends YGOProMsgResponseBase {
3695
- responsePlayer() {
3696
- return this.player;
3697
- }
3698
- defaultResponse() {
3699
- return this.prepareResponse(false);
3700
- }
3701
- prepareResponse(yes) {
3702
- const buffer = new Uint8Array(4);
3703
- const view = new DataView(buffer.buffer);
3704
- view.setInt32(0, yes ? 1 : 0, true);
3705
- return buffer;
3706
- }
3707
- };
3708
- YGOProMsgSelectYesNo.identifier = OcgcoreCommonConstants.MSG_SELECT_YESNO;
3709
- __decorateClass([
3710
- BinaryField("u8", 0)
3711
- ], YGOProMsgSelectYesNo.prototype, "player", 2);
3712
- __decorateClass([
3713
- BinaryField("i32", 1)
3714
- ], YGOProMsgSelectYesNo.prototype, "desc", 2);
3715
-
3716
- // src/protos/msg/proto/set.ts
3717
- var YGOProMsgSet = class extends YGOProMsgBase {
3718
- };
3719
- YGOProMsgSet.identifier = OcgcoreCommonConstants.MSG_SET;
3720
- __decorateClass([
3721
- BinaryField("i32", 0)
3722
- ], YGOProMsgSet.prototype, "code", 2);
3723
-
3724
- // src/protos/msg/proto/shuffle-deck.ts
3725
- var YGOProMsgShuffleDeck = class extends YGOProMsgBase {
3726
- };
3727
- YGOProMsgShuffleDeck.identifier = OcgcoreCommonConstants.MSG_SHUFFLE_DECK;
3728
- __decorateClass([
3729
- BinaryField("u8", 0)
3730
- ], YGOProMsgShuffleDeck.prototype, "player", 2);
3731
-
3732
- // src/protos/msg/proto/shuffle-extra.ts
3733
- var YGOProMsgShuffleExtra = class extends YGOProMsgBase {
3734
- // 对方视角需要隐藏额外卡组信息
3735
- opponentView() {
3736
- const view = this.copy();
3737
- view.cards = view.cards.map((card) => {
3738
- if (!(card & 2147483648)) {
3739
- return 0;
3740
- }
3741
- return card;
3742
- });
3743
- return view;
3744
- }
3745
- };
3746
- YGOProMsgShuffleExtra.identifier = OcgcoreCommonConstants.MSG_SHUFFLE_EXTRA;
3747
- __decorateClass([
3748
- BinaryField("u8", 0)
3749
- ], YGOProMsgShuffleExtra.prototype, "player", 2);
3750
- __decorateClass([
3751
- BinaryField("u8", 1)
3752
- ], YGOProMsgShuffleExtra.prototype, "count", 2);
3753
- __decorateClass([
3754
- BinaryField("i32", 2, (obj) => obj.count)
3755
- ], YGOProMsgShuffleExtra.prototype, "cards", 2);
3756
-
3757
- // src/protos/msg/proto/shuffle-hand.ts
3758
- var YGOProMsgShuffleHand = class extends YGOProMsgBase {
3759
- // 对方视角需要隐藏手牌信息
3760
- opponentView() {
3761
- const view = this.copy();
3762
- view.cards = view.cards.map(() => 0);
3763
- return view;
3764
- }
3765
- };
3766
- YGOProMsgShuffleHand.identifier = OcgcoreCommonConstants.MSG_SHUFFLE_HAND;
3767
- __decorateClass([
3768
- BinaryField("u8", 0)
3769
- ], YGOProMsgShuffleHand.prototype, "player", 2);
3770
- __decorateClass([
3771
- BinaryField("u8", 1)
3772
- ], YGOProMsgShuffleHand.prototype, "count", 2);
3773
- __decorateClass([
3774
- BinaryField("i32", 2, (obj) => obj.count)
3775
- ], YGOProMsgShuffleHand.prototype, "cards", 2);
3776
-
3777
- // src/protos/msg/proto/shuffle-set-card.ts
3778
- var YGOProMsgShuffleSetCard_CardLocation = class {
3779
- };
3780
- __decorateClass([
3781
- BinaryField("u8", 0)
3782
- ], YGOProMsgShuffleSetCard_CardLocation.prototype, "controller", 2);
3783
- __decorateClass([
3784
- BinaryField("u8", 1)
3785
- ], YGOProMsgShuffleSetCard_CardLocation.prototype, "location", 2);
3786
- __decorateClass([
3787
- BinaryField("u8", 2)
3788
- ], YGOProMsgShuffleSetCard_CardLocation.prototype, "sequence", 2);
3789
- __decorateClass([
3790
- BinaryField("u8", 3)
3791
- ], YGOProMsgShuffleSetCard_CardLocation.prototype, "position", 2);
3792
- var YGOProMsgShuffleSetCard_SetCardInfo = class {
3793
- };
3794
- __decorateClass([
3795
- BinaryField(() => YGOProMsgShuffleSetCard_CardLocation, 0)
3796
- ], YGOProMsgShuffleSetCard_SetCardInfo.prototype, "oldLocation", 2);
3797
- __decorateClass([
3798
- BinaryField(() => YGOProMsgShuffleSetCard_CardLocation, 4)
3799
- ], YGOProMsgShuffleSetCard_SetCardInfo.prototype, "newLocation", 2);
3800
- var YGOProMsgShuffleSetCard = class extends YGOProMsgBase {
3801
- };
3802
- YGOProMsgShuffleSetCard.identifier = OcgcoreCommonConstants.MSG_SHUFFLE_SET_CARD;
3803
- __decorateClass([
3804
- BinaryField("u8", 0)
3805
- ], YGOProMsgShuffleSetCard.prototype, "location", 2);
3806
- __decorateClass([
3807
- BinaryField("u8", 1)
3808
- ], YGOProMsgShuffleSetCard.prototype, "count", 2);
3809
- __decorateClass([
3810
- BinaryField(() => YGOProMsgShuffleSetCard_SetCardInfo, 2, (obj) => obj.count)
3811
- ], YGOProMsgShuffleSetCard.prototype, "cards", 2);
3812
-
3813
- // src/protos/msg/proto/sort-card.ts
3814
- var YGOProMsgSortCard_CardInfo = class {
3815
- };
3816
- __decorateClass([
3817
- BinaryField("i32", 0)
3818
- ], YGOProMsgSortCard_CardInfo.prototype, "code", 2);
3819
- __decorateClass([
3820
- BinaryField("u8", 4)
3821
- ], YGOProMsgSortCard_CardInfo.prototype, "controller", 2);
3822
- __decorateClass([
3823
- BinaryField("u8", 5)
3824
- ], YGOProMsgSortCard_CardInfo.prototype, "location", 2);
3825
- __decorateClass([
3826
- BinaryField("u8", 6)
3827
- ], YGOProMsgSortCard_CardInfo.prototype, "sequence", 2);
3828
- var YGOProMsgSortCard = class extends YGOProMsgResponseBase {
3829
- responsePlayer() {
3830
- return this.player;
3831
- }
3832
- defaultResponse() {
3833
- return this.prepareResponse(null);
3834
- }
3835
- prepareResponse(sortedOptions) {
3836
- if (sortedOptions == null) {
3837
- return new Uint8Array([255]);
3838
- }
3839
- const indices = [];
3840
- const usedIndices = /* @__PURE__ */ new Set();
3841
- for (const option of sortedOptions) {
3842
- let index;
3843
- if (isIndexResponse(option)) {
3844
- index = option.index;
3845
- if (index < 0 || index >= this.count) {
3846
- throw new TypeError(`Index out of range: ${index}`);
3847
- }
3848
- } else {
3849
- index = this.cards.findIndex(
3850
- (card, idx) => !usedIndices.has(idx) && (option.code == null || card.code === option.code) && (option.controller == null || card.controller === option.controller) && (option.location == null || card.location === option.location) && (option.sequence == null || card.sequence === option.sequence)
3851
- );
3852
- if (index === -1) {
3853
- throw new TypeError("Card not found");
3854
- }
3855
- }
3856
- indices.push(index);
3857
- usedIndices.add(index);
3858
- }
3859
- const buffer = new Uint8Array(indices.length);
3860
- indices.forEach((idx, i) => {
3861
- buffer[i] = idx;
3862
- });
3863
- return buffer;
3864
- }
3865
- };
3866
- YGOProMsgSortCard.identifier = OcgcoreCommonConstants.MSG_SORT_CARD;
3867
- __decorateClass([
3868
- BinaryField("u8", 0)
3869
- ], YGOProMsgSortCard.prototype, "player", 2);
3870
- __decorateClass([
3871
- BinaryField("u8", 1)
3872
- ], YGOProMsgSortCard.prototype, "count", 2);
3873
- __decorateClass([
3874
- BinaryField(() => YGOProMsgSortCard_CardInfo, 2, (obj) => obj.count)
3875
- ], YGOProMsgSortCard.prototype, "cards", 2);
3876
-
3877
- // src/protos/msg/proto/spsummoned.ts
3878
- var YGOProMsgSpSummoned = class extends YGOProMsgBase {
3879
- };
3880
- YGOProMsgSpSummoned.identifier = OcgcoreCommonConstants.MSG_SPSUMMONED;
3881
-
3882
- // src/protos/msg/proto/spsummoning.ts
3883
- var YGOProMsgSpSummoning = class extends YGOProMsgBase {
3884
- };
3885
- YGOProMsgSpSummoning.identifier = OcgcoreCommonConstants.MSG_SPSUMMONING;
3886
- __decorateClass([
3887
- BinaryField("i32", 0)
3888
- ], YGOProMsgSpSummoning.prototype, "code", 2);
3889
- __decorateClass([
3890
- BinaryField("u8", 4)
3891
- ], YGOProMsgSpSummoning.prototype, "controller", 2);
3892
- __decorateClass([
3893
- BinaryField("u8", 5)
3894
- ], YGOProMsgSpSummoning.prototype, "location", 2);
3895
- __decorateClass([
3896
- BinaryField("u8", 6)
3897
- ], YGOProMsgSpSummoning.prototype, "sequence", 2);
3898
- __decorateClass([
3899
- BinaryField("u8", 7)
3900
- ], YGOProMsgSpSummoning.prototype, "position", 2);
3901
-
3902
- // src/protos/msg/proto/start.ts
3903
- var YGOProMsgStart_PlayerInfo = class {
3904
- };
3905
- __decorateClass([
3906
- BinaryField("u16", 0)
3907
- ], YGOProMsgStart_PlayerInfo.prototype, "deckCount", 2);
3908
- __decorateClass([
3909
- BinaryField("u16", 2)
3910
- ], YGOProMsgStart_PlayerInfo.prototype, "extraCount", 2);
3911
- var YGOProMsgStart = class extends YGOProMsgBase {
3912
- /**
3913
- * Get/Set player number (low 4 bits, 0-3)
3914
- */
3915
- get playerNumber() {
3916
- return this.playerType & 15;
3917
- }
3918
- set playerNumber(value) {
3919
- this.playerType = this.playerType & 240 | value & 15;
3920
- }
3921
- /**
3922
- * Get/Set observer flag (high 4 bits, 0x00 or 0x10)
3923
- */
3924
- get observerFlag() {
3925
- return this.playerType & 240;
3926
- }
3927
- set observerFlag(value) {
3928
- this.playerType = this.playerType & 15 | value & 240;
3929
- }
3930
- };
3931
- YGOProMsgStart.identifier = 4;
3932
- __decorateClass([
3933
- BinaryField("u8", 0)
3934
- ], YGOProMsgStart.prototype, "playerType", 2);
3935
- __decorateClass([
3936
- BinaryField("u8", 1)
3937
- ], YGOProMsgStart.prototype, "duelRule", 2);
3938
- __decorateClass([
3939
- BinaryField("i32", 2)
3940
- ], YGOProMsgStart.prototype, "startLp0", 2);
3941
- __decorateClass([
3942
- BinaryField("i32", 6)
3943
- ], YGOProMsgStart.prototype, "startLp1", 2);
3944
- __decorateClass([
3945
- BinaryField(() => YGOProMsgStart_PlayerInfo, 10)
3946
- ], YGOProMsgStart.prototype, "player0", 2);
3947
- __decorateClass([
3948
- BinaryField(() => YGOProMsgStart_PlayerInfo, 14)
3949
- ], YGOProMsgStart.prototype, "player1", 2);
3950
-
3951
- // src/protos/msg/proto/summoned.ts
3952
- var YGOProMsgSummoned = class extends YGOProMsgBase {
3953
- };
3954
- YGOProMsgSummoned.identifier = OcgcoreCommonConstants.MSG_SUMMONED;
3955
-
3956
- // src/protos/msg/proto/summoning.ts
3957
- var YGOProMsgSummoning = class extends YGOProMsgBase {
3958
- };
3959
- YGOProMsgSummoning.identifier = OcgcoreCommonConstants.MSG_SUMMONING;
3960
- __decorateClass([
3961
- BinaryField("i32", 0)
3962
- ], YGOProMsgSummoning.prototype, "code", 2);
3963
- __decorateClass([
3964
- BinaryField("u8", 4)
3965
- ], YGOProMsgSummoning.prototype, "controller", 2);
3966
- __decorateClass([
3967
- BinaryField("u8", 5)
3968
- ], YGOProMsgSummoning.prototype, "location", 2);
3969
- __decorateClass([
3970
- BinaryField("u8", 6)
3971
- ], YGOProMsgSummoning.prototype, "sequence", 2);
3972
- __decorateClass([
3973
- BinaryField("u8", 7)
3974
- ], YGOProMsgSummoning.prototype, "position", 2);
3975
-
3976
- // src/protos/msg/proto/swap.ts
3977
- var YGOProMsgSwap_CardLocation = class {
3978
- };
3979
- __decorateClass([
3980
- BinaryField("u8", 0)
3981
- ], YGOProMsgSwap_CardLocation.prototype, "controller", 2);
3982
- __decorateClass([
3983
- BinaryField("u8", 1)
3984
- ], YGOProMsgSwap_CardLocation.prototype, "location", 2);
3985
- __decorateClass([
3986
- BinaryField("u8", 2)
3987
- ], YGOProMsgSwap_CardLocation.prototype, "sequence", 2);
3988
- __decorateClass([
3989
- BinaryField("u8", 3)
3990
- ], YGOProMsgSwap_CardLocation.prototype, "position", 2);
3991
- var YGOProMsgSwap = class extends YGOProMsgBase {
3992
- };
3993
- YGOProMsgSwap.identifier = OcgcoreCommonConstants.MSG_SWAP;
3994
- __decorateClass([
3995
- BinaryField(() => YGOProMsgSwap_CardLocation, 0)
3996
- ], YGOProMsgSwap.prototype, "card1", 2);
3997
- __decorateClass([
3998
- BinaryField(() => YGOProMsgSwap_CardLocation, 4)
3999
- ], YGOProMsgSwap.prototype, "card2", 2);
4000
-
4001
- // src/protos/msg/proto/swap-grave-deck.ts
4002
- var YGOProMsgSwapGraveDeck = class extends YGOProMsgBase {
4003
- };
4004
- YGOProMsgSwapGraveDeck.identifier = OcgcoreCommonConstants.MSG_SWAP_GRAVE_DECK;
4005
- __decorateClass([
4006
- BinaryField("u8", 0)
4007
- ], YGOProMsgSwapGraveDeck.prototype, "player", 2);
4008
-
4009
- // src/protos/msg/proto/tag-swap.ts
4010
- var YGOProMsgTagSwap = class extends YGOProMsgBase {
4011
- // 对方和队友视角需要隐藏手牌和额外卡组信息
4012
- opponentView() {
4013
- const view = this.copy();
4014
- view.handCards = view.handCards.map(() => 0);
4015
- view.extraCards = view.extraCards.map((card) => {
4016
- if (!(card & 2147483648)) {
4017
- return 0;
4018
- }
4019
- return card;
4020
- });
4021
- return view;
4022
- }
4023
- teammateView() {
4024
- return this.opponentView();
4025
- }
4026
- };
4027
- YGOProMsgTagSwap.identifier = OcgcoreCommonConstants.MSG_TAG_SWAP;
4028
- __decorateClass([
4029
- BinaryField("u8", 0)
4030
- ], YGOProMsgTagSwap.prototype, "player", 2);
4031
- __decorateClass([
4032
- BinaryField("u8", 1)
4033
- ], YGOProMsgTagSwap.prototype, "mzoneCount", 2);
4034
- __decorateClass([
4035
- BinaryField("u8", 2)
4036
- ], YGOProMsgTagSwap.prototype, "extraCount", 2);
4037
- __decorateClass([
4038
- BinaryField("u8", 3)
4039
- ], YGOProMsgTagSwap.prototype, "pzoneCount", 2);
4040
- __decorateClass([
4041
- BinaryField("u8", 4)
4042
- ], YGOProMsgTagSwap.prototype, "handCount", 2);
4043
- __decorateClass([
4044
- BinaryField("i32", 5, (obj) => obj.handCount)
4045
- ], YGOProMsgTagSwap.prototype, "handCards", 2);
4046
- __decorateClass([
4047
- BinaryField("i32", (obj) => 5 + obj.handCount * 4, (obj) => obj.extraCount)
4048
- ], YGOProMsgTagSwap.prototype, "extraCards", 2);
4049
- __decorateClass([
4050
- BinaryField("u32", (obj) => 5 + obj.handCount * 4 + obj.extraCount * 4)
4051
- ], YGOProMsgTagSwap.prototype, "mzoneFlags", 2);
4052
-
4053
- // src/protos/msg/proto/toss-coin.ts
4054
- var YGOProMsgTossCoin = class extends YGOProMsgBase {
4055
- };
4056
- YGOProMsgTossCoin.identifier = OcgcoreCommonConstants.MSG_TOSS_COIN;
4057
- __decorateClass([
4058
- BinaryField("u8", 0)
4059
- ], YGOProMsgTossCoin.prototype, "player", 2);
4060
- __decorateClass([
4061
- BinaryField("u8", 1)
4062
- ], YGOProMsgTossCoin.prototype, "count", 2);
4063
- __decorateClass([
4064
- BinaryField("u8", 2, (obj) => obj.count)
4065
- ], YGOProMsgTossCoin.prototype, "results", 2);
4066
-
4067
- // src/protos/msg/proto/toss-dice.ts
4068
- var YGOProMsgTossDice = class extends YGOProMsgBase {
4069
- };
4070
- YGOProMsgTossDice.identifier = OcgcoreCommonConstants.MSG_TOSS_DICE;
4071
- __decorateClass([
4072
- BinaryField("u8", 0)
4073
- ], YGOProMsgTossDice.prototype, "player", 2);
4074
- __decorateClass([
4075
- BinaryField("u8", 1)
4076
- ], YGOProMsgTossDice.prototype, "count", 2);
4077
- __decorateClass([
4078
- BinaryField("u8", 2, (obj) => obj.count)
4079
- ], YGOProMsgTossDice.prototype, "results", 2);
4080
-
4081
3055
  // src/vendor/script-constants.ts
4082
3056
  var OcgcoreScriptConstants = {
4083
3057
  ACTIVITY_ATTACK: 5,
@@ -4916,6 +3890,1038 @@ var OcgcoreScriptConstants = {
4916
3890
  TYPE_XYZ: 8388608
4917
3891
  };
4918
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
+
4919
4925
  // src/protos/msg/proto/update-card.ts
4920
4926
  var YGOProMsgUpdateCard = class extends YGOProMsgBase {
4921
4927
  opponentView() {
@@ -5767,6 +5773,7 @@ var RoomStatus = /* @__PURE__ */ ((RoomStatus2) => {
5767
5773
  YGOProMsgSelectIdleCmd_SimpleCardInfo,
5768
5774
  YGOProMsgSelectOption,
5769
5775
  YGOProMsgSelectPlace,
5776
+ YGOProMsgSelectPlaceCommon,
5770
5777
  YGOProMsgSelectPosition,
5771
5778
  YGOProMsgSelectSum,
5772
5779
  YGOProMsgSelectSum_CardInfo,