owparser

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

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

Go to latest
Published: Aug 20, 2018 License: MIT Imports: 8 Imported by: 0

README

haskaalo/owparser

Fast Overwatch Stats Parser for Golang

API docs: https://godoc.org/github.com/haskaalo/owparser

License

Copyright (c) 2018 Haskaalo

Licensed under MIT License

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidMode = errors.New("This mode doesn't exist")

ErrInvalidMode The mode provided doesn't exist

View Source
var Prestige = map[string]int{}/* 180 elements not displayed */

Prestige File name to prestige map From OWAPI made by SunDwarf https://github.com/SunDwarf/OWAPI

View Source
var RegexStatName = regexp.MustCompile(`[^a-zA-Z0-9]`)

RegexStatName Create a better JSON-looking key name for stats

View Source
var TimeReplacer = strings.NewReplacer(" ", "", "minutes", "m", "minute", "m", "hours", "h", "hour", "h", "seconds", "s", "second", "s")

TimeReplacer Replace Career profile hero time with a valid ParseDuration string format

Functions

This section is empty.

Types

type All

type All struct {
	*General
	QuickPlay   *Stats `json:"quickplay,omitempty"`
	Competitive *Stats `json:"competitive,omitempty"`
}

All stats together in one struct

type CareerProfile

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

CareerProfile ...

func NewCareerProfile

func NewCareerProfile(reader io.Reader) (*CareerProfile, error)

NewCareerProfile Get a CareerProfile struct from a Reader

func (*CareerProfile) NewAll

func (c *CareerProfile) NewAll() *All

NewAll Get all stats together

func (*CareerProfile) NewGeneral

func (c *CareerProfile) NewGeneral() *General

NewGeneral Get Data available even if account is private

func (*CareerProfile) NewStats

func (c *CareerProfile) NewStats(mode Mode) *Stats

NewStats Stats specific to a mode

type General

type General struct {
	Private  bool   `json:"private"`
	SR       int    `json:"rank,omitempty"`
	Prestige int    `json:"prestige"`
	Level    string `json:"level"`
	Portrait string `json:"portrait"`
}

General Data available even if account is private

type Mode

type Mode string

Mode stats

const (
	// Competitive specific stats
	Competitive Mode = "competitive"

	// QuickPlay specific stats
	QuickPlay Mode = "quickplay"
)

type Stats

type Stats struct {
	TimePlayed  map[string]float64                           `json:"timeplayed"`
	HeroList    []string                                     `json:"herolist"`
	CareerStats map[string]map[string]map[string]interface{} `json:"careerstats"`
}

Stats specific to a mode

Jump to

Keyboard shortcuts

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