Documentation
¶
Index ¶
- Constants
- Variables
- func AlignmentToString(alignment int8) string
- func AllSlots() []items.ItemType
- func ArmorSlots() []items.ItemType
- func CompileAdjectiveSwaps()
- func GetAllSlotTypes() []string
- func GetFormattedAdjective(adjName string) string
- func GetFormattedAdjectives(excludeShort bool) []string
- func SlotLabel(slot items.ItemType) string
- func WeaponSlots() []items.ItemType
- type Aggro
- type AggroType
- type Character
- func (c *Character) AddBuff(buffId int, isPermanent bool, triggerCountOverride ...int) error
- func (c *Character) AlignmentName() string
- func (c *Character) ApplyFormChange(newRaceId int) []items.Item
- func (c *Character) ApplyHealthChange(healthChange int) int
- func (c *Character) ApplyManaChange(manaChange int) int
- func (c *Character) AutoTrain()
- func (c *Character) BarterPrice(startPrice int) int
- func (c *Character) BestUpgrades() map[items.ItemType]items.Item
- func (c *Character) CanDualWield() bool
- func (c *Character) CancelBuffsWithFlag(buffFlag buffs.Flag) bool
- func (c *Character) CarryCapacity() int
- func (c *Character) Charm(userId int, rounds int, expireCommand string)
- func (c *Character) ClearQuestToken(questToken string)
- func (c *Character) DecayAlignment()
- func (c *Character) DeductActionPoints(amount int) bool
- func (c *Character) DisableSpell(spellName string) bool
- func (c *Character) EnableSpell(spellName string) bool
- func (c *Character) EndAggro()
- func (c *Character) FindInBackpack(itemName string) (items.Item, bool)
- func (c *Character) FindKeyInBackpack(lockId string) (items.Item, bool)
- func (c *Character) FindOnBody(itemName string) (items.Item, bool)
- func (c *Character) GetAdjectives() []string
- func (c *Character) GetAllBackpackItems() []items.Item
- func (c *Character) GetAllCooldowns() map[string]int
- func (c *Character) GetAllSkillRanks() map[string]int
- func (c *Character) GetAllWornItems() []items.Item
- func (c *Character) GetBaseCastSuccessChance(spellId string) int
- func (c *Character) GetBuffs(buffId ...int) []*buffs.Buff
- func (c *Character) GetCharmIds() []int
- func (c *Character) GetCharmedUserId() int
- func (c *Character) GetCooldown(trackingTag string) int
- func (c *Character) GetDefaultDiceRoll() (attacks int, dCount int, dSides int, bonus int, buffOnCrit []int)
- func (c *Character) GetDefense() int
- func (c *Character) GetDescription() string
- func (c *Character) GetGearValue() int
- func (c *Character) GetHealthAppearance() string
- func (c *Character) GetKey(lockId string) string
- func (c *Character) GetMapSprawlCapacity() int
- func (c *Character) GetMaxCharmedCreatures() int
- func (c *Character) GetMemoryCapacity() int
- func (c *Character) GetMiscData(key string) any
- func (c *Character) GetMiscDataKeys(prefixMatch ...string) []string
- func (c *Character) GetMobName(viewingUserId int, renderFlags ...NameRenderFlag) FormattedName
- func (c *Character) GetPlayerName(viewingUserId int, renderFlags ...NameRenderFlag) FormattedName
- func (c *Character) GetQuestProgress() map[int]string
- func (c *Character) GetRaceId() int
- func (c *Character) GetRandomItem() (items.Item, bool)
- func (c *Character) GetSetting(settingName string) string
- func (c *Character) GetSkillLevel(skillName skills.SkillTag) int
- func (c *Character) GetSkillLevelCost(currentLevel int) int
- func (c *Character) GetSkills() map[string]int
- func (c *Character) GetSpells() map[string]int
- func (c *Character) GiveQuestToken(questToken string) bool
- func (c *Character) GrantXP(xp int) (actualXP int, xpScale int)
- func (c *Character) HandsRequired(i items.Item) int
- func (c *Character) HasAdjective(adj string) bool
- func (c *Character) HasBuff(buffId int) bool
- func (c *Character) HasBuffFlag(buffFlag buffs.Flag) bool
- func (c *Character) HasKey(lockId string, difficulty int) (hasKey bool, hasSequence bool)
- func (c *Character) HasQuest(questToken string) bool
- func (c *Character) HasSpell(spellName string) bool
- func (c *Character) HasVisitedRoom(roomId int, zone string) bool
- func (c *Character) Heal(hp int, mana int) (int, int)
- func (c *Character) HealthPerRound() int
- func (c *Character) IsAggro(targetUserId int, targetMobInstanceId int) bool
- func (c *Character) IsCharmed(userId ...int) bool
- func (c *Character) IsDisabled() bool
- func (c *Character) IsFormChanged() bool
- func (c *Character) IsQuestDone(questToken string) bool
- func (c *Character) KeyCount() int
- func (c *Character) KnowsFirstAid() bool
- func (c *Character) LearnSpell(spellName string) bool
- func (c *Character) LevelUp() (bool, stats.Statistics)
- func (c *Character) ManaPerRound() int
- func (c *Character) MarkVisitedRoom(roomId int, zone string, validRoomIds map[int]struct{}) bool
- func (c *Character) MovementCost() int
- func (c *Character) PruneCooldowns()
- func (c *Character) Race() string
- func (c *Character) RaceSize() string
- func (c *Character) RecalculateStats()
- func (c *Character) RememberRoom(roomId int)
- func (c *Character) RemoveBuff(buffId int)
- func (c *Character) RemoveCharm() int
- func (c *Character) RemoveFromBody(i items.Item) bool
- func (c *Character) RemoveItem(i items.Item) bool
- func (c *Character) RevertFormChange() []items.Item
- func (c *Character) SetAdjective(adj string, addToList bool)
- func (c *Character) SetAggro(userId int, mobInstanceId int, aggroType AggroType, roundsWaitTime ...int)
- func (c *Character) SetAggroRemote(exitName string, userId int, mobInstanceId int, aggroType AggroType, ...)
- func (c *Character) SetCast(roundsWaitTime int, sInfo SpellAggroInfo)
- func (c *Character) SetKey(lockId string, sequence string)
- func (c *Character) SetMiscData(key string, value any)
- func (c *Character) SetPermaBuffs(buffIds []int)
- func (c *Character) SetSetting(settingName string, settingValue string)
- func (c *Character) SetSkill(skillName string, level int)
- func (c *Character) SetUserId(userId int)
- func (c *Character) StatMod(statName string) int
- func (c *Character) StoreItem(i items.Item) bool
- func (c *Character) TimerExists(name string) bool
- func (c *Character) TimerExpired(name string) bool
- func (c *Character) TimerSet(name, period string)
- func (c *Character) TrackBuffStarted(buffId int)
- func (c *Character) TrackCharmed(mobId int, add bool)
- func (c *Character) TrackPlayerDamage(userId int, damageAmt int)
- func (c *Character) TrackSpellCast(spellName string) bool
- func (c *Character) TrainSkill(skillName string, targetLevel ...int) int
- func (c *Character) TryCooldown(trackingTag string, cooldownTime string) bool
- func (c *Character) UnLearnSpell(spellName string) bool
- func (c *Character) Uncurse() []items.Item
- func (c *Character) UpdateAlignment(amt int)
- func (c *Character) UpdateItem(originalItm items.Item, replacement items.Item) bool
- func (c *Character) UseItem(i items.Item) int
- func (c *Character) Validate(recalcPermaBuffs ...bool) error
- func (c *Character) Wear(i items.Item) (returnItems []items.Item, newItemWorn bool, failureReason string)
- func (c *Character) XPTL(lvl int) int
- func (c *Character) XPTNL() int
- func (c *Character) XPTNLActual() (xpPastCurrentLevel int, tnlXP int)
- func (c *Character) ZoneVisitPercent(zone string, validRoomIds map[int]struct{}) int
- func (c *Character) ZoneVisitProgress(zone string, validRoomIds map[int]struct{}) (visited int, total int)
- type CharmInfo
- type Cooldowns
- type FormattedName
- type KDStats
- func (kd *KDStats) AddEliteDeath(mobId int, mobName string)
- func (kd *KDStats) AddEliteKill(mobId int, mobName string)
- func (kd *KDStats) AddMobDeath()
- func (kd *KDStats) AddMobKill(mobId int)
- func (kd *KDStats) AddPlayerDeath(killedByUserId int, killedByCharName string)
- func (kd *KDStats) AddPlayerKill(killedUserId int, killedCharName string)
- func (kd *KDStats) AddPvpDeath()
- func (kd *KDStats) GetEliteKills(mobId ...int) int
- func (kd *KDStats) GetMobDeaths() int
- func (kd *KDStats) GetMobKDRatio() float64
- func (kd *KDStats) GetMobKills(mobId ...int) int
- func (kd *KDStats) GetPvpDeaths() int
- func (kd *KDStats) GetPvpKDRatio() float64
- type MobMasteries
- type NameRenderFlag
- type RoomBitset
- func (rb RoomBitset) Count() int
- func (rb RoomBitset) CountIn(roomIds map[int]struct{}) int
- func (rb RoomBitset) Has(roomId int) bool
- func (rb RoomBitset) IsComplete(roomIds map[int]struct{}) bool
- func (rb RoomBitset) MarshalYAML() (interface{}, error)
- func (rb RoomBitset) Prune(validRoomIds map[int]struct{})
- func (rb RoomBitset) Set(roomId int)
- func (rb RoomBitset) ToSet() map[int]struct{}
- func (rb *RoomBitset) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Shop
- type ShopItem
- type SpellAggroInfo
- type Worn
Constants ¶
const ( // MinMax alignment AlignmentMinimum int8 = -100 AlignmentMaximum int8 = 100 // Good AlignmentHoly int8 = 80 AlignmentGood int8 = 60 AlignmentVirtuous int8 = 40 AlignmentLawful int8 = 20 // Neutral AlignmentNeutralHigh int8 = 19 AlignmentNeutral int8 = 0 AlignmentNeutralLow int8 = -19 // Evil AlignmentMisguided int8 = -20 AlignmentCorrupt int8 = -40 AlignmentEvil int8 = -60 AlignmentUnholy int8 = -80 // Threshold by which mobs will auto aggro AlignmentAggroThreshold int = 190 // Possible delta is 0 - 200 )
const ( CharmPermanent = -1 // Never expires due to time CharmExpiredDespawn = `emote bows and bids you farewell, disappearing into the scenery;despawn charmed mob expired` CharmExpiredRevert = `emote reverts to its old ways` )
const ( StockTemporary = -1 StockUnlimited = 0 )
Variables ¶
var OnGetFormattedName util.Hook[FormattedName]
OnGetFormattedName is fired at the end of getFormattedName with the fully-populated FormattedName. Modules may register handlers to modify the name before it is returned to the caller (e.g. to append a title).
var (
StartingRoomId = -1
)
Functions ¶
func AlignmentToString ¶
func AllSlots ¶ added in v0.9.8
AllSlots returns every equipment slot in canonical display order. Delegates to items.AllEquipSlots() so the single source of truth lives alongside the ItemType constants.
func ArmorSlots ¶ added in v0.9.8
ArmorSlots returns every equipment slot except Weapon.
func CompileAdjectiveSwaps ¶
func CompileAdjectiveSwaps()
func GetAllSlotTypes ¶
func GetAllSlotTypes() []string
GetAllSlotTypes returns all slot names as strings. Kept for backward compatibility; prefer AllSlots() for typed access.
func GetFormattedAdjective ¶
func GetFormattedAdjectives ¶
func SlotLabel ¶ added in v0.9.8
SlotLabel returns the short display label (with trailing colon) for a slot, e.g. items.Head -> "Head:". Used by UI code so label strings are not scattered across rendering packages.
func WeaponSlots ¶ added in v0.9.8
WeaponSlots returns the slots that hold weapons.
Types ¶
type Character ¶
type Character struct {
Name string // The name of the character
Description string // A description of the character.
Adjectives []string `yaml:"adjectives,omitempty"` // Decorative text for the name of the character (e.g. "sleeping", "dead", "wounded")
RoomId int `yaml:"roomid,omitempty"` // The room id the character is in.
RoomIdOnReset int `yaml:"roomidonreset,omitempty"` // The room they are sent to if their RoomId isn't found.
Zone string `yaml:"zone,omitempty"` // The zone the character is in. The folder the room can be located in too.
RaceId int `yaml:"raceid,omitempty"` // Character race
FormRaceId int `yaml:"formraceid,omitempty"` // Temporary race override (0 = not transformed)
Stats stats.Statistics // Character stats
Level int `yaml:"level,omitempty"` // The level of the character
Experience int `yaml:"experience,omitempty"` // The experience of the character
TrainingPoints int `yaml:"trainingpoints,omitempty"` // The number of training points the character has
StatPoints int `yaml:"statpoints,omitempty"` // The number of skill points the character has
Health int `yaml:"health,omitempty"` // The health of the character
Mana int `yaml:"mana,omitempty"` // The mana of the character
ActionPoints int `yaml:"actionpoints,omitempty"` // The resevoir of action points the character has to spend on movement etc.
Alignment int8 `yaml:"alignment,omitempty"` // The alignment of the character
Gold int `yaml:"gold,omitempty"` // The gold the character is holding
Bank int `yaml:"bank,omitempty"` // The gold the character has in the bank
Shop Shop `yaml:"shop,omitempty"` // Definition of shop services/items this character stocks (or just has at the moment)
SpellBook map[string]int `yaml:"spellbook,omitempty"` // The spells the character has learned
Charmed *CharmInfo `yaml:"-"` // If they are charmed, this is the info
CharmedMobs []int `yaml:"-"` // If they have charmed anyone, this is the list of mob instance ids
Items []items.Item `yaml:"items,omitempty"` // The items the character is holding
Buffs buffs.Buffs `yaml:"buffs,omitempty"` // The buffs the character has active
Equipment Worn `yaml:"equipment,omitempty"` // The equipment the character is wearing
TNLScale float32 `yaml:"-"` // The experience scale of the character. Don't write to yaml since is dynamically calculated.
HealthMax stats.StatInfo `yaml:"-"` // The maximum health of the character. Don't write to yaml since is dynamically calculated.
ManaMax stats.StatInfo `yaml:"-"` // The maximum mana of the character. Don't write to yaml since is dynamically calculated.
ActionPointsMax stats.StatInfo `yaml:"-"` // The maximum actions of character. Don't write to yaml since is dynamically calculated.
Aggro *Aggro `yaml:"-"` // Dont' store this. If they leave they break their aggro
Skills map[string]int `yaml:"skills,omitempty"` // The skills the character has, and what level they are at
Cooldowns Cooldowns `yaml:"cooldowns,omitempty"` // How many rounds until it is cooled down
Settings map[string]string `yaml:"settings,omitempty"` // custom setting tracking, used for anything.
QuestProgress map[int]string `yaml:"questprogress,omitempty"` // quest progress tracking
KeyRing map[string]string `yaml:"keyring,omitempty"` // key is the lock id, value is the sequence
KD KDStats `yaml:"kd,omitempty"` // Kill/Death stats
MiscData map[string]any `yaml:"miscdata,omitempty"` // Any random other data that needs to be stored
ExtraLives int `yaml:"extralives,omitempty"` // How many lives remain. If enabled, players can perma-die if they die at zero
MobMastery MobMasteries `yaml:"mobmastery,omitempty"` // Tracks particular masteries around a given mob
Pet pets.Pet `yaml:"pet,omitempty"` // Do they have a pet?
Created time.Time `yaml:"created"` // When this character was created
Timers map[string]gametime.RoundTimer `yaml:"timers,omitempty"` // any special timers added to this character
ZonesVisited map[string]RoomBitset `yaml:"zonesvisited,omitempty"` // permanent record of every room visited, keyed by zone name
PlayerDamage map[int]int `yaml:"-"` // key = who, value = how much
LastPlayerDamage uint64 `yaml:"-"` // last round a player damaged this character
KillerMobInstanceId int `yaml:"-"` // transient: mob instance that delivered the killing blow
KillerMobIsElite bool `yaml:"-"` // transient: true if the killing mob was elite
KillerMobName string `yaml:"-"` // transient: name of the mob that delivered the killing blow
// contains filtered or unexported fields
}
func (*Character) AlignmentName ¶
func (*Character) ApplyFormChange ¶ added in v0.9.8
func (*Character) ApplyHealthChange ¶
func (*Character) ApplyManaChange ¶
func (*Character) AutoTrain ¶
func (c *Character) AutoTrain()
AutoTrain() spends any training points for this character
func (*Character) BarterPrice ¶
func (*Character) BestUpgrades ¶ added in v0.9.8
BestUpgrades returns a map of equipment slot -> best backpack item that beats whatever is currently worn in that slot (or fills an empty slot). The caller receives only slots where an upgrade exists; worn items that already beat every backpack alternative are omitted.
Two-handed weapon / offhand mutual-exclusion is respected: a two-handed weapon candidate is skipped when an offhand item is already worn (or already chosen as an upgrade), and an offhand candidate is skipped when a two-handed weapon is already worn (or already chosen).
func (*Character) CanDualWield ¶
func (*Character) CancelBuffsWithFlag ¶
func (*Character) CarryCapacity ¶
func (*Character) ClearQuestToken ¶
func (*Character) DecayAlignment ¶ added in v0.9.8
func (c *Character) DecayAlignment()
DecayAlignment drifts alignment one step toward neutral. The amount decayed per call scales quadratically with distance from neutral so extreme alignments decay faster and are harder to maintain.
func (*Character) DeductActionPoints ¶
func (*Character) DisableSpell ¶
func (*Character) EnableSpell ¶
func (*Character) FindInBackpack ¶
func (*Character) FindKeyInBackpack ¶
func (*Character) GetAdjectives ¶
func (*Character) GetAllBackpackItems ¶
func (*Character) GetAllCooldowns ¶
func (*Character) GetAllSkillRanks ¶
func (*Character) GetAllWornItems ¶
func (*Character) GetBaseCastSuccessChance ¶
All spells should have a 10% minimum chance of success.
func (*Character) GetCharmIds ¶
func (*Character) GetCharmedUserId ¶
func (*Character) GetCooldown ¶
func (*Character) GetDefaultDiceRoll ¶
func (*Character) GetDefense ¶
Returns an integer representing a % damage reduction
func (*Character) GetDescription ¶
returns description unless description is a hash which points to another description location.
func (*Character) GetGearValue ¶
func (*Character) GetHealthAppearance ¶
USERNAME appears to be <BLANK>
func (*Character) GetMapSprawlCapacity ¶
func (*Character) GetMaxCharmedCreatures ¶
func (*Character) GetMemoryCapacity ¶
func (*Character) GetMiscData ¶
func (*Character) GetMiscDataKeys ¶
func (*Character) GetMobName ¶
func (c *Character) GetMobName(viewingUserId int, renderFlags ...NameRenderFlag) FormattedName
func (*Character) GetPlayerName ¶
func (c *Character) GetPlayerName(viewingUserId int, renderFlags ...NameRenderFlag) FormattedName
func (*Character) GetQuestProgress ¶
func (*Character) GetSetting ¶
func (*Character) GetSkillLevel ¶
Gets the current value of the skillname provided
func (*Character) GetSkillLevelCost ¶
func (*Character) GiveQuestToken ¶
func (*Character) HasAdjective ¶
func (*Character) HasVisitedRoom ¶ added in v0.9.8
HasVisitedRoom reports whether this character has ever visited roomId in zone.
func (*Character) HealthPerRound ¶
func (*Character) IsDisabled ¶
func (*Character) IsFormChanged ¶ added in v0.9.8
func (*Character) IsQuestDone ¶
func (*Character) KnowsFirstAid ¶
func (*Character) LearnSpell ¶
func (*Character) ManaPerRound ¶
func (*Character) MarkVisitedRoom ¶ added in v0.9.8
MarkVisitedRoom permanently records that this character has visited roomId in the given zone. Safe to call every time a player enters a room. Returns true only if this specific call completed the zone (i.e. every room in validRoomIds is now visited). Returns false if the room was already visited, if validRoomIds is empty, or if the zone is still incomplete.
func (*Character) PruneCooldowns ¶
func (c *Character) PruneCooldowns()
func (*Character) RecalculateStats ¶
func (c *Character) RecalculateStats()
returns true if something has changed.
func (*Character) RememberRoom ¶
Remember visiting a room. This may cause to forget an older room if the memory is full.
func (*Character) RemoveBuff ¶
func (*Character) RemoveCharm ¶
Returns userId of whoever had charmed them
func (*Character) RevertFormChange ¶ added in v0.9.8
func (*Character) SetAdjective ¶
func (*Character) SetAggroRemote ¶
func (*Character) SetCast ¶
func (c *Character) SetCast(roundsWaitTime int, sInfo SpellAggroInfo)
func (*Character) SetMiscData ¶
func (*Character) SetPermaBuffs ¶
Used with SpawnInfo to gift spawning mobs with permabuffs
func (*Character) SetSetting ¶
func (*Character) SetUserId ¶
Sometimes it's useful for a character to know what user it belongs to.
func (*Character) TimerExists ¶
func (*Character) TimerExpired ¶
func (*Character) TrackBuffStarted ¶
func (*Character) TrackCharmed ¶
func (*Character) TrackPlayerDamage ¶
returns description unless description is a hash which points to another description location.
func (*Character) TrackSpellCast ¶
func (*Character) TrainSkill ¶
Increases the skill training counter and returns the new value
func (*Character) TryCooldown ¶
func (*Character) UnLearnSpell ¶ added in v0.9.8
func (*Character) UpdateAlignment ¶
func (*Character) UpdateItem ¶
Copies over an existing item with a new item Returns true if successfully replaces an item
func (*Character) XPTNLActual ¶
Returns the actual xp in regards to the current level/next level
func (*Character) ZoneVisitPercent ¶ added in v0.9.8
ZoneVisitPercent returns the percentage (0–100) of rooms in zone that the character has visited. Returns 0 when the zone has no rooms.
func (*Character) ZoneVisitProgress ¶ added in v0.9.8
func (c *Character) ZoneVisitProgress(zone string, validRoomIds map[int]struct{}) (visited int, total int)
ZoneVisitProgress returns how many rooms the character has visited in zone and the total number of rooms in that zone, allowing callers to compute a completion percentage. validRoomIds should come from ZoneConfig.RoomIds.
type CharmInfo ¶
type FormattedName ¶
type FormattedName struct {
Name string
Type string // mob/user
Suffix string // What ansi alias suffix to use (if any)
Title string // Optional title appended after name (e.g. "Mayor of Frostfang")
Adjectives []string
UseShortAdjectives bool // Whether to failover to short adjectives
QuestAlert bool // Whether this mob is relevant to a current quest
PetName string // Name of pet (if any)
}
func (FormattedName) String ¶
func (f FormattedName) String() string
type KDStats ¶
type KDStats struct {
TotalKills int `json:"totalkills,omitempty"` // Quick tally of kills
Kills map[int]int `json:"kills,omitempty"` // map of MobId to count
TotalDeaths int `json:"totaldeaths,omitempty"` // Quick tally of deaths
TotalPvpKills int `json:"totalpvpkills,omitempty"` // Quick tally of pvp kills
PlayerKills map[string]int `json:"playerkills,omitempty"` // map of userid:username to count
PlayerDeaths map[string]int `json:"playerdeaths,omitempty"` // map of userid:username to count
TotalPvpDeaths int `json:"totalpvpdeaths,omitempty"` // Quick tally of pvp deaths
EliteKills map[string]int `json:"elitekills,omitempty"` // map of mobId:mobName to count (not included in TotalKills)
EliteDeaths map[string]int `json:"elitedeaths,omitempty"` // map of mobId:mobName to count of times killed by an elite
}
func (*KDStats) AddEliteDeath ¶ added in v0.9.8
func (*KDStats) AddEliteKill ¶ added in v0.9.8
func (*KDStats) AddMobDeath ¶
func (kd *KDStats) AddMobDeath()
func (*KDStats) AddMobKill ¶
func (*KDStats) AddPlayerDeath ¶
func (*KDStats) AddPlayerKill ¶
func (*KDStats) AddPvpDeath ¶
func (kd *KDStats) AddPvpDeath()
func (*KDStats) GetEliteKills ¶ added in v0.9.8
func (*KDStats) GetMobDeaths ¶
func (*KDStats) GetMobKDRatio ¶
func (*KDStats) GetMobKills ¶
func (*KDStats) GetPvpDeaths ¶
func (*KDStats) GetPvpKDRatio ¶
type MobMasteries ¶
func (*MobMasteries) GetAllTame ¶
func (m *MobMasteries) GetAllTame() map[int]int
func (*MobMasteries) GetTame ¶
func (m *MobMasteries) GetTame(mobId int) int
func (*MobMasteries) SetTame ¶
func (m *MobMasteries) SetTame(mobId int, amt int)
type NameRenderFlag ¶
type NameRenderFlag uint8
const ( RenderHealth NameRenderFlag = iota RenderAggro RenderShortAdjectives )
type RoomBitset ¶ added in v0.9.8
RoomBitset is a memory-efficient set of visited room IDs using a chunked bitset. The map key is roomId/64 (the block index) and the value is a uint64 where bit (roomId%64) represents that room. Blocks are only allocated for room ID ranges that have been visited, so sparse zones cost nothing for unvisited regions.
YAML serialization uses hex strings ("0x...") so the data is human-readable in character save files.
func (RoomBitset) Count ¶ added in v0.9.8
func (rb RoomBitset) Count() int
Count returns the total number of visited rooms across all blocks.
func (RoomBitset) CountIn ¶ added in v0.9.8
func (rb RoomBitset) CountIn(roomIds map[int]struct{}) int
CountIn returns how many rooms from the provided set have been visited.
func (RoomBitset) Has ¶ added in v0.9.8
func (rb RoomBitset) Has(roomId int) bool
Has reports whether a room has been visited. Non-positive room IDs always return true because they are sentinel values that are considered visited by definition.
func (RoomBitset) IsComplete ¶ added in v0.9.8
func (rb RoomBitset) IsComplete(roomIds map[int]struct{}) bool
IsComplete reports whether every room in the provided set has been visited.
func (RoomBitset) MarshalYAML ¶ added in v0.9.8
func (rb RoomBitset) MarshalYAML() (interface{}, error)
MarshalYAML serialises the bitset as a map of block-index to hex string so that character save files remain human-readable.
Example output:
0: "0x0000000000000003" 9: "0xFFFFFFFFFFFFFFFF"
func (RoomBitset) Prune ¶ added in v0.9.8
func (rb RoomBitset) Prune(validRoomIds map[int]struct{})
Prune clears any bits that do not correspond to a live room in validRoomIds, then removes blocks that become empty. This handles the case where rooms are deleted from a zone after a player has already visited them.
func (RoomBitset) Set ¶ added in v0.9.8
func (rb RoomBitset) Set(roomId int)
Set marks a room as visited. Room IDs must be positive; non-positive IDs are silently ignored because they represent special sentinel values (e.g. -1 for the character-creation room, 0 for StartRoomIdAlias) that are always considered visited.
func (RoomBitset) ToSet ¶ added in v0.9.8
func (rb RoomBitset) ToSet() map[int]struct{}
ToSet expands the bitset into a map[int]struct{} of all visited room IDs.
func (*RoomBitset) UnmarshalYAML ¶ added in v0.9.8
func (rb *RoomBitset) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML deserialises the hex-string map produced by MarshalYAML.
type ShopItem ¶
type ShopItem struct {
MobId int `yaml:"mobid,omitempty"` // Is it a mercenary for sale?
ItemId int `yaml:"itemid,omitempty"` // Is it an item for sale?
BuffId int `yaml:"buffid,omitempty"` // Does this shop keeper apply a buff if purchased?
PetType string `yaml:"pettype,omitempty"` // Does this shop sell pets?
Quantity int `yaml:"quantity,omitempty"` // How many currently avilable
QuantityMax int `yaml:"quantitymax,omitempty"` // 0 for unlimited, or a maximum that can be stocked at one time
Price int `yaml:"price,omitempty"` // If a price is provided, use it
TradeItemId int `yaml:"tradeitemid,omitempty"` // ItemId required in trade
RestockRate string `yaml:"restockrate,omitempty"` // 1 day, 1 week, 1 real month, etc
// contains filtered or unexported fields
}
type SpellAggroInfo ¶
type Worn ¶
type Worn struct {
Weapon items.Item `yaml:"weapon,omitempty"`
Offhand items.Item `yaml:"offhand,omitempty"`
Head items.Item `yaml:"head,omitempty"`
Neck items.Item `yaml:"neck,omitempty"`
Body items.Item `yaml:"body,omitempty"`
Belt items.Item `yaml:"belt,omitempty"`
Gloves items.Item `yaml:"gloves,omitempty"`
Ring items.Item `yaml:"ring,omitempty"`
Legs items.Item `yaml:"legs,omitempty"`
Feet items.Item `yaml:"feet,omitempty"`
}
func (*Worn) Get ¶ added in v0.9.8
Get returns a pointer to the item in the given slot, or nil for an unrecognized slot type. This is the single place that maps an ItemType to a Worn struct field; add new slots here and nowhere else.