levelup

package
v0.7.114 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 14 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 levelup answers "what's new at my next level?": the spells and ranks a class trainer teaches in a level window, what they cost when the dataset knows, the nearest class trainer, whether the character's money covers it, and the class quests coming up. Everything comes from the dataset's class_spells and trainer_spells, the capture, and the player's QuestieDB; nothing is guessed.

Index

Constants

View Source
const AheadLevels = 6

AheadLevels is how many levels above the character the Ahead offers reach.

Variables

View Source
var ClassIDs = map[string]int64{"WARRIOR": 1, "PALADIN": 2, "HUNTER": 3, "ROGUE": 4, "PRIEST": 5, "SHAMAN": 7, "MAGE": 8, "WARLOCK": 9, "DRUID": 11}

ClassIDs maps the capture's class token to the dataset's class_id.

Functions

func ClassCities added in v0.7.100

func ClassCities(faction, class string) []string

ClassCities are every capital that holds a class trainer for the faction's class, the usual one first; nil for a class the faction cannot play.

func ClassCity added in v0.7.70

func ClassCity(faction, class string) string

ClassCity is the capital for the faction's class trainers, "" when none is known.

func Facts

func Facts(c character.Character, ds store.DataStore, qx *questie.Index, from, to int) (text string, spells, quests bool)

Facts is the grounded block for "what's new at my next level": the spells to train from level from to to with costs, the total, the money check, the trainer and the class quests coming up. ok is false when the dataset holds nothing for the class and window.

func FlightFrom added in v0.7.87

func FlightFrom(city, zone string) string

FlightFrom is the flight point in zone with a direct flight to the city; "" when none is known.

func MoneyLine

func MoneyLine(c character.Character, total int64) string

MoneyLine is the plain money check: "" when the character's money is unknown or covers the total.

func QuestBlocked added in v0.7.89

func QuestBlocked(c character.Character, ds store.DataStore, qx *questie.Index) []string

QuestBlocked is one line per missed spell quest: the lowest blocked trainer rank (recorded as unavailable at the player's class trainer, else from the dataset's class list up to the character's level) and the quest that teaches the spell, or just where the quest is when no rank is blocked yet.

func Total

func Total(sp []Spell) (copper int64, unknown int)

Total is the cost of the spells that have one, and how many have none on record.

func TrainerSells added in v0.7.75

func TrainerSells(c character.Character, ds store.DataStore) string

TrainerSells states plainly what the player's opened class trainer sells (every level, minus what the trainer shows as learned), "" when the player opened none. The facts give it so an answer never names a spell the trainer does not sell.

Types

type ClassQuest

type ClassQuest struct {
	ID        int
	Name      string
	Level     int
	Giver     string
	Zone      string
	X, Y      float64
	OpensAt   int // the level it opens at; 0 when open now
	Objective string
}

ClassQuest is a class quest coming up: its giver and where.

func ClassQuests

func ClassQuests(c character.Character, qx *questie.Index, ahead int) []ClassQuest

ClassQuests lists the character's class quests available now or within ahead levels.

type QuestSpell added in v0.7.75

type QuestSpell struct {
	ID    int64
	Name  string
	Level int
	Quest string // the quest that rewards it
}

QuestSpell is a class spell a quest teaches, not a trainer.

func QuestSpells added in v0.7.75

func QuestSpells(c character.Character, ds store.DataStore, from, to int) []QuestSpell

QuestSpells lists the class spells of levels from to to that a quest rewards and the character does not know yet, never offered by a trainer.

func (QuestSpell) Line added in v0.7.75

func (q QuestSpell) Line() string

Line is "Defensive Stance: from the class quest The Bulwark".

type Spell

type Spell struct {
	ID    int64
	Name  string
	Rank  int   // 0 when the ability has no rank
	Level int   // the level it is learned at
	New   bool  // false when it upgrades a known rank
	Cost  int64 // copper; 0 when no corroborated offer carries one
	Seen  bool  // the cost is the one a trainer showed the player
	// SeenAt is when that trainer window was read (unix s); NeedLevel is the level its window said, 0 when none.
	SeenAt    int64
	NeedLevel int
	Blocked   bool // the trainer showed it as not yet available
	// Requires is the spell id of the rank to learn first (0 when none or already known); RequiresQuest the
	// quest that teaches that prerequisite (0 when none). State is set by Ahead: "blocked" or "later".
	Requires      int64
	RequiresQuest int
	State         string
	// Usually marks a spell from the dataset's class list, with no opened class trainer to confirm it.
	Usually bool
}

Spell is one ability or rank a trainer teaches.

func Ahead added in v0.7.91

func Ahead(c character.Character, ds store.DataStore) []Spell

Ahead lists the offers the trainer cannot teach yet, from the dataset's class list: a rank behind a quest-taught first rank ("blocked", at or below the character's level) and any rank within AheadLevels above their level ("later"). Each carries the prerequisite spell id and quest, so a reader can unlock it the moment the prerequisite is learned. Known spells are left out.

