Overview
This mod implements the not-fully-implemented vanilla logic for upgrading specific tools, allowing any shop to sell and carry out upgrades to tools.
This came about from wanting the Wizard to upgrade wands for my soon-to-be-ready area-of-effect spell mod, but it can be easily applied to any shopkeeper.
Tool upgrades are shop-dependent, so you can upgrade one tool at a time per shop.
Mod users, just download this mod as required. It doesn't do anything by itself.
Designating Tool Upgraders
This mod does not add actual items to shop inventory. See
Adding Upgrades below for that.
To designate a shop as an upgrader, use Content Patcher or the C# API.
Content Patcher
{
"Format": "2.9.1",
"Changes": [
{
"Action": "EditData",
"Target": "aedenthorn.ToolUpgraders/dict",
"Entries": {
"wizard": {
"ShopName": "Wizard",
"TileAction": "WizardBook",
"Tools": [
"aedenthorn.MagicWandsCP_silverWand",
"aedenthorn.MagicWandsCP_goldWand"
],
"UpgradeDays": 2,
"ReadyText": null,
"BeginText": "So it shall be. Come back in {0} days.",
"NoSpaceText": null,
"BeginSound": "wand",
"BeginNPC": "Wizard"
}
}
}
]
}
ShopName and TileAction are used to trigger receiving upgraded tools - if your shop is always opened via a tile action, you don't really need the ShopName.
Tools contains the ItemId of every tool the shop should be able to upgrade, again for triggering receipt.
You can omit the three "Text" fields to use the same dialogue as for the blacksmith.
The above example is what I'm using for my modded-in Wizard shop; it will work with any shop in Data/Shops.
C# API
Helper.ModRegistry.GetApi<IToolUpgradersAPI>("aedenthorn.ToolUpgraders")?.AddUpgrader("Wizard", "Wizard", "WizardBook", upgrades, null, Helper.Translation.Get("tool-ready-in-x"), null, "wand", "Wizard", Config.UpgradeDays);
Same basic idea as above, see
the API here. Again, this requires me doing other things to make a new Wizard shop based on the WizardBook tile, but it works with vanilla shops, e.g. just use "Carpenter" instead of "Wizard".
Adding Upgrades
The vanilla game already has a method for adding upgrades to shop inventory, but it's broken. This mod fixes it, so you can do:
{
"Format": "2.8.0",
"Changes": [
{
"Action": "EditData",
"Target": "Data/Shops",
"TargetField": [
"Carpenter",
"Items"
],
"Entries": {
"(T)CopperAxe": {
"Id": "(T)CopperAxe",
"ItemId": "TOOL_UPGRADES (T)CopperAxe"
}
}
}
]
}
This example adds the copper axe as an upgrade - upgrade info is already present in the game code so this is all you need to add an axe upgrade to Robin's shop. Note that this won't work unless you add Carpenter to the upgraders as explained above.
The important part here is the "TOOL_UPGRADES (T)CopperAxe"; this is vanilla code, but it doesn't normally work as expected (maybe it's disabled intentionally because it wouldn't work without some other things this mod does anyway).
7ae46fed-7839-4ea2-a9dd-82d6e5ddf14f
Technical
Requires SMAPI.
Implements a
Generic Mod Config Menu interface to change config settings in-game.
Code is at
https://github.com/aedenthorn/StardewValleyMods.
A list of all my mods for Stardew Valley is available at
https://www.nexusmods.com/stardewvalley/articles/895.