Shops

Bookseller

Access the traveling Bookseller's purchasable books and trade-in offers using the chainable BooksellerItemQuery and BooksellerTradeQuery APIs.

Quick Start

import { booksellerShop, booksellerTrades } from 'stardew-valley-data'

// Get all books for sale
const allBooks = booksellerShop().get()

// Get always-available books sorted by price
const available = booksellerShop().alwaysAvailable().sortByPrice().get()

// Get all trade-in offers
const trades = booksellerTrades().get()

Type Definitions

BooksellerItem

Each purchasable book conforms to the BooksellerItem interface:

FieldTypeDescription
idstringUnique identifier.
namestringDisplay name of the book.
availabilityBooksellerAvailabilityWhen the book appears in stock.
pricenumberBase purchase price in gold.
priceTiers[number, number, number] | undefinedOptional tiered pricing array.
imagestringPath to the book's image.

BooksellerAvailability

type BooksellerAvailability =
  | 'always'
  | 'rotating-skill'
  | 'rotating-year3'
  | 'chance'
  | 'golden-walnut'

BooksellerTrade

Each trade-in offer conforms to the BooksellerTrade interface:

FieldTypeDescription
bookIdstringID of the book being traded.
bookNamestringDisplay name of the book.
bookImagestringPath to the book's image.
receiveItemsstring[]Item names you receive in exchange.
receiveQuantitynumberQuantity of items received.

Query Methods

BooksellerItemQuery

BooksellerItemQuery extends QueryBase and inherits five terminal methods:

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

Filter Methods

MethodReturnsDescription
byAvailability(availability)BooksellerItemQueryFilter to books with the given availability type.
alwaysAvailable()BooksellerItemQueryFilter to books that are always in stock.

Sort Methods

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

BooksellerTradeQuery

MethodReturnsDescription
get()BooksellerTrade[]Return all trade-in offers.
count()numberReturn the number of trade-in offers.
findByBookId(bookId)BooksellerTrade | undefinedFind a trade-in offer by the book ID being traded.

Examples

List rotating books by availability

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

const rotating = booksellerShop().byAvailability('rotating-skill').get()

rotating.forEach((book) => {
  console.log(`${book.name} - ${book.price}g`)
})

Look up a trade-in offer

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

const trade = booksellerTrades().findByBookId('book_of_stars')

if (trade) {
  console.log(
    `Trade ${trade.bookName} for ${trade.receiveQuantity}x ${trade.receiveItems.join(', ')}`,
  )
}
Previous
Blacksmith