A mod for Stardew Valley that provides access to some game basic information, actions, and events via an HTTP interface listening at http://localhost:7882/.
It's my first game mod, so be gentle.
/api/v1/data/achievements: Get a list of all loaded achievements/api/v1/data/locations: Get a list of all loaded locations/api/v1/data/locations/{name}: Get info about a location by name
/api/v1/items: A basic list of all items registered in the game/api/v1/items/id/{itemId}: Get an item by its fully qualified ID (e.g.(F)1365)/api/v1/items/type/{itemType}: A basic list of all items of the given type (e.g.Ffor furniture)/api/v1/items/type/{itemType}/id/{itemId}: Get an item by its type and individual ID (e.g.Ffor furniture type and1365for individual ID)
/api/v1/mods: Gets a list of all installed mods/api/v1/mods/{modId}: Get info on a specific mod by its unique mod ID (e.g.zunderscore.StardewWebApi)
/api/v1/npcs: Gets a basic list of all named NPCs/api/v1/npcs/name/{name}: Gets a specific NPC by name/api/v1/npcs/birthday/{season}/{day}: Gets a list of all NPCs whose birthday is on the specified day of the specified season/api/v1/npcs/pets: Gets a list of all pet NPCs
/api/v1/players/main: Information about the current player/api/v1/players/main/inventory: Information about the current player's inventory
/api/v1/players/main/actions/refillEnergy: Fully refills the player's energy/stamina/api/v1/players/main/actions/passOut: Fully drains the player's energy/stamina, causing them to pass out/api/v1/players/main/actions/fullyHeal: Fully refills the player's health/api/v1/players/main/actions/knockOut: Fully drains the player's health, causing them to be knocked out/die/api/v1/players/main/actions/giveMoney/{amount}: Gives money to/takes money away from the player/api/v1/players/main/actions/giveItem/name/{itemName}: Attempts to add the specified item to the player's inventory, using the item's display name/api/v1/players/main/actions/giveItem/id/{itemId}: Same as above, but using the item's fully qualified ID (e.g.(F)1365) instead/api/v1/players/main/actions/warpPlayer/{location}: Warps the player to the specified location/api/v1/players/main/actions/petFarmAnimal/{name}: Pets the named farm animal (i.e. chickens, cows, etc., but not pets like dogs, cats, or turtles)
/api/v1/ui/actions/showHudMessage: Show a HUD message in the bottom left corner/api/v1/ui/actions/showHudMesssage/item: Show a HUD message with an item icon/api/v1/ui/actions/showHudMessage/large: Show a larger HUD message with text wrapping and no icon box/api/v1/ui/actions/showChatMessage: Show a chat message
/api/v1/world: Information about the world, including in-game date and farm weather
/api/v1/world/actions/playSound/{name}: Plays a sound in game/api/v1/world/actions/playMusicTrack/{name}: Plays a music track in game/api/v1/world/actions/stopMusicTrack: Stops the currently playing music track
Opening a WebSocket connection to /events will allow another application to listen for some basic in-game events.
When events occur, all connected WebSocket connections are sent a broadcast message containing an event object. This object has two possible properties:
event: The name of the event, as listed belowdata: An optional property that includes any relevant data about the event (e.g.TimeChangedwill send values includingoldTimeandnewTime)
Connected: When an application connects to the/eventsendpoint. This event is NOT broadcast to all connections, but rather sent ONLY to the current connection.
SaveLoaded: The player loads a saveSaved: The player saves the gameReturnedToTitle: The player returns to the title screenDayStarted: A new day has startedDayEnding: The current day is endingTimeChanged: The time has changed (e.g. from 6:00 AM to 6:10 AM)PlayerInventoryChanged: The player's inventory has changed in any wayPlayerLevelChanged: The level of one of the player's skills has changedPlayerWarped: The player has warped to a different map location, including normal travel between areas (e.g. walking from the farm to the bus stop)
FriendshipIncreased: The player's friendship with an NPC has increasedMultipleFriendshipsIncreased: The player's friendship with multiple NPCs has increasedFriendshipDecreased: The player's friendship with an NPC has decreasedMultipleFriendshipsDecreased: The player's friendship with multiple NPCs has decreasedPlayerStartedDating: The player has started dating an NPCPlayerStoppedDating: The player is no longer dating an NPCPlayerEngaged: The player has become engaged to an NPCPlayerNoLongerEngaged: The player is no longer engaged to an NPCPlayerMarried: The player has married an NPCPlayerDivorced: The player has divorced an NPC
FestivalStarted: A festival has startedFestivalEnded: A festival has ended