net

package
v0.0.0-...-d5d5497 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchetypeMessage

type ArchetypeMessage struct {
	Result     string  `msgpack:"r,omitempty"`
	ResultCode int     `msgpack:"c,omitempty"`
	ID         id.UUID `msgpack:"i,omitempty"`
}

func (ArchetypeMessage) Type

func (m ArchetypeMessage) Type() string

type ArchetypesMessage

type ArchetypesMessage struct {
	Archetypes []game.Archetype `msgpack:"a,omitempty"`
	IDs        []id.UUID        `msgpack:"i,omitempty"`
}

func (ArchetypesMessage) MarshalMsgpack

func (m ArchetypesMessage) MarshalMsgpack() ([]byte, error)

MarshalMsgpack marshals a game.Archetype interface into a wrapper Msgpack object.

func (ArchetypesMessage) Type

func (m ArchetypesMessage) Type() string

func (*ArchetypesMessage) UnmarshalMsgpack

func (m *ArchetypesMessage) UnmarshalMsgpack(data []byte) error

UnmarshalMsgpack unmarshals a wrapper Msgpack object into a game.Archetype interface.

type CharactersMessage

type CharactersMessage struct {
	Characters []*game.Character `msgpack:"c,omitempty"`
}

func (CharactersMessage) Type

func (m CharactersMessage) Type() string

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(c *websocket.Conn) *Connection

func (*Connection) Close

func (conn *Connection) Close()

func (*Connection) Connect

func (conn *Connection) Connect() chan error

func (*Connection) Loop

func (conn *Connection) Loop() (chan Message, chan error)

func (*Connection) Write

func (conn *Connection) Write(m Message) error

type CreateCharacterMessage

type CreateCharacterMessage struct {
	Result     string  `msgpack:"r,omitempty"`
	ResultCode int     `msgpack:"c,omitempty"`
	Name       string  `msgpack:"n,omitempty"`
	Archetype  id.UUID `msgpack:"a,omitempty"`
}

func (CreateCharacterMessage) Type

func (m CreateCharacterMessage) Type() string

type CreateWorldMessage

type CreateWorldMessage struct {
	Result     string `msgpack:"r,omitempty"`
	ResultCode int    `msgpack:"c,omitempty"`
	Name       string `msgpack:"n,omitempty"`
	Password   string `msgpack:"p,omitempty"`
}

func (CreateWorldMessage) Type

func (m CreateWorldMessage) Type() string

type DeleteCharacterMessage

type DeleteCharacterMessage struct {
	Result     string `msgpack:"r,omitempty"`
	ResultCode int    `msgpack:"c,omitempty"`
	Name       string `msgpack:"n,omitempty"`
}

func (DeleteCharacterMessage) Type

func (m DeleteCharacterMessage) Type() string

type DesireMessage

type DesireMessage struct {
	Result     string             `msgpack:"r,omitempty"`
	ResultCode int                `msgpack:"c,omitempty"`
	WID        id.WID             `msgpack:"wid,omitempty"`
	Desire     game.DesireWrapper `msgpack:"d,omitempty"`
}

func (DesireMessage) Type

func (m DesireMessage) Type() string

type EventMessage

type EventMessage struct {
	Event game.EventWrapper `msgpack:"e,omitempty"`
}

func (EventMessage) Type

func (m EventMessage) Type() string

type EventsMessage

type EventsMessage struct {
	Events []game.EventWrapper `msgpack:"e,omitempty"`
}

func (EventsMessage) Type

func (m EventsMessage) Type() string

type InventoryMessage

type InventoryMessage struct {
	WID       id.WID        `msgpack:"wid,omitempty"`
	Inventory []game.Object `msgpack:"i,omitempty"`
}

func (InventoryMessage) Type

func (m InventoryMessage) Type() string

type JoinCharacterMessage

type JoinCharacterMessage struct {
	Result     string `msgpack:"r,omitempty"`
	ResultCode int    `msgpack:"c,omitempty"`
	Name       string `msgpack:"n,omitempty"`
}

func (JoinCharacterMessage) Type

func (m JoinCharacterMessage) Type() string

type JoinWorldMessage

type JoinWorldMessage struct {
	Result     string  `msgpack:"r,omitempty"`
	ResultCode int     `msgpack:"c,omitempty"`
	World      id.UUID `msgpack:"w,omitempty"`
	Password   string  `msgpack:"p,omitempty"`
}

func (JoinWorldMessage) Type

func (m JoinWorldMessage) Type() string

type LocationMessage

type LocationMessage struct {
	Result     string       `msgpack:"r,omitempty"`
	ResultCode int          `msgpack:"c,omitempty"`
	ID         id.UUID      `msgpack:"id,omitempty"`
	Objects    game.Objects `msgpack:"o,omitempty"`
	Cells      game.Cells   `msgpack:"g,omitempty"`
}

func (LocationMessage) Type

func (m LocationMessage) Type() string

type LoginMessage

type LoginMessage struct {
	User       string `msgpack:"u,omitempty"`
	Password   string `msgpack:"p,omitempty"`
	Result     string `msgpack:"r,omitempty"`
	ResultCode int    `msgpack:"c,omitempty"`
}

func (LoginMessage) Type

func (m LoginMessage) Type() string

type LogoutMessage

type LogoutMessage struct {
	Result     string `msgpack:"r,omitempty"`
	ResultCode int    `msgpack:"c,omitempty"`
}

func (LogoutMessage) Type

func (m LogoutMessage) Type() string

type Message

type Message interface {
	Type() string
}

type OwnerMessage

type OwnerMessage struct {
	WID       id.WID       `msgpack:"wid,omitempty"`
	Inventory game.Objects `msgpack:"i,omitempty"`
	Skills    game.Skills  `msgpack:"s,omitempty"`
}

func (OwnerMessage) Type

func (m OwnerMessage) Type() string

type PingMessage

type PingMessage struct {
}

func (PingMessage) Type

func (m PingMessage) Type() string

type RegisterMessage

type RegisterMessage struct {
	User       string `msgpack:"u,omitempty"`
	Password   string `msgpack:"p,omitempty"`
	Result     string `msgpack:"r,omitempty"`
	ResultCode int    `msgpack:"c,omitempty"`
}

func (RegisterMessage) Type

func (m RegisterMessage) Type() string

type SkillsMessage

type SkillsMessage struct {
	WID    id.WID      `msgpack:"wid,omitempty"`
	Skills game.Skills `msgpack:"s,omitempty"`
}

func (SkillsMessage) Type

func (m SkillsMessage) Type() string

type UnjoinCharacterMessage

type UnjoinCharacterMessage struct {
	Result     string `msgpack:"r,omitempty"`
	ResultCode int    `msgpack:"c,omitempty"`
}

func (UnjoinCharacterMessage) Type

func (m UnjoinCharacterMessage) Type() string

type WorldsMessage

type WorldsMessage struct {
	Result     string           `msgpack:"r,omitempty"`
	ResultCode int              `msgpack:"c,omitempty"`
	Worlds     []game.WorldInfo `msgpack:"w,omitempty"`
}

func (WorldsMessage) Type

func (m WorldsMessage) Type() string

type Wrapper

type Wrapper struct {
	Type string             `msgpack:"t"`
	Data msgpack.RawMessage `msgpack:"d"`
}

func (*Wrapper) Message

func (w *Wrapper) Message() Message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL