apollostats

package
v0.0.0-...-cdff568 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2016 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const CACHE_UPDATE = 60

Cache update every x minutes.

View Source
const MAX_ROWS = 200

Max rows DB will return for all queries.

View Source
const TIMEOUT = 30

DB connection timeout, in seconds.

View Source
const TIMEZONE_ADJUST = "EST"

Need to adjust time because the main server is running GMT-5.

View Source
const VERSION = "0.6"

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountItem

type AccountItem struct {
	ID        int64     `gorm:"column:id;primary_key"`
	Timestamp time.Time `gorm:"column:time"`
	CKey      string    `gorm:"column:ckey"`
	Item      string    `gorm:"column:item"`
}

func (*AccountItem) TableName

func (a *AccountItem) TableName() string

type Ban

type Ban struct {
	ID         int64     `gorm:"column:id;primary_key"`
	Timestamp  time.Time `gorm:"column:bantime"`
	CKey       string    `gorm:"column:ckey"`
	CID        string    `gorm:"column:computerid"`
	IP         string    `gorm:"column:ip"`
	BanType    string    `gorm:"column:bantype"`
	BannedJob  string    `gorm:"column:job"`
	Admin      string    `gorm:"column:a_ckey"`
	Reason     string    `gorm:"column:reason"`
	Duration   int64     `gorm:"column:duration"`
	Expiration time.Time `gorm:"column:expiration_time"`
}

func (*Ban) Ban

func (b *Ban) Ban() string

Return a nicely formatted ban type.

func (*Ban) Expires

func (b *Ban) Expires() string

Return a nicely formatted expire time, as a string.

func (*Ban) Message

func (b *Ban) Message() string

Clean up the ban reason and return a nicely formatted string instead.

func (*Ban) TableName

func (b *Ban) TableName() string

type Cache

type Cache struct {
	LatestRound *RoundStats
	GameStats   *Stats
	GameModes   []*GameMode
	Countries   []*Country
	LastUpdated time.Time
	UpdateTime  time.Duration
	// contains filtered or unexported fields
}

func NewCache

func NewCache(i *Instance) *Cache

type Character

type Character struct {
	ID                 int64  `gorm:"column:id"`
	CKey               string `gorm:"column:ckey"`
	Name               string `gorm:"column:name"`
	Gender             string `gorm:"column:gender"`
	BirthDate          string `gorm:"column:birth_date"`
	Species            string `gorm:"column:species"`
	HomeSystem         string `gorm:"column:home_system"`
	Citizenship        string `gorm:"column:citizenship"`
	Faction            string `gorm:"column:faction"`
	Religion           string `gorm:"column:religion"`
	NanotrasenRelation string `gorm:"column:nanotrasen_relation"`
	Department         int64  `gorm:"column:department"`
	Roles              string `gorm:"column:roles"`
	FlavorTextsHuman   string `gorm:"column:flavor_texts_human"`
	FlavorTextsRobot   string `gorm:"column:flavor_texts_robot"`
	EmpNotes           string `gorm:"column:gen_notes"`
	MedNotes           string `gorm:"column:med_notes"`
	SecNotes           string `gorm:"column:sec_notes"`
	EmpRecords         string `gorm:"column:gen_record"`
	MedRecords         string `gorm:"column:med_record"`
	SecRecords         string `gorm:"column:sec_record"`
	JobAntag           int64  `gorm:"column:job_antag"`
	ExploitRecords     string `gorm:"column:exploit_record"`
}

func (*Character) Flavor

func (c *Character) Flavor() string

func (*Character) NiceBirthDate

func (c *Character) NiceBirthDate() string

func (*Character) NiceDep

func (c *Character) NiceDep() string

func (*Character) NiceGender

func (c *Character) NiceGender() string

func (*Character) NiceName

func (c *Character) NiceName() string

func (*Character) Records

func (c *Character) Records() map[string]string

func (*Character) TableName

func (c *Character) TableName() string

func (*Character) UnlockedJobs

func (c *Character) UnlockedJobs() []string

type Country

type Country struct {
	ISOCode   string
	Name      string
	Continent string
	Hits      int64
}

func GeoLookup

func GeoLookup(players []*Player) ([]*Country, error)

type DB

type DB struct {
	*gorm.DB
}

func OpenDB

func OpenDB(DSN string, verbose bool) (*DB, error)

func (*DB) AllAccountItems

func (db *DB) AllAccountItems() []*AccountItem

func (*DB) AllDeaths

func (db *DB) AllDeaths() []*Death

func (*DB) AllGameModes

func (db *DB) AllGameModes() []*GameMode

func (*DB) AllPlayers

func (db *DB) AllPlayers() []*Player

func (*DB) AllRounds

func (db *DB) AllRounds() []*RoundStats

func (*DB) GetAILaws

func (db *DB) GetAILaws(id int64) []*RoundAILaws

func (*DB) GetAntags

func (db *DB) GetAntags(id int64) []*RoundAntags

func (*DB) GetCharacter

func (db *DB) GetCharacter(id int64) *Character

func (*DB) GetDeaths

func (db *DB) GetDeaths(id int64) []*Death

func (*DB) GetLatestRound

func (db *DB) GetLatestRound() *RoundStats

func (*DB) GetRound

func (db *DB) GetRound(id int64) *RoundStats

func (*DB) GetStats

func (db *DB) GetStats() *Stats

func (*DB) SearchBans

