stardew-valley-data 0.31.0 → 0.32.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/CHANGELOG.md +25 -0
- package/dist/index.d.mts +23 -10
- package/dist/index.d.ts +23 -10
- package/dist/index.js +52 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,31 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
|
|
6
6
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.32.0] - 2026-03-29
|
|
9
|
+
|
|
10
|
+
### Breaking Changes
|
|
11
|
+
|
|
12
|
+
- `SaveData.pet: SavePet | null` renamed to `pets: SavePet[]` — all pets are now returned as an
|
|
13
|
+
array; callers must update property access from `data.pet` to `data.pets`
|
|
14
|
+
- `parsePet(root)` renamed to `parsePets(root, player)` — new signature accepts the raw player node
|
|
15
|
+
to identify the starter pet; returns `SavePet[]` instead of `SavePet | null`
|
|
16
|
+
- `SavePet` gains a required `starter: boolean` field — `true` for the pet chosen at game start
|
|
17
|
+
(matched by `whichPetType` + `whichPetBreed`), `false` for all additional pets
|
|
18
|
+
- `SaveToolLevels` tool fields changed from `number` to
|
|
19
|
+
`SaveToolLevel { level: number; enchantment: string | null }` — callers must update e.g.
|
|
20
|
+
`toolLevels.axe` → `toolLevels.axe.level`
|
|
21
|
+
- `SaveToolLevels` gains a required `currentlyUpgrading: SaveUpgradingTool | null` field — set when
|
|
22
|
+
a tool is at the blacksmith; the tool's `level` is backfilled to its pre-upgrade value
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- `SaveToolLevel` interface (`level`, `enchantment`) — enchantment name is stripped of its
|
|
27
|
+
`Enchantment` suffix (e.g. `ShavingEnchantment` → `Shaving`), or `null` if none applied
|
|
28
|
+
- `SaveUpgradingTool` interface (`tool`, `name`) — identifies which tool is at the blacksmith and
|
|
29
|
+
its display name (e.g. `{ tool: 'pan', name: 'Iridium Pan' }`)
|
|
30
|
+
- Enchantments are now parsed for all tools including FishingRod; array-format enchantment nodes are
|
|
31
|
+
handled (first entry used)
|
|
32
|
+
|
|
8
33
|
## [0.31.0] - 2026-03-29
|
|
9
34
|
|
|
10
35
|
### Added
|
package/dist/index.d.mts
CHANGED
|
@@ -2674,7 +2674,7 @@ interface SaveData {
|
|
|
2674
2674
|
walnuts: SaveWalnuts;
|
|
2675
2675
|
islandUpgrades: SaveIslandUpgrades;
|
|
2676
2676
|
children: SaveChild[];
|
|
2677
|
-
|
|
2677
|
+
pets: SavePet[];
|
|
2678
2678
|
horse: SaveHorse | null;
|
|
2679
2679
|
powers: SavePowers;
|
|
2680
2680
|
raccoons: SaveRaccoons;
|
|
@@ -2706,15 +2706,27 @@ interface SavePlayer {
|
|
|
2706
2706
|
gameVersion: string;
|
|
2707
2707
|
millisecondsPlayed: number;
|
|
2708
2708
|
}
|
|
2709
|
-
/**
|
|
2709
|
+
/** A tool currently being upgraded at the blacksmith. */
|
|
2710
|
+
interface SaveUpgradingTool {
|
|
2711
|
+
tool: 'wateringCan' | 'pan' | 'pickaxe' | 'axe' | 'hoe';
|
|
2712
|
+
name: string;
|
|
2713
|
+
}
|
|
2714
|
+
/** Level and active enchantment for a single tool. Enchantment is null when none is applied. */
|
|
2715
|
+
interface SaveToolLevel {
|
|
2716
|
+
level: number;
|
|
2717
|
+
enchantment: string | null;
|
|
2718
|
+
}
|
|
2719
|
+
/** Upgrade levels and enchantments for the player's tools (level 0 = base, 1 = copper, 2 = steel, 3 = gold, 4 = iridium). */
|
|
2710
2720
|
interface SaveToolLevels {
|
|
2711
|
-
wateringCan:
|
|
2712
|
-
pan:
|
|
2713
|
-
pickaxe:
|
|
2714
|
-
axe:
|
|
2715
|
-
hoe:
|
|
2716
|
-
trashCan:
|
|
2717
|
-
fishingRod:
|
|
2721
|
+
wateringCan: SaveToolLevel;
|
|
2722
|
+
pan: SaveToolLevel;
|
|
2723
|
+
pickaxe: SaveToolLevel;
|
|
2724
|
+
axe: SaveToolLevel;
|
|
2725
|
+
hoe: SaveToolLevel;
|
|
2726
|
+
trashCan: SaveToolLevel;
|
|
2727
|
+
fishingRod: SaveToolLevel;
|
|
2728
|
+
/** The tool currently at the blacksmith being upgraded, or null if none. */
|
|
2729
|
+
currentlyUpgrading: SaveUpgradingTool | null;
|
|
2718
2730
|
}
|
|
2719
2731
|
/** Mastery system progress including XP, levels spent, and unlocked perks. */
|
|
2720
2732
|
interface SaveMastery {
|
|
@@ -2915,12 +2927,13 @@ interface SaveChild {
|
|
|
2915
2927
|
age: number;
|
|
2916
2928
|
gender: string;
|
|
2917
2929
|
}
|
|
2918
|
-
/**
|
|
2930
|
+
/** A pet owned by the player. `starter` is true for the pet chosen at game start. */
|
|
2919
2931
|
interface SavePet {
|
|
2920
2932
|
name: string;
|
|
2921
2933
|
type: string;
|
|
2922
2934
|
breed: number;
|
|
2923
2935
|
friendship: number;
|
|
2936
|
+
starter: boolean;
|
|
2924
2937
|
}
|
|
2925
2938
|
/** The player's horse with name and unique ID. */
|
|
2926
2939
|
interface SaveHorse {
|
package/dist/index.d.ts
CHANGED
|
@@ -2674,7 +2674,7 @@ interface SaveData {
|
|
|
2674
2674
|
walnuts: SaveWalnuts;
|
|
2675
2675
|
islandUpgrades: SaveIslandUpgrades;
|
|
2676
2676
|
children: SaveChild[];
|
|
2677
|
-
|
|
2677
|
+
pets: SavePet[];
|
|
2678
2678
|
horse: SaveHorse | null;
|
|
2679
2679
|
powers: SavePowers;
|
|
2680
2680
|
raccoons: SaveRaccoons;
|
|
@@ -2706,15 +2706,27 @@ interface SavePlayer {
|
|
|
2706
2706
|
gameVersion: string;
|
|
2707
2707
|
millisecondsPlayed: number;
|
|
2708
2708
|
}
|
|
2709
|
-
/**
|
|
2709
|
+
/** A tool currently being upgraded at the blacksmith. */
|
|
2710
|
+
interface SaveUpgradingTool {
|
|
2711
|
+
tool: 'wateringCan' | 'pan' | 'pickaxe' | 'axe' | 'hoe';
|
|
2712
|
+
name: string;
|
|
2713
|
+
}
|
|
2714
|
+
/** Level and active enchantment for a single tool. Enchantment is null when none is applied. */
|
|
2715
|
+
interface SaveToolLevel {
|
|
2716
|
+
level: number;
|
|
2717
|
+
enchantment: string | null;
|
|
2718
|
+
}
|
|
2719
|
+
/** Upgrade levels and enchantments for the player's tools (level 0 = base, 1 = copper, 2 = steel, 3 = gold, 4 = iridium). */
|
|
2710
2720
|
interface SaveToolLevels {
|
|
2711
|
-
wateringCan:
|
|
2712
|
-
pan:
|
|
2713
|
-
pickaxe:
|
|
2714
|
-
axe:
|
|
2715
|
-
hoe:
|
|
2716
|
-
trashCan:
|
|
2717
|
-
fishingRod:
|
|
2721
|
+
wateringCan: SaveToolLevel;
|
|
2722
|
+
pan: SaveToolLevel;
|
|
2723
|
+
pickaxe: SaveToolLevel;
|
|
2724
|
+
axe: SaveToolLevel;
|
|
2725
|
+
hoe: SaveToolLevel;
|
|
2726
|
+
trashCan: SaveToolLevel;
|
|
2727
|
+
fishingRod: SaveToolLevel;
|
|
2728
|
+
/** The tool currently at the blacksmith being upgraded, or null if none. */
|
|
2729
|
+
currentlyUpgrading: SaveUpgradingTool | null;
|
|
2718
2730
|
}
|
|
2719
2731
|
/** Mastery system progress including XP, levels spent, and unlocked perks. */
|
|
2720
2732
|
interface SaveMastery {
|
|
@@ -2915,12 +2927,13 @@ interface SaveChild {
|
|
|
2915
2927
|
age: number;
|
|
2916
2928
|
gender: string;
|
|
2917
2929
|
}
|
|
2918
|
-
/**
|
|
2930
|
+
/** A pet owned by the player. `starter` is true for the pet chosen at game start. */
|
|
2919
2931
|
interface SavePet {
|
|
2920
2932
|
name: string;
|
|
2921
2933
|
type: string;
|
|
2922
2934
|
breed: number;
|
|
2923
2935
|
friendship: number;
|
|
2936
|
+
starter: boolean;
|
|
2924
2937
|
}
|
|
2925
2938
|
/** The player's horse with name and unique ID. */
|
|
2926
2939
|
interface SaveHorse {
|
package/dist/index.js
CHANGED
|
@@ -41140,7 +41140,10 @@ function parseChildren(root) {
|
|
|
41140
41140
|
}
|
|
41141
41141
|
return result;
|
|
41142
41142
|
}
|
|
41143
|
-
function
|
|
41143
|
+
function parsePets(root, player) {
|
|
41144
|
+
const results = [];
|
|
41145
|
+
const starterType = str(player?.whichPetType);
|
|
41146
|
+
const starterBreed = num(player?.whichPetBreed);
|
|
41144
41147
|
const locations2 = ensureArray(root.locations?.GameLocation);
|
|
41145
41148
|
for (const loc of locations2) {
|
|
41146
41149
|
const l = loc;
|
|
@@ -41153,15 +41156,18 @@ function parsePet(root) {
|
|
|
41153
41156
|
n["@_xsi:type"] ?? n["@_type"]
|
|
41154
41157
|
);
|
|
41155
41158
|
if (xsiType !== "Pet" && xsiType !== "Cat" && xsiType !== "Dog") continue;
|
|
41156
|
-
|
|
41159
|
+
const type = str(n.petType, xsiType);
|
|
41160
|
+
const breed = num(n.whichBreed);
|
|
41161
|
+
results.push({
|
|
41157
41162
|
name: str(n.name),
|
|
41158
|
-
type
|
|
41159
|
-
breed
|
|
41160
|
-
friendship: num(n.friendshipTowardFarmer)
|
|
41161
|
-
|
|
41163
|
+
type,
|
|
41164
|
+
breed,
|
|
41165
|
+
friendship: num(n.friendshipTowardFarmer),
|
|
41166
|
+
starter: type === starterType && breed === starterBreed
|
|
41167
|
+
});
|
|
41162
41168
|
}
|
|
41163
41169
|
}
|
|
41164
|
-
return
|
|
41170
|
+
return results;
|
|
41165
41171
|
}
|
|
41166
41172
|
function parseHorse(root) {
|
|
41167
41173
|
const locations2 = ensureArray(root.locations?.GameLocation);
|
|
@@ -41611,16 +41617,41 @@ function collectToolItems(node, depth = 0) {
|
|
|
41611
41617
|
}
|
|
41612
41618
|
return results;
|
|
41613
41619
|
}
|
|
41620
|
+
function getEnchantmentName(item) {
|
|
41621
|
+
const enc = item.enchantments;
|
|
41622
|
+
if (!enc) return null;
|
|
41623
|
+
const first = Array.isArray(enc) ? enc[0] : enc;
|
|
41624
|
+
if (!first || typeof first !== "object") return null;
|
|
41625
|
+
const xsiType = first["@_xsi:type"] ?? "";
|
|
41626
|
+
return xsiType.replace(/Enchantment$/, "") || null;
|
|
41627
|
+
}
|
|
41628
|
+
function toolLevel(level, enchantment = null) {
|
|
41629
|
+
return { level, enchantment };
|
|
41630
|
+
}
|
|
41614
41631
|
function parseToolLevels(player, root) {
|
|
41615
41632
|
const levels = {
|
|
41616
|
-
wateringCan: 0,
|
|
41617
|
-
pan: 0,
|
|
41618
|
-
pickaxe: 0,
|
|
41619
|
-
axe: 0,
|
|
41620
|
-
hoe: 0,
|
|
41621
|
-
trashCan: num(player.trashCanLevel),
|
|
41622
|
-
fishingRod: -1
|
|
41633
|
+
wateringCan: toolLevel(0),
|
|
41634
|
+
pan: toolLevel(0),
|
|
41635
|
+
pickaxe: toolLevel(0),
|
|
41636
|
+
axe: toolLevel(0),
|
|
41637
|
+
hoe: toolLevel(0),
|
|
41638
|
+
trashCan: toolLevel(num(player.trashCanLevel)),
|
|
41639
|
+
fishingRod: toolLevel(-1),
|
|
41640
|
+
currentlyUpgrading: null
|
|
41623
41641
|
};
|
|
41642
|
+
const upgrading = player.toolBeingUpgraded;
|
|
41643
|
+
if (upgrading) {
|
|
41644
|
+
const xsiType = upgrading["@_xsi:type"] ?? upgrading["@_type"] ?? "";
|
|
41645
|
+
const key = TOOL_KEY_MAP[xsiType];
|
|
41646
|
+
if (key) {
|
|
41647
|
+
const offset = key === "pan" ? 2 : 1;
|
|
41648
|
+
const currentLevel = num(upgrading.upgradeLevel) - offset;
|
|
41649
|
+
if (currentLevel > levels[key].level) {
|
|
41650
|
+
levels[key] = toolLevel(currentLevel, getEnchantmentName(upgrading));
|
|
41651
|
+
}
|
|
41652
|
+
levels.currentlyUpgrading = { tool: key, name: str(upgrading.name) };
|
|
41653
|
+
}
|
|
41654
|
+
}
|
|
41624
41655
|
const allItems2 = [
|
|
41625
41656
|
...collectToolItems(player.items),
|
|
41626
41657
|
...collectToolItems(root.locations?.GameLocation)
|
|
@@ -41631,10 +41662,14 @@ function parseToolLevels(player, root) {
|
|
|
41631
41662
|
const key = TOOL_KEY_MAP[xsiType];
|
|
41632
41663
|
if (key) {
|
|
41633
41664
|
const level = num(i.upgradeLevel);
|
|
41634
|
-
if (level > levels[key])
|
|
41665
|
+
if (level > levels[key].level) {
|
|
41666
|
+
levels[key] = toolLevel(level, getEnchantmentName(i));
|
|
41667
|
+
}
|
|
41635
41668
|
} else if (xsiType === "FishingRod") {
|
|
41636
41669
|
const rodLevel = FISHING_ROD_LEVEL[i.name] ?? -1;
|
|
41637
|
-
if (rodLevel > levels.fishingRod)
|
|
41670
|
+
if (rodLevel > levels.fishingRod.level) {
|
|
41671
|
+
levels.fishingRod = toolLevel(rodLevel, getEnchantmentName(i));
|
|
41672
|
+
}
|
|
41638
41673
|
}
|
|
41639
41674
|
}
|
|
41640
41675
|
return levels;
|
|
@@ -41882,7 +41917,7 @@ var v1 = (ctx) => ({
|
|
|
41882
41917
|
walnuts: parseWalnuts(ctx.root),
|
|
41883
41918
|
islandUpgrades: parseIslandUpgrades(ctx.mailSet),
|
|
41884
41919
|
children: parseChildren(ctx.root),
|
|
41885
|
-
|
|
41920
|
+
pets: parsePets(ctx.root, ctx.player),
|
|
41886
41921
|
horse: parseHorse(ctx.root),
|
|
41887
41922
|
powers: parsePowers(ctx.mailSet, ctx.eventsSet),
|
|
41888
41923
|
raccoons: parseRaccoons(ctx.root, ctx.mailSet),
|