Shops

Dwarf

Access the complete stock list for the Dwarf's shop in the Mines with category-based filtering using the chainable DwarfShopQuery API.

Quick Start

import { dwarfShop } from 'stardew-valley-data'

// Get all dwarf shop items
const all = dwarfShop().get()

// Get explosives sorted by price
const bombs = dwarfShop().explosives().sortByPrice().get()

// Find a specific item
const item = dwarfShop().findByName('Mega Bomb')

Type Definition

Each item conforms to the DwarfShopItem interface:

FieldTypeDescription
idstringUnique identifier.
namestringDisplay name of the item.
descriptionstringIn-game description text.
pricenumberPurchase price in gold.
imagestringPath to the item's image.
categoryDwarfShopCategoryItem category.

DwarfShopCategory

type DwarfShopCategory =
  | 'explosive'
  | 'food'
  | 'consumable'
  | 'recipe'
  | 'decoration'
  | 'scarecrow'
  | 'book'

Query Methods

DwarfShopQuery extends QueryBase and inherits five terminal methods:

MethodReturnsDescription
get()DwarfShopItem[]Return all results as an array.
first()DwarfShopItem | undefinedReturn the first result.
find(id)DwarfShopItem | undefinedFind an item by exact ID.
findByName(name)DwarfShopItem | undefinedFind an item by name (case-insensitive).
count()numberReturn the number of results.

Filter Methods

MethodReturnsDescription
byCategory(category)DwarfShopQueryFilter to items in the given category.
explosives()DwarfShopQueryFilter to explosive items (Cherry Bomb, Bomb, Mega Bomb).
consumables()DwarfShopQueryFilter to consumable items (Life Elixir, Oil of Garlic).
recipes()DwarfShopQueryFilter to crafting recipe items.

Sort Methods

MethodReturnsDescription
sortByPrice(order?)DwarfShopQuerySort by price. Pass 'asc' (default) or 'desc'.
sortByName(order?)DwarfShopQuerySort alphabetically by name. Pass 'asc' (default) or 'desc'.

Examples

List items by category

import { dwarfShop } from 'stardew-valley-data'

const categories = [
  'explosive',
  'food',
  'consumable',
  'recipe',
  'decoration',
  'scarecrow',
  'book',
]

categories.forEach((cat) => {
  const items = dwarfShop().byCategory(cat).get()
  if (items.length > 0) {
    console.log(`\n${cat.toUpperCase()} (${items.length}):`)
    items.forEach((item) => console.log(`  ${item.name} - ${item.price}g`))
  }
})

Find the cheapest explosive

import { dwarfShop } from 'stardew-valley-data'

const cheapest = dwarfShop().explosives().sortByPrice().first()

if (cheapest) {
  console.log(`${cheapest.name} is the cheapest bomb at ${cheapest.price}g`)
}
Previous
Desert trader