sc2replaystats

package
v0.0.0-...-b20e1e0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	APIKey string
	// contains filtered or unexported fields
}

func (*API) LastReplay

func (api *API) LastReplay() (Replay, error)

func (*API) Player

func (api *API) Player(playerId int) (Player, error)

func (*API) Replay

func (api *API) Replay(id int) (Replay, error)

func (*API) Verify

func (api *API) Verify() bool

type Clan

type Clan struct {
	Id   int    `json:"clans_id"`
	Name string `json:"clan_name"`
	Tag  string `json:"clan_tag"`
}

type GameLength

type GameLength struct {
	time.Duration
}

func (*GameLength) UnmarshalJSON

func (gameLength *GameLength) UnmarshalJSON(b []byte) error

type GameType

type GameType int
const (
	AutoMM GameType = iota
	AutoMMAI
	AutoMMArchon
	Private
)

func (GameType) String

func (gameType GameType) String() string

func (*GameType) UnmarshalJSON

func (gameType *GameType) UnmarshalJSON(b []byte) error

type Player

type Player struct {
	Id           int    `json:"players_id"`
	Name         string `json:"players_name"`
	BattleNetURL string `json:"battle_net_url"`
	Clan         Clan   `json:"clan"`
}

type PlayerColor

type PlayerColor color.RGBA

func (*PlayerColor) UnmarshalJSON

func (playerColor *PlayerColor) UnmarshalJSON(data []byte) error

type Race

type Race int
const (
	Protoss Race = iota
	Terran
	Zerg
)

func (Race) Shorthand

func (race Race) Shorthand() string

func (Race) String

func (race Race) String() string

func (*Race) UnmarshalJSON

func (race *Race) UnmarshalJSON(b []byte) error

type Replay

type Replay struct {
	ReplayURL     string         `json:"replay_url"`
	ReplayID      int            `json:"replay_id"`
	MapName       string         `json:"map_name"`
	Format        string         `json:"format"`
	GameType      GameType       `json:"game_type"`
	GameLength    GameLength     `json:"game_length"`
	WinningPlayer string         `json:"winning_player"`
	Players       []ReplayPlayer `json:"players"`
	SeasonId      int            `json:"seasons_id"`
	ReplayDate    time.Time      `json:"replay_date"`
	ReplayVersion string         `json:"replay_version"`
}

func (*Replay) PlayersByTeam

func (replay *Replay) PlayersByTeam() map[int][]ReplayPlayer

func (*Replay) Winner

func (replay *Replay) Winner() *ReplayPlayer

type ReplayPlayer

type ReplayPlayer struct {
	ID         int         `json:"players_id"`
	ClanTag    string      `json:"clan"`
	Race       Race        `json:"race"`
	Mmr        int         `json:"mmr"`
	Division   string      `json:"division"`
	ServerRank int         `json:"server_rank"`
	GlobalRank int         `json:"global_rank"`
	Apm        int         `json:"apm"`
	Team       int         `json:"team"`
	Winner     SC2RBool    `json:"winner"`
	Color      PlayerColor `json:"color"`
	Player     Player      `json:"player"` /* Only present in `/account/last-replay` endpoint */
}

type SC2RBool

type SC2RBool bool

SC2Replaystats uses `0` for false, `1` for true. Using a custom type allows us to have a custom UnmarshalJSON method.

func (*SC2RBool) UnmarshalJSON

func (winner *SC2RBool) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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