game

package
v0.0.0-...-b0deb01 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxStabledPets int = 10 // Maximum number of pets to hold in the stables
)

Variables

This section is empty.

Functions

func CancelTimer

func CancelTimer(s uo.Serial)

CancelTimer cancels the timer identified by serial if it exists.

func DynamicDispatch

func DynamicDispatch(which string, receiver, source Object, v any) bool

DynamicDispatch attempts to execute the named dynamic dispatch function on the given object with the receiver. The receiver may not be nil, but the source can.

func ExecuteEventHandler

func ExecuteEventHandler(which string, receiver, source Object, v any) bool

ExecuteEventHandler executes the named event handler with the given receiver and source. Both the receiver and source can be nil.

func Find

func Find[I Object](s uo.Serial) I

Find returns the given object cast to the given interface, or the zero value if any of this fails.

func HashPassword

func HashPassword(password string) string

Hashes a password suitable for the accounts database.

func MarshalTimers

func MarshalTimers(s *marshal.TagFileSegment)

MarshalTimers writes all timers to the segment.

func NewTimer

func NewTimer(delay uo.Time, event string, receiver, source Object, noRent bool, parameter any) uo.Serial

NewTimer creates a new timer with the given options, then adds the timer to the update pool most suitable for it. A serial number uniquely identifying the timer is returned. See CancelTimer().

func ObjectType

func ObjectType(o Object) marshal.ObjectType

ObjectType returns the marshal type code of the object

func RegisterWorld

func RegisterWorld(w World)

RegisterWorld registers the world object to the game library.

func Remove

func Remove(o Object)

Remove completely removes the object and all of its children from the game. It additionally removes the objects from the world data store. It is safe to pass nil to Remove().

func SetAIGetter

func SetAIGetter(fn func(string) AIModel)

SetAIGetter sets the function used to get the Thinker by name.

func SetEventHandlerGetter

func SetEventHandlerGetter(fn func(string) *EventHandler)

SetEventHandlerGetter sets the function used to get event handler functions by name.

func SetEventIndexGetter

func SetEventIndexGetter(fn func(string) uint16)

SetEventIndexGetter sets the function used to get event handler index numbers by name.

func UnmarshalTimers

func UnmarshalTimers(s *marshal.TagFileSegment)

UnmarshalTimers reads all timers from the segment.

func UpdateTimers

func UpdateTimers(now uo.Time)

UpdateTimers updates every timer within the update pools suitable for time.

Types

type AIModel

type AIModel interface {
	Act(Mobile, uo.Time)
	Target(Mobile, uo.Time)
}

AIModel is the interface all AI models implement

type Account

type Account struct {
	// contains filtered or unexported fields
}

Account holds all of the account information for one user

func NewAccount

func NewAccount(username, passwordHash string, roles Role) *Account

NewAccount creates a new account object

func (*Account) ComparePasswordHash

func (a *Account) ComparePasswordHash(hash string) bool

ComparePasswordHash returns true if the hash given matches this account's

func (*Account) Deserialize

func (a *Account) Deserialize(t *template.Template, create bool)

Deserialize does nothing

func (*Account) EmailAddress

func (a *Account) EmailAddress() string

EmailAddress returns the email address for the account

func (*Account) HasRole

func (a *Account) HasRole(r Role) bool

HasRole returns true if the account has the given role

func (*Account) IncrementFailedLoginCount

func (a *Account) IncrementFailedLoginCount() int

IncrementFailedLoginCount increments the failed login count and returns it.

func (*Account) Lock

func (a *Account) Lock()

Lock locks the account.

func (*Account) Locked

func (a *Account) Locked() bool

Locked returns true if the account is locked.

func (*Account) Marshal

func (a *Account) Marshal(s *marshal.TagFileSegment)

Marshal writes the account data to a segment

func (*Account) Player

func (a *Account) Player() uo.Serial

Player returns the player mobile serial, or uo.SerialMobileNil if none

func (*Account) SetEmailAddress

func (a *Account) SetEmailAddress(e string)

SetEmailAddress sets the email address for the account

func (*Account) SetPlayer

func (a *Account) SetPlayer(s uo.Serial)

SetPlayer sets the player mobile serial, or uo.SerialMobileNil if none

func (*Account) SetTemplateName

func (a *Account) SetTemplateName(name string)

SetTemplateName does nothing for accounts

func (*Account) Suspend

func (a *Account) Suspend(d time.Duration)

Suspend suspends the account for the given amount of time.

func (*Account) SuspendedUntil

func (a *Account) SuspendedUntil() time.Time

SuspendedUntil returns the time the latest suspension ends.

func (*Account) TemplateName

func (a *Account) TemplateName() string

TemplateName returns the template name for accounts

func (*Account) ToggleRole

func (a *Account) ToggleRole(r Role)

ToggleRole toggles the given role.

func (*Account) Unlock

func (a *Account) Unlock()

Unlock unlocks the account.

func (*Account) Unmarshal

func (a *Account) Unmarshal(s *marshal.TagFileSegment)

Unmarshal reads the account data from a segment

func (*Account) UpdatePasswordByHash

func (a *Account) UpdatePasswordByHash(hash string)

UpdatePasswordByHash updates the account's password by hash value.

func (*Account) Username

func (a *Account) Username() string

Username returns the username of the account

type BaseContainer

type BaseContainer struct {
	BaseItem
	// contains filtered or unexported fields
}

BaseContainer implements the base implementation of the Container interface.

func (*BaseContainer) AddObject

func (c *BaseContainer) AddObject(o Object) bool

AddObject implements the Object interface.

func (*BaseContainer) AdjustWeightAndCount

func (c *BaseContainer) AdjustWeightAndCount(w float32, n int)

AdjustWeightAndCount implements the Container interface.

func (*BaseContainer) AppendContextMenuEntries

func (c *BaseContainer) AppendContextMenuEntries(m *ContextMenu, src Mobile)

AppendContextMenuEntries implements the Object interface.

func (*BaseContainer) AppendOPLEntires

func (c *BaseContainer) AppendOPLEntires(r Object, p *serverpacket.OPLPacket)

AppendOPLEntries implements the Object interface.

func (*BaseContainer) ConsumeGold

func (c *BaseContainer) ConsumeGold(amount int) bool

ConsumeGold implements the Container interface.

func (*BaseContainer) Contains

func (c *BaseContainer) Contains(o Object) bool

Contains implements the Container interface.

func (*BaseContainer) ContentWeight

func (c *BaseContainer) ContentWeight() float32

ContentWeight implements the Container interface.

func (*BaseContainer) Contents

func (c *BaseContainer) Contents() []Item

Contents implements the Container interface.

func (*BaseContainer) CountGold

func (c *BaseContainer) CountGold() int

CountGold implements the Container interface.

func (*BaseContainer) Deserialize

func (c *BaseContainer) Deserialize(t *template.Template, create bool)

Deserialize implements the util.Serializeable interface.

func (*BaseContainer) DropInto

func (c *BaseContainer) DropInto(i Item) bool

DropInto implements the Container interface.

func (*BaseContainer) DropSound

func (c *BaseContainer) DropSound() uo.Sound

DropSound implements the Container interface.

func (*BaseContainer) ForceAddObject

func (c *BaseContainer) ForceAddObject(o Object)

ForceAddObject implements the Container interface.

func (*BaseContainer) ForceRemoveObject

func (c *BaseContainer) ForceRemoveObject(o Object)

ForceRemoveObject implements the Object interface.

func (*BaseContainer) GumpGraphic

func (c *BaseContainer) GumpGraphic() uo.GUMP

GumpGraphic implements the Container interface.

func (*BaseContainer) InsertObject

func (c *BaseContainer) InsertObject(obj any)

InsertObject implements the Object interface.

func (*BaseContainer) ItemCount

func (c *BaseContainer) ItemCount() int

ItemCount implements the Container interface.

func (*BaseContainer) Marshal

func (i *BaseContainer) Marshal(s *marshal.TagFileSegment)

Marshal implements the marshal.Marshaler interface.

func (*BaseContainer) ObjectType

func (i *BaseContainer) ObjectType() marshal.ObjectType

ObjectType implements the Object interface.

func (*BaseContainer) Open

func (c *BaseContainer) Open(m Mobile)

Open implements the object interface.

func (*BaseContainer) RecalculateStats

func (c *BaseContainer) RecalculateStats()

RecalculateStats implements the Object interface

func (*BaseContainer) RemoveChildren

func (i *BaseContainer) RemoveChildren()

RemoveChildren implements the Object interface.

func (*BaseContainer) RemoveObject

func (c *BaseContainer) RemoveObject(o Object) bool

RemoveObject implements the Object interface.

func (*BaseContainer) RemoveObserver

func (c *BaseContainer) RemoveObserver(o ContainerObserver)

RemoveObserver implements the Container interface.

func (*BaseContainer) SingleClick

func (c *BaseContainer) SingleClick(from Mobile)

SingleClick implements the Object interface

func (*BaseContainer) StopAllObservers

func (c *BaseContainer) StopAllObservers()

StopAllObservers forces all observers of this container to stop observing it.

func (*BaseContainer) Unmarshal

func (i *BaseContainer) Unmarshal(s *marshal.TagFileSegment)

Unmarshal implements the marshal.Unmarshaler interface.

func (*BaseContainer) UpdateItem

func (c *BaseContainer) UpdateItem(i Item)

UpdateItem implements the Container interface.

func (*BaseContainer) UpdateItemOPL

func (c *BaseContainer) UpdateItemOPL(i Item)

UpdateItemOPL implements the Container interface.

func (*BaseContainer) Weight

func (c *BaseContainer) Weight() float32

Weight implements the Object interface.

type BaseItem

type BaseItem struct {
	BaseObject
	// contains filtered or unexported fields
}

BaseItem provides the basic implementation of Item.

func (*BaseItem) AlphaBlend

func (i *BaseItem) AlphaBlend() bool

func (*BaseItem) Amount

func (i *BaseItem) Amount() int

Amount implements the Item interface.

func (*BaseItem) Animation

func (i *BaseItem) Animation() bool

func (*BaseItem) AppendOPLEntires

func (i *BaseItem) AppendOPLEntires(r Object, p *serverpacket.OPLPacket)

AppendOPLEntries implements the Object interface.

func (*BaseItem) Armor

func (i *BaseItem) Armor() bool

func (*BaseItem) ArtUsed

func (i *BaseItem) ArtUsed() bool

func (*BaseItem) ArticleA

func (i *BaseItem) ArticleA() bool

func (*BaseItem) ArticleAn

func (i *BaseItem) ArticleAn() bool

func (*BaseItem) Background

func (i *BaseItem) Background() bool

Flag accessors

func (*BaseItem) BaseGraphic

func (i *BaseItem) BaseGraphic() uo.Graphic

BaseGraphic implements the Item interface.

func (*BaseItem) Bridge

func (i *BaseItem) Bridge() bool

func (*BaseItem) CanCombineWith

func (i *BaseItem) CanCombineWith(item Item) bool

CanCombineWith implements the Item interface.

func (*BaseItem) Combine

func (i *BaseItem) Combine(other Item) bool

Combine implements the Item interface.

func (*BaseItem) Consume

func (i *BaseItem) Consume(n int) bool

Consume implements the Item interface.

func (*BaseItem) ConsumeUse

func (i *BaseItem) ConsumeUse() bool

ConsumeUse implements the Item interface.

func (*BaseItem) Container

func (i *BaseItem) Container() bool

func (*BaseItem) Damaging

func (i *BaseItem) Damaging() bool

func (*BaseItem) Deserialize

func (i *BaseItem) Deserialize(t *template.Template, create bool)

Deserialize implements the util.Serializeable interface.

func (*BaseItem) DisplayName

func (i *BaseItem) DisplayName() string

DisplayName implements the Object interface.

func (*BaseItem) Door

func (i *BaseItem) Door() bool

func (*BaseItem) DropLocation

func (i *BaseItem) DropLocation() uo.Location

DropLocation implements the Item interface

func (*BaseItem) DropSoundOverride

func (i *BaseItem) DropSoundOverride(s uo.Sound) uo.Sound

DropSoundOverride implements the Item interface.

func (*BaseItem) Dyable

func (i *BaseItem) Dyable() bool

Dyable implements the Item interface.

func (*BaseItem) Flip

func (i *BaseItem) Flip()

Flip implements the Item interface.

func (*BaseItem) Flippable

func (i *BaseItem) Flippable() bool

Flippable implements the Item interface.

func (*BaseItem) Flipped

func (i *BaseItem) Flipped() bool

Flipped implements the Item interface.

func (*BaseItem) FlippedGraphic

func (i *BaseItem) FlippedGraphic() uo.Graphic

FlippedGraphic implements the Item interface.

func (*BaseItem) Foliage

