Esempio n. 1
0
func GetGlobalStats(store store.DB) GlobalStats {
	db := store.Conn()

	gs := GlobalStats{}

	gs.Matches = getMatchCount(db)
	k, _, s := getKillSuicideDeathCount(db)

	gs.Frags = k
	gs.Suicides = s
	gs.Players = getUniquePlayersCount(db)
	gs.Maps = getUniqueMapsCount(db)
	gs.RocketsLaunched = getRocketsLaunchedCount(db)

	return gs

}
Esempio n. 2
0
func GetPlayerGlobaStats(store store.DB, player uint) *PlayerGlobalStats {
	db := store.Conn()

	pgs := PlayerGlobalStats{}
	pgs.Kills, pgs.Deaths, pgs.Suicides = getPlayerKillDeathSuicide(db,
		player)
	pgs.Matches = getPlayerMatches(db, player)
	pgs.Weapons = getPlayerWeapons(db, player)
	pgs.Items = getPlayerItems(db, player)
	if pgs.Matches != 0 {
		pgs.KillsPerMatch = float32(pgs.Kills) / float32(pgs.Matches)
	}

	if (pgs.Deaths + pgs.Suicides) != 0 {
		pgs.Efficiency = float32(pgs.Kills) / float32(pgs.Deaths+pgs.Suicides)
	}
	return &pgs
}