Documentation
¶
Index ¶
- func AppendText(message string, chatlog io.Writer)
- func BindRooms(room *Room, exit Exit, otherRooms ...*Room)
- func BindRoomsBidirectional(room *Room, exit Exit, otherRooms ...*Room)
- func ErrorBox(message string, app *tview.Application, back tview.Primitive)
- func FetchPlugin[T Plugin](engine *Akevitt) (*T, error)
- func FetchPluginUnsafe[T Plugin](engine *Akevitt) T
- func FilterByType[T any, TCollection any](collection []TCollection) []T
- func Find[T comparable](collection []T, value T) bool
- func FindByKey[TCollection, T comparable](collection []TCollection, selector func(key TCollection) T, value T) *TCollection
- func FindNeighboringRoomByName(currentRoom *Room, name string) (*Room, *Exit, error)
- func GetMapKeys[TKey comparable, TMap map[TKey]TValues, TValues any](m TMap) (keys []TKey)
- func GetMapValues[TKey comparable, TMap map[TKey]TResult, TResult any](m TMap) (values []TResult)
- func GetScriptName(command string) string
- func LogError(message string)
- func LogInfo(message string)
- func LogWarn(message string)
- func LookupOfType[T Object](room *Room) []T
- func MapSlice[T any, TResult any](l []T, callback func(v T) TResult) []TResult
- func NewEngine() *akevittBuilder
- func NewSessionScreen(s ssh.Session) (tcell.Screen, error)
- func PurgeDeadSessions(engine *Akevitt, callback ...DeadSessionFunc)
- func RemoveItem[T comparable](l []T, item T) []T
- func RemoveItemByIndex[T any](l []T, i int) []T
- func SplitCommand(command string) []string
- type Account
- type ActiveSession
- type Akevitt
- func (engine *Akevitt) AddCommand(command string, function CommandFunc)
- func (engine *Akevitt) AddInit(fn func(*Akevitt, *ActiveSession))
- func (engine *Akevitt) AddItem(item *Item)
- func (engine *Akevitt) AddNPC(npc *NPC)
- func (engine *Akevitt) AddRoom(room *Room) error
- func (engine *Akevitt) AddSessionDead(fn DeadSessionFunc)
- func (engine *Akevitt) ExecuteCommand(command string, session *ActiveSession) error
- func (engine *Akevitt) ExecuteLuaCommand(command string, session *ActiveSession) error
- func (engine *Akevitt) GetCommands() []string
- func (engine *Akevitt) GetItemByGUID(guid string) *Item
- func (engine *Akevitt) GetLuaVM() *LuaVM
- func (engine *Akevitt) GetNPCByGUID(guid string) *NPC
- func (engine *Akevitt) GetNPCByName(name string) *NPC
- func (engine *Akevitt) GetOnDeadSession() []DeadSessionFunc
- func (engine *Akevitt) GetRoom(key uint64) (*Room, error)
- func (engine *Akevitt) GetRoomByGUID(guid string) *Room
- func (engine *Akevitt) GetRoomByName(name string) *Room
- func (engine *Akevitt) GetSessions() Sessions
- func (engine *Akevitt) GetSpawnRoom() *Room
- func (engine *Akevitt) GlobalLookup(room *Room, name string) []Object
- func (engine *Akevitt) LoadLuaScript(path string) error
- func (engine *Akevitt) LoadLuaScriptsDir(dir string) error
- func (engine *Akevitt) ReloadLua() error
- func (engine *Akevitt) Run() error
- func (engine *Akevitt) SaveObject(object Object) error
- type CommandFunc
- type DatabasePlugin
- type DeadSessionFunc
- type Exit
- type Item
- type LuaVM
- func (vm *LuaVM) CallCommand(command string, session *ActiveSession) error
- func (vm *LuaVM) Close()
- func (vm *LuaVM) GetScript(name string) (*lua.LFunction, bool)
- func (vm *LuaVM) LoadScript(path string) error
- func (vm *LuaVM) LoadScriptsDir(dir string) error
- func (vm *LuaVM) Reload() error
- func (vm *LuaVM) SetEngine(engine *Akevitt)
- func (vm *LuaVM) SetScriptsPath(path string)
- type NPC
- type Object
- type ObjectImpl
- type Pair
- type Plugin
- type Room
- type Sessions
- type UIFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendText ¶
func BindRoomsBidirectional ¶
func FetchPlugin ¶
func FetchPluginUnsafe ¶
func FilterByType ¶
func Find ¶
func Find[T comparable](collection []T, value T) bool
func FindByKey ¶
func FindByKey[TCollection, T comparable](collection []TCollection, selector func(key TCollection) T, value T) *TCollection
func GetMapKeys ¶
func GetMapKeys[TKey comparable, TMap map[TKey]TValues, TValues any](m TMap) (keys []TKey)
func GetMapValues ¶
func GetMapValues[TKey comparable, TMap map[TKey]TResult, TResult any](m TMap) (values []TResult)
func GetScriptName ¶
func LookupOfType ¶
func PurgeDeadSessions ¶
func PurgeDeadSessions(engine *Akevitt, callback ...DeadSessionFunc)
func RemoveItem ¶
func RemoveItem[T comparable](l []T, item T) []T
func RemoveItemByIndex ¶
func SplitCommand ¶
Types ¶
type Account ¶
type Account struct {
ObjectImpl
Username string
Password string
PersistentData map[string]any
}
Account is a basic structure for storing credential information.
type ActiveSession ¶
type ActiveSession struct {
Account *Account
Application *tview.Application
Data map[string]any
RoomID string
}
func (*ActiveSession) Send ¶
func (session *ActiveSession) Send(message string)
func (*ActiveSession) SendLines ¶
func (session *ActiveSession) SendLines(lines ...string)
func (*ActiveSession) Sendf ¶
func (session *ActiveSession) Sendf(format string, args ...any)
type Akevitt ¶
type Akevitt struct {
// contains filtered or unexported fields
}
func (*Akevitt) AddCommand ¶
func (engine *Akevitt) AddCommand(command string, function CommandFunc)
func (*Akevitt) AddInit ¶
func (engine *Akevitt) AddInit(fn func(*Akevitt, *ActiveSession))
func (*Akevitt) AddSessionDead ¶
func (engine *Akevitt) AddSessionDead(fn DeadSessionFunc)
func (*Akevitt) ExecuteCommand ¶
func (engine *Akevitt) ExecuteCommand(command string, session *ActiveSession) error
func (*Akevitt) ExecuteLuaCommand ¶
func (engine *Akevitt) ExecuteLuaCommand(command string, session *ActiveSession) error
func (*Akevitt) GetCommands ¶
func (*Akevitt) GetItemByGUID ¶
func (*Akevitt) GetNPCByGUID ¶
func (*Akevitt) GetNPCByName ¶
func (*Akevitt) GetOnDeadSession ¶
func (engine *Akevitt) GetOnDeadSession() []DeadSessionFunc
func (*Akevitt) GetRoomByGUID ¶
func (*Akevitt) GetRoomByName ¶
func (*Akevitt) GetSessions ¶
func (*Akevitt) GetSpawnRoom ¶
func (*Akevitt) GlobalLookup ¶
func (*Akevitt) LoadLuaScript ¶
func (*Akevitt) LoadLuaScriptsDir ¶
func (*Akevitt) SaveObject ¶
type CommandFunc ¶
type CommandFunc = func(engine *Akevitt, session *ActiveSession, arguments string) error
type DatabasePlugin ¶
type DeadSessionFunc ¶
type DeadSessionFunc = func(deadSession *ActiveSession, liveSessions []*ActiveSession, engine *Akevitt)
type Exit ¶
type Exit struct {
Room *Room
Name string
OnPreEnter func(*Akevitt, *ActiveSession) error
}
func IsRoomReachable ¶
type Item ¶
type Item struct {
ObjectImpl
Properties map[string]any
}
type LuaVM ¶
type LuaVM struct {
L *lua.LState
// contains filtered or unexported fields
}
func (*LuaVM) CallCommand ¶
func (vm *LuaVM) CallCommand(command string, session *ActiveSession) error
func (*LuaVM) LoadScript ¶
func (*LuaVM) LoadScriptsDir ¶
func (*LuaVM) SetScriptsPath ¶
type NPC ¶
type NPC struct {
ObjectImpl
RoomID string
Dialogue string
OnInteract func(*Akevitt, *ActiveSession) error
}
type ObjectImpl ¶
func (*ObjectImpl) GetGUID ¶
func (o *ObjectImpl) GetGUID() string
func (*ObjectImpl) GetName ¶
func (o *ObjectImpl) GetName() string
type Room ¶
type Room struct {
ObjectImpl
Exits []*Exit
Objects []Object
OnPreEnter func(*Akevitt, *ActiveSession, *Exit) error
// contains filtered or unexported fields
}
func (*Room) Enter ¶
func (room *Room) Enter(engine *Akevitt, session *ActiveSession, targetExit *Exit) error
func (*Room) GetObjects ¶
func (*Room) RemoveObject ¶
type Sessions ¶
type Sessions = map[ssh.Session]*ActiveSession
Click to show internal directories.
Click to hide internal directories.