Documentation
¶
Index ¶
- Constants
- Variables
- func DeleteMobSpec(mobId MobId) error
- func DestroyInstance(instanceId int)
- func GetAllMobInstanceIds() []int
- func GetAllMobNames() []string
- func GetMemoryUsage() map[string]util.MemoryResult
- func GetMobScriptForTag(mobId MobId, tag string) (string, error)
- func IsHostile(groupName string, userId int) bool
- func LoadDataFiles()
- func MakeHostile(groupName string, userId int, rounds int)
- func MobInstanceExists(instanceId int) bool
- func RecentlyDied(instanceId int) bool
- func ReduceHostility()
- func SaveMobScript(mobId MobId, content string) error
- func SaveMobScriptForTag(mobId MobId, tag string, content string) error
- func SaveMobSpec(spec *Mob) error
- func StockMobShop(mobId MobId, entry characters.ShopItem) error
- func TrackRecentDeath(instanceId int)
- func ZoneNameSanitize(zone string) string
- type Mob
- func (m *Mob) AddBuff(buffId int, source string)
- func (m *Mob) Command(inputTxt string, waitSeconds ...float64)
- func (r *Mob) ConsidersAnAlly(m *Mob) bool
- func (m *Mob) Converse()
- func (m *Mob) Despawns() bool
- func (m *Mob) Filename() string
- func (m *Mob) Filepath() string
- func (m *Mob) GetAllScriptTags() []string
- func (m *Mob) GetAngryCommand() string
- func (m *Mob) GetIdleCommand() string
- func (m *Mob) GetScript() string
- func (m *Mob) GetScriptPath() string
- func (m *Mob) GetScriptPathForTag(tag string) string
- func (m *Mob) GetSellPrice(item items.Item) int
- func (m *Mob) GetTempData(key string) any
- func (m *Mob) HasAttackedPlayer(userId int) bool
- func (m *Mob) HasScript() bool
- func (m *Mob) HasShop() bool
- func (r *Mob) HatesAlignment(otherAlignment int8) bool
- func (r *Mob) HatesMob(m *Mob) bool
- func (r *Mob) HatesRace(raceName string) bool
- func (r *Mob) Id() int
- func (m *Mob) InConversation() bool
- func (m *Mob) IsTameable() bool
- func (m *Mob) PlayerAttacked(userId int)
- func (r *Mob) Save() error
- func (m *Mob) SetConversation(id int)
- func (m *Mob) SetTempData(key string, value any)
- func (m *Mob) ShorthandId() string
- func (m *Mob) Sleep(seconds int)
- func (r *Mob) Validate() error
- type MobForHire
- type MobId
- type PathQueue
- type PathRoom
Constants ¶
View Source
const (
ScriptTemplateQuest = `item-gold-quest.js`
)
Variables ¶
View Source
var (
SampleScripts = map[string]string{
`item and gold`: `item-gold-quest.js`,
}
)
Functions ¶
func DeleteMobSpec ¶ added in v0.9.8
func DestroyInstance ¶
func DestroyInstance(instanceId int)
func GetAllMobInstanceIds ¶
func GetAllMobInstanceIds() []int
func GetAllMobNames ¶
func GetAllMobNames() []string
func GetMemoryUsage ¶
func GetMemoryUsage() map[string]util.MemoryResult
func GetMobScriptForTag ¶ added in v0.9.8
func MakeHostile ¶
func MobInstanceExists ¶
func RecentlyDied ¶
func ReduceHostility ¶
func ReduceHostility()
func SaveMobScript ¶ added in v0.9.8
func SaveMobScriptForTag ¶ added in v0.9.8
func SaveMobSpec ¶ added in v0.9.8
func StockMobShop ¶ added in v0.9.8
func StockMobShop(mobId MobId, entry characters.ShopItem) error
func TrackRecentDeath ¶
func TrackRecentDeath(instanceId int)
func ZoneNameSanitize ¶
Types ¶
type Mob ¶
type Mob struct {
MobId MobId
Zone string `yaml:"zone,omitempty"`
ItemDropChance int `yaml:"itemdropchance,omitempty"` // chance in 100
ActivityLevel int `yaml:"activitylevel,omitempty"` // 1-100%
InstanceId int `yaml:"-"`
HomeRoomId int `yaml:"-"`
Hostile bool `yaml:"hostile,omitempty"` // whether they attack on sight
LastIdleCommand uint8 `yaml:"-"` // Track what hte last used idlecommand was
BoredomCounter uint8 `yaml:"-"` // how many rounds have passed since this mob has seen a player
Groups []string `yaml:"groups,omitempty"` // What group do they identify with? Helps with teamwork
Hates []string `yaml:"hates,omitempty"` // What NPC groups or races do they hate and probably fight if encountered?
IdleCommands []string `yaml:"idlecommands,omitempty"` // Commands they may do while idle (not in combat)
AngryCommands []string `yaml:"angrycommands,omitempty"` // randomly chosen to queue when they are angry/entering combat.
CombatCommands []string `yaml:"combatcommands,omitempty"` // Commands they may do while in combat
Character characters.Character
MaxWander int `yaml:"maxwander,omitempty"` // Max rooms to wander from home
WanderCount int `yaml:"-"` // How many times this mob has wandered
PreventIdle bool `yaml:"-"` // Whether they can't possibly be idle
ScriptTag string `yaml:"scripttag,omitempty"` // Script for this mob: mobs/frostfang/scripts/{mobId}-{mobname}-{ScriptTag}.js
QuestFlags []string `yaml:"questflags,omitempty,flow"` // What quest flags are set on this mob?
BuffIds []int `yaml:"buffids,omitempty"` // Buff Id's this mob always has upon spawn
EliteChance int `yaml:"elitechance,omitempty"` // Percent chance (0-100) this mob spawns as elite
IsElite bool `yaml:"-"` // Runtime flag: true if this instance is elite
Path PathQueue `yaml:"-"` // a pre-calculated path the mob is following.
// contains filtered or unexported fields
}
func GetAllMobInstances ¶ added in v0.9.8
func GetAllMobInstances() []*Mob
func GetAllMobSpecs ¶ added in v0.9.8
func GetAllMobSpecs() []Mob
func GetInstance ¶
func GetMobSpec ¶
func (*Mob) ConsidersAnAlly ¶
func (*Mob) GetAllScriptTags ¶ added in v0.9.8
GetAllScriptTags returns the tag (empty string for the base script) of every .js script file that exists for this mob. The base (untagged) script is always first when present; tagged scripts follow in sorted order.
func (*Mob) GetAngryCommand ¶
func (*Mob) GetIdleCommand ¶
func (*Mob) GetScriptPath ¶
func (*Mob) GetScriptPathForTag ¶ added in v0.9.8
func (*Mob) GetTempData ¶
func (*Mob) HasAttackedPlayer ¶
func (*Mob) HatesAlignment ¶
func (*Mob) InConversation ¶
func (*Mob) IsTameable ¶
func (*Mob) PlayerAttacked ¶
func (*Mob) SetConversation ¶
func (*Mob) SetTempData ¶
func (*Mob) ShorthandId ¶
type MobForHire ¶
type MobId ¶
type MobId int // Creating a custom type to help prevent confusion over MobId and MobInstanceId
func MobIdByName ¶
Click to show internal directories.
Click to hide internal directories.