SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

Create unified item commands

Pathoschild opened this issue ยท 3 comments

commented

Create unified commands to search and add any item type.

commented

Proposed implementation

Extend list_items to search all item types, and add a 'type' field:

> list_items red

type      | id   | name
--------- | ---- | -------------------
fish      | 146  | Red Mullet
fish      | 150  | Red Snapper
furniture | 12   | Red Diner Chair
furniture | 294  | Red Armchair
furniture | 424  | Red Couch
furniture | 1296 | Manicured Pine
furniture | 1451 | Red Rug
furniture | 1618 | Red Cottage Rug
object    | 146  | Red Mullet
object    | 150  | Red Snapper
object    | 230  | Red Plate
object    | 266  | Red Cabbage
object    | 331  | Weathered Floor
object    | 420  | Red Mushroom
object    | 437  | Red Slime Egg
object    | 485  | Red Cabbage Seeds
weapon    | 52   | Tempered Broadsword

I don't think the game has any names or descriptions for wallpaper/flooring, but I guess we could just list them like this:

type      | id    | name
--------- | ----- | -------------------
flooring  | 0-39  | Flooring
wallpaper | 0-111 | Wallpaper

Then extend player_additem to support a type field:

> player_additem 485
OK, added Red Cabbage Seeds to your inventory.

> player_additem fish 146
OK, added Red Mullet to your inventory.

> player_additem wallpaper 7
OK, added wallpaper #7 to your inventory.
commented

One thing that could come in handy is the ability to add other items and/or categories. We would need "fake"/"virtual" IDs for the command itself (which could change if the mod list changes), but this way we could have custom items supported in the unified command. (Otherwise every mod would need to create a command.)

Example for items in existing categories (Sleepy Eye):

> list_items tool

type      | id   | name
--------- | ---- | -------------------
tool      | ??? | Axe
tool      | ??? | Copper Axe
...
tool      | ??? | Tent

An example for categories would be the critter catching stuff I posted in Discord a couple weeks ago. I imagine custom categories would need to manage their own IDs?


Also, maybe have player_additem work with strings if there is only one exact match? A few entries, like player_additem Stone, wouldn't work, but something like player_additem Red Cabbage would work (and so would player_additem Red Cabbage Seeds. If there is more than one match, (like with stone), just say it is ambiguous or something. (Possibly allow refining into each category with that, or require it?)

This would also avoid the virtual ID issue in many cases.

commented

Done in develop for the upcoming SMAPI release.