Documentation
¶
Index ¶
- type Args
- type ChatType
- type EntitiesArgs
- type Entity
- type EntityArgs
- type EntityBase
- type EntityChatArgs
- type EntityStatus
- type EntityType
- type EntityUpdateArgs
- type Info
- type Item
- type ItemArgs
- type ItemUpdateArgs
- type Items
- type ItemsArgs
- type Manager
- func (mgr *Manager) Entered(handler g.EventHandler[Args])
- func (mgr *Manager) Entities(yield func(ent Entity) bool)
- func (mgr *Manager) EntitiesAdded(handler g.EventHandler[EntitiesArgs])
- func (mgr *Manager) Entity(id int) *Entity
- func (mgr *Manager) EntityByName(name string) *Entity
- func (mgr *Manager) EntityChat(handler g.EventHandler[EntityChatArgs])
- func (mgr *Manager) EntityCount() int
- func (mgr *Manager) EntityLeft(handler g.EventHandler[EntityArgs])
- func (mgr *Manager) EntityUpdated(handler g.EventHandler[EntityUpdateArgs])
- func (mgr *Manager) HasRights() bool
- func (mgr *Manager) Heightmap() []string
- func (mgr *Manager) Id() int
- func (mgr *Manager) Info() *Info
- func (mgr *Manager) IsInRoom() bool
- func (mgr *Manager) IsOwner() bool
- func (mgr *Manager) Item(id int) *Item
- func (mgr *Manager) ItemAdded(handler g.EventHandler[ItemArgs])
- func (mgr *Manager) ItemCount() int
- func (mgr *Manager) ItemRemoved(handler g.EventHandler[ItemArgs])
- func (mgr *Manager) ItemUpdated(handler g.EventHandler[ItemUpdateArgs])
- func (mgr *Manager) Items(yield func(item Item) bool)
- func (mgr *Manager) ItemsLoaded(handler g.EventHandler[ItemsArgs])
- func (mgr *Manager) Left(handler g.EventHandler[Args])
- func (mgr *Manager) Model() string
- func (mgr *Manager) Object(id int) *Object
- func (mgr *Manager) ObjectAdded(handler g.EventHandler[ObjectArgs])
- func (mgr *Manager) ObjectCount() int
- func (mgr *Manager) ObjectRemoved(handler g.EventHandler[ObjectArgs])
- func (mgr *Manager) ObjectUpdated(handler g.EventHandler[ObjectUpdateArgs])
- func (mgr *Manager) Objects(yield func(obj Object) bool)
- func (mgr *Manager) ObjectsLoaded(handler g.EventHandler[ObjectsArgs])
- func (mgr *Manager) RightsUpdated(handler g.VoidHandler)
- func (mgr *Manager) Slide(handler g.EventHandler[SlideArgs])
- type Object
- type ObjectArgs
- type ObjectUpdateArgs
- type ObjectsArgs
- type Point
- type SlideArgs
- type SlideEntityArgs
- type SlideMoveType
- type SlideObject
- type SlideObjectArgs
- type SlideObjectBundle
- type Tile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EntitiesArgs ¶
EntitiesArgs holds the arguments for events involving a list of entities.
type Entity ¶
type Entity struct { EntityBase Dir int HeadDir int Action string }
Entity represents a user, pet or bot in a room.
type EntityArgs ¶
type EntityArgs struct {
Entity Entity
}
EntityArgs holds the arguments for events involving a single entity.
type EntityBase ¶ added in v0.1.2
type EntityChatArgs ¶
type EntityChatArgs struct { EntityArgs Type ChatType Message string }
EntityChat holds the arguments for chat events.
type EntityStatus ¶ added in v0.1.2
EntityStatus represents a status update of an entity in a room.
type EntityType ¶
type EntityType int
const ( User EntityType = iota + 1 Pet PublicBot PrivateBot )
func (EntityType) Compose ¶ added in v0.2.4
func (entityType EntityType) Compose(p *g.Packet, pos *int)
func (EntityType) String ¶ added in v0.2.4
func (entityType EntityType) String() string
type EntityUpdateArgs ¶ added in v0.1.2
type EntityUpdateArgs struct { Pre Entity // Prev is the previous state of the entity before the update. Entity Entity // Cur is the current state of the entity after the update. }
EntityUpdateArgs holds the arguments for entity update events.
type Info ¶
type Info struct { CanOthersMoveFurni bool Door int Id int Owner string Marker string Name string Description string ShowOwnerName bool Trading int Alert int MaxVisitors int AbsoluteMaxVisitors int }
Info contains information about a room.
type ItemArgs ¶
type ItemArgs struct {
Item Item
}
ItemArgs holds the arguments for wall item events involing a single item.
type ItemUpdateArgs ¶ added in v0.2.6
type ItemUpdateArgs struct { Pre Item // Pre is the previous state of the item before the update. Item Item // Item is the current state of the item after the update. }
ItemUpdateArgs holds the arguments for wall item update events.
type ItemsArgs ¶
type ItemsArgs struct {
Items []Item
}
ItemsArgs holds the arguments for wall item events involing a list of items.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(ix g.Interceptor) *Manager
func (*Manager) Entered ¶
func (mgr *Manager) Entered(handler g.EventHandler[Args])
Entered registers an event handler that is invoked when the user enters a room.
func (*Manager) EntitiesAdded ¶
func (mgr *Manager) EntitiesAdded(handler g.EventHandler[EntitiesArgs])
EntitiesAdded registers an event handler that is invoked when entities are loaded or enter the room. The Entered flag on the EntitiesArgs indicates whether the entity entered the room. If not, the entities were already in the room and are being loaded.
func (*Manager) Entity ¶ added in v0.3.0
Entity gets an entity in the room by its index. It returns nil if the entity was not found.
func (*Manager) EntityByName ¶ added in v0.2.1
EntityByName gets the entity with the specified name. Names are case-insensitive. Returns nil if it does not exist.
func (*Manager) EntityChat ¶
func (mgr *Manager) EntityChat(handler g.EventHandler[EntityChatArgs])
EntityChat registers an event handler that is invoked when an entity sends a chat message.
func (*Manager) EntityCount ¶ added in v0.3.0
EntityCount returns the number of entities in the room.
func (*Manager) EntityLeft ¶
func (mgr *Manager) EntityLeft(handler g.EventHandler[EntityArgs])
EntityLeft registers an event handler that is invoked when an entity leaves the room.
func (*Manager) EntityUpdated ¶ added in v0.1.2
func (mgr *Manager) EntityUpdated(handler g.EventHandler[EntityUpdateArgs])
func (*Manager) Item ¶ added in v0.3.0
Item gets a wall item in the room by its ID. It returns nil if the item was not found.
func (*Manager) ItemAdded ¶ added in v0.2.0
func (mgr *Manager) ItemAdded(handler g.EventHandler[ItemArgs])
ItemAdded registers an event handler that is invoked when a wall item is added to the room.
func (*Manager) ItemRemoved ¶
func (mgr *Manager) ItemRemoved(handler g.EventHandler[ItemArgs])
ItemRemoved registers an event handler that is invoked when an item is removed from the room.
func (*Manager) ItemUpdated ¶ added in v0.2.6
func (mgr *Manager) ItemUpdated(handler g.EventHandler[ItemUpdateArgs])
ItemUpdated registers an event handler that is invoked when a wall item is updated in the room.
func (*Manager) ItemsLoaded ¶ added in v0.2.0
func (mgr *Manager) ItemsLoaded(handler g.EventHandler[ItemsArgs])
ItemsLoaded registers an event handler that is invoked when wall items are loaded.
func (*Manager) Left ¶
func (mgr *Manager) Left(handler g.EventHandler[Args])
Left registers an event handler that is invoked when the user leaves the room.
func (*Manager) Object ¶ added in v0.3.0
Object gets a floor item in the room by its ID. It returns nil if the object was not found.
func (*Manager) ObjectAdded ¶
func (mgr *Manager) ObjectAdded(handler g.EventHandler[ObjectArgs])
ObjectAdded registers an event handler that is invoked when a floor item is added to the room.
func (*Manager) ObjectCount ¶ added in v0.3.0
ObjectCount returns the number of objects in the room.
func (*Manager) ObjectRemoved ¶
func (mgr *Manager) ObjectRemoved(handler g.EventHandler[ObjectArgs])
ObjectRemoved registers an event handler that is invoked when a floor item is removed from the room.
func (*Manager) ObjectUpdated ¶ added in v0.1.2
func (mgr *Manager) ObjectUpdated(handler g.EventHandler[ObjectUpdateArgs])
ObjectUpdated registers an event handler that is invoked when a floor item is updated in the room.
func (*Manager) ObjectsLoaded ¶
func (mgr *Manager) ObjectsLoaded(handler g.EventHandler[ObjectsArgs])
ObjectsLoaded registers an event handler that is invoked when floor items are loaded.
func (*Manager) RightsUpdated ¶ added in v0.1.5
func (mgr *Manager) RightsUpdated(handler g.VoidHandler)
type Object ¶
type Object struct { Id int Class string X, Y int Width, Height int Direction int Z float64 Colors string RuntimeData string Extra int StuffData string }
Object represents a floor item in a room.
type ObjectArgs ¶
type ObjectArgs struct {
Object Object
}
ObjectArgs holds the arguments for floor item events involving a single item.
type ObjectUpdateArgs ¶ added in v0.1.2
type ObjectUpdateArgs struct { Pre Object // Prev is the previous state of the object before the update. Object Object // Cur is the current state of the object after the update. }
ObjectUpdateArgs holds the arguments for floor item update events.
type ObjectsArgs ¶
type ObjectsArgs struct {
Objects []Object
}
ObjectArgs holds the arguments for floor item events involving a list of items.
type Point ¶ added in v0.2.4
type Point struct {
X, Y int
}
Point represents 2-dimensional coordinates in a room.
type SlideArgs ¶ added in v0.2.4
type SlideArgs struct {
From, To Point
ObjectSlides []SlideObjectArgs
// Source contains the object that caused the slide, if it is available.
Source *Object
SlideMoveType SlideMoveType
// EntitySlide contains arguments for an entity slide event, if an entity is involved in this event.
EntitySlide *SlideEntityArgs
}
SlideArgs holds the arguments for floor item and entity slide events.
type SlideEntityArgs ¶ added in v0.2.4
type SlideMoveType ¶ added in v0.2.4
type SlideMoveType int
const ( SlideMoveTypeNone SlideMoveType = iota SlideMoveTypeMove SlideMoveTypeSlide )
type SlideObject ¶ added in v0.2.4
type SlideObjectArgs ¶ added in v0.2.4
type SlideObjectArgs struct { // Object contains the state of the object after the slide update. Object Object From, To Tile }
SlideObjectArgs holds the arguments for floor item slide events.
type SlideObjectBundle ¶ added in v0.2.4
type SlideObjectBundle struct {
From, To Point
Objects []SlideObject
RollerId int
SlideMoveType SlideMoveType
Entity SlideObject
}