Documentation ¶
Index ¶
- Constants
- Variables
- func CreateCharacterFunc(p *Player, cmd string) (string, error)
- func GetPasswordFunc(p *Player, cmd string) (string, error)
- func GetUsernameFunc(p *Player, cmd string) (string, error)
- func InitDatabase()
- func NoValidCommand(p *Player, msg string) (string, error)
- func RenderCommandTemplate(path string, p interface{}) (string, error)
- type CmdFunc
- type Command
- type InitModeFunc
- type Mode
- type Player
- func (p *Player) CheckPassword(pwd string) bool
- func (p *Player) HandleMessage(msg string) (string, error)
- func (p *Player) Logout()
- func (p *Player) MergePlayer(op *Player)
- func (p *Player) RaceString() string
- func (p *Player) Save() error
- func (p *Player) ShortID() string
- func (p *Player) Start() string
- func (p *Player) String() string
- func (p *Player) SwitchModes(mode int, cmd ...string) string
- type Race
Constants ¶
View Source
const ( SplashMode = iota LoginUsernameMode LoginPasswordMode GameMode CreateCharacterMode )
View Source
const ( RaceNone = iota RaceEarther RaceLunite RaceBelter )
Variables ¶
View Source
var CommandTemplateCache = map[string]*template.Template{}
View Source
var Exited = errors.New("Player exited.")
View Source
var GameState = struct { sync.RWMutex Players map[string]*Player }{Players: make(map[string]*Player)}
View Source
var ModeTemplateCache = map[string]*template.Template{}
View Source
var UnknownMode = errors.New("No such mode exists.")
Functions ¶
func InitDatabase ¶
func InitDatabase()
func RenderCommandTemplate ¶
Types ¶
type Command ¶
func CreateCharacterCmd ¶
func CreateCharacterCmd() *Command
func NewQuitCmd ¶
func NewQuitCmd() *Command
type InitModeFunc ¶
type InitModeFunc func(*Player)
type Mode ¶
type Mode struct { Id int Name string Desc string DescTemplate string Cmds []*Command DefaultCmd CmdFunc InitCmd InitModeFunc }
func MustGetMode ¶
func NewCreateCharacterMode ¶
func NewCreateCharacterMode() *Mode
func NewGameMode ¶
func NewGameMode() *Mode
func NewLoginPasswordMode ¶
func NewLoginPasswordMode() *Mode
func NewLoginUsernameMode ¶
func NewLoginUsernameMode() *Mode
func NewSplashMode ¶
func NewSplashMode() *Mode
Click to show internal directories.
Click to hide internal directories.