func (db *DB) SearchBans(ckey string) []*Ban

func (*DB) SearchCharacter

func (db *DB) SearchCharacter(species, name string) []*Character

type Death

type Death struct {
	ID        int64     `gorm:"column:id;primary_key"`
	RoundID   int64     `gorm:"column:round_id"`
	Timestamp time.Time `gorm:"column:tod"`
	Name      string    `gorm:"column:name"`
	Job       string    `gorm:"column:job"`
	Room      string    `gorm:"column:pod"`
	Position  string    `gorm:"column:coord"`
	Brute     int64     `gorm:"column:bruteloss"`
	Brain     int64     `gorm:"column:brainloss"`
	Fire      int64     `gorm:"column:fireloss"`
	Oxygen    int64     `gorm:"column:oxyloss"`
}

func (*Death) RoomName

func (d *Death) RoomName() string

Return a cleaned up room name.

func (*Death) TableName

func (d *Death) TableName() string

type GameMode

type GameMode struct {
	Title           string
	TotalRounds     int64
	AvgRounds       float64
	AvgDuration     float64
	AvgProductivity float64
	AvgDeaths       float64
	AvgAntagWins    float64
}

type GameModeSlice

type GameModeSlice []*GameMode

func (GameModeSlice) Len

func (m GameModeSlice) Len() int

func (GameModeSlice) Less

func (m GameModeSlice) Less(i, j int) bool

func (GameModeSlice) Swap

func (m GameModeSlice) Swap(i, j int)

type Instance

type Instance struct {
	Verbose bool
	DB      *DB
	// contains filtered or unexported fields
}

func (*Instance) Init

func (i *Instance) Init() error

func (*Instance) Serve

func (i *Instance) Serve(addr string) error

type NullWriter

type NullWriter struct {
}

Matches the Writer interface, it will do nothing when Write() is called.

func (*NullWriter) Write

func (w *NullWriter) Write(p []byte) (n int, err error)

Do nothing and return n=0 and err=nil.

type Player

type Player struct {
	ID   int64
	CKey string
	IP   string
}

func (*Player) TableName

func (p *Player) TableName() string

type RoundAILaws

type RoundAILaws struct {
	ID      int64  `gorm:"column:id"`
	RoundID int64  `gorm:"column:round_id"`
	Law     string `gorm:"column:law"`
}

func (*RoundAILaws) TableName

func (r *RoundAILaws) TableName() string

type RoundAntags

type RoundAntags struct {
	ID      int64  `gorm:"column:id"`
	RoundID int64  `gorm:"column:round_id"`
	Name    string `gorm:"column:name"`
	Job     string `gorm:"column:job"`
	Role    string `gorm:"column:role"`
	Success bool   `gorm:"column:success"`
}

func (*RoundAntags) TableName

func (r *RoundAntags) TableName() string

type RoundStats

type RoundStats struct {
	ID       int64     `gorm:"column:id"`
	GameMode string    `gorm:"column:game_mode"`
	EndTime  time.Time `gorm:"column:end_time"`
	Duration int64     `gorm:"column:duration"`

	Productivity    int64 `gorm:"column:productivity"`
	Deaths          int64 `gorm:"column:deaths"`
	Clones          int64 `gorm:"column:clones"`
	DispenseVolume  int64 `gorm:"column:dispense_volume"`
	BombsExploded   int64 `gorm:"column:bombs_exploded"`
	Vended          int64 `gorm:"column:vended"`
	RunDistance     int64 `gorm:"column:run_distance"`
	BloodMopped     int64 `gorm:"column:blood_mopped"`
	DamageCost      int64 `gorm:"column:damage_cost"`
	BreakTime       int64 `gorm:"column:break_time"`
	MonkeyDeaths    int64 `gorm:"column:monkey_deaths"`
	SpamBlocked     int64 `gorm:"column:spam_blocked"`
	PeopleSlipped   int64 `gorm:"column:people_slipped"`
	DoorsOpened     int64 `gorm:"column:doors_opened"`
	GunsFired       int64 `gorm:"column:guns_fired"`
	BeepskyBeatings int64 `gorm:"column:beepsky_beatings"`
	DoorsWelded     int64 `gorm:"column:doors_welded"`
	Totalkwh        int64 `gorm:"column:total_kwh"`
	Artifacts       int64 `gorm:"column:artifacts"`
	CargoProfit     int64 `gorm:"column:cargo_profit"`
	TrashVented     int64 `gorm:"column:trash_vented"`
	AIFollow        int64 `gorm:"column:ai_follow"`
	Banned          int64 `gorm:"column:banned"`
}

func (*RoundStats) TableName

func (r *RoundStats) TableName() string

type SpeciesCount

type SpeciesCount struct {
	TotalDiona      int64
	TotalHuman      int64
	TotalMachine    int64
	TotalNucleation int64
	TotalSkrell     int64
	TotalTajara     int64
	TotalUnathi     int64
	TotalVox        int64
	TotalWryn       int64
}

type Stats

type Stats struct {
	TotalAccountItems  int64
	TotalBans          int64
	AvgBans            float64
	TotalRounds        int64
	TotalDeaths        int64
	AvgDeaths          float64
	TotalRoundDuration float64
	AvgRoundDuration   float64
	TotalMonkeys       int64
	TotalDamages       int64
	TotalPlayers       int64
	TotalCharacters    int64
	Species            *SpeciesCount
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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