thronestats

package
v0.0.0-...-099c470 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: BSD-3-Clause, MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CHECK_FREQUENCY time.Duration = 5 * time.Second
View Source
var Characters = map[int]string{
	0:  "Random",
	1:  "Fish",
	2:  "Crystal",
	3:  "Eyes",
	4:  "Melting",
	5:  "Plant",
	6:  "Yung Venuz",
	7:  "Steroids",
	8:  "Robot",
	9:  "Chicken",
	10: "Rebel",
	11: "Horror",
	12: "Rogue",
	13: "Big Dog",
	14: "Skeleton",
	15: "Frog",
	16: "Cuz",
}
View Source
var Crowns = map[int]string{
	1:  "Bare Head",
	2:  "Crown of Death",
	3:  "Crown of Life",
	4:  "Crown of Haste",
	5:  "Crown of Guns",
	6:  "Crown of Hatred",
	7:  "Crown of Blood",
	8:  "Crown of Destiny",
	9:  "Crown of Love",
	10: "Crown of Risk",
	11: "Crown of Curses",
	12: "Crown of Luck",
	13: "Crown of Protection",
}
View Source
var DEFAULT_CHARACTER = -1
View Source
var DEFAULT_CROWN = -1
View Source
var DEFAULT_ENEMY = -1
View Source
var DEFAULT_ULTRA = 0
View Source
var Enemies = map[int]string{}/* 107 elements not displayed */
View Source
var Mutations = map[int]string{
	0:  "Heavy Heart",
	1:  "Rhino Skin",
	2:  "Extra Feet",
	3:  "Plutonium Hunger",
	4:  "Rabbit Paw",
	5:  "Throne Butt",
	6:  "Lucky Shot",
	7:  "Bloodlust",
	8:  "Gamma Guts",
	9:  "Second Stomach",
	10: "Back Muscle",
	11: "Scarier Face",
	12: "Euphoria",
	13: "Long Arms",
	14: "Boiling Veins",
	15: "Shotgun Shoulders",
	16: "Recycle Gland",
	17: "Laser Brain",
	18: "Last Wish",
	19: "Eagle Eyes",
	20: "Impact Wrists",
	21: "Bolt Marrow",
	22: "Stress",
	23: "Trigger Fingers",
	24: "Sharp Teeth",
	25: "Patience",
	26: "Hammer Head",
	27: "Strong Spirit",
	28: "Open Mind",
}
View Source
var Ultras = map[int]map[int]string{
	1: map[int]string{
		1: "Confiscate",
		2: "Gun Warrant",
	},
	2: map[int]string{
		1: "Fortress",
		2: "Juggernaut",
	},
	3: map[int]string{
		1: "Projectile Style",
		2: "Monster Style",
	},
	4: map[int]string{
		1: "Brain Capacity",
		2: "Detachment",
	},
	5: map[int]string{
		1: "Trapper",
		2: "Killer",
	},
	6: map[int]string{
		1: "Ima Gun God",
		2: "Back 2 Bizniz",
	},
	7: map[int]string{
		1: "Ambidextrous",
		2: "Get Loaded",
	},
	8: map[int]string{
		1: "Refined Taste",
		2: "Regurgitate",
	},
	9: map[int]string{
		1: "Harder to kill",
		2: "Determination",
	},
	10: map[int]string{
		1: "Personal Guard",
		2: "Riot",
	},
	11: map[int]string{
		1: "Stalker",
		2: "Anomaly",
		3: "Meltdown",
	},
	12: map[int]string{
		1: "Super Portal Strike",
		2: "Super Blast Armor",
	},
}
View Source
var Weapons = map[int]string{}/* 127 elements not displayed */

Functions

func GetCharacterIcon

func GetCharacterIcon(character int, bskin bool) string

func GetCrownIcon

func GetCrownIcon(crown int) string

func GetEnemyIcon

func GetEnemyIcon(enemy int) string

func GetMutationIcon

func GetMutationIcon(mutation int) string

