stardew-valley-data 0.3.0 → 0.4.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
@@ -33194,6 +33194,7 @@ function parseAnimals(root) {
33194
33194
  id: str(fa.myID),
33195
33195
  name: str(fa.name),
33196
33196
  type: str(fa.type),
33197
+ buildingId: str(b.id),
33197
33198
  buildingType: str(fa.buildingTypeILiveIn),
33198
33199
  friendship: num(fa.friendshipTowardFarmer),
33199
33200
  happiness: num(fa.happiness),
@@ -33218,9 +33219,8 @@ function parseBuildings(root) {
33218
33219
  for (const building of buildings2) {
33219
33220
  const b = building;
33220
33221
  result.push({
33222
+ id: str(b.id),
33221
33223
  type: str(b.buildingType),
33222
- tileX: num(b.tileX),
33223
- tileY: num(b.tileY),
33224
33224
  animalCount: num(b.currentOccupants)
33225
33225
  });
33226
33226
  }
@@ -33418,9 +33418,9 @@ function parseBundles(root, mail) {
33418
33418
  });
33419
33419
  const itemsCompleted = items.filter((it) => it.completed).length;
33420
33420
  bundles2.push({
33421
+ id: `${def.room}/${index}`,
33421
33422
  bundleIndex: index,
33422
33423
  name: def.name,
33423
- room: def.room,
33424
33424
  items,
33425
33425
  itemsRequired: def.itemsRequired,
33426
33426
  itemsCompleted,
@@ -33448,7 +33448,7 @@ function parseBundles(root, mail) {
33448
33448
  rooms.sort((a, b) => a.areaIndex - b.areaIndex);
33449
33449
  const isJojaRoute = JOJA_MAIL_FLAGS.some((f) => mail.has(f));
33450
33450
  const isCCComplete = mail.has("ccIsComplete");
33451
- return { bundles: bundles2, rooms, isJojaRoute, isCCComplete };
33451
+ return { rooms, isJojaRoute, isCCComplete };
33452
33452
  }
33453
33453
 
33454
33454
  // src/save-file/parsers/v1/date.ts
@@ -33609,9 +33609,8 @@ function parseMail(mailReceived) {
33609
33609
  }
33610
33610
  function parseSpecialOrders(root) {
33611
33611
  const completed = ensureArray(root.completedSpecialOrders?.string).map((m) => str(m)).filter(Boolean);
33612
- const townCompleted = completed.filter((id) => !QI_ORDER_IDS.has(id));
33613
33612
  const qiCompleted = completed.filter((id) => QI_ORDER_IDS.has(id));
33614
- return { completed, townCompleted, qiCompleted };
33613
+ return { completed, qiCompleted };
33615
33614
  }
33616
33615
  function parseBooksRead(player) {
33617
33616
  const books = [];
@@ -33775,6 +33774,67 @@ function parseMastery(stats) {
33775
33774
  perks
33776
33775
  };
33777
33776
  }
33777
+ var TOOL_TYPES = ["WateringCan", "Pan", "Pickaxe", "Axe", "Hoe"];
33778
+ var TOOL_KEY_MAP = {
33779
+ WateringCan: "wateringCan",
33780
+ Pan: "pan",
33781
+ Pickaxe: "pickaxe",
33782
+ Axe: "axe",
33783
+ Hoe: "hoe"
33784
+ };
33785
+ function collectToolItems(node, depth = 0) {
33786
+ if (!node || typeof node !== "object" || depth > 20) return [];
33787
+ const results = [];
33788
+ if (Array.isArray(node)) {
33789
+ for (const child of node) results.push(...collectToolItems(child, depth + 1));
33790
+ return results;
33791
+ }
33792
+ const obj = node;
33793
+ const xsiType = obj["@_xsi:type"] ?? obj["@_type"] ?? "";
33794
+ if (TOOL_TYPES.includes(xsiType)) {
33795
+ results.push(obj);
33796
+ }
33797
+ for (const key of [
33798
+ "Item",
33799
+ "items",
33800
+ "objects",
33801
+ "item",
33802
+ "Object",
33803
+ "value",
33804
+ "GameLocation",
33805
+ "Building",
33806
+ "buildings",
33807
+ "indoors",
33808
+ "heldObject"
33809
+ ]) {
33810
+ if (obj[key]) results.push(...collectToolItems(obj[key], depth + 1));
33811
+ }
33812
+ return results;
33813
+ }
33814
+ function parseToolLevels(player, root) {
33815
+ const levels = {
33816
+ wateringCan: 0,
33817
+ pan: 0,
33818
+ pickaxe: 0,
33819
+ axe: 0,
33820
+ hoe: 0,
33821
+ trashCan: num(player.trashCanLevel)
33822
+ };
33823
+ const allItems2 = [
33824
+ ...collectToolItems(player.items),
33825
+ ...collectToolItems(root.locations?.GameLocation)
33826
+ ];
33827
+ for (const item of allItems2) {
33828
+ const i = item;
33829
+ const xsiType = i["@_xsi:type"] ?? i["@_type"] ?? "";
33830
+ const key = TOOL_KEY_MAP[xsiType];
33831
+ if (key) {
33832
+ const level = num(i.upgradeLevel);
33833
+ if (level > levels[key]) levels[key] = level;
33834
+ }
33835
+ }
33836
+ return levels;
33837
+ }
33778
33838
  function parsePlayer(player, root) {
33779
33839
  return {
33780
33840
  name: str(player.name),
@@ -33785,10 +33845,13 @@ function parsePlayer(player, root) {
33785
33845
  totalMoneyEarned: num(player.totalMoneyEarned),
33786
33846
  spouse: player.spouse ? str(player.spouse) : null,
33787
33847
  houseUpgradeLevel: num(player.houseUpgradeLevel),
33848
+ luckLevel: num(player.luckLevel),
33849
+ maxItems: num(player.maxItems),
33788
33850
  maxHealth: num(player.maxHealth),
33789
33851
  maxStamina: num(player.maxStamina),
33790
33852
  skills: parseSkills(player.experiencePoints?.int),
33791
33853
  mastery: parseMastery(player.stats),
33854
+ toolLevels: parseToolLevels(player, root),
33792
33855
  gameVersion: str(root.gameVersion)
33793
33856
  };
33794
33857
  }
@@ -33881,12 +33944,13 @@ function parseCraftingRecipes(data) {
33881
33944
  }
33882
33945
 
33883
33946
  // src/save-file/parsers/v1/secret-notes.ts
33884
- function parseSecretNotes(player, mail) {
33947
+ function parseSecretNotes(player, mail, events2) {
33885
33948
  const allNotes = ensureArray(player.secretNotesSeen?.int).map(num);
33886
33949
  return {
33887
33950
  notesFound: allNotes.filter((n) => n < 1e3),
33888
33951
  journalScrapsFound: allNotes.filter((n) => n >= 1e3).map((n) => n - 1e3),
33889
- hasMagnifyingGlass: mail.has("HasMagnifyingGlass") || player.hasMagnifyingGlass === true || player.hasMagnifyingGlass === "true"
33952
+ hasMagnifyingGlass: mail.has("HasMagnifyingGlass") || player.hasMagnifyingGlass === true || player.hasMagnifyingGlass === "true",
33953
+ hasSeenKrobus: events2.has("520702")
33890
33954
  };
33891
33955
  }
33892
33956
 
@@ -33980,7 +34044,7 @@ var v1 = (ctx) => ({
33980
34044
  professions: parseProfessions(ctx.player.professions),
33981
34045
  booksRead: parseBooksRead(ctx.player),
33982
34046
  eventsSeen: ctx.eventsSeen,
33983
- secretNotes: parseSecretNotes(ctx.player, ctx.mailSet),
34047
+ secretNotes: parseSecretNotes(ctx.player, ctx.mailSet, ctx.eventsSet),
33984
34048
  walnuts: parseWalnuts(ctx.root),
33985
34049
  islandUpgrades: parseIslandUpgrades(ctx.mailSet),
33986
34050
  children: parseChildren(ctx.root),