func (i *BaseItem) Foliage() bool

func (*BaseItem) Generic

func (i *BaseItem) Generic() bool

func (*BaseItem) Graphic

func (i *BaseItem) Graphic() uo.Graphic

Graphic implements the Item interface.

func (*BaseItem) GraphicOffset

func (i *BaseItem) GraphicOffset() int

GraphicOffset implements the Item interface.

func (*BaseItem) Height

func (i *BaseItem) Height() int8

Height implements the Item interface.

func (*BaseItem) Highest

func (i *BaseItem) Highest() int8

Highest returns the highest elevation of the object

func (*BaseItem) Impassable

func (i *BaseItem) Impassable() bool

func (*BaseItem) Internal

func (i *BaseItem) Internal() bool

func (*BaseItem) LiftSound

func (i *BaseItem) LiftSound() uo.Sound

LiftSound implements the Item interface.

func (*BaseItem) LightSource

func (i *BaseItem) LightSource() bool

func (*BaseItem) Map

func (i *BaseItem) Map() bool

func (*BaseItem) Marshal

func (i *BaseItem) Marshal(s *marshal.TagFileSegment)

Marshal implements the marshal.Marshaler interface.

func (*BaseItem) Movable

func (i *BaseItem) Movable() bool

Movable implements the Item interface

func (*BaseItem) MultiMovable

func (i *BaseItem) MultiMovable() bool

func (*BaseItem) NoDiagonal

func (i *BaseItem) NoDiagonal() bool

func (*BaseItem) NoHouse

func (i *BaseItem) NoHouse() bool

func (*BaseItem) NoRent

func (i *BaseItem) NoRent() bool

NoRent implements the Object interface.

func (*BaseItem) NoShadow

func (i *BaseItem) NoShadow() bool

func (*BaseItem) NoShoot

func (i *BaseItem) NoShoot() bool

func (*BaseItem) ObjectType

func (i *BaseItem) ObjectType() marshal.ObjectType

ObjectType implements the Object interface.

func (*BaseItem) PartialHue

func (i *BaseItem) PartialHue() bool

func (*BaseItem) PixelBleed

func (i *BaseItem) PixelBleed() bool

func (*BaseItem) PlayAnimOnce

func (i *BaseItem) PlayAnimOnce() bool

func (*BaseItem) RefreshDecayDeadline

func (i *BaseItem) RefreshDecayDeadline()

RefreshDecayDeadline implements the Item interface

func (*BaseItem) Roof

func (i *BaseItem) Roof() bool

func (*BaseItem) SetAmount

func (i *BaseItem) SetAmount(n int)

SetAmount implements the Item interface.

func (*BaseItem) SetBaseGraphic

func (i *BaseItem) SetBaseGraphic(g uo.Graphic)

SetBaseGraphic implements the Item interface.

func (*BaseItem) SetDefForGraphic

func (i *BaseItem) SetDefForGraphic(g uo.Graphic)

SetDefForGraphic implements the Item interface.

func (*BaseItem) SetDropLocation

func (i *BaseItem) SetDropLocation(l uo.Location)

SetDropLocation implements the Item interface

func (*BaseItem) SetFlippedGraphic

func (i *BaseItem) SetFlippedGraphic(g uo.Graphic)

SetFlippedGraphic implements the Item interface.

func (*BaseItem) SingleClick

func (o *BaseItem) SingleClick(from Mobile)

SingleClick implements the Object interface

func (*BaseItem) Split

func (i *BaseItem) Split(n int) Item

Split implements the Item interface.

func (*BaseItem) Stackable

func (i *BaseItem) Stackable() bool

Stackable implements the Item interface.

func (*BaseItem) StairBack

func (i *BaseItem) StairBack() bool

func (*BaseItem) StairRight

func (i *BaseItem) StairRight() bool

func (*BaseItem) StandingHeight

func (i *BaseItem) StandingHeight() int8

StandingHeight returns the standing height based on the object's flags.

func (*BaseItem) Surface

func (i *BaseItem) Surface() bool

func (*BaseItem) Translucent

func (i *BaseItem) Translucent() bool

func (*BaseItem) Transparent

func (i *BaseItem) Transparent() bool

func (*BaseItem) Unmarshal

func (i *BaseItem) Unmarshal(s *marshal.TagFileSegment)

Unmarshal implements the marshal.Unmarshaler interface.

func (*BaseItem) Update

func (i *BaseItem) Update(t uo.Time)

Update implements the Object interface.

func (*BaseItem) UseNewArt

func (i *BaseItem) UseNewArt() bool

func (*BaseItem) Uses

func (i *BaseItem) Uses() int

Uses implements the Item interface.

func (*BaseItem) Value

func (i *BaseItem) Value() int

Value implements the Item interface.

func (*BaseItem) Wall

func (i *BaseItem) Wall() bool

func (*BaseItem) Weapon

func (i *BaseItem) Weapon() bool

func (*BaseItem) Wearable

func (i *BaseItem) Wearable() bool

func (*BaseItem) Weight

func (i *BaseItem) Weight() float32

Weight implements the Object interface

func (*BaseItem) Wet

func (i *BaseItem) Wet() bool

func (*BaseItem) Window

func (i *BaseItem) Window() bool

func (*BaseItem) Z

func (i *BaseItem) Z() int8

Z returns the permanent Z location of the tile

type BaseMobile

type BaseMobile struct {
	BaseObject
	// contains filtered or unexported fields
}

BaseMobile provides the base implementation for Mobile

func (*BaseMobile) AIGoal

func (m *BaseMobile) AIGoal() Object

AIGoal implements the Mobile interface.

func (*BaseMobile) AddObject

func (m *BaseMobile) AddObject(o Object) bool

AddObject adds the object to the mobile. It returns true if successful.

func (*BaseMobile) AdjustBankGold

func (m *BaseMobile) AdjustBankGold(n int)

AdjustBankGold implements the Object interface.

func (*BaseMobile) AdjustGold

func (m *BaseMobile) AdjustGold(n int)

AdjustGold implements the Mobile interface.

func (*BaseMobile) AdjustWeight

func (m *BaseMobile) AdjustWeight(n float32)

AdjustWeight implements the Object interface

func (*BaseMobile) AfterMove

func (m *BaseMobile) AfterMove()

AfterMove implements the Mobile interface.

func (*BaseMobile) AfterUnmarshalOntoMap

func (m *BaseMobile) AfterUnmarshalOntoMap()

AfterUnmarshalOntoMap implements the Object interface.

func (*BaseMobile) AppendContextMenuEntries

func (m *BaseMobile) AppendContextMenuEntries(c *ContextMenu, src Mobile)

AppendContextMenuEntries implements the Object interface.

func (*BaseMobile) AppendOPLEntires

func (m *BaseMobile) AppendOPLEntires(r Object, p *serverpacket.OPLPacket)

AppendOPLEntries implements the Object interface.

func (*BaseMobile) BankBoxOpen

func (m *BaseMobile) BankBoxOpen() bool

BankBoxOpen implements the Mobile interface.

func (*BaseMobile) BankGold

func (m *BaseMobile) BankGold() int

BankGold implements the Object interface.

func (*BaseMobile) Body

func (m *BaseMobile) Body() uo.Body

Body implements the Mobile interface.

func (*BaseMobile) CanAccess

func (m *BaseMobile) CanAccess(o Object) bool

CanAccess implements the Mobile interface.

func (*BaseMobile) CanBeCommandedBy

func (m *BaseMobile) CanBeCommandedBy(om Mobile) bool

CanBeCommandedBy implements the Mobile interface.

func (*BaseMobile) CanSee

func (m *BaseMobile) CanSee(o Object) bool

CanSee implements the Mobile interface.

func (*BaseMobile) CanTakeStep

func (m *BaseMobile) CanTakeStep() bool

CanTakeStep implements the Mobile interface.

func (*BaseMobile) ChargeGold

func (m *BaseMobile) ChargeGold(n int) bool

ChargeGold implements the Mobile interface.

func (*BaseMobile) Claim

func (m *BaseMobile) Claim(p Mobile) *Error

Claim implements the Mobile interface.

func (*BaseMobile) ControlMaster

func (m *BaseMobile) ControlMaster() Mobile

ControlMaster implements the Mobile interface.

func (*BaseMobile) Deserialize

func (m *BaseMobile) Deserialize(t *template.Template, create bool)

Deserialize implements the util.Serializeable interface.

func (*BaseMobile) Dexterity

func (m *BaseMobile) Dexterity() int

Dexterity implements the Mobile interface.

func (*BaseMobile) Dismount

func (m *BaseMobile) Dismount()

Dismount implements the Mobile interface.

func (*BaseMobile) DropItemInCursor

func (m *BaseMobile) DropItemInCursor()

DropItemInCursor drops the item in the player's cursor to their feet.

func (*BaseMobile) DropToBackpack

func (m *BaseMobile) DropToBackpack(o Object, force bool) bool

DropToBackpack implements the Mobile interface.

func (*BaseMobile) DropToBankBox

func (m *BaseMobile) DropToBankBox(o Object, force bool) bool

DropToBankBox implements the Mobile interface.

func (*BaseMobile) DropToFeet

func (m *BaseMobile) DropToFeet(o Object)

DropToFeet implements the Mobile interface.

func (*BaseMobile) Equip

func (m *BaseMobile) Equip(w Wearable) bool

Equip implements the Mobile interface.

func (*BaseMobile) EquipmentInSlot

func (m *BaseMobile) EquipmentInSlot(l uo.Layer) Wearable

EquipmentInSlot implements the Mobile interface.

func (*BaseMobile) Facing

func (m *BaseMobile) Facing() uo.Direction

Facing implements the Mobile interface.

func (*BaseMobile) ForceAddObject

func (m *BaseMobile) ForceAddObject(obj Object)

ForceAddObject implements the Object interface.

func (*BaseMobile) ForceEquip

func (m *BaseMobile) ForceEquip(w Wearable)

ForceEquip implements the Mobile interface.

func (*BaseMobile) ForceRemoveObject

func (m *BaseMobile) ForceRemoveObject(o Object)

ForceRemoveObject removes the object from the mobile forcefully.

func (*BaseMobile) ForceUnequip

func (m *BaseMobile) ForceUnequip(w Wearable)

ForceUnequip implements the Mobile interface.

func (*BaseMobile) GetNotorietyFor

func (m *BaseMobile) GetNotorietyFor(other Mobile) uo.Notoriety

GetNotorietyFor implements the Mobile interface.

func (*BaseMobile) Gold

func (m *BaseMobile) Gold() int

Gold implements the Mobile interface.

func (*BaseMobile) HasLineOfSight

func (m *BaseMobile) HasLineOfSight(o Object) bool

HasLineOfSight implements the Mobile interface.

func (*BaseMobile) HitPoints

func (m *BaseMobile) HitPoints() int

HitPoints implements the Mobile interface.

func (*BaseMobile) InBackpack

func (m *BaseMobile) InBackpack(o Object) bool

InBackpack implements the Mobile interface.

func (*BaseMobile) InBank

func (m *BaseMobile) InBank(o Object) bool

InBank implements the Mobile interface.

func (*BaseMobile) Intelligence

func (m *BaseMobile) Intelligence() int

Intelligence implements the Mobile interface.

func (*BaseMobile) IsEquipped

func (m *BaseMobile) IsEquipped(o Object) bool

IsEquipped implements the Mobile interface.

func (*BaseMobile) IsFemale

func (m *BaseMobile) IsFemale() bool

IsFemale implements the Mobile interface.

func (*BaseMobile) IsHumanBody

func (m *BaseMobile) IsHumanBody() bool

IsHumanBody implements the Mobile interface.

func (*BaseMobile) IsItemOnCursor

func (m *BaseMobile) IsItemOnCursor() bool

IsItemInCursor implements the Mobile interface.

func (*BaseMobile) IsMounted

func (m *BaseMobile) IsMounted() bool

IsMounted implements the Mobile interface.

func (*BaseMobile) IsPlayerCharacter

func (m *BaseMobile) IsPlayerCharacter() bool

IsPlayerCharacter implements the Mobile interface.

func (*BaseMobile) IsRunning

func (m *BaseMobile) IsRunning() bool

IsRunning implements the Mobile interface.

func (*BaseMobile) ItemInCursor

func (m *BaseMobile) ItemInCursor() Item

ItemInCursor implements the Mobile interface.

func (*BaseMobile) Mana

func (m *BaseMobile) Mana() int

Mana implements the Mobile interface.

func (*BaseMobile) MapEquipment

func (m *BaseMobile) MapEquipment(fn func(Wearable) error) []error

MapEquipment implements the Mobile interface.

func (*BaseMobile) Marshal

func (m *BaseMobile) Marshal(s *marshal.TagFileSegment)