func GetUltraIcon

func GetUltraIcon(character int, ultra int) string

func GetWeaponIcon

func GetWeaponIcon(weapon int) string

func HandleMessage

func HandleMessage(uuid uuid.UUID, messageContent []byte)

func IsIn

func IsIn(list []int, value int) bool

func RunServer

func RunServer(settings ServerSettings)

func SendGlobalStats

func SendGlobalStats(uuid uuid.UUID)

func SendHello

func SendHello(uuid uuid.UUID)

func SendToConnection

func SendToConnection(uuid uuid.UUID, data []byte)

func ToInt

func ToInt(value string) int

func Unsubscribe

func Unsubscribe(uuid uuid.UUID)

Types

type ApiResponse

type ApiResponse struct {
	Current  *ApiResponseRun `json:"current"`
	Previous *ApiResponseRun `json:"previous"`
}

func NewApiResponse

func NewApiResponse() *ApiResponse

func (*ApiResponse) ToRunData

func (ar *ApiResponse) ToRunData() *RunDataContainer

type ApiResponseRun

type ApiResponseRun struct {
	Character     int    `json:"char"`
	LastDamagedBy int    `json:"lasthit"`
	World         int    `json:"world"`
	Area          int    `json:"level"`
	Crown         int    `json:"crown"`
	Weapon1       int    `json:"wepA"`
	Weapon2       int    `json:"wepB"`
	BSkin         int    `json:"skin"`
	Ultra         int    `json:"ultra"`
	CharacterLvl  int    `json:"charlvl"`
	Loop          int    `json:"loops"`
	Win           bool   `json:"win"`
	Mutations     string `json:"mutations"`
	Kills         int    `json:"kills"`
	Health        int    `json:"health"`
	SteamId       int    `json:"steamid"`
	Type          string `json:"type"`
	Timestamp     int    `json:"timestamp"`
}

func NewApiResponseRun

func NewApiResponseRun() *ApiResponseRun

type ApiSubscriber

type ApiSubscriber struct {
	ClientUUID uuid.UUID
	SteamId64  string
	StreamKey  string
	// contains filtered or unexported fields
}

func NewApiSubscriber

func NewApiSubscriber(uuid uuid.UUID, steamId64 string, streamKey string) ApiSubscriber

func (*ApiSubscriber) SendMessage

func (as *ApiSubscriber) SendMessage(header string, content string, icon string)

func (*ApiSubscriber) Start

func (as *ApiSubscriber) Start()

func (*ApiSubscriber) Stop

func (as *ApiSubscriber) Stop()

type ConnectionWrapper

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

func (*ConnectionWrapper) Close

func (c *ConnectionWrapper) Close()

func (*ConnectionWrapper) Send

func (c *ConnectionWrapper) Send(data []byte)

type MessageIn

type MessageIn struct {
	Type      string `json:"type"`
	SteamId64 string `json:"steamId64"`
	StreamKey string `json:"streamKey"`
}

type MessageOut

type MessageOut struct {
	Type    string `json:"type"`
	Header  string `json:"header"`
	Content string `json:"content"`
	Icon    string `json:"icon"`
}

func (MessageOut) ToJson

func (m MessageOut) ToJson() []byte

type RunData

type RunData struct {
	Health        int
	BSkin         bool
	Character     int
	Crown         int
	Mutations     []int
	Weapons       []int
	Timestamp     int
	Kills         int
	Ultra         int
	LastDamagedBy int

	Area  int
	World int
	Loop  int
	Level string
}

func NewRunData

func NewRunData() *RunData

func (*RunData) Print

func (rd *RunData) Print()

func (*RunData) ReadFromApiResponseRun

func (rd *RunData) ReadFromApiResponseRun(arr *ApiResponseRun)

type RunDataContainer

type RunDataContainer struct {
	Current  *RunData
	Previous *RunData
}

func NewRunDataContainer

func NewRunDataContainer() *RunDataContainer

