gioframework

package module
v0.0.0-...-e4bd1bf Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2017 License: MIT Imports: 4 Imported by: 1

README

gioframework

Framework for interacting with Generals.io

Documentation

Overview

gioframework document

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cell

type Cell struct {
	Armies  int
	Type    CellType
	Faction int
}

type CellType

type CellType int
const (
	Plain CellType = iota
	City
	General
)

type Client

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

func Connect

func Connect(server string, userid string, username string) (*Client, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) GetReplays

func (c *Client) GetReplays() []Replay

func (*Client) GetReplaysForUser

func (c *Client) GetReplaysForUser(userID string) []Replay

func (*Client) Join1v1

func (c *Client) Join1v1() *Game

func (*Client) JoinClassic

func (c *Client) JoinClassic() *Game

func (*Client) JoinCustomGame

func (c *Client) JoinCustomGame(ID string) *Game

func (*Client) JoinTeam

func (c *Client) JoinTeam(team string) *Game

func (*Client) Run

func (c *Client) Run() error

type Game

type Game struct {
	ID string

	QueueUpdate func(playercount, forcestartcount int)
	PreStart    func()
	Start       func(playerindex int, users []string)
	Update      func(update GameUpdate)
	Won         func()
	Lost        func()
	Chat        func(user int, message string)

	PlayerIndex int
	Width       int
	Height      int
	GameMap     []Cell

	TurnCount int

	Scores []struct {
		Armies int  `json:"total"`
		Tiles  int  `json:"tiles"`
		Index  int  `json:"i"`
		Dead   bool `json:"dead"`
	}
	// contains filtered or unexported fields
}

func (*Game) Attack

func (g *Game) Attack(from, to int, is50 bool)

func (*Game) GetAdjacents

func (g *Game) GetAdjacents(from int) (adjacent []int)

func (*Game) GetDistance

func (g *Game) GetDistance(from, to int) int

func (*Game) GetNeighborhood

func (g *Game) GetNeighborhood(from int) (adjacent []int)

func (*Game) QueueLength

func (g *Game) QueueLength() int

func (*Game) SendChat

func (g *Game) SendChat(msg string)

func (*Game) SetForceStart

func (g *Game) SetForceStart(start bool)

func (*Game) Walkable

func (g *Game) Walkable(cell int) bool

type GameUpdate

type GameUpdate struct {
	AttackIndex int   `json:"attackIndex"`
	CitiesDiff  []int `json:"cities_diff"`
	Generals    []int `json:"generals"`
	MapDiff     []int `json:"map_diff"`
	Scores      []struct {
		Armies int  `json:"total"`
		Tiles  int  `json:"tiles"`
		Index  int  `json:"i"`
		Dead   bool `json:"dead"`
	}
	Stars *[]float64 `json:"stars"`
	Turn  int        `json:"turn"`
}

type Ranking

type Ranking struct {
	Name  string  `json:"name"`
	Stars float64 `json:"stars"`
}

type Replay

type Replay struct {
	Type    string    `json:"type"`
	ID      string    `json:"id"`
	Started int64     `json:"started"`
	Turns   int       `json:"turns"`
	Ranking []Ranking `json:"ranking"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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