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