Marshal implements the marshal.Marshaler interface.

func (*BaseMobile) MaxHitPoints

func (m *BaseMobile) MaxHitPoints() int

MaxHitPoints implements the Mobile interface.

func (*BaseMobile) MaxMana

func (m *BaseMobile) MaxMana() int

MaxMana implements the Mobile interface.

func (*BaseMobile) MaxStamina

func (m *BaseMobile) MaxStamina() int

MaxStamina implements the Mobile interface.

func (*BaseMobile) MaxWeight

func (m *BaseMobile) MaxWeight() int

MaxWeight implements the Mobile interface.

func (*BaseMobile) MobileFlags

func (m *BaseMobile) MobileFlags() uo.MobileFlags

MobileFlags implements the Mobile interface.

func (*BaseMobile) Mount

func (m *BaseMobile) Mount(mount Mobile)

Mount implements the Mobile interface.

func (*BaseMobile) NetState

func (m *BaseMobile) NetState() NetState

NetState implements the Mobile interface.

func (*BaseMobile) NoRent

func (m *BaseMobile) NoRent() bool

NoRent implements the Object interface.

func (*BaseMobile) ObjectType

func (m *BaseMobile) ObjectType() marshal.ObjectType

ObjectType implements the Object interface.

func (*BaseMobile) PickUp

func (m *BaseMobile) PickUp(o Object) bool

PickUp attempts to pick up the object. Returns true if successful.

func (*BaseMobile) RecalculateStats

func (m *BaseMobile) RecalculateStats()

RecalculateStats implements the Object interface.

func (*BaseMobile) RemoveChildren

func (m *BaseMobile) RemoveChildren()

RemoveChildren implements the Object interface.

func (*BaseMobile) RemoveObject

func (m *BaseMobile) RemoveObject(o Object) bool

RemoveObject removes the object from the mobile. It returns true if successful.

func (*BaseMobile) RequestCursorState

func (m *BaseMobile) RequestCursorState(s CursorState)

RequestCursorState implements the Mobile interface.

func (*BaseMobile) RestoreControlMaster

func (m *BaseMobile) RestoreControlMaster()

RestoreControlMaster attempts to restore the control master pointer from the serial recorded from the save file.

func (*BaseMobile) SerialType

func (o *BaseMobile) SerialType() uo.SerialType

SerialType implements the util.Serializeable interface.

func (*BaseMobile) SetAI

func (m *BaseMobile) SetAI(which string)

SetAI implements the Mobile interface.

func (*BaseMobile) SetAIGoal

func (m *BaseMobile) SetAIGoal(o Object)

SetAIGoal implements the Mobile interface.

func (*BaseMobile) SetAmount

func (m *BaseMobile) SetAmount(n int)

SetAmount implements the Object interface.

func (*BaseMobile) SetBody

func (m *BaseMobile) SetBody(b uo.Body)

SetBody implements the Mobile interface.

func (*BaseMobile) SetControlMaster

func (m *BaseMobile) SetControlMaster(cm Mobile)

SetControlMaster implements the Mobile interface.

func (*BaseMobile) SetFacing

func (m *BaseMobile) SetFacing(f uo.Direction)

SetFacing implements the Mobile interface.

func (*BaseMobile) SetNetState

func (m *BaseMobile) SetNetState(n NetState)

SetNetState implements the Mobile interface.

func (*BaseMobile) SetRunning

func (m *BaseMobile) SetRunning(v bool)

SetRunning implements the Mobile interface.

func (*BaseMobile) SetViewRange

func (m *BaseMobile) SetViewRange(r int16)

SetViewRange implements the Mobile interface.

func (*BaseMobile) Skill

func (m *BaseMobile) Skill(which uo.Skill) int16

Skill implements the Mobile interface.

func (*BaseMobile) SkillCheck

func (m *BaseMobile) SkillCheck(which uo.Skill, min, max int) bool

SkillCheck implements the Mobile interface.

func (*BaseMobile) Skills

func (m *BaseMobile) Skills() []int16

Skills implements the Mobile interface.

func (*BaseMobile) Stable

func (m *BaseMobile) Stable(p Mobile) *Error

Stable implements the Mobile interface.

func (*BaseMobile) StabledPets

func (m *BaseMobile) StabledPets() []Mobile

StabledPets implements the Mobile interface.

func (*BaseMobile) Stamina

func (m *BaseMobile) Stamina() int

Stamina implements the Mobile interface.

func (*BaseMobile) StandOn

func (m *BaseMobile) StandOn(s uo.CommonObject)

StandOn implements the Mobile interface.

func (*BaseMobile) StandingOn

func (m *BaseMobile) StandingOn() uo.CommonObject

StandingOn implements the Mobile interface.

func (*BaseMobile) Step

func (m *BaseMobile) Step(d uo.Direction) bool

Step implements the Mobile interface.

func (*BaseMobile) Strength

func (m *BaseMobile) Strength() int

Strength implements the Mobile interface.

func (*BaseMobile) Unequip

func (m *BaseMobile) Unequip(w Wearable) bool

Unequip implements the Mobile interface.

func (*BaseMobile) Unmarshal

func (m *BaseMobile) Unmarshal(s *marshal.TagFileSegment)

Unmarshal implements the marshal.Unmarshaler interface.

func (*BaseMobile) Update

func (m *BaseMobile) Update(t uo.Time)

Update implements the Mobile interface.

func (*BaseMobile) ViewRange

func (m *BaseMobile) ViewRange() int16

ViewRange implements the Mobile interface.

func (*BaseMobile) Weight

func (m *BaseMobile) Weight() float32

Weight implements the Object interface

type BaseObject

type BaseObject struct {
	// contains filtered or unexported fields
}

BaseObject is the base of all game objects and implements the Object interface

func (*BaseObject) AddObject

func (o *BaseObject) AddObject(c Object) bool

AddObject implements the Object interface

func (*BaseObject) AfterUnmarshalOntoMap

func (o *BaseObject) AfterUnmarshalOntoMap()

AfterUnmarshalOntoMap implements the Object interface.

func (*BaseObject) AppendContextMenuEntries

func (o *BaseObject) AppendContextMenuEntries(m *ContextMenu, src Mobile)

AppendContextMenuEntries implements the Object interface

func (*BaseObject) AppendOPLEntires

func (o *BaseObject) AppendOPLEntires(r Object, p *serverpacket.OPLPacket)

AppendOPLEntries implements the Object interface.

func (*BaseObject) AppendTemplateContextMenuEntry

func (o *BaseObject) AppendTemplateContextMenuEntry(event string, cl uo.Cliloc)

AppendTemplateContextMenuEntry implements the Object interface

func (*BaseObject) BaseTemplate

func (o *BaseObject) BaseTemplate() string

BaseTemplate implements the Object interface.

func (*BaseObject) Deserialize

func (o *BaseObject) Deserialize(t *template.Template, create bool)

Deserialize implements the util.Serializeable interface.

func (*BaseObject) DisplayName

func (o *BaseObject) DisplayName() string

DisplayName implements the Object interface

func (*BaseObject) Facing

func (o *BaseObject) Facing() uo.Direction

Facing implements the Object interface

func (*BaseObject) ForceAddObject

func (o *BaseObject) ForceAddObject(obj Object)

ForceAddObject implements the Object interface. PLEASE NOTE that a call to BaseObject.ForceAddObject() will leak the object!

func (*BaseObject) ForceRemoveObject

func (o *BaseObject) ForceRemoveObject(obj Object)

ForceRemoveObject implements the Object interface. PLEASE NOTE that a call to BaseObject.ForceRemoveObject() will leak the object!

func (*BaseObject) GetEventHandler

func (o *BaseObject) GetEventHandler(which string) *EventHandler

GetEventHandler implements the Object interface

func (*BaseObject) HasParent

func (o *BaseObject) HasParent(t Object) bool

HasParent implements the Object interface

func (*BaseObject) Hue

func (o *BaseObject) Hue() uo.Hue

Hue implements the Object interface

func (*BaseObject) InsertObject

func (o *BaseObject) InsertObject(obj any)

InsertObject implements the Object interface. PLEASE NOTE that a call to BaseObject.InsertObject() will leak the object!

func (*BaseObject) InvalidateOPL

func (o *BaseObject) InvalidateOPL()

InvalidateOPL implements the Object interface.

func (*BaseObject) LinkEvent

func (o *BaseObject) LinkEvent(event, handler string)

LinkEvent implements the Object interface

func (*BaseObject) Location

func (o *BaseObject) Location() uo.Location

Location implements the Object interface

func (*BaseObject) Marshal

func (o *BaseObject) Marshal(s *marshal.TagFileSegment)

Marshal implements the marshal.Marshaler interface.

func (*BaseObject) Name

func (o *BaseObject) Name() string

Name implements the Object interface.

func (*BaseObject) NoRent

func (o *BaseObject) NoRent() bool

NoRent implements the Object interface.

func (*BaseObject) OPLPackets

func (o *BaseObject) OPLPackets(self Object) (*serverpacket.OPLPacket, *serverpacket.OPLInfo)

OPLPackets implements the Object interface.

func (*BaseObject) ObjectType

func (o *BaseObject) ObjectType() marshal.ObjectType

ObjectType implements the Object interface.

func (*BaseObject) Owner

func (o *BaseObject) Owner() Object

Owner implements the Object interface.

func (*BaseObject) Parent

func (o *BaseObject) Parent() Object

Parent implements the Object interface

func (*BaseObject) RecalculateStats

func (o *BaseObject) RecalculateStats()

RecalculateStats implements the Object interface

func (*BaseObject) Remove

func (o *BaseObject) Remove()

Remove implements the Object interface.

func (*BaseObject) RemoveChildren

func (o *BaseObject) RemoveChildren()

RemoveChildren implements the Object interface

func (*BaseObject) RemoveObject

func (o *BaseObject) RemoveObject(c Object) bool

RemoveObject implements the Object interface

func (*BaseObject) Removed

func (o *BaseObject) Removed() bool

Removed implements the Object interface.

func (*BaseObject) Serial

func (o *BaseObject) Serial() uo.Serial

Serial implements the Object interface.

func (*BaseObject) SerialType

func (o *BaseObject) SerialType() uo.SerialType

SerialType implements the util.Serializeable interface.

func (*BaseObject) SetAmount

func (o *BaseObject) SetAmount(n int)

SetAmount implements the Object interface.

func (*BaseObject) SetFacing

func (o *BaseObject) SetFacing(f uo.Direction)

SetFacing implements the Object interface

func (*BaseObject) SetHue

func (o *BaseObject) SetHue(hue uo.Hue)

SetHue implements the Object interface

func (*BaseObject) SetLocation

func (o *BaseObject) SetLocation(l uo.Location)

SetLocation implements the Object interface

func (*BaseObject) SetName

func (o *BaseObject) SetName(name string)

SetName implements the Object interface.

func (*BaseObject) SetOwner

func (o *BaseObject) SetOwner(owner Object)

SetOwner implements the Object interface.

func (*BaseObject) SetParent

func (o *BaseObject) SetParent(p Object)

SetParent implements the Object interface

func (*BaseObject) SetSerial

func (o *BaseObject) SetSerial(s uo.Serial)

SetSerial implements the Object interface.

func (*BaseObject) SetSpawnerRegion

func (o *BaseObject) SetSpawnerRegion(r *Region)

SetSpawnerRegion implements the Object interface.

func (*BaseObject) SetTemplateName

func (o *BaseObject) SetTemplateName(name string)

SetTemplateName implements the Object interface

func (*BaseObject) SpawnerRegion

func (o *BaseObject) SpawnerRegion() *Region

SpawnerRegion implements the Object interface.

func (*BaseObject) TemplateName

func (o *BaseObject) TemplateName() string

TemplateName implements the Object interface

func (*BaseObject) Unmarshal

func (o *BaseObject) Unmarshal(s *marshal.TagFileSegment)

Unmarshal implements the marshal.Unmarshaler interface.

func (*BaseObject) Update

func (o *BaseObject) Update(t uo.Time)

Update implements the Object interface.

func (*BaseObject) Visibility

func (o *BaseObject) Visibility() uo.Visibility

Visibility implements the Object interface.

func (*BaseObject) Weight

func (o *BaseObject) Weight() float32

Weight implements the Object interface

type BaseWeapon

type BaseWeapon struct {
	BaseWearable
	// contains filtered or unexported fields
}

BaseWeapon is the base implementatino of Weapon

func (*BaseWeapon) AnimationAction

func (w *BaseWeapon) AnimationAction() uo.AnimationAction

AnimationAction implements the Weapon interface.

func (*BaseWeapon) Deserialize

func (w *BaseWeapon) Deserialize(t *template.Template, create bool)

Deserialize implements the util.Serializeable interface.