func Learned added in v0.7.97

func Learned(c character.Character, ds store.DataStore, to int) []Spell

Learned lists the abilities of the character's class a player has by level to: every first rank of the dataset's class_spells at or below it, with the level that rank is learned at, in level order. It leaves out what no trainer teaches and no level gives: a talent or its effect, the passive half of a stance or form, a rune ability, and a spell a class quest teaches that the character has not learned. Ranks above the first are not listed; the first rank's level stands.

func Spells

func Spells(c character.Character, ds store.DataStore, from, to int) []Spell

Spells lists the trainer-taught spells of the character's class for levels from to to, in level order. When the player opened their class trainer, that trainer's own offers are the list: offered, at or below the window, not shown as learned. Without one the dataset's class list stands in and each spell is marked Usually. A spell the capture says the character knows is left out, a rank a higher rank in the same window supersedes is too, and so is a spell a quest teaches (see QuestSpells).

func (Spell) Label

func (s Spell) Label() string

Label is the spell as a player reads it: "Rend (Rank 2)".

type TrainPlace added in v0.7.70

type TrainPlace struct {
	City    string
	From    string   // the flight point to fly from, when a known direct flight reaches the city
	Trainer *Trainer // the class trainer's NPC and position, only when a capture or QuestieDB names one
	Seen    bool     // the trainer is one the player opened
	Here    bool     // the character is already in the city
	Bound   bool     // the character's hearthstone is bound in the city, which the capture says
	Cross   string   // the zeppelin or boat to take first, when the city is on another continent than the zone
}

TrainPlace is where the character should go to train class spells.

func TrainAt added in v0.7.70

func TrainAt(c character.Character, qx *questie.Index) (TrainPlace, bool)

TrainAt chooses the place to train class spells: a class trainer the player opened in the city or where they stand, else the class's trainer in the faction's city from QuestieDB, else the city alone. It never names an NPC or a position that no source holds.

func (TrainPlace) Line added in v0.7.70

func (p TrainPlace) Line(class string) string

Line is the plain fact: "Train at: Undercity (fly from Tarren Mill)".

type Trainer

type Trainer struct {
	Name, Zone string
	X, Y       float64
	Map        int // the uiMapID the position is on, 0 when unknown
}

Trainer is the nearest class trainer from the player's QuestieDB.

func NearestTrainer

func NearestTrainer(c character.Character, qx *questie.Index) (Trainer, bool)

NearestTrainer is the character's class trainer for their faction, in their zone first, else the nearest by map distance, else the first. ok is false without a QuestieDB or a trainer.

func SeenClassTrainer added in v0.7.47

func SeenClassTrainer(c character.Character) (Trainer, bool)

SeenClassTrainer is the class trainer the player opened (one whose window carries no profession skill gate), the newest on the character's own map first.

func (Trainer) String

func (t Trainer) String() string

Jump to

Keyboard shortcuts

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