ygopro-msg-encode 1.1.28 → 1.1.30

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
@@ -977,7 +977,8 @@ var CardQuery = class {
977
977
  offset += 4;
978
978
  }
979
979
  if (this.flags & OcgcoreCommonConstants.QUERY_POSITION) {
980
- const pdata = view.getInt32(offset, true);
980
+ const pdata = view.getUint32(offset, true);
981
+ this.positionData = pdata;
981
982
  this.position = (pdata >>> 24 & 255) >>> 0;
982
983
  offset += 4;
983
984
  }
@@ -1026,9 +1027,12 @@ var CardQuery = class {
1026
1027
  offset += 4;
1027
1028
  }
1028
1029
  if (this.flags & OcgcoreCommonConstants.QUERY_REASON_CARD) {
1030
+ this.reasonCardData = view.getUint32(offset, true);
1029
1031
  offset += 4;
1030
1032
  }
1031
1033
  if (this.flags & OcgcoreCommonConstants.QUERY_EQUIP_CARD) {
1034
+ const pdata = view.getUint32(offset, true);
1035
+ this.equipCardData = pdata;
1032
1036
  this.equipCard = {
1033
1037
  controller: view.getUint8(offset),
1034
1038
  location: view.getUint8(offset + 1),
@@ -1040,7 +1044,9 @@ var CardQuery = class {
1040
1044
  const count = view.getInt32(offset, true);
1041
1045
  offset += 4;
1042
1046
  this.targetCards = [];
1047
+ this.targetCardData = [];
1043
1048
  for (let i = 0; i < count; i++) {
1049
+ this.targetCardData.push(view.getUint32(offset, true));
1044
1050
  this.targetCards.push({
1045
1051
  controller: view.getUint8(offset),
1046
1052
  location: view.getUint8(offset + 1),
@@ -1144,8 +1150,8 @@ function serializeCardQuery(card) {
1144
1150
  offset += 4;
1145
1151
  }
1146
1152
  if (flags & OcgcoreCommonConstants.QUERY_POSITION) {
1147
- const pdata = (source.position || 0) << 24 >>> 0;
1148
- view.setInt32(offset, pdata, true);
1153
+ const pdata = source.positionData !== void 0 ? source.positionData >>> 0 : (source.position || 0) << 24 >>> 0;
1154
+ view.setUint32(offset, pdata, true);
1149
1155
  offset += 4;
1150
1156
  }
1151
1157
  if (flags & OcgcoreCommonConstants.QUERY_ALIAS) {
@@ -1193,30 +1199,41 @@ function serializeCardQuery(card) {
1193
1199
  offset += 4;
1194
1200
  }
1195
1201
  if (flags & OcgcoreCommonConstants.QUERY_REASON_CARD) {
1196
- view.setInt32(offset, 0, true);
1202
+ view.setUint32(offset, (source.reasonCardData || 0) >>> 0, true);
1197
1203
  offset += 4;
1198
1204
  }
1199
1205
  if (flags & OcgcoreCommonConstants.QUERY_EQUIP_CARD) {
1200
- const equipCard = source.equipCard || {
1201
- controller: 0,
1202
- location: 0,
1203
- sequence: 0
1204
- };
1205
- view.setUint8(offset, equipCard.controller);
1206
- view.setUint8(offset + 1, equipCard.location);
1207
- view.setUint8(offset + 2, equipCard.sequence);
1208
- view.setUint8(offset + 3, 0);
1209
- offset += 4;
1206
+ if (source.equipCardData !== void 0) {
1207
+ view.setUint32(offset, source.equipCardData >>> 0, true);
1208
+ offset += 4;
1209
+ } else {
1210
+ const equipCard = source.equipCard || {
1211
+ controller: 0,
1212
+ location: 0,
1213
+ sequence: 0
1214
+ };
1215
+ view.setUint8(offset, equipCard.controller);
1216
+ view.setUint8(offset + 1, equipCard.location);
1217
+ view.setUint8(offset + 2, equipCard.sequence);
1218
+ view.setUint8(offset + 3, 0);
1219
+ offset += 4;
1220
+ }
1210
1221
  }
1211
1222
  if (flags & OcgcoreCommonConstants.QUERY_TARGET_CARD) {
1212
1223
  const targets = source.targetCards || [];
1213
1224
  view.setInt32(offset, targets.length, true);
1214
1225
  offset += 4;
1215
- for (const target of targets) {
1216
- view.setUint8(offset, target.controller);
1217
- view.setUint8(offset + 1, target.location);
1218
- view.setUint8(offset + 2, target.sequence);
1219
- view.setUint8(offset + 3, 0);
1226
+ for (let i = 0; i < targets.length; i++) {
1227
+ const target = targets[i];
1228
+ const rawTarget = source.targetCardData?.[i];
1229
+ if (rawTarget !== void 0) {
1230
+ view.setUint32(offset, rawTarget >>> 0, true);
1231
+ } else {
1232
+ view.setUint8(offset, target.controller);
1233
+ view.setUint8(offset + 1, target.location);
1234
+ view.setUint8(offset + 2, target.sequence);
1235
+ view.setUint8(offset + 3, 0);
1236
+ }
1220
1237
  offset += 4;
1221
1238
  }
1222
1239
  }
@@ -3847,16 +3864,7 @@ var YGOProMsgMove = class extends YGOProMsgBase {
3847
3864
  return view;
3848
3865
  }
3849
3866
  teammateView() {
3850
- const view = this.copy();
3851
- const cl = view.current.location;
3852
- const cp = view.current.position;
3853
- if (cl & (OcgcoreScriptConstants.LOCATION_GRAVE | OcgcoreScriptConstants.LOCATION_OVERLAY)) {
3854
- return view;
3855
- }
3856
- if (cl & (OcgcoreScriptConstants.LOCATION_DECK | OcgcoreScriptConstants.LOCATION_HAND)) {
3857
- view.code = 0;
3858
- }
3859
- return view;
3867
+ return this.opponentView();
3860
3868
  }
3861
3869
  playerView(playerId) {
3862
3870
  if (playerId === 7 /* OBSERVER */) {