func (*BaseWeapon) ObjectType

func (w *BaseWeapon) ObjectType() marshal.ObjectType

ObjectType implements the Object interface.

func (*BaseWeapon) Skill

func (w *BaseWeapon) Skill() uo.Skill

Skill implements the Weapon interface.

type BaseWearable

type BaseWearable struct {
	BaseItem
	BaseWearableImplementation
}

BaseWearable provides the most common implementation of Wearable

func (*BaseWearable) AppendOPLEntires

func (i *BaseWearable) AppendOPLEntires(r Object, p *serverpacket.OPLPacket)

AppendOPLEntries implements the Object interface.

func (*BaseWearable) Deserialize

func (i *BaseWearable) Deserialize(t *template.Template, create bool)

Deserialize implements the util.Serializeable interface.

func (*BaseWearable) Marshal

func (i *BaseWearable) Marshal(s *marshal.TagFileSegment)

Marshal implements the marshal.Marshaler interface.

func (*BaseWearable) ObjectType

func (i *BaseWearable) ObjectType() marshal.ObjectType

ObjectType implements the Object interface.

func (*BaseWearable) Unmarshal

func (i *BaseWearable) Unmarshal(s *marshal.TagFileSegment)

Unmarshal implements the marshal.Unmarshaler interface.

type BaseWearableImplementation

type BaseWearableImplementation struct {
	// contains filtered or unexported fields
}

BaseWearableImplementation provides the most common implementation of the Wearable interface and associated functionality to be mixed into other structs.

func (*BaseWearableImplementation) DamageDurability

func (i *BaseWearableImplementation) DamageDurability(r Object, v float64)

DamageDurability implements the Wearable interface.

func (*BaseWearableImplementation) Deserialize

func (i *BaseWearableImplementation) Deserialize(t *template.Template, create bool)

Deserialize implements the util.Serializeable interface.

func (*BaseWearableImplementation) Layer

func (i *BaseWearableImplementation) Layer() uo.Layer

Layer implements the Wearable interface.

func (*BaseWearableImplementation) Marshal

Marshal implements the marshal.Marshaler interface.

func (*BaseWearableImplementation) Unmarshal

Unmarshal implements the marshal.Unmarshaler interface.

type Check

type Check struct {
	BaseItem
	// contains filtered or unexported fields
}

Check implements a bank check

func (*Check) CheckAmount

func (i *Check) CheckAmount() int

CheckAmount returns the amount of gold left on the check.

func (*Check) ConsumeGold

func (i *Check) ConsumeGold(v int) bool

ConsumeGold removes the given amount of gold from the check if possible and returns true if completed successfully.

func (*Check) Deserialize

func (i *Check) Deserialize(t *template.Template, create bool)

Deserialize implements the util.Serializeable interface.

func (*Check) DisplayName

func (i *Check) DisplayName() string

DisplayName implements the Object interface

func (*Check) Marshal

func (i *Check) Marshal(s *marshal.TagFileSegment)

Marshal implements the marshal.Marshaler interface.

func (*Check) ObjectType

func (i *Check) ObjectType() marshal.ObjectType

ObjectType implements marshal.Marshaler.

func (*Check) SetCheckAmount

func (i *Check) SetCheckAmount(v int)

SetCheckAmount sets the amount on the check.

func (*Check) Unmarshal

func (i *Check) Unmarshal(s *marshal.TagFileSegment)

Unmarshal implements the marshal.Unmarshaler interface.

type Chunk

type Chunk struct {
	// contains filtered or unexported fields
}

Chunk contains the tile matrix, static and dynamic objects in one 8x8 Chunk

func (*Chunk) Add

func (c *Chunk) Add(o Object) bool

Add adds the object to the chunk and returns true if it is located in this chunk.

func (*Chunk) AddRegion

func (c *Chunk) AddRegion(r *Region) bool

AddRegion adds the region to this chunk if it overlaps.

func (*Chunk) GetTile

func (c *Chunk) GetTile(x, y int16) uo.Tile

GetTile returns the Tile value for the given chunk-relative location. x and y must be between 0 and 7 inclusive.

func (*Chunk) Remove

func (c *Chunk) Remove(o Object)

Remove removes the object from the chunk.

func (*Chunk) RemoveRegion

func (c *Chunk) RemoveRegion(r *Region)

RemoveRegion removes the region pointed to.

func (*Chunk) Update

func (c *Chunk) Update(t uo.Time)

Update handles the 1-minute periodic update for this chunk.

type Container

type Container interface {
	Item
	// GumpGraphic returns the gump graphic of the item
	GumpGraphic() uo.GUMP
	// Contains returns true if the object is a direct child of this container,
	// or any child containers.
	Contains(Object) bool
	// ContentWeight returns the total weight of all contained items excluding
	// the weight of the container itself. Use game.Item.Weight to get the
	// weight of the container without the contents.
	ContentWeight() float32
	// ItemCount returns the total number of items within the container.
	ItemCount() int
	// Contents returns the contents of the container.
	Contents() []Item
	// Open is called by mobiles to open the container.
	Open(Mobile)
	// RemoveObserver removes an observer from this container's list of
	// containers.
	RemoveObserver(o ContainerObserver)
	// StopAllObservers forces all observers of this container to stop observing
	// it.
	StopAllObservers()
	// AdjustWeightAndCount adds to the cached total weight and item count of
	// the container.
	AdjustWeightAndCount(float32, int)
	// DropInto attempts to drop the item into this container, merging it with
	// any currently existing stacks. Returns true on success.
	DropInto(Item) bool
	// UpdateItem must be called when an item contained in this container
	// changes.
	UpdateItem(Item)
	// UpdateItemOPL must be called when an item contained in this container
	// has an OPL change.
	UpdateItemOPL(Item)
	// DropSound returns the default drop sound for the container.
	DropSound() uo.Sound
	// CountGold returns the amount of gold contained within this container and
	// all sub-containers.
	CountGold() int
	// ConsumeGold attempts to consume the given amount of gold from the
	// container and all sub-containers and will consume gold coins before
	// checks. It returns true if this was successful. ConsumeGold only modifies
	// items if it returns true.
	ConsumeGold(int) bool
}

Container is the interface all objects implement that can contain other other objects within an inventory.

type ContainerObserver

type ContainerObserver interface {
	// ContainerOpen sends the open container gump packet and all of the
	// contents of the container to the observer. The observer should keep track
	// of all open containers so they can close then when needed.
	ContainerOpen(Container)
	// ContainerClose closes the container on the client side as well as all
	// child containers this observer may be observing.
	ContainerClose(Container)
	// ContainerItemAdded notifies the observer of a new item in the container.
	ContainerItemAdded(Container, Item)
	// ContainerItemRemoved notifies the observer of a item being removed from
	// the container.
	ContainerItemRemoved(Container, Item)
	// ContainerItemOPLChanged notifies the observer of an item's OPL changing.
	ContainerItemOPLChanged(Container, Item)
	// ContainerRangeCheck asks the observer to close all out-of-range
	// containers.
	ContainerRangeCheck()
	// ContainerIsObserving returns true if the given container is being
	// observed by the observer.
	ContainerIsObserving(Object) bool
}

ContainerObserver is implemented by anything that can be notified of changes to the contents of a container.

type ContextMenu

type ContextMenu serverpacket.ContextMenu

func BuildContextMenu

func BuildContextMenu(o Object, m Mobile) *ContextMenu

BuildContextMenu builds the context menu for the given object.

func (*ContextMenu) Append

func (m *ContextMenu) Append(handler string, cl uo.Cliloc)

Append appends an entry to the context menu and returns the new context menu.

func (*ContextMenu) IsEmpty

func (m *ContextMenu) IsEmpty() bool

IsEmpty returns true if the context menu has no entries.

type ContextMenuEntry

type ContextMenuEntry struct {
	// Event name to execute
	Event string
	// Cliloc of the label, must be in the range 3_000_000 - 3_060_000 inclusive
	Cliloc uo.Cliloc
}

ContextMenuEntry abstracts an entry for a ContextMenu.

type Cursor

type Cursor struct {
	State CursorState // The current state of the cursor
	// contains filtered or unexported fields
}

Cursor represents a mobile's cursor

func (*Cursor) Drop

func (c *Cursor) Drop(target Object) bool

Drop attempts to drop the item on the cursor onto the target and returns true if successful.

func (*Cursor) Item

func (c *Cursor) Item() Item

Item returns the item currently in the cursor, or nil if none

func (*Cursor) Occupied

func (c *Cursor) Occupied() bool

Occupied returns true if there is already an item on the cursor

func (*Cursor) PickUp

func (c *Cursor) PickUp(o Object) bool

PickUp attempts to pick up the object. Returns true if successful.

func (*Cursor) Return

func (c *Cursor) Return()

Return send the item on the cursor back to it's previous parent.

func (*Cursor) Wear

func (c *Cursor) Wear(target Object) bool

Wear attempts to wear the item on the cursor onto the target and returns true if successful.

type CursorState

type CursorState int

CursorState represents the current state of the client's cursor from the player's point of view. Not that this does not account for targeting cursors.

const (
	CursorStateNormal CursorState = 0
	CursorStatePickUp CursorState = 1
	CursorStateDrop   CursorState = 2
	CursorStateEquip  CursorState = 3
	CursorStateReturn CursorState = 4
)

CursorState constants

type EquipmentCollection

type EquipmentCollection struct {
	// contains filtered or unexported fields
}

EquipmentCollection is a collection of Items associated to equipment layers. The zero value of EquipmentCollection is valid for all operations. This has special handling for player backpacks and bank boxes.

func NewEquipmentCollection

func NewEquipmentCollection() *EquipmentCollection

NewEquipmentCollection creates a new, empty EquipmentCollection and returns it.

func NewEquipmentCollectionWith

func NewEquipmentCollectionWith(ids []uo.Serial, parent Object) *EquipmentCollection

NewEquipmentCollectionWith reads the collection of references from the given slice of object IDs and rebuilds the pointers.

func (*EquipmentCollection) Contains

func (c *EquipmentCollection) Contains(o Wearable) bool

Contains returns true if the equipment collection contains the item

func (*EquipmentCollection) Equip

func (c *EquipmentCollection) Equip(o Wearable) bool

Equip adds an item to the collection as long as the layer is not already taken.

func (*EquipmentCollection) GetItemInLayer

func (c *EquipmentCollection) GetItemInLayer(l uo.Layer) Wearable

GetItemInLayer returns a pointer to the item in the named layer or nil if the layer is unoccupied

func (*EquipmentCollection) IsLayerOccupied

func (c *EquipmentCollection) IsLayerOccupied(l uo.Layer) bool

IsLayerOccupied returns true if the named layer is already occupied

func (*EquipmentCollection) Map

func (c *EquipmentCollection) Map(fn func(Wearable) error) []error

Map executes a function for every item in the collection.

func (*EquipmentCollection) Unequip

func (c *EquipmentCollection) Unequip(o Wearable) bool

Unequip removes an item from the collection. Returns true if successful.

func (*EquipmentCollection) Weight

func (c *EquipmentCollection) Weight() float32

Weight returns the total weight of all equipped items excluding the bank box and the contents of containers.

type Error

type Error struct {
	Cliloc        uo.Cliloc // Cliloc number of the error message, if any
	ClilocStrings []string  // Strings to inject into the cliloc message
	String        string    // Error string
}

Error represents an error with UO communications details

func (*Error) SendTo

func (e *Error) SendTo(n NetState, from Object)

SendTo sends the error message to the given net state

type EventHandler

type EventHandler func(Object, Object, any) bool

EventHandler is the function signature of event handlers

type Item

