ygopro-msg-encode 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPOSITE_FIELDS_AUDIT.md +275 -0
- package/COMPOSITE_FIELDS_GUIDE.md +303 -0
- package/DECK_COUNT_EXPLANATION.md +124 -0
- package/ENUM_FIX_SUMMARY.md +84 -0
- package/ENUM_UPDATE.md +219 -0
- package/PROTOCOL_VERIFICATION_SUMMARY.md +410 -0
- package/README.md +32 -0
- package/REFACTOR_COMPOSITE_FIELDS.md +242 -0
- package/STOC_CHAT_FIX.md +156 -0
- package/UTF16_STRING_FIX.md +190 -0
- package/dist/index.cjs +177 -8
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +167 -8
- package/dist/index.mjs.map +4 -4
- package/dist/src/protos/common/host-info.d.ts +2 -1
- package/dist/src/protos/ctos/proto/create-game.d.ts +2 -2
- package/dist/src/protos/ctos/proto/hand-result.d.ts +2 -1
- package/dist/src/protos/ctos/proto/join-game.d.ts +1 -1
- package/dist/src/protos/ctos/proto/kick.d.ts +2 -1
- package/dist/src/protos/ctos/proto/player-info.d.ts +1 -1
- package/dist/src/protos/ctos/proto/tp-result.d.ts +2 -1
- package/dist/src/protos/msg/proto/start.d.ts +17 -0
- package/dist/src/protos/network-enums.d.ts +94 -0
- package/dist/src/protos/stoc/proto/deck-count.d.ts +15 -1
- package/dist/src/protos/stoc/proto/error-msg.d.ts +2 -1
- package/dist/src/protos/stoc/proto/hs-player-change.d.ts +23 -0
- package/dist/src/protos/stoc/proto/hs-player-enter.d.ts +1 -1
- package/dist/src/protos/stoc/proto/srvpro-roomlist.d.ts +2 -1
- package/dist/src/protos/stoc/proto/type-change.d.ts +23 -0
- package/index.ts +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export * from './src/protos/common';
|
|
|
4
4
|
export * from './src/protos/ctos';
|
|
5
5
|
export * from './src/protos/stoc';
|
|
6
6
|
export * from './src/protos/msg';
|
|
7
|
+
export * from './src/protos/network-enums';
|
|
7
8
|
export * from './src/vendor/ocgcore-constants';
|
|
8
9
|
export * from './src/vendor/script-constants';
|
package/dist/index.mjs
CHANGED
|
@@ -510,7 +510,7 @@ var YGOProCtosPlayerInfo = class extends YGOProCtosBase {
|
|
|
510
510
|
}
|
|
511
511
|
};
|
|
512
512
|
__decorateClass([
|
|
513
|
-
BinaryField("
|
|
513
|
+
BinaryField("utf16", 0, 20)
|
|
514
514
|
], YGOProCtosPlayerInfo.prototype, "name", 2);
|
|
515
515
|
|
|
516
516
|
// src/protos/ctos/proto/create-game.ts
|
|
@@ -523,10 +523,10 @@ __decorateClass([
|
|
|
523
523
|
BinaryField(() => HostInfo, 0)
|
|
524
524
|
], YGOProCtosCreateGame.prototype, "info", 2);
|
|
525
525
|
__decorateClass([
|
|
526
|
-
BinaryField("
|
|
526
|
+
BinaryField("utf16", 20, 20)
|
|
527
527
|
], YGOProCtosCreateGame.prototype, "name", 2);
|
|
528
528
|
__decorateClass([
|
|
529
|
-
BinaryField("
|
|
529
|
+
BinaryField("utf16", 60, 20)
|
|
530
530
|
], YGOProCtosCreateGame.prototype, "pass", 2);
|
|
531
531
|
|
|
532
532
|
// src/protos/ctos/proto/join-game.ts
|
|
@@ -542,7 +542,7 @@ __decorateClass([
|
|
|
542
542
|
BinaryField("u32", 4)
|
|
543
543
|
], YGOProCtosJoinGame.prototype, "gameid", 2);
|
|
544
544
|
__decorateClass([
|
|
545
|
-
BinaryField("
|
|
545
|
+
BinaryField("utf16", 8, 20)
|
|
546
546
|
], YGOProCtosJoinGame.prototype, "pass", 2);
|
|
547
547
|
|
|
548
548
|
// src/protos/ctos/proto/leave-game.ts
|
|
@@ -2921,8 +2921,9 @@ var YGOProMsgSelectCounter = class extends YGOProMsgResponseBase {
|
|
|
2921
2921
|
throw new TypeError(`Index out of range: ${index}`);
|
|
2922
2922
|
}
|
|
2923
2923
|
} else {
|
|
2924
|
+
const card = option.card;
|
|
2924
2925
|
index = this.cards.findIndex(
|
|
2925
|
-
(
|
|
2926
|
+
(card2) => (card2.code == null || card2.code === card2.code) && (card2.controller == null || card2.controller === card2.controller) && (card2.location == null || card2.location === card2.location) && (card2.sequence == null || card2.sequence === card2.sequence)
|
|
2926
2927
|
);
|
|
2927
2928
|
if (index === -1) {
|
|
2928
2929
|
throw new TypeError("Card not found");
|
|
@@ -3814,6 +3815,24 @@ var YGOProMsgStart = class extends YGOProMsgBase {
|
|
|
3814
3815
|
static {
|
|
3815
3816
|
this.identifier = 4;
|
|
3816
3817
|
}
|
|
3818
|
+
/**
|
|
3819
|
+
* Get/Set player number (low 4 bits, 0-3)
|
|
3820
|
+
*/
|
|
3821
|
+
get playerNumber() {
|
|
3822
|
+
return this.playerType & 15;
|
|
3823
|
+
}
|
|
3824
|
+
set playerNumber(value) {
|
|
3825
|
+
this.playerType = this.playerType & 240 | value & 15;
|
|
3826
|
+
}
|
|
3827
|
+
/**
|
|
3828
|
+
* Get/Set observer flag (high 4 bits, 0x00 or 0x10)
|
|
3829
|
+
*/
|
|
3830
|
+
get observerFlag() {
|
|
3831
|
+
return this.playerType & 240;
|
|
3832
|
+
}
|
|
3833
|
+
set observerFlag(value) {
|
|
3834
|
+
this.playerType = this.playerType & 15 | value & 240;
|
|
3835
|
+
}
|
|
3817
3836
|
};
|
|
3818
3837
|
__decorateClass([
|
|
3819
3838
|
BinaryField("u8", 0)
|
|
@@ -5189,14 +5208,28 @@ var YGOProStocWaitingSide = class extends YGOProStocBase {
|
|
|
5189
5208
|
};
|
|
5190
5209
|
|
|
5191
5210
|
// src/protos/stoc/proto/deck-count.ts
|
|
5211
|
+
var YGOProStocDeckCount_DeckInfo = class {
|
|
5212
|
+
};
|
|
5213
|
+
__decorateClass([
|
|
5214
|
+
BinaryField("i16", 0)
|
|
5215
|
+
], YGOProStocDeckCount_DeckInfo.prototype, "main", 2);
|
|
5216
|
+
__decorateClass([
|
|
5217
|
+
BinaryField("i16", 2)
|
|
5218
|
+
], YGOProStocDeckCount_DeckInfo.prototype, "extra", 2);
|
|
5219
|
+
__decorateClass([
|
|
5220
|
+
BinaryField("i16", 4)
|
|
5221
|
+
], YGOProStocDeckCount_DeckInfo.prototype, "side", 2);
|
|
5192
5222
|
var YGOProStocDeckCount = class extends YGOProStocBase {
|
|
5193
5223
|
static {
|
|
5194
5224
|
this.identifier = 9;
|
|
5195
5225
|
}
|
|
5196
5226
|
};
|
|
5197
5227
|
__decorateClass([
|
|
5198
|
-
BinaryField(
|
|
5199
|
-
], YGOProStocDeckCount.prototype, "
|
|
5228
|
+
BinaryField(() => YGOProStocDeckCount_DeckInfo, 0)
|
|
5229
|
+
], YGOProStocDeckCount.prototype, "player0DeckCount", 2);
|
|
5230
|
+
__decorateClass([
|
|
5231
|
+
BinaryField(() => YGOProStocDeckCount_DeckInfo, 6)
|
|
5232
|
+
], YGOProStocDeckCount.prototype, "player1DeckCount", 2);
|
|
5200
5233
|
|
|
5201
5234
|
// src/protos/stoc/proto/create-game.ts
|
|
5202
5235
|
var YGOProStocCreateGame = class extends YGOProStocBase {
|
|
@@ -5223,6 +5256,29 @@ var YGOProStocTypeChange = class extends YGOProStocBase {
|
|
|
5223
5256
|
static {
|
|
5224
5257
|
this.identifier = 19;
|
|
5225
5258
|
}
|
|
5259
|
+
/**
|
|
5260
|
+
* Get/Set player position (low 4 bits, 0-7)
|
|
5261
|
+
*/
|
|
5262
|
+
get playerPosition() {
|
|
5263
|
+
return this.type & 15;
|
|
5264
|
+
}
|
|
5265
|
+
set playerPosition(value) {
|
|
5266
|
+
this.type = this.type & 240 | value & 15;
|
|
5267
|
+
}
|
|
5268
|
+
/**
|
|
5269
|
+
* Get/Set host flag (high 4 bits)
|
|
5270
|
+
* Returns true if this player is the host
|
|
5271
|
+
*/
|
|
5272
|
+
get isHost() {
|
|
5273
|
+
return (this.type >> 4 & 15) !== 0;
|
|
5274
|
+
}
|
|
5275
|
+
set isHost(value) {
|
|
5276
|
+
if (value) {
|
|
5277
|
+
this.type = this.type & 15 | 16;
|
|
5278
|
+
} else {
|
|
5279
|
+
this.type = this.type & 15;
|
|
5280
|
+
}
|
|
5281
|
+
}
|
|
5226
5282
|
};
|
|
5227
5283
|
__decorateClass([
|
|
5228
5284
|
BinaryField("u8", 0)
|
|
@@ -5353,7 +5409,7 @@ var YGOProStocHsPlayerEnter = class extends YGOProStocBase {
|
|
|
5353
5409
|
// 1 byte padding (note: actual size is 41 bytes, not 42 - workaround in original code)
|
|
5354
5410
|
};
|
|
5355
5411
|
__decorateClass([
|
|
5356
|
-
BinaryField("
|
|
5412
|
+
BinaryField("utf16", 0, 20)
|
|
5357
5413
|
], YGOProStocHsPlayerEnter.prototype, "name", 2);
|
|
5358
5414
|
__decorateClass([
|
|
5359
5415
|
BinaryField("u8", 40)
|
|
@@ -5364,6 +5420,25 @@ var YGOProStocHsPlayerChange = class extends YGOProStocBase {
|
|
|
5364
5420
|
static {
|
|
5365
5421
|
this.identifier = 33;
|
|
5366
5422
|
}
|
|
5423
|
+
/**
|
|
5424
|
+
* Get/Set player state (low 4 bits)
|
|
5425
|
+
* Can be a PlayerChangeState enum value or a player position (0-7) for position changes
|
|
5426
|
+
*/
|
|
5427
|
+
get playerState() {
|
|
5428
|
+
return this.status & 15;
|
|
5429
|
+
}
|
|
5430
|
+
set playerState(value) {
|
|
5431
|
+
this.status = this.status & 240 | value & 15;
|
|
5432
|
+
}
|
|
5433
|
+
/**
|
|
5434
|
+
* Get/Set player position (high 4 bits, 0-3)
|
|
5435
|
+
*/
|
|
5436
|
+
get playerPosition() {
|
|
5437
|
+
return this.status >> 4 & 15;
|
|
5438
|
+
}
|
|
5439
|
+
set playerPosition(value) {
|
|
5440
|
+
this.status = this.status & 15 | (value & 15) << 4;
|
|
5441
|
+
}
|
|
5367
5442
|
};
|
|
5368
5443
|
__decorateClass([
|
|
5369
5444
|
BinaryField("u8", 0)
|
|
@@ -5467,18 +5542,101 @@ YGOProStoc.register(YGOProStocHsWatchChange);
|
|
|
5467
5542
|
YGOProStoc.register(YGOProStocTeammateSurrender);
|
|
5468
5543
|
YGOProStoc.register(YGOProStocFieldFinish);
|
|
5469
5544
|
YGOProStoc.register(YGOProStocSrvproRoomlist);
|
|
5545
|
+
|
|
5546
|
+
// src/protos/network-enums.ts
|
|
5547
|
+
var HandResult = /* @__PURE__ */ ((HandResult2) => {
|
|
5548
|
+
HandResult2[HandResult2["ROCK"] = 1] = "ROCK";
|
|
5549
|
+
HandResult2[HandResult2["SCISSORS"] = 2] = "SCISSORS";
|
|
5550
|
+
HandResult2[HandResult2["PAPER"] = 3] = "PAPER";
|
|
5551
|
+
return HandResult2;
|
|
5552
|
+
})(HandResult || {});
|
|
5553
|
+
var TurnPlayerResult = /* @__PURE__ */ ((TurnPlayerResult2) => {
|
|
5554
|
+
TurnPlayerResult2[TurnPlayerResult2["SECOND"] = 0] = "SECOND";
|
|
5555
|
+
TurnPlayerResult2[TurnPlayerResult2["FIRST"] = 1] = "FIRST";
|
|
5556
|
+
return TurnPlayerResult2;
|
|
5557
|
+
})(TurnPlayerResult || {});
|
|
5558
|
+
var NetPlayerType = /* @__PURE__ */ ((NetPlayerType2) => {
|
|
5559
|
+
NetPlayerType2[NetPlayerType2["PLAYER1"] = 0] = "PLAYER1";
|
|
5560
|
+
NetPlayerType2[NetPlayerType2["PLAYER2"] = 1] = "PLAYER2";
|
|
5561
|
+
NetPlayerType2[NetPlayerType2["PLAYER3"] = 2] = "PLAYER3";
|
|
5562
|
+
NetPlayerType2[NetPlayerType2["PLAYER4"] = 3] = "PLAYER4";
|
|
5563
|
+
NetPlayerType2[NetPlayerType2["PLAYER5"] = 4] = "PLAYER5";
|
|
5564
|
+
NetPlayerType2[NetPlayerType2["PLAYER6"] = 5] = "PLAYER6";
|
|
5565
|
+
NetPlayerType2[NetPlayerType2["OBSERVER"] = 7] = "OBSERVER";
|
|
5566
|
+
return NetPlayerType2;
|
|
5567
|
+
})(NetPlayerType || {});
|
|
5568
|
+
var ChatColor = /* @__PURE__ */ ((ChatColor2) => {
|
|
5569
|
+
ChatColor2[ChatColor2["LIGHTBLUE"] = 8] = "LIGHTBLUE";
|
|
5570
|
+
ChatColor2[ChatColor2["RED"] = 11] = "RED";
|
|
5571
|
+
ChatColor2[ChatColor2["GREEN"] = 12] = "GREEN";
|
|
5572
|
+
ChatColor2[ChatColor2["BLUE"] = 13] = "BLUE";
|
|
5573
|
+
ChatColor2[ChatColor2["BABYBLUE"] = 14] = "BABYBLUE";
|
|
5574
|
+
ChatColor2[ChatColor2["PINK"] = 15] = "PINK";
|
|
5575
|
+
ChatColor2[ChatColor2["YELLOW"] = 16] = "YELLOW";
|
|
5576
|
+
ChatColor2[ChatColor2["WHITE"] = 17] = "WHITE";
|
|
5577
|
+
ChatColor2[ChatColor2["GRAY"] = 18] = "GRAY";
|
|
5578
|
+
ChatColor2[ChatColor2["DARKGRAY"] = 19] = "DARKGRAY";
|
|
5579
|
+
return ChatColor2;
|
|
5580
|
+
})(ChatColor || {});
|
|
5581
|
+
var GameMode = /* @__PURE__ */ ((GameMode2) => {
|
|
5582
|
+
GameMode2[GameMode2["SINGLE"] = 0] = "SINGLE";
|
|
5583
|
+
GameMode2[GameMode2["MATCH"] = 1] = "MATCH";
|
|
5584
|
+
GameMode2[GameMode2["TAG"] = 2] = "TAG";
|
|
5585
|
+
return GameMode2;
|
|
5586
|
+
})(GameMode || {});
|
|
5587
|
+
var ErrorMessageType = /* @__PURE__ */ ((ErrorMessageType2) => {
|
|
5588
|
+
ErrorMessageType2[ErrorMessageType2["JOINERROR"] = 1] = "JOINERROR";
|
|
5589
|
+
ErrorMessageType2[ErrorMessageType2["DECKERROR"] = 2] = "DECKERROR";
|
|
5590
|
+
ErrorMessageType2[ErrorMessageType2["SIDEERROR"] = 3] = "SIDEERROR";
|
|
5591
|
+
ErrorMessageType2[ErrorMessageType2["VERERROR"] = 4] = "VERERROR";
|
|
5592
|
+
return ErrorMessageType2;
|
|
5593
|
+
})(ErrorMessageType || {});
|
|
5594
|
+
var DeckErrorType = /* @__PURE__ */ ((DeckErrorType2) => {
|
|
5595
|
+
DeckErrorType2[DeckErrorType2["LFLIST"] = 1] = "LFLIST";
|
|
5596
|
+
DeckErrorType2[DeckErrorType2["OCGONLY"] = 2] = "OCGONLY";
|
|
5597
|
+
DeckErrorType2[DeckErrorType2["TCGONLY"] = 3] = "TCGONLY";
|
|
5598
|
+
DeckErrorType2[DeckErrorType2["UNKNOWNCARD"] = 4] = "UNKNOWNCARD";
|
|
5599
|
+
DeckErrorType2[DeckErrorType2["CARDCOUNT"] = 5] = "CARDCOUNT";
|
|
5600
|
+
DeckErrorType2[DeckErrorType2["MAINCOUNT"] = 6] = "MAINCOUNT";
|
|
5601
|
+
DeckErrorType2[DeckErrorType2["EXTRACOUNT"] = 7] = "EXTRACOUNT";
|
|
5602
|
+
DeckErrorType2[DeckErrorType2["SIDECOUNT"] = 8] = "SIDECOUNT";
|
|
5603
|
+
DeckErrorType2[DeckErrorType2["NOTAVAIL"] = 9] = "NOTAVAIL";
|
|
5604
|
+
return DeckErrorType2;
|
|
5605
|
+
})(DeckErrorType || {});
|
|
5606
|
+
var PlayerChangeState = /* @__PURE__ */ ((PlayerChangeState2) => {
|
|
5607
|
+
PlayerChangeState2[PlayerChangeState2["OBSERVE"] = 8] = "OBSERVE";
|
|
5608
|
+
PlayerChangeState2[PlayerChangeState2["READY"] = 9] = "READY";
|
|
5609
|
+
PlayerChangeState2[PlayerChangeState2["NOTREADY"] = 10] = "NOTREADY";
|
|
5610
|
+
PlayerChangeState2[PlayerChangeState2["LEAVE"] = 11] = "LEAVE";
|
|
5611
|
+
return PlayerChangeState2;
|
|
5612
|
+
})(PlayerChangeState || {});
|
|
5613
|
+
var RoomStatus = /* @__PURE__ */ ((RoomStatus2) => {
|
|
5614
|
+
RoomStatus2[RoomStatus2["WAITING"] = 0] = "WAITING";
|
|
5615
|
+
RoomStatus2[RoomStatus2["DUELING"] = 1] = "DUELING";
|
|
5616
|
+
RoomStatus2[RoomStatus2["SIDING"] = 2] = "SIDING";
|
|
5617
|
+
return RoomStatus2;
|
|
5618
|
+
})(RoomStatus || {});
|
|
5470
5619
|
export {
|
|
5471
5620
|
BattleCmdType,
|
|
5472
5621
|
BinaryField,
|
|
5473
5622
|
CardQuery,
|
|
5474
5623
|
CardQuery_CardLocation,
|
|
5475
5624
|
CardQuery_Counter,
|
|
5625
|
+
ChatColor,
|
|
5626
|
+
DeckErrorType,
|
|
5627
|
+
ErrorMessageType,
|
|
5628
|
+
GameMode,
|
|
5629
|
+
HandResult,
|
|
5476
5630
|
HostInfo,
|
|
5477
5631
|
IdleCmdType,
|
|
5478
5632
|
IndexResponse,
|
|
5633
|
+
NetPlayerType,
|
|
5479
5634
|
OcgcoreCommonConstants,
|
|
5480
5635
|
OcgcoreScriptConstants,
|
|
5636
|
+
PlayerChangeState,
|
|
5637
|
+
RoomStatus,
|
|
5481
5638
|
SrvproRoomInfo,
|
|
5639
|
+
TurnPlayerResult,
|
|
5482
5640
|
YGOProCtos,
|
|
5483
5641
|
YGOProCtosBase,
|
|
5484
5642
|
YGOProCtosChat,
|
|
@@ -5622,6 +5780,7 @@ export {
|
|
|
5622
5780
|
YGOProStocChat,
|
|
5623
5781
|
YGOProStocCreateGame,
|
|
5624
5782
|
YGOProStocDeckCount,
|
|
5783
|
+
YGOProStocDeckCount_DeckInfo,
|
|
5625
5784
|
YGOProStocDuelEnd,
|
|
5626
5785
|
YGOProStocDuelStart,
|
|
5627
5786
|
YGOProStocErrorMsg,
|