World & Progression

NPCs

Every resident NPC in Dinkum, with their occupation, move-in requirements, and food preferences.


Type

NPC

interface NPC {
  id: string
  name: string
  img: string
  occupation: string
  requirements: {
    visit: string
    moveIn: string
  }
  foodPreferences: {
    likes: string
    likesImg: string
    dislikes: string
    dislikesImg: string
  }
}
FieldTypeDescription
idstringStable identifier
namestringDisplay name
imgstringPath to the NPC's portrait, relative to images/
occupationstringTheir role in town
requirements.visitstringRequirement to visit the NPC
requirements.moveInstringRequirement for the NPC to move in
foodPreferences.likesstringFavorite food
foodPreferences.likesImgstringPath to that food's icon
foodPreferences.dislikesstringDisliked food
foodPreferences.dislikesImgstringPath to that food's icon

Factory

import { npcs } from 'dinkum-data'

npcs() // all 23 NPCs
npcs(source) // wrap a pre-filtered array

Filters

MethodSignatureDescription
byOccupationbyOccupation(text: string)Filter to NPCs whose occupation description contains the given text (case-insensitive).
import { npcs } from 'dinkum-data'

npcs().byOccupation('quest giver').get()

Terminal methods

MethodReturnsDescription
.get()NPC[]All results
.first()NPC | undefinedFirst result
.find(id)NPC | undefinedFind by id
.findByName(name)NPC | undefinedCase-insensitive exact name match
.search(query)NPC[]Case-insensitive partial name match
.count()numberNumber of results

Examples

import { npcs } from 'dinkum-data'

// Every NPC whose occupation mentions the Town Hall
npcs().byOccupation('Town Hall').get()

// Look up by name
npcs().findByName('Fletch')

Next steps

  • See Buildings for the buildings some NPCs are tied to
  • Browse Calendar for these NPCs' birthdays and calendar events
  • Read core concepts for the shared query builder pattern
Previous
Buildings