Documentation
¶
Index ¶
- Constants
- Variables
- func AlignmentToString(alignment int8) string
- func AltsExists(userId int) bool
- func CompileAdjectiveSwaps()
- func GetAllSlotTypes() []string
- func GetFormattedAdjective(adjName string) string
- func GetFormattedAdjectives(excludeShort bool) []string
- func SaveAlts(userId int, alts []Character) bool
- type Aggro
- type AggroType
- type Character
- func (c *Character) AddBuff(buffId int, isPermanent bool) error
- func (c *Character) AlignmentName() string
- 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) CacheDescription()
- 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) 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) 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) 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) 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) MovementCost() int
- func (c *Character) PruneCooldowns()
- func (c *Character) Race() 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) 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) 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)
- type CharmInfo
- type Cooldowns
- type FormattedName
- type KDStats
- 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) 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 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 = 100 // 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 (
StartingRoomId = -1
)
Functions ¶
func AlignmentToString ¶
func AltsExists ¶
func CompileAdjectiveSwaps ¶
func CompileAdjectiveSwaps()
func GetAllSlotTypes ¶
func GetAllSlotTypes() []string
func GetFormattedAdjective ¶
func GetFormattedAdjectives ¶
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 // The room id the character is in.
Zone string // The zone the character is in. The folder the room can be located in too.
RaceId int // Character race
Stats stats.Statistics // Character stats
Level int // The level of the character
Experience int // The experience of the character
TrainingPoints int // The number of training points the character has
StatPoints int // The number of skill points the character has
Health int // The health of the character
Mana int // The mana of the character
ActionPoints int // The resevoir of action points the character has to spend on movement etc.
Alignment int8 // The alignment of the character
Gold int // The gold the character is holding
Bank int // 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
PlayerDamage map[int]int `yaml:"-"` // key = who, value = how much
LastPlayerDamage uint64 `yaml:"-"` // last round a player damaged this character
// contains filtered or unexported fields
}
func (*Character) AlignmentName ¶
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) CacheDescription ¶
func (c *Character) CacheDescription()
This should only be used for mobs. Not players
func (*Character) CanDualWield ¶
func (*Character) CancelBuffsWithFlag ¶
func (*Character) CarryCapacity ¶
func (*Character) ClearQuestToken ¶
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) HealthPerRound ¶
func (*Character) IsDisabled ¶
func (*Character) IsQuestDone ¶
func (*Character) KnowsFirstAid ¶
func (*Character) LearnSpell ¶
func (*Character) ManaPerRound ¶
func (*Character) PruneCooldowns ¶
func (c *Character) PruneCooldowns()
func (*Character) RecalculateStats ¶
func (c *Character) RecalculateStats()
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) 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) 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
type CharmInfo ¶
type FormattedName ¶
type FormattedName struct {
Name string
Type string // mob/user
Suffix string // What ansi alias suffix to use (if any)
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
}
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) 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 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"`
}