screepsws

package
v0.0.0-...-ed1cdfe Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalResponse

func UnmarshalResponse(data []byte, v interface{}) bool

Types

type CPUResponse

type CPUResponse struct {
	Response
	CPU    float64 `json:"cpu"`
	Memory float64 `json:"memory"`
}

type CodeResponse

type CodeResponse struct {
	Response
	Branch    string            `json:"branch"`
	World     string            `json:"world"`
	Modules   map[string]string `json:"modules"`
	Timestamp int               `json:"timestamp"`
	Hash      int               `json:"hash"`
}

type ConsoleResponse

type ConsoleResponse struct {
	Response
	Shard    string                      `json:"shard"`
	Messages screepstype.ConsoleMessages `json:"messages"`
}

type MemoryResponse

type MemoryResponse struct {
	Response
}

type MessageResponse

type MessageResponse struct {
	Response
	NewMessage  screepstype.NewMessage  `json:"newMessage"`
	MessageRead screepstype.MessageRead `json:"messageRead"`
}

type NewMessageResponse

type NewMessageResponse struct {
	Response
}

type RawRoomResponse

type RawRoomResponse struct {
	Response
	Flags   int                         `json:"flags"`
	Info    screepstype.RoomInfo        `json:"info"`
	Users   map[string]screepstype.User `json:"users"`
	Objects map[string]json.RawMessage  `json:"objects"`
}

type Response

type Response struct {
	Error string
}

type RoomMapResponse

type RoomMapResponse struct {
	Response
	Walls       [][]int `json:"w"`
	Roads       [][]int `json:"r"`
	PowerBanks  [][]int `json:"pb"`
	Portals     [][]int `json:"p"`
	Sources     [][]int `json:"s"`
	Controllers [][]int `json:"c"`
	Minerals    [][]int `json:"m"`
	KeeperLairs [][]int `json:"k"`
	UserObjects map[string][][]int
}

func (*RoomMapResponse) UnmarshalJSON

func (r *RoomMapResponse) UnmarshalJSON(b []byte) error

type RoomResponse

type RoomResponse struct {
	Response
	Flags       int                         `json:"flags"`
	Info        screepstype.RoomInfo        `json:"info"`
	Users       map[string]screepstype.User `json:"users"`
	Controllers map[string]screepstype.Controller
	Creeps      map[string]screepstype.Creep
	Energies    map[string]screepstype.Energy
	Extensions  map[string]screepstype.Extension
	Minerals    map[string]screepstype.Mineral
	Roads       map[string]screepstype.Road
	Sources     map[string]screepstype.Source
	Spawns      map[string]screepstype.Spawn
	Storages    map[string]screepstype.Storage
	Towers      map[string]screepstype.Tower
	Walls       map[string]screepstype.Wall
	Deltas      map[string]json.RawMessage
}

func (*RoomResponse) UnmarshalJSON

func (r *RoomResponse) UnmarshalJSON(b []byte) error

type ServerMessageResponse

type ServerMessageResponse struct {
	Response
}

type SetActiveBranchResponse

type SetActiveBranchResponse struct {
	Response
	Branch     string                 `json:"branch"`
	ActiveName screepstype.ActiveName `json:"branch"`
}

type WebSocket

type WebSocket interface {
	Close() error

	// Server
	SubscribeServerMessage() (<-chan ServerMessageResponse, error)
	UnsubscribeServerMessage() error

	// Room
	SubscribeRoom(shard, room string) (<-chan RoomResponse, error)
	UnsubscribeRoom(shard, room string) error
	SubscribeRoomMap(shard, room string) (<-chan RoomMapResponse, error)
	UnsubscribeRoomMap(shard, room string) error

	// User
	SubscribeCode(userID string) (<-chan CodeResponse, error)
	UnsubscribeCode(userID string) error
	SubscribeConsole(userID string) (<-chan ConsoleResponse, error)
	UnsubscribeConsole(userID string) error
	SubscribeCPU(userID string) (<-chan CPUResponse, error)
	UnsubscribeCPU(userID string) error
	SubscribeMemory(userID, path string) (<-chan MemoryResponse, error)
	UnsubscribeMemory(userID, path string) error
	SubscribeMessage(userID, respondentID string) (<-chan MessageResponse, error)
	UnsubscribeMessage(userID, respondentID string) error
	SubscribeMoney(userID string) (<-chan int, error)
	UnsubscribeMoney(userID string) error
	SubscribeNewMessage(userID string) (<-chan NewMessageResponse, error)
	UnsubscribeNewMessage(userID string) error
	SubscribeSetActiveBranch(userID string) (<-chan SetActiveBranchResponse, error)
	UnsubscribeSetActiveBranch(userID string) error
}

func NewWebSocket

func NewWebSocket(rawServerURL, token string) (WebSocket, error)

Jump to

Keyboard shortcuts

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