type Item interface {
	Object
	// BaseGraphic returns the base graphic of the item
	BaseGraphic() uo.Graphic
	// SetBaseGraphic sets the base graphic of the item
	SetBaseGraphic(uo.Graphic)
	// Graphic returns the current effective graphic of the item without the
	// graphic offset
	Graphic() uo.Graphic
	// GraphicOffset returns the current graphic offset of the item, this will
	// range 0-255 inclusive.
	GraphicOffset() int
	// Dyable returns true if the item's hue can be changed by the player
	Dyable() bool
	// Flippable returns true if the item can be flipped / turned
	Flippable() bool
	// Flipped returns true if the item is currently flipped / turned
	Flipped() bool
	// Flip toggles the flipped / turned state
	Flip()
	// FlippedGraphic returns the flipped graphic for this item if any.
	FlippedGraphic() uo.Graphic
	// SetFlippedGraphic sets the flipped graphic for this item.
	SetFlippedGraphic(uo.Graphic)
	// Stackable returns true if the item can be stacked
	Stackable() bool
	// Movable returns true if the item can be moved
	Movable() bool
	// Amount of the stack
	Amount() int
	// Value returns the base sale price of the item at a vendor
	Value() int
	// Consume attempts to remove n from the number of items in this stack and
	// returns true if successful. This function takes care of removing the
	// object if amount reaches zero and updating the object otherwise.
	Consume(int) bool
	// Split splits off a number of items from a stack. nil is returned if
	// n < 1 || n >= item.Amount(). nil is also returned for all non-stackable
	// items. In the event of an error during duplication the error will be
	// logged and nil will be returned. Otherwise a new duplicate item is
	// created with the remaining amount. This item is removed from its parent.
	// If this remove operation fails this function returns nil. The new
	// object is then force-added to the old parent in the same location.
	// The parent of this item is then set to the new item. If nil is returned
	// this item's amount and parent has not changed.
	Split(int) Item
	// Combine adds the amount of this item to the amount of the other item,
	// then replaces itself with that other item. Returns false on failure.
	// Failure can happen if this item does not support stacking, the items are
	// not from the same template object, or the combined amounts would be
	// greater than uo.MaxStackAmount. If this function returns true this item
	// has been totally removed from the world and data stores.
	Combine(Item) bool
	// CanCombineWith returns true if the given item can be combined with this
	// one. This function does not consider max stack count.
	CanCombineWith(Item) bool
	// Height returns the height of the item
	Height() int8
	// Highest returns the highest elevation of the object.
	Highest() int8
	// StandingHeight returns the standing height offset of the item, usually 0
	StandingHeight() int8
	// Z returns the permanent Z location of the object
	Z() int8
	// DropLocation returns the requested drop location of an item
	DropLocation() uo.Location
	// SetDropLocation sets the requested drop location of an item
	SetDropLocation(uo.Location)
	// RefreshDecayDeadline updates the decay deadline for this item based on
	// the item's internal state.
	RefreshDecayDeadline()
	// LiftSound returns the sound to play when this item is lifted.
	LiftSound() uo.Sound
	// DropSoundOverride returns the sound to play considering the item's
	// override and the given sound.
	DropSoundOverride(uo.Sound) uo.Sound
	// Uses returns the number of generic uses / charges left on an item.
	Uses() int
	// ConsumeUse returns true if a generic use / charge was able to be consumed
	// from the item.
	ConsumeUse() bool
	// SetDefForGraphic forces a different static definition to be used for this
	// item instead of the one associated with the base graphic. This is really
	// hacky and was put in for southward counter-clockwise-opening doors.
	SetDefForGraphic(uo.Graphic)

	Background() bool
	Weapon() bool
	Transparent() bool
	Translucent() bool
	Wall() bool
	Damaging() bool
	Impassable() bool
	Wet() bool
	Surface() bool
	Bridge() bool
	Generic() bool
	Window() bool
	NoShoot() bool
	ArticleA() bool
	ArticleAn() bool
	Internal() bool
	Foliage() bool
	PartialHue() bool
	NoHouse() bool
	Map() bool
	Container() bool
	Wearable() bool
	LightSource() bool
	Animation() bool
	NoDiagonal() bool
	Armor() bool
	Roof() bool
	Door() bool
	StairBack() bool
	StairRight() bool
	AlphaBlend() bool
	UseNewArt() bool
	ArtUsed() bool
	NoShadow() bool
	PixelBleed() bool
	PlayAnimOnce() bool
	MultiMovable() bool
}

Item is the interface that all non-static items implement.

type Layerer

type Layerer interface {
	// Layer returns the layer of the object
	Layer() uo.Layer
}

Layerer represents an item that can be layered onto an equippable mobile.

type Map

type Map struct {
	// contains filtered or unexported fields
}

Map contains the tile matrix, static items, and all dynamic objects of a map.

func NewMap

func NewMap() *Map

NewMap creates and returns a new Map

func (*Map) AddObject

func (m *Map) AddObject(o Object) bool

AddObject adds an object to the map sending all proper updates. If the object is an item it will be stacked on top of any other items at the location. It returns false only if the object is an item and could not fit on the map.

func (*Map) AddRegion

func (m *Map) AddRegion(r *Region)

AddRegion adds the given region to the map.

func (*Map) AfterUnmarshal

func (m *Map) AfterUnmarshal()

AfterUnmarshal calls AfterUnmarshalOntoMap calls for all map objects. We do this with a pre-compiled list of objects so that calls to AfterUnmarshalOntoMap can call world.Remove() if needed.

func (*Map) CanFit

func (m *Map) CanFit(o Object, l uo.Location) bool

CanFit returns true if the object can fit between the statics and items in the given new location.

func (*Map) ConsumeOre

func (m *Map) ConsumeOre(l uo.Location, n int) int

ConsumeOre attempts to consume the specified amount of ore from the chunk at the specified location and returns the number of ore piles consumed.

func (*Map) ForceAddObject

func (m *Map) ForceAddObject(o Object)

ForceAddObject places the object on the map without regard to any blockers.

func (*Map) ForceRemoveObject

func (m *Map) ForceRemoveObject(o Object)

ForceRemoveObject removes the object from the map and always succeeds.

func (*Map) GetChunk

func (m *Map) GetChunk(l uo.Location) *Chunk

GetChunk returns a pointer to the chunk for the given location.

func (*Map) GetFloorAndCeiling

func (m *Map) GetFloorAndCeiling(l uo.Location, ignoreDynamicItems, considerStepHeight bool) (uo.CommonObject, uo.CommonObject)

GetFloorAndCeiling returns the objects that make up the floor below and the ceiling above the given reference location. These objects may be any of the objects contained within the map such as Tiles, Items, Statics, and Multis. A nil return value means that there is no floor below the position, or that there is no ceiling above the position. Normally at least one of the return values will be non-nil referencing at least the tile matrix. However there are certain places on the map - such as cave entrances - where the tile matrix is ignored. In these cases both return values may be nil if there are no items or statics to create a surface. If the ignoreDynamicItems argument is true then only Items of concrete type *StaticItem are considered. If the considerStepHeight parameter is true then gaps less than or equal to uo.StepHeight will be ignored.

NOTE: This function requires that all statics and items are z-sorted bottom to top.

func (*Map) GetItemsInRange

func (m *Map) GetItemsInRange(l uo.Location, r int16) []Item

GetItemsInRange returns a slice of all items within the given range of the given location.

func (*Map) GetMobilesInRange

func (m *Map) GetMobilesInRange(l uo.Location, r int16) []Mobile

GetMobilesInRange returns a slice of all items within the given range of the given location.

func (*Map) GetNetStatesInRange

func (m *Map) GetNetStatesInRange(l uo.Location, r int16) []Mobile

GetNetStatesInRange returns a slice of all mobiles in range of the given location with attached net states. Mobile.n / Mobile.NetState() will always be non-null.

func (*Map) GetObjectsInRange

func (m *Map) GetObjectsInRange(l uo.Location, r int16) []Object

GetObjectsInRange returns a slice of all objects within the given range of the given location.

func (*Map) GetSpawnableSurface

func (m *Map) GetSpawnableSurface(l uo.Location, maxZ int8, o Object) uo.CommonObject

GetSpawnableSurface returns the surface on which something should be spawned in the given location, or nil if no suitable surface for the object was found. If the parameter object is nil, the height of the object is assumed to be 0.

func (*Map) GetTile

func (m *Map) GetTile(x, y int16) uo.Tile

GetTile returns the Tile value for the location

func (*Map) HasOre

func (m *Map) HasOre(l uo.Location) bool

HasOre returns true if the chunk at the given location has any ore.

func (*Map) ItemBaseQuery

func (m *Map) ItemBaseQuery(tn string, bounds uo.Bounds) []Item

ItemBaseQuery returns a slice of all of the items who's direct BaseTemplate property matches the given template name. The second parameter may be the zero value, in which case the entire map is searched. WARNING: This can be expensive and will hang the server.

func (*Map) ItemQuery

func (m *Map) ItemQuery(tn string, bounds uo.Bounds) []Item

ItemQuery returns a slice of all of the items matching the given template name. The second parameter may be the zero value, in which case the entire map is searched. WARNING: This can be expensive and will hang the server.

func (*Map) LineOfSight

func (m *Map) LineOfSight(a, b uo.Location) bool

LineOfSight returns true if there is line of site between the two locations. The reference used for the Bresenham Line Algorithm was https://www.baeldung.com/cs/bresenhams-line-algorithm#:~:text=3.-,Description,words%2C%20only%20very%20cheap%20operations.

func (*Map) LoadFromMuls

func (m *Map) LoadFromMuls(mapmul *file.MapMul, staticsmul *file.StaticsMul)

LoadFromMul reads in all of the segments of the given MapMul object and updates the map

func (*Map) Marshal

func (m *Map) Marshal(wg *sync.WaitGroup, s *marshal.TagFileSegment)

Marshal writes out top-level map information

func (*Map) MarshalDeepStorage

func (m *Map) MarshalDeepStorage(wg *sync.WaitGroup, s *marshal.TagFileSegment)

MarshalDeepStorage writes out the off-map objects

func (*Map) MarshalObjects

func (m *Map) MarshalObjects(wg *sync.WaitGroup, s *marshal.TagFileSegment, pool, pools int)

MarshalObjects writes out all objects that are directly on the map split into pools to facilitate multi-goroutine saving.

func (*Map) MoveMobile

func (m *Map) MoveMobile(mob Mobile, dir uo.Direction) bool

MoveMobile moves a mobile in the given direction. Returns true if the movement was successful.

func (*Map) PlayAnimation

func (m *Map) PlayAnimation(who Mobile, at uo.AnimationType, aa uo.AnimationAction)

PlayAnimation plays an animation for a mobile.

func (*Map) PlayEffect

func (m *Map) PlayEffect(t uo.GFXType, src, trg Object, gfx uo.Graphic, speed, duration uint8, fixed, explodes bool, hue uo.Hue, bm uo.GFXBlendMode)

PlayEffect plays a graphic effect with the given parameters for all clients in range.

func (*Map) PlaySound

func (m *Map) PlaySound(which uo.Sound, from uo.Location)

PlaySound plays a sound at the given location for all clients in range.

func (*Map) Query

func (m *Map) Query(center uo.Location, queryRange int16, set map[uo.Graphic]struct{}) bool

Query returns true if there is a static or dynamic item within range of the given location who's BaseGraphic property is contained within the given set.

func (*Map) RegionFeaturesAt

func (m *Map) RegionFeaturesAt(l uo.Location) RegionFeature

RegionFeaturesAt returns the accumulated region features from all regions at the given location.

func (*Map) RegionsAt

func (m *Map) RegionsAt(l uo.Location) []*Region

RegionsAt returns a slice of all of the regions that overlap the given location.

func (*Map) RegionsWithin

func (m *Map) RegionsWithin(b uo.Bounds) []*Region

RegionsWithin returns a slice of all of the regions that overlap the given bounds.

func (*Map) RemoveEverything

func (m *Map) RemoveEverything(mob Mobile)

RemoveEverything removes everything in range of the mobile

func (*Map) RemoveObject

func (m *Map) RemoveObject(o Object) bool

RemoveObject removes the object from the map. It always returns true, even if the object was not on the map to begin with. If the object removed was an item any other items that were resting on this one will be plopped downward.

func (*Map) RemoveRegion

func (m *Map) RemoveRegion(r *Region)

RemoveRegion removes the given region from the map.

func (*Map) RetrieveObject

func (m *Map) RetrieveObject(s uo.Serial) Object

RetrieveObject retrieves and object from deep storage.

func (*Map) SendCliloc

func (m *Map) SendCliloc(from Object, r int16, c uo.Cliloc, args ...string)

SendCliloc sends cliloc speech to all mobiles in range.

func (*Map) SendEverything

func (m *Map) SendEverything(mob Mobile)

SendEverything sends everything in range to the mobile

func (*Map) SendSpeech

func (m *Map) SendSpeech(from Object, r int16, format string, args ...any)

SendSpeech sends speech to all mobiles in range.

func (*Map) SetNewParent

func (m *Map) SetNewParent(o, p Object) bool

SetNewParent sets the parent object of this object. It properly removes the object from the old parent and adds the object to the new parent. Use nil to represent the world. This function returns false if the operation failed for any reason.

func (*Map) StaticsAt

func (m *Map) StaticsAt(l uo.Location) []uo.CommonObject

StaticsAt returns a slice of the statics and static items at the given location.

func (*Map) StoreObject

func (m *Map) StoreObject(o Object)

StoreObject places an object into deep storage.

func (*Map) TeleportMobile

func (m *Map) TeleportMobile(mob Mobile, l uo.Location) bool

TeleportMobile moves a mobile from where it is now to the new location. This returns false if there is not enough room at that location for the mobile. This will also trigger all events as if the mobile left the tile normally, and arrived at the new tile normally.

func (*Map) Unmarshal

func (m *Map) Unmarshal(s *marshal.TagFileSegment)

Unmarshal reads in top-level map information

func (*Map) UnmarshalDeepStorage

func (m *Map) UnmarshalDeepStorage(s *marshal.TagFileSegment)

UnmarshalDeepStorage unmarshals all of the objects in map deep storage.

func (*Map) UnmarshalObjects

func (m *Map) UnmarshalObjects(s *marshal.TagFileSegment)

UnmarshalObjects unmarshals all of the objects directly parented to the map.

func (*Map) Update

func (m *Map) Update(t uo.Time)

Update calls Update on a few chunks every tick such that every chunk gets an Update call once every real-world minute or twelve in-game minutes. It also calls Update on a few regions every tick such that every region is updated over fifteen real-world seconds or three in-game minutes. Finally Update calls Update for every mobile on the map.

func (*Map) UpdateViewRangeForMobile

func (m *Map) UpdateViewRangeForMobile(mob Mobile, r int16)

UpdateViewRangeForMobile handles an update of the mobiles ViewRange value in a way that sends the correct packets to the attached NetState, if any.

type Mobile

type Mobile interface {
	Object

	// NetState returns the NetState implementation currently bound to this
	// mobile, or nil if there is none.
	NetState() NetState
	// SetNetState sets the currently bound NetState. Use SetNetState(nil) to
	// disconnect the mobile.
	SetNetState(NetState)

	// MobileFlags returns the MobileFlags value for this mobile
	MobileFlags() uo.MobileFlags
	// Strength returns the current effective strength
	Strength() int
	// Dexterity returns the current effective dexterity
	Dexterity() int
	// Intelligence returns the current effective intelligence
	Intelligence() int
	// HitPoints returns the current hit points
	HitPoints() int
	// MaxHitPoints returns the current effective max hit points
	MaxHitPoints() int
	// Mana returns the current mana
	Mana() int
	// MaxMana returns the current effective max mana
	MaxMana() int
	// Stamina returns the current stamina
	Stamina() int
	// MaxStamina returns the current effective max stamina
	MaxStamina() int
	// MaxWeight returns the maximum total weight of the mobile
	MaxWeight() int
	// Gold returns the amount of gold within the mobile's backpack
	Gold() int
	// AdjustGold adds n to the total amount of gold on the mobile
	AdjustGold(int)
	// BankGold returns the amount of gold within the mobile's bank box
	BankGold() int
	// AdjustBankGold adds n to the total amount of gold in the bank
	AdjustBankGold(int)
	// ChargeGold removes the given amount of gold from the mobile's inventory
	// and bank and returns true only if successful.
	ChargeGold(int) bool
	// Skill returns the raw skill value (range 0-1000) of the named skill
	Skill(uo.Skill) int16
	// Skills returns a slice of all raw skill values (range 0-1000)
	Skills() []int16
	// SkillCheck returns true if the skill check succeeded. This function will
	// also calculate skill and stat gains and send mobile updates for these.
	SkillCheck(uo.Skill, int, int) bool

	// SetAIGoal sets the object that is the goal of the AI model
	SetAIGoal(Object)
	// AIGoal returns the object that is the goal of the AI model
	AIGoal() Object
	// SetAI sets the AI model for the mobile to use.
	SetAI(string)
	// ControlMaster returns the mobile that controls this one, or nil.
	ControlMaster() Mobile
	// SetControlMaster sets the control master of this mobile which may be nil.
	SetControlMaster(Mobile)
	// RestoreControlMaster attempts to restore the control master pointer from the
	// serial recorded from the save file. This should only be called internally.
	RestoreControlMaster()
	// CanBeCommandedBy returns true if this mobile can be commanded by the
	// argument mobile.
	CanBeCommandedBy(Mobile) bool
	// ViewRange returns the number of tiles this mobile can see and visually
	// observe objects in the world. If this mobile has an attached NetState,
	// this value can change at any time at the request of the player.
	ViewRange() int16
	// SetViewRange sets the view range of the mobile, bounding it to sane
	// values.
	SetViewRange(int16)
	// IsRunning returns true if the mobile is running.
	IsRunning() bool
	// Facing returns the current facing of the mobile.
	Facing() uo.Direction
	// SetFacing sets the current facing of the mobile.
	SetFacing(uo.Direction)
	// CanTakeStep returns true if the mobile is able to move this tick.
	CanTakeStep() bool
	// Step attempts to step the mobile in the given direction.
	Step(uo.Direction) bool
	// SetRunning sets the running flag of the mobile.
	SetRunning(bool)
	// StandOn sets the surface that the mobile is standing on.
	StandOn(uo.CommonObject)
	// StandingOn returns the surface that the mobile is standing on.
	StandingOn() uo.CommonObject
	// CanSee returns true if the mobile can see the object without regard to
	// line of sight.
	CanSee(Object) bool
	// HasLineOfSight returns true if the mobile has line of sight to the
	// object.
	HasLineOfSight(Object) bool

	// Body returns the animation body of the mobile.
	Body() uo.Body
	// SetBody sets the animation body of the mobile.
	SetBody(uo.Body)
	// IsPlayerCharacter returns true if this mobile is attached to a player's
	// account.
	IsPlayerCharacter() bool
	// IsFemale returns true if the mobile is female.
	IsFemale() bool
	// IsHumanBody returns true if the body value is humanoid.
	IsHumanBody() bool

	// ItemInHand returns a pointer to the item held in the mobile's cursor.
	// This is usually only used by mobiles being controlled by a client.
	ItemInCursor() Item
	// Returns true if the mobile's cursor has an item on it.
	IsItemOnCursor() bool
	// PickUp attempts to place an object on the mobile's cursor. Returns true
	// if successful.
	PickUp(Object) bool
	// DropItemInCursor drops the item in the cursor to the ground at the
	// mobile's feet.
	DropItemInCursor()
	// RequestCursorState is uses to set the cursor state to either
	// CursorStateDrop or CursorStateEquip. All other values will be ignored.
	RequestCursorState(CursorState)
	// Equip equips the given item in the item's layer, returns false if the
	// equip operation failed for any reason.
	Equip(Wearable) bool
	// ForceEquip forcefully equips the given item. If an existing item is in
	// that slot it will be leaked!
	ForceEquip(Wearable)
	// Unequip unequips the given item from the item's layer. It returns false
	// if the unequip operation failed for any reason.
	Unequip(Wearable) bool
	// ForceUnequip forcefully unequips the given item.
	ForceUnequip(Wearable)
	// EquipmentInSlot returns the item equipped in the named slot or nil.
	EquipmentInSlot(uo.Layer) Wearable
	// IsEquipped returns true if this mobile is wearing the object.
	IsEquipped(Object) bool
	// MapEquipment executes the function for every item this mobile has
	// equipped and returns any errors. Be careful, as this will also map over
	// inventory backpacks and player bank boxes. Filter them by checking the
	// wearable's layer.
	MapEquipment(func(Wearable) error) []error
	// DropToBackpack is a helper function that places items within a mobile's
	// backpack. If the second argument is true, the item will be placed without
	// regard to weight and item caps. Returns true if successful.
	DropToBackpack(Object, bool) bool
	// DropToBankBox is a helper function that places items within a mobile's
	// bank box. If the second argument is true, the item will be placed without
	// regard to the item cap. Returns true if successful.
	DropToBankBox(Object, bool) bool
	// DropToFeet is a helper function that places items at the mobile's feet.
	// The item is forced to the location of the mobile's feet without regard to
	// having enough space. Use this function as a last-ditch method to get an
	// item to a player.
	DropToFeet(Object)
	// AdjustWeight adds n to this mobile's equipment collection's weight cache.
	AdjustWeight(float32)
	// InBank returns true if the given item is within this mobile's bank box.
	InBank(Object) bool
	// InBackpack returns true if the given item is within this mobile's
	// backpack.
	InBackpack(Object) bool
	// BankBoxOpen returns true if the mobile is currently observing its bank
	// box.
	BankBoxOpen() bool
	// Stable attempts to stable the given mobile.
	Stable(Mobile) *Error
	// Claim attempts to claim the given mobile.
	Claim(Mobile) *Error
	// StabledPets returns a slice of all of the stabled pets of this mobile.
	StabledPets() []Mobile

	// Mount attempts to mount the given mountable mobile.
	Mount(Mobile)
	// Dismount attempts to dismount the mobile they are riding.
	Dismount()
	// IsMounted returns true if the mobile is riding a mount.
	IsMounted() bool

	// GetNotorietyFor returns the notoriety value of the given mobile as
	// observed from this mobile.
	GetNotorietyFor(Mobile) uo.Notoriety

	// AfterMove is called by Map.MoveMobile after the mobile has arrived at its
	// new location.
	AfterMove()

	// CanAccess returns true if this mobile has access to the given object.
	// This only considers container accessability and ownership, NOT line of
	// sight or range.
	CanAccess(Object) bool
}

Mobile is the interface all mobiles implement

type MountItem

type MountItem struct {
	BaseWearable
	// contains filtered or unexported fields
}

MountItem is a special wearable on uo.LayerMount that represents a mount that a mobile is riding, if any.

func (*MountItem) AddObject

func (i *MountItem) AddObject(o Object) bool

AddObject implements the Object interface

func (*MountItem) ForceAddObject

func (i *MountItem) ForceAddObject(o Object)

ForceAddObject implements the Object interface. PLEASE NOTE that a call to BaseObject.ForceAddObject() will leak the object!

func (*MountItem) ForceRemoveObject

func (i *MountItem) ForceRemoveObject(o Object)

ForceRemoveObject implements the Object interface. PLEASE NOTE that a call to BaseObject.ForceRemoveObject() will leak the object!

func (*MountItem) Marshal

func (i *MountItem) Marshal(s *marshal.TagFileSegment)

Marshal implements the marshal.Marshaler interface.

func (*MountItem) Mount

func (i *MountItem) Mount() Mobile

Mount returns the current mount mobile associated to the item. Might be nil.

func (*MountItem) ObjectType

func (i *MountItem) ObjectType() marshal.ObjectType

ObjectType implements the Object interface.

func (*MountItem) RemoveObject

func (i *MountItem) RemoveObject(o Object) bool

RemoveObject implements the Object interface

func (*MountItem) SetBaseGraphicForBody

func (i *MountItem) SetBaseGraphicForBody(body uo.Body)

SetBaseGraphicForBody sets the base graphic of the item correctly for the given mount body.

func (*MountItem) Unmarshal

func (i *MountItem) Unmarshal(s *marshal.TagFileSegment)

Unmarshal implements the marshal.Unmarshaler interface.

type NetState

type NetState interface {
	ContainerObserver

	// Disconnect disconnects the underlying network connection
	Disconnect()
	// Account returns the account attached to this NetState, which will never
	// be nil.
	Account() *Account
	// TakeAction returns true if an action is allowed at this time. Examples of
	// actions are double-clicking anything basically and moving and
	// equipping items. This method assumes that the action will be taken after
	// this call and sets internal states to limit action speed.
	TakeAction() bool
	// Mobile returns the mobile associated with this state if any.
	Mobile() Mobile

	// Speech sends a speech packet
	Speech(Object, string, ...interface{})
	// Cliloc sends a localized client message packet
	Cliloc(Object, uo.Cliloc, ...string)

	// Animate
	Animate(Mobile, uo.AnimationType, uo.AnimationAction)
	// Send sends a custom packet to the client
	Send(serverpacket.Packet) bool
	// Sound sends a sound to the client from the specified location
	Sound(uo.Sound, uo.Location)
	// Music sends a song to the client
	Music(uo.Music)

	// TargetSendCursor sends a targeting request to the client
	TargetSendCursor(uo.TargetType, func(*clientpacket.TargetResponse))
	// GetText sends a client-side GUMP (packet 0xAB) to reply with a string
	GetText(string, string, int, func(string))

	// SendItem sends an object information packet to the client
	SendObject(Object)
	// RemoveObject sends a delete object packet to the client
	RemoveObject(Object)
	// UpdateObject sends packets to update the stats of an object
	UpdateObject(Object)
	// UpdateMobile sends a
	// WordItem sends the WornItem packet to the given mobile
	WornItem(Wearable, Mobile)
	// DragItem sends a DragItem packet
	DragItem(Item, Mobile, uo.Location, Mobile, uo.Location)
	// DropReject sends the MoveItemReject packet with the given reason code
	DropReject(uo.MoveItemRejectReason)

	// DrawPlayer sends a DrawPlayer packet for the attached mobile if any
	DrawPlayer()
	// MoveMobile sends an MoveMobile packet for the given mobile
	MoveMobile(Mobile)
	// UpdateSkill updates a single skill on the client side
	UpdateSkill(uo.Skill, uo.SkillLock, int)

	// GUMP sends a generic GUMP to the client.
	GUMP(g any, target, param Object)
	// CloseGump closes the named gump on the client
	CloseGump(gump uo.Serial)
	// RefreshGUMP refreshes the passed GUMP on the client side.
	RefreshGUMP(any)
	// GetGUMPByID returns a pointer to the identified GUMP or nil if the state
	// does not currently have a GUMP of that type open.
	GetGUMPByID(uo.Serial) any
	// OpenPaperDoll opens the paper doll of the given mobile
	OpenPaperDoll(m Mobile)
}

