Documentation ¶
Index ¶
- Variables
- func GetSteamName(steamid uint64) (string, error)
- func LoginHandler(w http.ResponseWriter, r *http.Request)
- func LogoutHandler(w http.ResponseWriter, r *http.Request)
- type Config
- type DBdatas
- type GameServerData
- func (g *GameServerData) Create(userid int, displayname string, ipstring string, port int, rconpassword string, ...) *GameServerData
- func (g *GameServerData) GetDisplay() string
- func (g *GameServerData) GetHostPort() string
- func (g *GameServerData) SendRcon(cmd string) (string, error)
- func (g *GameServerData) TableName() string
- type GetPlayerData
- type MapStatsData
- type MatchData
- func (m *MatchData) Create(userid int64, team1id int64, team2id int64, team1string string, ...) *MatchData
- func (m *MatchData) Finalized() bool
- func (m *MatchData) Finished() bool
- func (m *MatchData) GetCurrentScore(g *gorm.DB) (int, int)
- func (m *MatchData) GetLoser() (TeamData, error)
- func (m *MatchData) GetMapStat() ([]MapStatsData, error)
- func (m *MatchData) GetServer() GameServerData
- func (m *MatchData) GetStatusString(ShowWinner bool) (string, error)
- func (m *MatchData) GetTeam1() (TeamData, error)
- func (m *MatchData) GetTeam2() (TeamData, error)
- func (m *MatchData) GetUser() UserData
- func (m *MatchData) GetVSString() (string, error)
- func (m *MatchData) GetWinner() (TeamData, error)
- func (m *MatchData) Live() bool
- func (m *MatchData) Pending() bool
- func (m *MatchData) TableName() string
- type MatchPageData
- type MatchesPageData
- type MetricsData
- type MetricsDataPage
- type MyserversPageData
- type PlayerStatsData
- func (p *PlayerStatsData) GetADR() float64
- func (p *PlayerStatsData) GetFPR() float64
- func (p *PlayerStatsData) GetHSP() float64
- func (p *PlayerStatsData) GetKDR() float64
- func (p *PlayerStatsData) GetRating() float64
- func (p *PlayerStatsData) GetSteamURL() string
- func (p *PlayerStatsData) TableName() string
- type TeamCreatePageData
- type TeamData
- func (t *TeamData) CanDelete(userid int) bool
- func (t *TeamData) CanEdit(userid int) bool
- func (t *TeamData) Create(userid int, name string, tag string, flag string, logo string, auths []byte, ...) *TeamData
- func (t *TeamData) GetFlagHTML(scale float64) string
- func (t *TeamData) GetLogoHTML(scale float64) string
- func (t *TeamData) GetLogoOrFlagHTML(scale float64, otherteam TeamData) string
- func (t *TeamData) GetNameURLHtml() string
- func (t *TeamData) GetPlayers() ([]GetPlayerData, error)
- func (t *TeamData) GetRecentMatches(limit int) []MatchData
- func (t *TeamData) GetURL() string
- func (t *TeamData) GetVSMatchResult(matchid int) (string, error)
- func (t *TeamData) SetData(name string, tag string, flag string, logo string, auths []byte, ...) *TeamData
- func (t *TeamData) TableName() string
- type TeamPageData
- type TeamsPageData
- type UserData
- type UserPageData
Constants ¶
This section is empty.
Variables ¶
var ( // SteamAPIKey Steam Web API Key for accessing Steam API. SteamAPIKey = "" // DefaultPage Default page where player access root directly. DefaultPage string // SQLAccess SQL Access Object for MySQL and GORM things SQLAccess DBdatas // Cnf Configration Data Cnf Config // Sess Session Sess *sessions.Sessions )
Functions ¶
func GetSteamName ¶
GetSteamName Get steam profile name by steamid64 via Steam web API
func LoginHandler ¶
func LoginHandler(w http.ResponseWriter, r *http.Request)
LoginHandler HTTP Handler for /login page.
func LogoutHandler ¶
func LogoutHandler(w http.ResponseWriter, r *http.Request)
LogoutHandler HTTP Handler for /logout
Types ¶
type Config ¶
type Config struct { SteamAPIKey string DefaultPage string SQLHost string SQLUser string SQLPass string SQLPort int SQLDBName string HOST string }
Config Configration Struct for config.ini
type GameServerData ¶
type GameServerData struct { ID int `gorm:"primary_key;column:id;AUTO_INCREMENT;NOT NULL"` UserID int `gorm:"column:user_id;DEFAULT NULL"` InUse bool `gorm:"column:in_use;DEFAULT NULL"` IPString string `gorm:"column:ip_string;DEFAULT NULL"` Port int `gorm:"column:port;DEFAULT NULL"` RconPassword string `gorm:"column:rcon_password;DEFAULT NULL"` DisplayName string `gorm:"column:display_name;DEFAULT NULL"` PublicServer bool `gorm:"column:public_server;DEFAULT NULL"` User UserData `gorm:"ASSOCIATION_FOREIGNKEY:user_id"` }
GameServerData Struct for game_server table.
func (*GameServerData) Create ¶
func (g *GameServerData) Create(userid int, displayname string, ipstring string, port int, rconpassword string, publicserver bool) *GameServerData
Create Register GameServer into DB. not implemented yet.
func (*GameServerData) GetDisplay ¶
func (g *GameServerData) GetDisplay() string
GetDisplay Returns "DisplayName" if its not empty. otherwise it returns address and port.
func (*GameServerData) GetHostPort ¶
func (g *GameServerData) GetHostPort() string
GetHostPort gets gameserver addr and port. e.g. localhost:27015
func (*GameServerData) SendRcon ¶
func (g *GameServerData) SendRcon(cmd string) (string, error)
SendRcon Sends Remote-Commands to server.
func (*GameServerData) TableName ¶
func (g *GameServerData) TableName() string
TableName declairation for GORM
type GetPlayerData ¶
type GetPlayerData struct {
Auth string
}
GetPlayerData Struct for GetPlayers() function.
type MapStatsData ¶
type MapStatsData struct { ID int `gorm:"primary_key" gorm:"column:id"` MatchID int `gorm:"column:match_id" gorm:"ForeignKey:match_id"` MapNumber int `gorm:"column:map_number"` MapName string `gorm:"column:map_name"` StartTime sql.NullTime `gorm:"column:start_time"` EndTime sql.NullTime `gorm:"column:end_time"` Winner int `gorm:"column:winner"` Team1Score int `gorm:"column:team1_score"` Team2Score int `gorm:"column:team2_score"` User UserData `gorm:"ASSOCIATION_FOREIGNKEY:user_id"` }
MapStatsData MapStatsData struct for map_stats table.
func (*MapStatsData) TableName ¶
func (m *MapStatsData) TableName() string
TableName declairation for GORM
type MatchData ¶
type MatchData struct { ID int64 `gorm:"primary_key;column:id" json:"id"` UserID int64 `gorm:"column:user_id" json:"user_id"` ServerID int64 `gorm:"column:server_id" json:"-"` Team1ID int64 `gorm:"column:team1_id" json:"team1_id"` Team2ID int64 `gorm:"column:team2_id" json:"team2_id"` Winner sql.NullInt64 `gorm:"column:winner" json:"winner"` Cancelled bool `gorm:"column:cancelled" json:"cancelled"` StartTime sql.NullTime `gorm:"column:start_time" json:"start_time"` EndTime sql.NullTime `gorm:"column:end_time" json:"end_time"` MaxMaps int `gorm:"column:max_maps" json:"max_maps"` Title string `gorm:"column:title" json:"title"` SkipVeto bool `gorm:"column:skip_veto" json:"skip_veto"` APIKey string `gorm:"column:api_key" json:"-"` VetoMapPool string `gorm:"column:veto_mappool" json:"veto_mappool"` Team1Score int `gorm:"column:team1_score" json:"team1_score"` Team2Score int `gorm:"column:team2_score" json:"team2_score"` Team1String string `gorm:"column:team1_string" json:"team1_string"` Team2String string `gorm:"column:team2_string" json:"team2_string"` Forfeit bool `gorm:"column:forfeit" json:"forfeit"` PluginVersion string `gorm:"column:plugin_version" json:"-"` MapStats []MapStatsData `json:"-"` Server GameServerData `json:"-"` User UserData `gorm:"ASSOCIATION_FOREIGNKEY:user_id" json:"-"` }
MatchData Struct for match table.
func (*MatchData) Create ¶
func (m *MatchData) Create(userid int64, team1id int64, team2id int64, team1string string, team2string string, maxmaps int, skipveto bool, title string, vetomappool string, serverid int64) *MatchData
Create Register Match information into DB. not implemented yet
func (*MatchData) GetCurrentScore ¶
GetCurrentScore Returns current match score. returns map-score if match is BO1.
func (*MatchData) GetMapStat ¶
func (m *MatchData) GetMapStat() ([]MapStatsData, error)
GetMapStat Gets each map stat data as "MapStatsData" struct array.
func (*MatchData) GetServer ¶
func (m *MatchData) GetServer() GameServerData
GetServer Get match server ID as GameServerData
func (*MatchData) GetStatusString ¶
GetStatusString Get match status as string. for gorazor template
func (*MatchData) GetVSString ¶
GetVSString Get Match VS information as string. for gorazor template
type MatchPageData ¶
MatchPageData Struct for /match/{matchID} page.
type MatchesPageData ¶
type MatchesPageData struct { LoggedIn bool UserName string UserID int Matches []MatchData AllMatches bool MyMatches bool Owner UserData }
MatchesPageData Struct for /matches/ page.
type MetricsData ¶
type MetricsData struct { RegisteredUsers int `json:"users"` SavedTeams int `json:"saved_teams"` MatchesCreated int `json:"matches_created"` CompletedMatches int `json:"completed_matches"` ServersAdded int `json:"servers_added"` MapsWithStatsSaved int `json:"maps_with_stats"` UniquePlayers int `json:"unique_players"` }
MetricsData Struct metrics analysys.
type MetricsDataPage ¶
type MetricsDataPage struct { LoggedIn bool Data MetricsData }
MetricsDataPage Struct for /metrics page.
type MyserversPageData ¶
type MyserversPageData struct { Servers []GameServerData LoggedIn bool }
MyserversPageData Struct for /myservers page.
type PlayerStatsData ¶
type PlayerStatsData struct { ID int `gorm:"primary_key;column:id"` MatchID int `gorm:"column:match_id"` MapID int `gorm:"column:map_id"` TeamID int `gorm:"column:team_id"` SteamID string `gorm:"column:steam_id;unique"` Name string `gorm:"column:name"` Kills int `gorm:"column:kills"` Deaths int `gorm:"column:deaths"` Roundsplayed int `gorm:"column:roundsplayed"` Assists int `gorm:"column:assists"` FlashbangAssists int `gorm:"column:flashbang_assists"` Teamkills int `gorm:"column:teamkills"` Suicides int `gorm:"column:suicides"` HeadshotKills int `gorm:"column:headshot_kills"` Damage int64 `gorm:"column:damage"` BombPlants int `gorm:"column:bomb_plants"` BombDefuses int `gorm:"column:bomb_defuses"` V1 int `gorm:"column:v1"` V2 int `gorm:"column:v2"` V3 int `gorm:"column:v3"` V4 int `gorm:"column:v4"` V5 int `gorm:"column:v5"` K1 int `gorm:"column:k1"` K2 int `gorm:"column:k2"` K3 int `gorm:"column:k3"` K4 int `gorm:"column:k4"` K5 int `gorm:"column:k5"` FirstdeathCT int `gorm:"column:firstdeath_Ct"` FirstdeathT int `gorm:"column:firstdeath_t"` FirstkillCT int `gorm:"column:firstkill_ct"` FirstkillT int `gorm:"column:firstkill_t"` User UserData `gorm:"ASSOCIATION_FOREIGNKEY:user_id"` }
PlayerStatsData Player stats data struct for player_stats table.
func (*PlayerStatsData) GetADR ¶
func (p *PlayerStatsData) GetADR() float64
GetADR Returns player's ADR(Average Damage per Round).
func (*PlayerStatsData) GetFPR ¶
func (p *PlayerStatsData) GetFPR() float64
GetFPR Returns player's FPR(Frags Per Round).
func (*PlayerStatsData) GetHSP ¶
func (p *PlayerStatsData) GetHSP() float64
GetHSP Returns player's HSP(HeadShot Percentage).
func (*PlayerStatsData) GetKDR ¶
func (p *PlayerStatsData) GetKDR() float64
GetKDR Returns player's KDR(Kill/Deaths Ratio).
func (*PlayerStatsData) GetRating ¶
func (p *PlayerStatsData) GetRating() float64
GetRating Get player's rating. Average datas are static tho.
func (*PlayerStatsData) GetSteamURL ¶
func (p *PlayerStatsData) GetSteamURL() string
GetSteamURL get player's Steam community URL by their steamid64.
func (*PlayerStatsData) TableName ¶
func (p *PlayerStatsData) TableName() string
TableName declairation for GORM
type TeamCreatePageData ¶
type TeamCreatePageData struct { LoggedIn bool Edit bool Content interface{} // should be template }
TeamCreatePageData Struct for /team/create page.
type TeamData ¶
type TeamData struct { ID int `gorm:"primary_key;column:id" json:"id"` UserID int `gorm:"column:user_id" json:"user_id"` Name string `gorm:"column:name" json:"name"` Tag string `gorm:"column:tag" json:"tag"` Flag string `gorm:"column:flag" json:"flag"` Logo string `gorm:"column:logo" json:"logo"` AuthsPickle []byte `gorm:"column:auths" json:"-"` Auths []string `json:"auths"` // converts pickle []byte to []string Players []PlayerStatsData `gorm:"-" json:"-"` PublicTeam bool `gorm:"column:public_team" json:"public_team"` User UserData `gorm:"ASSOCIATION_FOREIGNKEY:user_id" json:"-"` }
TeamData Struct for team table.
func (*TeamData) Create ¶
func (t *TeamData) Create(userid int, name string, tag string, flag string, logo string, auths []byte, publicteam bool) *TeamData
Create Register Team information into DB. not implemented.
func (*TeamData) GetFlagHTML ¶
GetFlagHTML Get team's flag as a HTML string. for gorazor template
func (*TeamData) GetLogoHTML ¶
GetLogoHTML Get team's Logo as a HTML string. for gorazor template
func (*TeamData) GetLogoOrFlagHTML ¶
GetLogoOrFlagHTML Get team logo or flag as a HTML.
func (*TeamData) GetNameURLHtml ¶
GetNameURLHtml Get team page and name as a-tag. for gorazor template
func (*TeamData) GetPlayers ¶
func (t *TeamData) GetPlayers() ([]GetPlayerData, error)
GetPlayers Gets registered player's steamid64.
func (*TeamData) GetRecentMatches ¶
GetRecentMatches Gets team match history.
func (*TeamData) GetVSMatchResult ¶
GetVSMatchResult Returns Match result as string for gorazor template.
type TeamPageData ¶
TeamPageData Struct for /team/{teamID} page.
type TeamsPageData ¶
TeamsPageData Struct for /teams/{userID} page.
type UserData ¶
type UserData struct { ID int `gorm:"primary_key;column:id;AUTO_INCREMENT"` SteamID string `gorm:"column:steam_id;unique"` Name string `gorm:"column:name"` Admin bool `gorm:"column:admin"` Servers []GameServerData `gorm:"foreignkey:user_id"` Teams []TeamData `gorm:"foreignkey:user_id"` Matches []MatchData `gorm:"foreignkey:user_id"` }
UserData Struct for "user" table.
func (*UserData) GetOrCreate ¶
GetOrCreate Get or Register Userdata into DB.
func (*UserData) GetRecentMatches ¶
GetRecentMatches Gets match history
func (*UserData) GetSteamURL ¶
GetSteamURL Get user's steam page URL by their steamid64
type UserPageData ¶
UserPageData Struct for /user/{userID} page.