func (*RunDataContainer) ReadFromApiResponse

func (rdc *RunDataContainer) ReadFromApiResponse(ar *ApiResponse)

type RunStats

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

func NewRunStats

func NewRunStats() *RunStats

func (*RunStats) CrownChoice

func (rs *RunStats) CrownChoice(crown int) bool

func (*RunStats) Killed

func (rs *RunStats) Killed(causeOfDeath int, diedOnLevel string)

func (*RunStats) MutationChoice

func (rs *RunStats) MutationChoice(mutation int) bool

func (*RunStats) NewRun

func (rs *RunStats) NewRun(character int)

func (*RunStats) Reset

func (rs *RunStats) Reset()

func (*RunStats) UltraChoice

func (rs *RunStats) UltraChoice(ultra int) bool

func (*RunStats) UpdateStatsContainer

func (rs *RunStats) UpdateStatsContainer(sc *StatsContainer)

func (*RunStats) WeaponPickup

func (rs *RunStats) WeaponPickup(weapon int) bool

type ServerSettings

type ServerSettings struct {
	ListenAddress string `yaml:"listen_address"`
	ListenPort    int    `yaml:"listen_port"`
	WwwPath       string `yaml:"www_path"`
}

func GetServerSettings

func GetServerSettings() ServerSettings

func (*ServerSettings) ToYaml

func (s *ServerSettings) ToYaml() []byte

type StatsContainer

type StatsContainer struct {
	SteamId64 string   `json:"-"`
	Loaded    bool     `json:"-"`
	Running   bool     `json:"-"`
	RunStats  RunStats `json:"-"`
	Runs      int      `json:"runs"`

	Characters      map[string]int            `json:"characters"`
	CausesOfDeath   map[string]int            `json:"causesOfDeath"`
	MutationChoices map[string]int            `json:"mutationChoices"`
	WeaponChoices   map[string]int            `json:"weaponChoices"`
	CrownChoices    map[string]int            `json:"crownChoices"`
	UltraChoices    map[string]map[string]int `json:"ultraChoices"`

	DeathsByLevel map[string]int `json:"deathsByLevel"`

	MostPopularWeapon      string `json:"mostPopularWeapon"`
	MostCommonCauseOfDeath string `json:"mostCommonCauseOfDeath"`
	MostPopularMutation    string `json:"mostPopularMutation"`
	MostPopularCrown       string `json:"mostPopularCrown"`
	MostPopularCharacter   string `json:"mostPopularCharacter"`
	MostCommonDeathLevel   string `json:"mostCommonDeathLevel"`
}
var GlobalStats *StatsContainer

func NewStatsContainer

func NewStatsContainer(steamId64 string) *StatsContainer

func (*StatsContainer) EndRun

func (rs *StatsContainer) EndRun()

func (*StatsContainer) GetCauseOfDeathRate

func (sc *StatsContainer) GetCauseOfDeathRate(enemy int) string

func (*StatsContainer) GetCharacterRate

func (sc *StatsContainer) GetCharacterRate(character int, extra int) string

func (*StatsContainer) GetCrownRate

func (sc *StatsContainer) GetCrownRate(mutation int, extra int) string

func (*StatsContainer) GetLevelDeathRate

func (sc *StatsContainer) GetLevelDeathRate(level string) string

func (*StatsContainer) GetMutationRate

func (sc *StatsContainer) GetMutationRate(mutation int, extra int) string

func (*StatsContainer) GetUltraRate

func (sc *StatsContainer) GetUltraRate(character int, ultra int, extra int) string

func (*StatsContainer) GetWeaponRate

func (sc *StatsContainer) GetWeaponRate(weapon int, extra int) string

func (*StatsContainer) Save

func (sc *StatsContainer) Save()

func (*StatsContainer) ToJson

func (sc *StatsContainer) ToJson() []byte

func (*StatsContainer) UpdateStats

func (sc *StatsContainer) UpdateStats()

Jump to

Keyboard shortcuts

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