NetState is the interface the server client's network state object must implement to be compatible with this library of game objects.

type Object

type Object interface {
	Deserialize(*template.Template, bool)
	marshal.Marshaler
	marshal.Unmarshaler

	// Removed returns true if this object has been removed from the data store
	Removed() bool
	// Remove flags the object as having been removed from the data store
	Remove()
	// NoRent returns true if this object should not persist through server
	// restart.
	NoRent() bool
	// SpawnerRegion returns a pointer to the region that spawned this object
	// if any.
	SpawnerRegion() *Region
	// SetSpawnerRegion sets the spawner region.
	SetSpawnerRegion(*Region)

	// Serial returns the serial of the object
	Serial() uo.Serial
	// SetSerial sets the serial of the object, only used during object creation
	SetSerial(uo.Serial)
	// SerialType returns what kind of serial should be generated for this type
	// of object.
	SerialType() uo.SerialType
	// Parent returns a pointer to the parent object of this object, or nil
	// if the object is attached directly to the world
	Parent() Object
	// HasParent returns true if the given object is this object's parent, or
	// the parent of any other object in the parent chain.
	HasParent(Object) bool
	// SetParent sets the parent pointer. Use nil to represent the world.
	SetParent(Object)
	// RemoveChildren is responsible for calling Remove() for all child objects.
	RemoveChildren()
	// TemplateName returns the name of the template used to create this object.
	TemplateName() string
	// SetTemplateName sets the name of the template used to create this object.
	// For internal use only.
	SetTemplateName(string)
	// BaseTemplate returns the name of the direct base template used when
	// creating this object.
	BaseTemplate() string

	// Update handles updates for objects. Mobiles should receive an Update()
	// call every tick, while Items (on the ground) should receive one every
	// minute.
	Update(uo.Time)
	// LinkEvent links the named handler to this object's event callbacks. Use
	// the global function ExecuteEventHandler.
	LinkEvent(string, string)
	// GetEventHandler returns the named link function or nil.
	GetEventHandler(string) *EventHandler
	// RecalculateStats is called after an object has been unmarshaled and
	// should be used to recalculate dynamic attributes.
	RecalculateStats()
	// RemoveObject removes an object from this object. This is called when
	// changing parent objects. This function should return false if the object
	// could not be removed.
	RemoveObject(Object) bool
	// AddObject adds an object to this object. This is called when changing
	// parent objects. This function should return false if the object could not
	// be added.
	AddObject(Object) bool
	// ForceAddObject is like AddObject but should not fail for any reason.
	ForceAddObject(Object)
	// InsertObject adds an object as a child of this object through an empty
	// interface.
	InsertObject(any)
	// ForceRemoveObject is like RemoveObject but should not fail for any
	// reason.
	ForceRemoveObject(Object)
	// AfterUnmarshalOntoMap is called only when 1) The object has just been
	// reconstructed from a save file 2) The object's parent is nil - the map
	// If these conditions are true, then this function will be called for all
	// objects after all objects have been placed into the map data structure.
	// This is used for recalculating dynamic values that require spatial
	// awareness, such as the surface a mobile is standing on.
	AfterUnmarshalOntoMap()
	// AppendTemplateContextMenuEntry is used to add a context menu entry to the
	// list of context menu entries from the template's Events line.
	AppendTemplateContextMenuEntry(string, uo.Cliloc)
	// AppendContextMenuEntries is called when building the context menu of an
	// object. The function may append any entries it needs with the
	// ContextMenu.Append function. The second parameter represents the mobile
	// requesting the context menu, which should always be a player's mobile
	// with attached NetState.
	AppendContextMenuEntries(*ContextMenu, Mobile)

	// OPLPackets returns the current OPL packets for this object. The Object
	// parameter must be a self-reference to this object.
	OPLPackets(Object) (*serverpacket.OPLPacket, *serverpacket.OPLInfo)
	// InvalidateOPL flags the OPLPacket for this object as stale and in need of
	// rebuilding.
	InvalidateOPL()
	// AppendOPLEntires is called when building the object property list of an
	// object. The function may append any entries it needs with the
	// OPLPacket.Append and OPLPacket.AppendColor functions. The first parameter
	// must be the object self-reference.
	AppendOPLEntires(Object, *serverpacket.OPLPacket)

	// Location returns the current location of the object
	Location() uo.Location
	// SetLocation sets the absolute location of the object without regard to
	// the map.
	SetLocation(uo.Location)
	// Hue returns the hue of the item
	Hue() uo.Hue
	// SetHue sets the hue of the item. Remember to use hue.SetPartial() if a
	// partial hue is desired.
	SetHue(uo.Hue)
	// Facing returns the direction the object is currently facing. 8-way for
	// mobiles, 2-way for most items, and 4-way for a few items.
	Facing() uo.Direction
	// SetFacing sets the direction the object is currently facing.
	SetFacing(uo.Direction)
	// Visibility returns the current visibility level of the object.
	Visibility() uo.Visibility
	// SetAmount sets the amount of the stack, if any. If this is out of range
	// it will be bounded to a sane value. Generally this only applies to items.
	SetAmount(int)

	// DisplayName returns the name of the object with any articles attached.
	DisplayName() string
	// SetName sets the name of the object and clears all article flags.
	SetName(string)
	// Name returns the name of the object without any articles attached.
	Name() string
	// Weight returns the total weight of the object. For an item, this is the
	// base weight of the item times the amount. For container items this is the
	// base weight of the item plus the weight of the contents. For mobiles this
	// is the total weight of all equipment including containers, but excluding
	// the bank box if any.
	Weight() float32
}

Object is the interface every object in the game implements

func RootParent

func RootParent(o Object) Object

RootParent returns the top-most parent of the object who's parent is the map. If this object's parent is the map this object is returned.

type Region

type Region struct {
	Name      string          // Name of the region
	Bounds    uo.Bounds       // Bounds of all bounding rects for first-level inclusion detection
	Rects     []uo.Bounds     // Bounds of all the rects region
	Features  RegionFeature   // Feature flags for this region
	Music     string          // Music track to play for the region as a range expression
	Entries   []*SpawnerEntry // All of the entries for region spawning
	SpawnMinZ int8            // Minimum Z position for spawned objects
	SpawnMaxZ int8            // Maximum Z position for spawned objects
}

Region defines a geographical bounding area and data that defines various behaviors.

func (*Region) AddRect

func (r *Region) AddRect(b uo.Bounds)

AddRect adds a rect to the region.

func (*Region) Contains

func (r *Region) Contains(l uo.Location) bool

Contains returns true if the location is contained within one of the rects of the region.

func (*Region) ForceRecalculateBounds

func (r *Region) ForceRecalculateBounds()

ForceRecalculateBounds recalculates the Bounds member variable.

func (*Region) FullRespawn

func (r *Region) FullRespawn()

FullRespawn removes all objects spawned by this region and then fully respawns all entries.

func (*Region) Overlaps

func (r *Region) Overlaps(b uo.Bounds) bool

Overlaps returns true if the given bounds overlap with any of the rects of the region.

func (*Region) ReleaseObject

func (r *Region) ReleaseObject(o Object)

ReleaseObject releases the given object from this spawner so another may spawn in its place.

func (*Region) Spawn

func (r *Region) Spawn(which string) Object

Spawn spawns an object by template name and returns a pointer to it or nil.

func (*Region) Update

func (r *Region) Update(t uo.Time)

Update is the periodic update function for the region.

type RegionFeature

type RegionFeature uint16

RegionFeature is a flag that turns on the given feature for a region. Note that feature flags can be turned on by a region but not turned off.

const (
	RegionFeatureSafeLogout    RegionFeature = 0b0000000000000001 // Disables the 10 minute logout wait
	RegionFeatureGuarded       RegionFeature = 0b0000000000000010 // Enables guards
	RegionFeatureNoTeleport    RegionFeature = 0b0000000000000100 // Disables teleporting into and out of the region
	RegionFeatureSpawnOnGround RegionFeature = 0b0000000000001000 // Forces spawned objects to follow the terrain
)

type Role

type Role byte

Role describes the roles that an account may have.

const (
	RolePlayer        Role = 0b00000001 // Access most game functions
	RoleModerator     Role = 0b00000010 // Global chat moderation commands
	RoleAdministrator Role = 0b00000100 // Server administration commands
	RoleGameMaster    Role = 0b00001000 // Most other commands and actions
	RoleDeveloper     Role = 0b00010000 // Commands and actions that can be dangerous on a live shard
	RoleSuperUser     Role = 0b10000000 // Marks the account as the super user
	RoleStaff         Role = 0b10011100 // All roles considered "staff", with a GM body
	RoleAll           Role = 0b11111111 // All roles current and future
)

type SpawnedObject

type SpawnedObject struct {
	Object            Object  // Pointer to the object that was spawned
	NextSpawnDeadline uo.Time // When should the object be spawned again
}

SpawnedObject describes one object that was spawned.

type SpawnerEntry

type SpawnerEntry struct {
	Template string           // Name of the template of the object
	Amount   int              // Amount of objects to spawn in the area
	Delay    uo.Time          // Delay between object disappearance and respawn
	Objects  []*SpawnedObject // Pointers to the spawned objects
}

SpawnerEntry describes one object to spawn.

type StaticItem

type StaticItem struct {
	// contains filtered or unexported fields
}

StaticItem is a light-weight Item implementation intended to be used for non-functional decorative items.

func (*StaticItem) AddObject

func (i *StaticItem) AddObject(o Object) bool

func (*StaticItem) AfterUnmarshalOntoMap

func (i *StaticItem) AfterUnmarshalOntoMap()

AfterUnmarshalOntoMap implements the Object interface.

func (*StaticItem) AlphaBlend

func (i *StaticItem) AlphaBlend() bool

func (*StaticItem) Amount

func (i *StaticItem) Amount() int

func (*StaticItem) Animation

func (i *StaticItem) Animation() bool

func (*StaticItem) AppendContextMenuEntries

func (i *StaticItem) AppendContextMenuEntries(m *ContextMenu, src Mobile)

func (*StaticItem) AppendOPLEntires

func (i *StaticItem) AppendOPLEntires(r Object, p *serverpacket.OPLPacket)

func (*StaticItem) AppendTemplateContextMenuEntry

func (i *StaticItem) AppendTemplateContextMenuEntry(event string, cl uo.Cliloc)

func (*StaticItem) Armor

func (i *StaticItem) Armor() bool

func (*StaticItem) ArtUsed

func (i *StaticItem) ArtUsed() bool

func (*StaticItem) ArticleA

func (i *StaticItem) ArticleA() bool

func (*StaticItem) ArticleAn

func (i *StaticItem) ArticleAn() bool

func (*StaticItem) Background

func (i *StaticItem) Background() bool

Flag accessors

func (*StaticItem) BaseGraphic

func (i *StaticItem) BaseGraphic() uo.Graphic

Item interface BaseGraphic implements the Item interface.

func (*StaticItem) BaseTemplate

func (i *StaticItem) BaseTemplate() string

func (*StaticItem) Bridge

func (i *StaticItem) Bridge() bool

func (*StaticItem) CanCombineWith

func (i *StaticItem) CanCombineWith(Item) bool

func (*StaticItem) Combine

func (i *StaticItem) Combine(item Item) bool

func (*StaticItem) Consume

func (i *StaticItem) Consume(n int) bool

func (*StaticItem) ConsumeUse

func (i *StaticItem) ConsumeUse() bool

func (*StaticItem) Container

func (i *StaticItem) Container() bool

func (*StaticItem) Damaging

func (i *StaticItem) Damaging() bool

func (*StaticItem) Deserialize

func (i *StaticItem) Deserialize(t *template.Template, create bool)

Deserialize implements the util.Serializeable interface.

func (*StaticItem) DisplayName

func (i *StaticItem) DisplayName() string

func (*StaticItem) Door

func (i *StaticItem) Door() bool

func (*StaticItem) DropLocation

func (i *StaticItem) DropLocation() uo.Location

func (*StaticItem) DropSoundOverride

func (i *StaticItem) DropSoundOverride(s uo.Sound) uo.Sound

func (*StaticItem) Dyable

func (i *StaticItem) Dyable() bool

func (*StaticItem) Facing

func (i *StaticItem) Facing() uo.Direction

