Documentation ¶
Index ¶
- type Actions
- func (a *Actions) Call(key string, self, actor, target *Object) (bool, string)
- func (a *Actions) Get(key string) string
- func (a *Actions) Has(key string) bool
- func (a *Actions) Private(key string) bool
- func (a *Actions) Restricted(key string) bool
- func (a *Actions) Safe() bool
- func (a *Actions) Set(key string, code string)
- func (a *Actions) Unsafe()
- type Attr
- func (a *Attr) Array() []any
- func (a *Attr) ArrayBool() []bool
- func (a *Attr) ArrayFloat32() []float32
- func (a *Attr) ArrayFloat64() []float64
- func (a *Attr) ArrayInt32() []int32
- func (a *Attr) ArrayInt64() []int64
- func (a *Attr) ArrayString() []string
- func (a *Attr) ArrayUint32() []uint32
- func (a *Attr) ArrayUint64() []uint64
- func (a *Attr) Bool() bool
- func (a *Attr) Complex() (bool, bool)
- func (a *Attr) Float32() float32
- func (a *Attr) Float64() float64
- func (a *Attr) Get() any
- func (a *Attr) Int32() int32
- func (a *Attr) Int64() int64
- func (a *Attr) Map() map[string]any
- func (a *Attr) MapBool() map[string]bool
- func (a *Attr) MapFloat32() map[string]float32
- func (a *Attr) MapFloat64() map[string]float64
- func (a *Attr) MapInt32() map[string]int32
- func (a *Attr) MapInt64() map[string]int64
- func (a *Attr) MapString() map[string]string
- func (a *Attr) MapUint32() map[string]uint32
- func (a *Attr) MapUint64() map[string]uint64
- func (a *Attr) MarshalJSON() ([]byte, error)
- func (a *Attr) Set(val any)
- func (a *Attr) String() string
- func (a *Attr) Type() string
- func (a *Attr) Uint32() uint32
- func (a *Attr) Uint64() uint64
- func (a *Attr) UnmarshalJSON(data []byte) error
- type Attributes
- func (a *Attributes) Array(key string) []any
- func (a *Attributes) ArrayBool(key string) []bool
- func (a *Attributes) ArrayFloat32(key string) []float32
- func (a *Attributes) ArrayFloat64(key string) []float64
- func (a *Attributes) ArrayInt32(key string) []int32
- func (a *Attributes) ArrayInt64(key string) []int64
- func (a *Attributes) ArrayString(key string) []string
- func (a *Attributes) ArrayUint32(key string) []uint32
- func (a *Attributes) ArrayUint64(key string) []uint64
- func (a *Attributes) Bool(key string) bool
- func (a *Attributes) Complex(key string) (bool, bool)
- func (a *Attributes) Float32(key string) float32
- func (a *Attributes) Float64(key string) float64
- func (a *Attributes) Get(key string) any
- func (a *Attributes) Has(key string) bool
- func (a *Attributes) Int32(key string) int32
- func (a *Attributes) Int64(key string) int64
- func (a *Attributes) Map(key string) map[string]any
- func (a *Attributes) MapBool(key string) map[string]bool
- func (a *Attributes) MapFloat32(key string) map[string]float32
- func (a *Attributes) MapFloat64(key string) map[string]float64
- func (a *Attributes) MapInt32(key string) map[string]int32
- func (a *Attributes) MapInt64(key string) map[string]int64
- func (a *Attributes) MapString(key string) map[string]string
- func (a *Attributes) MapUint32(key string) map[string]uint32
- func (a *Attributes) MapUint64(key string) map[string]uint64
- func (a *Attributes) MarshalJSON() ([]byte, error)
- func (a *Attributes) Private(key string) bool
- func (a *Attributes) Restricted(key string) bool
- func (a *Attributes) Safe() bool
- func (a *Attributes) Set(key string, val any)
- func (a *Attributes) String(key string) string
- func (a *Attributes) Uint32(key string) uint32
- func (a *Attributes) Uint64(key string) uint64
- func (a *Attributes) UnmarshalJSON(data []byte) error
- func (a *Attributes) Unsafe()
- type Groups
- func (g *Groups) Get(key string) uint32
- func (g *Groups) Has(key string) bool
- func (g *Groups) Is(key string) bool
- func (g *Groups) Private(key string) bool
- func (g *Groups) Restricted(key string) bool
- func (g *Groups) Safe() bool
- func (g *Groups) Set(key string, level uint32)
- func (g *Groups) Unsafe()
- type Inventory
- func (i *Inventory) Count(obj_id uint64) (uint64, bool)
- func (i *Inventory) FindAll(obj_id uint64) ([]uint64, bool)
- func (i *Inventory) FindOne(obj_id uint64) (uint64, bool)
- func (i *Inventory) Get(slot uint64) uint64
- func (i *Inventory) Has(slot uint64) bool
- func (i *Inventory) Safe() bool
- func (i *Inventory) Set(slot uint64, obj_id uint64)
- func (i *Inventory) Unsafe()
- type Object
- func (o *Object) Bool(key string) bool
- func (o *Object) Call(fun string, args ...*Object) (bool, string)
- func (o *Object) Define(name, code string)
- func (o *Object) Float32(key string) float32
- func (o *Object) Float64(key string) float64
- func (o *Object) HasActions() bool
- func (o *Object) HasAttributes() bool
- func (o *Object) HasGroup() bool
- func (o *Object) HasInventory() bool
- func (o *Object) Id() uint64
- func (o *Object) Int32(key string) int32
- func (o *Object) Int64(key string) int64
- func (o *Object) Is(key string) bool
- func (o *Object) IsTemp() bool
- func (o *Object) Level(key string, level uint32)
- func (o *Object) Name() string
- func (o *Object) Owner() uint64
- func (o *Object) Set(key string, val any)
- func (o *Object) String(key string) string
- func (o *Object) Uint32(key string) uint32
- func (o *Object) Uint64(key string) uint64
- type Storage
- func (s *Storage) ActionLock(id uint64) bool
- func (s *Storage) ActionLocked(id uint64) bool
- func (s *Storage) ActionUnlock(id uint64)
- func (s *Storage) AttrLock(id uint64) bool
- func (s *Storage) AttrLocked(id uint64) bool
- func (s *Storage) AttrUnlock(id uint64)
- func (s *Storage) GetActions(id uint64) (*Actions, error)
- func (s *Storage) GetAttributes(id uint64) (*Attributes, error)
- func (s *Storage) GetGroups(id uint64) (*Groups, error)
- func (s *Storage) GetInventory(id uint64) (*Inventory, error)
- func (s *Storage) GetObject(id uint64) (*Object, error)
- func (s *Storage) GroupLock(id uint64) bool
- func (s *Storage) GroupLocked(id uint64) bool
- func (s *Storage) GroupUnlock(id uint64)
- func (s *Storage) HasAction(id uint64) bool
- func (s *Storage) HasAttr(id uint64) bool
- func (s *Storage) HasGroup(id uint64) bool
- func (s *Storage) HasInv(id uint64) bool
- func (s *Storage) InvLock(id uint64) bool
- func (s *Storage) InvLocked(id uint64) bool
- func (s *Storage) InvUnlock(id uint64)
- func (s *Storage) NewObject() *Object
- func (s *Storage) NewTempObject() *Object
- func (s *Storage) NextId() (uint64, bool)
- func (s *Storage) Postcheck(id uint64)
- func (s *Storage) Precheck()
- func (s *Storage) SetAction(id uint64, act *Actions) error
- func (s *Storage) SetAttr(id uint64, attr *Attributes) error
- func (s *Storage) SetGroup(id uint64, group *Groups) error
- func (s *Storage) SetInv(id uint64, inv *Inventory) error
- func (s *Storage) SetObject(obj *Object) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actions ¶
type Actions struct {
// contains filtered or unexported fields
}
Lua based scripting
func (*Actions) Call ¶
Calls the given function, given a range of 1 to 3 objects (use temporary objects for short-term variables)
func (*Actions) Get ¶
Obtains the function's code, will return an empty string on missing or Restricted functions
func (*Actions) Restricted ¶
Restricted prevents being changed or called on Client side
type Attr ¶
type Attr struct {
// contains filtered or unexported fields
}
A single Attribute, with no name
func (*Attr) Array ¶
Returns the value as []any
Returns nil if the value isn't an array or not []any
func (*Attr) ArrayBool ¶
Returns the value as []bool
Returns nil if the value isn't an array or not []bool
func (*Attr) ArrayFloat32 ¶
Returns the value as []float32
Returns nil if the value isn't an array or not []float32
func (*Attr) ArrayFloat64 ¶
Returns the value as []float64
Returns nil if the value isn't an array or not []float64
func (*Attr) ArrayInt32 ¶
Returns the value as []int32
Returns nil if the value isn't an array or not []int32
func (*Attr) ArrayInt64 ¶
Returns the value as []int64
Returns nil if the value isn't an array or not []int64
func (*Attr) ArrayString ¶
Returns the value as []string
Returns nil if the value isn't an array or not []string (currently no conversion)
func (*Attr) ArrayUint32 ¶
Returns the value as []uint32
Returns nil if the value isn't an array or not []uint32
func (*Attr) ArrayUint64 ¶
Returns the value as []uint64
Returns nil if the value isn't an array or not []uint64
func (*Attr) Map ¶
Returns the value as map[string]any
Returns nil if the value isn't a map or not map[string]any
func (*Attr) MapBool ¶
Returns the value as map[string]bool
Returns nil if the value isn't a map or not map[string]bool
func (*Attr) MapFloat32 ¶
Returns the value as map[string]float32
Returns nil if the value isn't a map or not map[string]float32
func (*Attr) MapFloat64 ¶
Returns the value as map[string]float64
Returns nil if the value isn't a map or not map[string]float64
func (*Attr) MapInt32 ¶
Returns the value as map[string]int32
Returns nil if the value isn't a map or not map[string]int32
func (*Attr) MapInt64 ¶
Returns the value as map[string]int64
Returns nil if the value isn't a map or not map[string]int64
func (*Attr) MapString ¶
Returns the value as map[string]string
Returns nil if the value isn't a map or not map[string]string
func (*Attr) MapUint32 ¶
Returns the value as map[string]uint32
Returns nil if the value isn't a map or not map[string]uint32
func (*Attr) MapUint64 ¶
Returns the value as map[string]uint64
Returns nil if the value isn't a map or not map[string]uint64
func (*Attr) MarshalJSON ¶
Convert the Attribute into JSON
func (*Attr) UnmarshalJSON ¶
Convert the JSON into a Attribute
type Attributes ¶
type Attributes struct {
// contains filtered or unexported fields
}
Attributes or Variables of an Object
func (*Attributes) Array ¶
func (a *Attributes) Array(key string) []any
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) ArrayBool ¶
func (a *Attributes) ArrayBool(key string) []bool
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) ArrayFloat32 ¶
func (a *Attributes) ArrayFloat32(key string) []float32
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) ArrayFloat64 ¶
func (a *Attributes) ArrayFloat64(key string) []float64
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) ArrayInt32 ¶
func (a *Attributes) ArrayInt32(key string) []int32
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) ArrayInt64 ¶
func (a *Attributes) ArrayInt64(key string) []int64
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) ArrayString ¶
func (a *Attributes) ArrayString(key string) []string
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) ArrayUint32 ¶
func (a *Attributes) ArrayUint32(key string) []uint32
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) ArrayUint64 ¶
func (a *Attributes) ArrayUint64(key string) []uint64
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) Bool ¶
func (a *Attributes) Bool(key string) bool
Obtain the value of the Attribute
Returns false on missing or Restricted (or if the value actually is false)
func (*Attributes) Complex ¶
func (a *Attributes) Complex(key string) (bool, bool)
Complex returns if the value of the Attribute is array or map (returning array or map as booleans)
Returns false and false on missing or Restricted (Or if the value isn't Complex)
func (*Attributes) Float32 ¶
func (a *Attributes) Float32(key string) float32
Obtain the value of the Attribute
Returns 0.0 on missing or Restricted (or if the value actually is 0.0)
func (*Attributes) Float64 ¶
func (a *Attributes) Float64(key string) float64
Obtain the value of the Attribute
Returns 0.0 on missing or Restricted (or if the value actually is 0.0)
func (*Attributes) Get ¶
func (a *Attributes) Get(key string) any
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually is nil)
func (*Attributes) Has ¶
func (a *Attributes) Has(key string) bool
Checks if the variable/attribute exists
Also validates the underlying attribute structure for nil cases
func (*Attributes) Int32 ¶
func (a *Attributes) Int32(key string) int32
Obtain the value of the Attribute
Returns 0 on missing or Restricted (or if the value actually is 0)
func (*Attributes) Int64 ¶
func (a *Attributes) Int64(key string) int64
Obtain the value of the Attribute
Returns 0 on missing or Restricted (or if the value actually is 0)
func (*Attributes) Map ¶
func (a *Attributes) Map(key string) map[string]any
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) MapBool ¶
func (a *Attributes) MapBool(key string) map[string]bool
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) MapFloat32 ¶
func (a *Attributes) MapFloat32(key string) map[string]float32
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) MapFloat64 ¶
func (a *Attributes) MapFloat64(key string) map[string]float64
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) MapInt32 ¶
func (a *Attributes) MapInt32(key string) map[string]int32
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) MapInt64 ¶
func (a *Attributes) MapInt64(key string) map[string]int64
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) MapString ¶
func (a *Attributes) MapString(key string) map[string]string
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) MapUint32 ¶
func (a *Attributes) MapUint32(key string) map[string]uint32
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) MapUint64 ¶
func (a *Attributes) MapUint64(key string) map[string]uint64
Obtain the value of the Attribute
Returns nil on missing or Restricted (or if the value actually isn't Complex)
func (*Attributes) MarshalJSON ¶
func (a *Attributes) MarshalJSON() ([]byte, error)
Converts Attriubtes into JSON
func (*Attributes) Private ¶
func (a *Attributes) Private(key string) bool
Client side can't change, but can read
func (*Attributes) Restricted ¶
func (a *Attributes) Restricted(key string) bool
Client side can't change nor read
func (*Attributes) Set ¶
func (a *Attributes) Set(key string, val any)
Assigns the attribute
Prevents assignment on Private and Restricted value under Client side
func (*Attributes) String ¶
func (a *Attributes) String(key string) string
Obtain the value of the Attribute
Returns empty on missing or Restricted (or if the value actually is empty)
func (*Attributes) Uint32 ¶
func (a *Attributes) Uint32(key string) uint32
Obtain the value of the Attribute
Returns 0 on missing or Restricted (or if the value actually is 0)
func (*Attributes) Uint64 ¶
func (a *Attributes) Uint64(key string) uint64
Obtain the value of the Attribute
Returns 0 on missing or Restricted (or if the value actually is 0)
func (*Attributes) UnmarshalJSON ¶
func (a *Attributes) UnmarshalJSON(data []byte) error
Converts JSON into Attributes
type Groups ¶
type Groups struct {
// contains filtered or unexported fields
}
Isolation layer for Objects
func (*Groups) Get ¶
Obtain the group's level
Returns the level or 0 for missing or Restricted groups
func (*Groups) Private ¶
Prevents the group from being changed Client side, but can be read Client side
func (*Groups) Restricted ¶
Prevents the group from being changed and read Client side
type Inventory ¶
type Inventory struct {
// contains filtered or unexported fields
}
func NewInventory ¶
func NewInventory() *Inventory
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
func NewTempObject ¶
func NewTempObject() *Object
func (*Object) HasActions ¶
func (*Object) HasAttributes ¶
func (*Object) HasInventory ¶
type Storage ¶
type Storage struct {
BaseDir string
}
func NewStorage ¶
func NewStorage() *Storage
func (*Storage) ActionLock ¶
func (*Storage) ActionLocked ¶
func (*Storage) ActionUnlock ¶
func (*Storage) AttrLocked ¶
func (*Storage) AttrUnlock ¶
func (*Storage) GetAttributes ¶
func (s *Storage) GetAttributes(id uint64) (*Attributes, error)