Documentation ¶
Index ¶
- Variables
- func Boxed(p []byte, width int) []byte
- func Center(p interface{}) []byte
- func CenterIn(p []byte, width int) []byte
- func Decode(v interface{}, m *Message) error
- func Indent(p interface{}) []byte
- type Area
- type Areas
- type Bot
- type BufIO
- type Character
- type Characters
- type CharactersMap
- type Client
- type Decoder
- type Direction
- type Encoder
- type Event
- type EventApproach
- type EventDisconnect
- type EventGoAway
- type EventInventoryUpdate
- type EventJoin
- type EventJoinGame
- type EventLeave
- type EventLook
- type EventMove
- type EventPickup
- type EventSay
- type EventStopGame
- type Game
- type GobProtocol
- type IO
- type Ident
- type Inventory
- type IsBot
- type Item
- type Items
- type Long
- type Message
- type Name
- type Nav
- type Player
- type Position
- type Protocol
- type RWCache
- type Server
- type Short
- type StdIO
- type Task
- type TextFormat
- type Tile
- type Tiles
- type Title
- type Transceiver
- type Transmitter
- type UI
- func (me *UI) CID() Ident
- func (me *UI) CharacterName() Name
- func (u *UI) Do(v string)
- func (u *UI) DoWait(v, duration string)
- func (u *UI) HandleEvent(e interface{})
- func (me *UI) OtherPlayer(name Name, text string)
- func (me *UI) OtherPlayerSays(name Name, text string)
- func (me *UI) Print(v ...interface{}) (int, error)
- func (me *UI) Printf(format string, v ...interface{}) (int, error)
- func (me *UI) Println(v ...interface{}) (int, error)
- func (u *UI) Run(ctx context.Context) error
- func (u *UI) ShowIntro()
- func (me *UI) Use(c *Client)
- func (me *UI) Write(p []byte) (int, error)
- func (u *UI) WritePrompt()
- type World
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultTextFormat = &TextFormat{
cols: 72,
}
Functions ¶
Types ¶
type Character ¶
type Characters ¶
type CharactersMap ¶
func NewCharactersMap ¶
func NewCharactersMap() *CharactersMap
func (*CharactersMap) Add ¶
func (me *CharactersMap) Add(c *Character)
func (*CharactersMap) At ¶
func (me *CharactersMap) At(p Position) []*Character
func (*CharactersMap) Len ¶
func (me *CharactersMap) Len() int
func (*CharactersMap) Remove ¶
func (me *CharactersMap) Remove(id Ident)
type EventApproach ¶ added in v0.4.0
type EventApproach struct {
Name
}
when character enters a tile
type EventDisconnect ¶ added in v0.3.0
type EventDisconnect struct { // set by server Ident }
type EventGoAway ¶ added in v0.4.0
type EventGoAway struct {
Name
}
type EventInventoryUpdate ¶ added in v0.5.0
type EventInventoryUpdate struct {
*Inventory
}
type EventJoinGame ¶ added in v0.5.0
type EventLeave ¶
type EventMove ¶ added in v0.3.0
type EventMove struct { Direction // set by server Ident // set by game Position Title // of the area *Tile Body []byte }
Your character EventMove in the game
type EventPickup ¶ added in v0.5.0
type EventStopGame ¶
type EventStopGame struct{}
type Game ¶
type Game struct { World Characters MaxTasks int LogAllEvents bool logger.Logger // contains filtered or unexported fields }
func (*Game) AffectGame ¶ added in v0.2.0
type GobProtocol ¶
type GobProtocol struct{}
Protocol used over the wire
func (*GobProtocol) NewDecoder ¶
func (me *GobProtocol) NewDecoder(r io.Reader) Decoder
func (*GobProtocol) NewEncoder ¶
func (me *GobProtocol) NewEncoder(w io.Writer) Encoder
type IO ¶
type IO io.ReadWriter
type Inventory ¶ added in v0.5.0
type Inventory struct {
Items
}
func NewInventory ¶ added in v0.5.0
func NewInventory() *Inventory
type Message ¶
Message is for transferring events between client and server using encoding/gob
func NewMessage ¶
func (*Message) CheckError ¶
type RWCache ¶
type RWCache struct { io.ReadWriter LastRead []byte LastWrite []byte }
func NewRWCache ¶
func NewRWCache(rw io.ReadWriter) *RWCache
type Server ¶
type Task ¶
type Task struct { Event // contains filtered or unexported fields }
type TextFormat ¶ added in v0.4.0
type TextFormat struct {
// contains filtered or unexported fields
}
func (*TextFormat) Center ¶ added in v0.4.0
func (f *TextFormat) Center(p []byte) []byte
func (*TextFormat) Indent ¶ added in v0.4.0
func (f *TextFormat) Indent(p []byte) []byte
func (*TextFormat) Prefix ¶ added in v0.4.0
func (f *TextFormat) Prefix(p []byte) []byte
type Transceiver ¶
func NewTransceiver ¶
func NewTransceiver(rw io.ReadWriter, proto Protocol) *Transceiver
func (*Transceiver) Receive ¶
func (me *Transceiver) Receive(v any) error
func (*Transceiver) Transmit ¶
func (me *Transceiver) Transmit(v any) error
type Transmitter ¶
type UI ¶
type UI struct { logger.Logger // cache last input/output to simplify tests IO *RWCache *Character Location string // used in prompt // contains filtered or unexported fields }
func (*UI) CharacterName ¶ added in v0.4.0
func (*UI) HandleEvent ¶ added in v0.2.0
func (u *UI) HandleEvent(e interface{})
func (*UI) WritePrompt ¶
func (u *UI) WritePrompt()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.