Documentation
¶
Index ¶
- Constants
- Variables
- func DestroyInstance(instanceId int)
- func GetAllMobInstanceIds() []int
- func GetAllMobNames() []string
- func GetMemoryUsage() map[string]util.MemoryResult
- 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 TrackRecentDeath(instanceId int)
- func ZoneNameSanitize(zone string) string
- type ItemTrade
- 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) GetAngryCommand() string
- func (m *Mob) GetIdleCommand() string
- func (m *Mob) GetScript() string
- func (m *Mob) GetScriptPath() 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 DestroyInstance ¶
func DestroyInstance(instanceId int)
func GetAllMobInstanceIds ¶
func GetAllMobInstanceIds() []int
func GetAllMobNames ¶
func GetAllMobNames() []string
func GetMemoryUsage ¶
func GetMemoryUsage() map[string]util.MemoryResult
func MakeHostile ¶
func MobInstanceExists ¶
func RecentlyDied ¶
func ReduceHostility ¶
func ReduceHostility()
func TrackRecentDeath ¶
func TrackRecentDeath(instanceId int)
func ZoneNameSanitize ¶
Types ¶
type ItemTrade ¶
type ItemTrade struct {
AcceptedItemIds []int `yaml:"accepteditemids,omitempty,flow"` // Must provide every item id in this list.
AcceptedGold int `yaml:"acceptedgold,omitempty,flow"` // Must provide at least this much gold.
PrizeItemIds []int `yaml:"prizeitemids,omitempty,flow"` // Will give these items in exchange.
PrizeBuffIds []int `yaml:"prizebuffids,omitempty,flow"` // Will give these buffs in exchange.
PrizeRoomId int `yaml:"prizeroomid,omitempty,flow"` // Will move player to this room in exchange.
PrizeQuestIds []string `yaml:"prizequestids,omitempty,flow"` // What quest id's will be awarded?
PrizeGold int `yaml:"prizegold,omitempty,flow"` // How much gold are they given?
PrizeCommands []string `yaml:"prizecommands,omitempty,flow"` // What commands will be executed?
GivenItems map[int][]int `yaml:"-"` // key = userId, value = Items given. Should only contain items from AcceptedItemIds
GivenGold map[int]int `yaml:"-"` // key = userId, value = how much gold is given
}
type Mob ¶
type Mob struct {
MobId MobId
Zone string `yaml:"zone,omitempty"`
ItemDropChance int // chance in 100
ActivityLevel int `yaml:"activitylevel,omitempty"` // 1-100%
InstanceId int `yaml:"-"`
HomeRoomId int `yaml:"-"`
Hostile bool // 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 // 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 // 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"` // 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
Path PathQueue `yaml:"-"` // a pre-calculated path the mob is following.
// contains filtered or unexported fields
}
func GetInstance ¶
func GetMobSpec ¶
func (*Mob) ConsidersAnAlly ¶
func (*Mob) GetAngryCommand ¶
func (*Mob) GetIdleCommand ¶
func (*Mob) GetScriptPath ¶
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.