func (*StaticItem) Flip

func (i *StaticItem) Flip()

func (*StaticItem) Flippable

func (i *StaticItem) Flippable() bool

func (*StaticItem) Flipped

func (i *StaticItem) Flipped() bool

func (*StaticItem) FlippedGraphic

func (i *StaticItem) FlippedGraphic() uo.Graphic

func (*StaticItem) Foliage

func (i *StaticItem) Foliage() bool

func (*StaticItem) ForceAddObject

func (i *StaticItem) ForceAddObject(o Object)

func (*StaticItem) ForceRemoveObject

func (i *StaticItem) ForceRemoveObject(o Object)

func (*StaticItem) Generic

func (i *StaticItem) Generic() bool

func (*StaticItem) GetEventHandler

func (i *StaticItem) GetEventHandler(s string) *EventHandler

func (*StaticItem) Graphic

func (i *StaticItem) Graphic() uo.Graphic

Graphic implements the Item interface.

func (*StaticItem) GraphicOffset

func (i *StaticItem) GraphicOffset() int

func (*StaticItem) HasParent

func (i *StaticItem) HasParent(o Object) bool

func (*StaticItem) Height

func (i *StaticItem) Height() int8

func (*StaticItem) Highest

func (i *StaticItem) Highest() int8

Highest returns the highest elevation of the object

func (*StaticItem) Hue

func (i *StaticItem) Hue() uo.Hue

func (*StaticItem) Impassable

func (i *StaticItem) Impassable() bool

func (*StaticItem) InsertObject

func (i *StaticItem) InsertObject(o any)

func (*StaticItem) Internal

func (i *StaticItem) Internal() bool

func (*StaticItem) InvalidateOPL

func (i *StaticItem) InvalidateOPL()

func (*StaticItem) LiftSound

func (i *StaticItem) LiftSound() uo.Sound

func (*StaticItem) LightSource

func (i *StaticItem) LightSource() bool

func (*StaticItem) LinkEvent

func (i *StaticItem) LinkEvent(event, handler string)

func (*StaticItem) Location

func (i *StaticItem) Location() uo.Location

func (*StaticItem) Map

func (i *StaticItem) Map() bool

func (*StaticItem) Marshal

func (i *StaticItem) Marshal(s *marshal.TagFileSegment)

Marshal implements the marshal.Marshaler interface.

func (*StaticItem) Movable

func (i *StaticItem) Movable() bool

func (*StaticItem) MultiMovable

func (i *StaticItem) MultiMovable() bool

func (*StaticItem) Name

func (i *StaticItem) Name() string

func (*StaticItem) NoDiagonal

func (i *StaticItem) NoDiagonal() bool

func (*StaticItem) NoHouse

func (i *StaticItem) NoHouse() bool

func (*StaticItem) NoRent

func (o *StaticItem) NoRent() bool

NoRent implements the Object interface.

func (*StaticItem) NoShadow

func (i *StaticItem) NoShadow() bool

func (*StaticItem) NoShoot

func (i *StaticItem) NoShoot() bool

func (*StaticItem) OPLPackets

func (i *StaticItem) OPLPackets(self Object) (*serverpacket.OPLPacket, *serverpacket.OPLInfo)

func (*StaticItem) ObjectType

func (o *StaticItem) ObjectType() marshal.ObjectType

ObjectType implements the Object interface.

func (*StaticItem) Owner

func (o *StaticItem) Owner() Object

Owner implements the Object interface.

func (*StaticItem) Parent

func (i *StaticItem) Parent() Object

func (*StaticItem) PartialHue

func (i *StaticItem) PartialHue() bool

func (*StaticItem) PixelBleed

func (i *StaticItem) PixelBleed() bool

func (*StaticItem) PlayAnimOnce

func (i *StaticItem) PlayAnimOnce() bool

func (*StaticItem) RecalculateStats

func (i *StaticItem) RecalculateStats()

func (*StaticItem) RefreshDecayDeadline

func (i *StaticItem) RefreshDecayDeadline()

RefreshDecayDeadline implements the Item interface

func (*StaticItem) Remove

func (o *StaticItem) Remove()

Remove implements the Object interface.

func (*StaticItem) RemoveChildren

func (i *StaticItem) RemoveChildren()

func (*StaticItem) RemoveObject

func (i *StaticItem) RemoveObject(o Object) bool

func (*StaticItem) Removed

func (o *StaticItem) Removed() bool

Removed implements the Object interface.

func (*StaticItem) Roof

func (i *StaticItem) Roof() bool

func (*StaticItem) Serial

func (o *StaticItem) Serial() uo.Serial

Serial implements the Object interface.

func (*StaticItem) SerialType

func (o *StaticItem) SerialType() uo.SerialType

SerialType implements the Object interface.

func (*StaticItem) SetAmount

func (i *StaticItem) SetAmount(int)

func (*StaticItem) SetBaseGraphic

func (i *StaticItem) SetBaseGraphic(g uo.Graphic)

SetBaseGraphic implements the Item interface.

func (*StaticItem) SetDefForGraphic

func (i *StaticItem) SetDefForGraphic(g uo.Graphic)

func (*StaticItem) SetDropLocation

func (i *StaticItem) SetDropLocation(l uo.Location)

func (*StaticItem) SetFacing

func (i *StaticItem) SetFacing(d uo.Direction)

func (*StaticItem) SetFlippedGraphic

func (i *StaticItem) SetFlippedGraphic(g uo.Graphic)

func (*StaticItem) SetHue

func (i *StaticItem) SetHue(hue uo.Hue)

func (*StaticItem) SetLocation

func (i *StaticItem) SetLocation(l uo.Location)

func (*StaticItem) SetName

func (i *StaticItem) SetName(string)

func (*StaticItem) SetObjectType

func (o *StaticItem) SetObjectType(t marshal.ObjectType)

SetObjectType implements the Object interface.

func (*StaticItem) SetOwner

func (o *StaticItem) SetOwner(owner Object)

SetOwner implements the Object interface.

func (*StaticItem) SetParent

func (i *StaticItem) SetParent(o Object)

func (*StaticItem) SetSerial

func (o *StaticItem) SetSerial(s uo.Serial)

SetSerial implements the Object interface.

func (*StaticItem) SetSpawnerRegion

func (o *StaticItem) SetSpawnerRegion(r *Region)

SetSpawnerRegion implements the Object interface.

func (*StaticItem) SetTemplateName

func (i *StaticItem) SetTemplateName(name string)

func (*StaticItem) SingleClick

func (i *StaticItem) SingleClick(m Mobile)

Object interface

func (*StaticItem) SpawnerRegion

func (o *StaticItem) SpawnerRegion() *Region

SpawnerRegion implements the Object interface.

func (*StaticItem) Split

func (i *StaticItem) Split(n int) Item

func (*StaticItem) Stackable

func (i *StaticItem) Stackable() bool

func (*StaticItem) StairBack

func (i *StaticItem) StairBack() bool

func (*StaticItem) StairRight

func (i *StaticItem) StairRight() bool

func (*StaticItem) StandingHeight

func (i *StaticItem) StandingHeight() int8

StandingHeight returns the standing height based on the object's flags.

func (*StaticItem) Surface

func (i *StaticItem) Surface() bool

func (*StaticItem) TemplateName

func (i *StaticItem) TemplateName() string

func (*StaticItem) Translucent

func (i *StaticItem) Translucent() bool

func (*StaticItem) Transparent

func (i *StaticItem) Transparent() bool

func (*StaticItem) Unmarshal

func (i *StaticItem) Unmarshal(s *marshal.TagFileSegment)

Unmarshal implements the marshal.Unmarshaler interface.

func (*StaticItem) Update

func (o *StaticItem) Update(t uo.Time)

Update implements the Object interface.

func (*StaticItem) UseNewArt

func (i *StaticItem) UseNewArt() bool

func (*StaticItem) Uses

func (i *StaticItem) Uses() int

func (*StaticItem) Value

func (i *StaticItem) Value() int

func (*StaticItem) Visibility

func (o *StaticItem) Visibility() uo.Visibility

Visibility implements the Object interface.

func (*StaticItem) Wall

func (i *StaticItem) Wall() bool

func (*StaticItem) Weapon

func (i *StaticItem) Weapon() bool

func (*StaticItem) Wearable

func (i *StaticItem) Wearable() bool

func (*StaticItem) Weight

func (i *StaticItem) Weight() float32

func (*StaticItem) Wet

func (i *StaticItem) Wet() bool

func (*StaticItem) Window

func (i *StaticItem) Window() bool

func (*StaticItem) Z

func (i *StaticItem) Z() int8

type Timer

type Timer struct {
	// contains filtered or unexported fields
}

Timer dispatches an event after a set interval, optionally repeating. If either the receiver or source objects have been deleted prior to the trigger the event will not fire. Nil may be passed for either or both the receiver and source objects.

func (*Timer) Execute

func (t *Timer) Execute()

Execute executes the event on the timer

type VoidObject

type VoidObject struct {
	BaseObject
}

VoidObject is an object that blindly accepts object adds and removes and does not track them. If an object is left parented to a Void object it will leak.

var TheVoid *VoidObject = &VoidObject{
	BaseObject: BaseObject{
		serial: uo.SerialTheVoid,
		name:   "the void",
	},
}

Global instance of the void object

func (*VoidObject) AddObject

func (o *VoidObject) AddObject(c Object) bool

AddObject implements the Object interface

func (*VoidObject) RemoveObject

func (o *VoidObject) RemoveObject(c Object) bool

RemoveObject implements the Object interface

func (*VoidObject) Serial

func (o *VoidObject) Serial() uo.Serial

Serial implements the util.Serialer interface.

type Weapon

type Weapon interface {
	Wearable

	// Skill returns the weapon skill this weapon uses
	Skill() uo.Skill
	// AnimationAction returns the animation action code used for an attack
	AnimationAction() uo.AnimationAction
}

Weapon is the interface all weapons implement

type Wearable

type Wearable interface {
	Item
	Layerer
	// DamageDurability handles durability loss of a wearable. The first
	// parameter must be an object back-reference.
	DamageDurability(Object, float64)
}

Wearable represents an item that can be worn by a humanoid mobile

type WearableContainer

type WearableContainer struct {
	BaseContainer
	BaseWearableImplementation
}

WearableContainer is a wearable item with the properties of a container, such as inventory backpacks and the player's bank box.

func (*WearableContainer) Deserialize

func (i *WearableContainer) Deserialize(t *template.Template, create bool)

Deserialize implements the util.Serializeable interface.

func (*WearableContainer) Marshal

func (i *WearableContainer) Marshal(s *marshal.TagFileSegment)

Marshal implements the marshal.Marshaler interface.

func (*WearableContainer) ObjectType

func (i *WearableContainer) ObjectType() marshal.ObjectType

ObjectType implements the Object interface.

func (*WearableContainer) Unmarshal

func (i *WearableContainer) Unmarshal(s *marshal.TagFileSegment)

Unmarshal implements the marshal.Unmarshaler interface.

type World

type World interface {
	// Find returns a pointer to the object with the given ID or nil
	Find(uo.Serial) Object
	// Delete removes the given object from the world and delets it from the
	// data stores.
	Delete(Object)
	// Update adds the object to the world's list of objects that we need to
	// send update packets for. It is safe to update the same object rapidly in
	// succession. No duplicate packets will be sent.
	Update(Object)
	// UpdateOPLInfo adds the object to the world's list of objects that need to
	// have OPLInfo packets sent for. It is safe to call this method in rapid
	// succession. No duplicate packets will be sent.
	UpdateOPLInfo(Object)
	// Map returns the map the world is using.
	Map() *Map
	// GetItemDefinition returns the uo.StaticDefinition that holds the static
	// data for a given item graphic.
	GetItemDefinition(uo.Graphic) *uo.StaticDefinition
	// Random returns the uo.RandomSource for the world.
	Random() uo.RandomSource
	// Time returns the current time in the Sossarian universe. This is what
	// timers use to avoid complications with DST, save lag, rollbacks, and
	// downtime.
	Time() uo.Time
	// ServerTime returns the current wall-clock time of the server. This is
	// updated once per tick.
	ServerTime() time.Time
	// BroadcastPacket sends the packet to every net state connected to the
	// game service with an attached mobile.
	BroadcastPacket(serverpacket.Packet)
	// BroadcastMessage sends a system message to every net state with a mobile
	BroadcastMessage(Object, string, ...interface{})
	// Accounts returns a slice of pointers to the accounts on the server. This
	// should only be used for admin GUMPs and commands.
	Accounts() []*Account
}

World is the interface the server's game world model must implement for the internal game objects to work properly.

func GetWorld

func GetWorld() World

GetWorld returns the internal world object.

Jump to

Keyboard shortcuts

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