vendors

package
v0.7.113 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package vendors finds who sells an item, from the dataset's vendor_sources table (offers players saw in game and reported to Everloot, CC BY-SA 4.0). The rules are in docs/upgrade-paths.md.

Index

Constants

View Source
const (
	KindVendor  = "vendor"
	KindTrainer = "trainer"
	KindFlight  = "flight"
)

Kinds a Search can look for.

View Source
const (
	MaxFound = 5
	MaxSells = 6
)

MaxFound is how many NPCs a search lists; MaxSells is how many goods each one names.

View Source
const (
	Source = "everloot"
	Credit = "Everloot (CC BY-SA)"
)

Source tags the facts as Everloot's; Credit is the attribution line for an answer's sources.

View Source
const CheapPerBand = 10000

CheapPerBand is the price, in copper, a vendor path may cost per ten levels of the character's level band (level/10 + 1 bands) to count as cheap: 1 gold at levels 1-9, 2 gold at 10-19, and so on.

Variables

This section is empty.

Functions

func BasePrice added in v0.7.97

func BasePrice(ds store.DataStore, itemID, listed int64) int64

BasePrice is the price a player with no standing pays for an item whose vendor row lists the price. A reporter's price can be lower than the item's buy price because of a reputation discount the reporter had (a tenth off at Honored), so the buy price is used when it is higher. An unknown listed price (0 or less) stays unknown.

func Money

func Money(c int64) string

Money writes copper as gold, silver and copper; "" for a price of zero or less.

func ObservedOf added in v0.7.104

func ObservedOf(chars ...character.Character) []character.SeenVendor

ObservedOf is the vendors every one of the characters opened.

Types

type Found added in v0.7.98

type Found struct {
	NPCID   int64   `json:"npc_id"`
	Name    string  `json:"name"`
	Sub     string  `json:"subname,omitempty" jsonschema:"the NPC's title, such as Shady Goods"`
	Zone    string  `json:"zone,omitempty"`
	Subzone string  `json:"subzone,omitempty"`
	X       float64 `json:"x,omitempty"`
	Y       float64 `json:"y,omitempty"`
	HasXY   bool    `json:"has_coordinates"`
	Faction string  `json:"faction,omitempty" jsonschema:"Alliance, Horde, or empty for a vendor both factions can use"`
	// FactionKnown is true when a source holds the NPC's side: QuestieDB (an empty side there is a vendor both sides use) or the NPC row.
	FactionKnown bool     `json:"faction_known" jsonschema:"false when no data says which side can use the NPC; Faction is then empty"`
	Sells        []string `json:"sells,omitempty"`
	Questie      bool     `json:"from_questie" jsonschema:"the place or the subname was read from the player's QuestieDB"`
	Observed     bool     `json:"observed,omitempty" jsonschema:"true when one of the player's characters opened this vendor's shop"`
	// contains filtered or unexported fields
}

Found is one NPC the search matched.

func (Found) Line added in v0.7.98

func (f Found) Line() string

Line is "Sly Garrett <Shady Goods>, Booty Bay, Stranglethorn Vale (27.1, 77.2): sells ...".

type Offer

type Offer struct {
	NPCID       int64  `json:"-"`
	Vendor      string `json:"vendor"`
	Zone        string `json:"zone,omitempty"`
	PriceCopper int64  `json:"price_copper"`
	Price       string `json:"price,omitempty" jsonschema:"the price in gold, silver and copper; empty when the price is unknown"`
	Limited     bool   `json:"limited,omitempty" jsonschema:"the vendor has limited stock"`
	Source      string `json:"source" jsonschema:"everloot, or seen by you when the player saw this vendor in game"`
}

Offer is one vendor selling one item.

func Best

func Best(ds store.DataStore, itemID int64) (Offer, bool)

Best is the cheapest offer for the item (a known price before an unknown one, then the lowest NPC id), or false when the table is missing or has no vendor for it. A vendor the dataset does not name is skipped: advice never points at "vendor 1234".

func BestFor added in v0.7.47

func BestFor(c character.Character, ds store.DataStore, itemID int64) (Offer, bool)

BestFor is Best for a character: a vendor the player opened and saw sell the item (open to their faction) comes first, at the price it showed, ahead of the dataset's offers.

func (Offer) Cheap

func (o Offer) Cheap(level int) bool

Cheap reports whether the price is modest for a character of the level: at or under CheapPerBand copper for each band of ten levels. An unknown price is never cheap.

func (Offer) Line

func (o Offer) Line() string

Line is "Buy from <vendor> in <zone> for <price>", with "limited stock" when it is limited.

func (Offer) LineFor added in v0.7.97

func (o Offer) LineFor(count int) string

LineFor is Line for count units to buy: the price is for one unit, so more than one says "each".

func (Offer) Seen added in v0.7.47

func (o Offer) Seen() bool

Seen reports whether the offer is one the player saw in game.

type Query added in v0.7.98

type Query struct {
	Text    string
	Zone    string
	Kind    string // vendor (default), trainer or flight
	Faction string // the player's faction; "" lists both
	At      questie.Where
	// Observed are the vendors the player's characters opened (Seen.Vendors), searched beside the dataset and
	// QuestieDB and merged by npc id; use ObservedOf to collect them.
	Observed []character.SeenVendor
}

Query is one who-sells question. Text is a keyword, an item name or a subname word ("poison", "Shady Goods", "reagents"); empty lists the NPCs of the kind in Zone.

type Result added in v0.7.98

type Result struct {
	Found []Found `json:"found"`
	Text  string  `json:"text"`
	Gap   string  `json:"gap,omitempty" jsonschema:"set when nothing matched: the data that holds no such NPC"`
}

Result is a search's answer: the NPCs (nearest first), the line to say, and Gap when nothing matched.

func Search(ds store.DataStore, qx *questie.Index, q Query) Result

Search finds NPCs of the kind for the query, from the dataset's vendor offers and NPC rows and from the player's QuestieDB (its subnames and vendor types). Either source may be nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL