Documentation ¶
Index ¶
- Variables
- func GetSteamName(steamid uint64) (string, error)
- func LoginHandler(c *gin.Context)
- func LogoutHandler(c *gin.Context)
- type Config
- type DBdatas
- type GameServerData
- func (g *GameServerData) CanDelete(userid int) bool
- func (g *GameServerData) CanEdit(userid int) bool
- func (g *GameServerData) Create(userid int, displayname string, ipstring string, port int, rconpassword string, ...) (*GameServerData, error)
- func (g *GameServerData) Delete() error
- func (g *GameServerData) Edit() (*GameServerData, error)
- func (g *GameServerData) GetDisplay() string
- func (g *GameServerData) GetHostPort() string
- func (g *GameServerData) SendRcon(cmd string) (string, error)
- func (g *GameServerData) TableName() string
- type MapStatsData
- type MatchConfig
- type MatchData
- func (m *MatchData) BuildMatchDict() (*MatchConfig, error)
- func (m *MatchData) Create(userid int, team1id int, team2id int, team1string string, team2string string, ...) (*MatchData, error)
- func (m *MatchData) Finalized() bool
- func (m *MatchData) Finished() bool
- func (m *MatchData) Get(id int) (*MatchData, error)
- func (m *MatchData) GetCurrentScore(g *gorm.DB) (int, int, error)
- func (m *MatchData) GetLoser() (TeamData, error)
- func (m *MatchData) GetMapStat() (*MatchData, error)
- func (m *MatchData) GetServer() (*GameServerData, error)
- func (m *MatchData) GetStatusString(ShowWinner bool) (string, error)
- func (m *MatchData) GetTeam1() (TeamData, error)
- func (m *MatchData) GetTeam2() (TeamData, error)
- 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) SendToServer() error
- 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) GetOrCreate(matchID int, MapNumber int, steamid string) (*PlayerStatsData, error)
- 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 []string, ...) (*TeamData, error)
- func (t *TeamData) Delete() error
- func (t *TeamData) Edit() (*TeamData, error)
- func (t *TeamData) GetNameURLHtml() string
- func (t *TeamData) GetPlayers() (*[]string, error)
- func (t *TeamData) GetRecentMatches(limit int) []*MatchData
- func (t *TeamData) GetURL() string
- func (t *TeamData) GetVSMatchResult(matchid int) (string, error)
- func (t *TeamData) TableName() string
- type TeamPageData
- type TeamsPageData
- type UserData
- type UserMaxResources
- 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
Types ¶
type Config ¶
type Config struct { SteamAPIKey string DefaultPage string SQLHost string SQLUser string SQLPass string SQLPort int SQLDBName string SQLDebugMode bool HOST string Cookie string }
Config Configration Struct for config.ini
type GameServerData ¶
type GameServerData struct { ID int `gorm:"primary_key;column:id;AUTO_INCREMENT;NOT NULL" json:"id"` UserID int `gorm:"column:user_id;DEFAULT NULL" json:"user_id"` InUse bool `gorm:"column:in_use;DEFAULT NULL" json:"in_use"` IPString string `gorm:"column:ip_string;DEFAULT NULL" json:"ip_string"` Port int `gorm:"column:port;DEFAULT NULL" json:"port"` RconPassword string `gorm:"column:rcon_password;DEFAULT NULL" json:"rcon_password"` DisplayName string `gorm:"column:display_name;DEFAULT NULL" json:"display_name"` PublicServer bool `gorm:"column:public_server;DEFAULT NULL" json:"public_server"` }
GameServerData Struct for game_server table.
func (*GameServerData) CanDelete ¶
func (g *GameServerData) CanDelete(userid int) bool
CanDelete Check if server is deletable for user or not.
func (*GameServerData) CanEdit ¶
func (g *GameServerData) CanEdit(userid int) bool
CanEdit Check if server is editable for user or not.
func (*GameServerData) Create ¶
func (g *GameServerData) Create(userid int, displayname string, ipstring string, port int, rconpassword string, publicserver bool) (*GameServerData, error)
Create Register GameServer into DB.
func (*GameServerData) Delete ¶
func (g *GameServerData) Delete() error
Delete Deletes GameServer information.
func (*GameServerData) Edit ¶
func (g *GameServerData) Edit() (*GameServerData, error)
Edit Edits GameServer information.
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 specific IP SRCDS.
func (*GameServerData) TableName ¶
func (g *GameServerData) TableName() string
TableName declairation for GORM
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 sql.NullInt32 `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) GetOrCreate ¶
func (m *MapStatsData) GetOrCreate(matchID int, MapNumber int, mapname string) (*MapStatsData, error)
GetOrCreate Get or register mapstats data.
func (*MapStatsData) TableName ¶
func (m *MapStatsData) TableName() string
TableName declairation for GORM
type MatchConfig ¶
type MatchConfig struct { MatchID string `json:"matchid"` // NOT int Scrim bool `json:"scrim,omitempty"` MatchTitle string `json:"match_title,omitempty"` PlayersPerTeam int `json:"players_per_team,omitempty"` MinPlayersToReady int `json:"min_players_to_ready,omitempty"` MinSPectatorsToReady int `json:"min_spectators_to_ready,omitempty"` SkipVeto bool `json:"skip_veto,omitempty"` // bo2_series and maps_to_win are deprecated on get5 plugin side. Use num_maps insted // Bo2Series bool `json:"bo2_series"` // MapsToWin int `json:"maps_to_win"` NumMaps int `json:"num_maps,omitempty"` VetoFirst string `json:"veto_first,omitempty"` // team1 || team2 SideType string `json:"side_type,omitempty"` // standard and ? FavoredTeamPercentageText string `json:"favored_percentage_text,omitempty"` FavoredTeamPercentageTeam1 int `json:"favored_percentage_team1,omitempty"` Spectators struct { Name string `json:"name"` Players []string `json:"players"` } `json:"spectators"` Team1 struct { Flag string `json:"flag"` Name string `json:"name"` Tag string `json:"tag"` Players []string `json:"players"` } `json:"team1"` Team2 struct { Flag string `json:"flag"` Name string `json:"name"` Tag string `json:"tag"` Players []string `json:"players"` } `json:"team2"` Maplist []string `json:"maplist"` MapSides []string `json:"map_sides"` Cvars map[string]string `json:"cvars"` }
MatchConfig Match configration for get5 api, based on https://github.com/splewis/get5/blob/master/configs/get5/example_match.json and https://github.com/splewis/get5/blob/3f793ceb3736d78ba6a92f42631d91cb52f0beb4/scripting/get5/matchconfig.sp#L435
type MatchData ¶
type MatchData struct { ID int `gorm:"primary_key;column:id" json:"id"` UserID int `gorm:"column:user_id" json:"user_id"` ServerID int `gorm:"column:server_id" json:"server_id"` Team1ID int `gorm:"column:team1_id" json:"team1_id"` Team2ID int `gorm:"column:team2_id" json:"team2_id"` Winner sql.NullInt32 `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:"-"` VetoMapPoolJSON []string `gorm:"-" 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 `gorm:"ForeignKey:MatchID" json:"-"` Server GameServerData `json:"-"` }
MatchData Struct for match table.
func (*MatchData) BuildMatchDict ¶
func (m *MatchData) BuildMatchDict() (*MatchConfig, error)
BuildMatchDict Builds match JSON data.
func (*MatchData) Create ¶
func (m *MatchData) Create(userid int, team1id int, team2id int, team1string string, team2string string, maxmaps int, skipveto bool, title string, vetomappool []string, serverid int) (*MatchData, error)
Create Register Match information into DB.
func (*MatchData) GetCurrentScore ¶
GetCurrentScore Returns current match score. returns map-score if match is BO1.
func (*MatchData) GetMapStat ¶
GetMapStat Gets each map stat data as "MapStatsData" struct array.
func (*MatchData) GetServer ¶
func (m *MatchData) GetServer() (*GameServerData, error)
GetServer Get match server ID as GameServerData
func (*MatchData) GetStatusString ¶
GetStatusString Get match status as string.
func (*MatchData) GetVSString ¶
GetVSString Get Match VS information as string. for gorazor template
func (*MatchData) SendToServer ¶
SendToServer Send match config to server
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 int `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) GetOrCreate ¶
func (p *PlayerStatsData) GetOrCreate(matchID int, MapNumber int, steamid string) (*PlayerStatsData, error)
GetOrCreate Get or register player stats data into DB.
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 `gorm:"-" json:"auths"` // converts pickle []byte to []string Players []PlayerStatsData `gorm:"-" json:"-"` PublicTeam bool `gorm:"column:public_team" json:"public_team"` }
TeamData Struct for team table.
func (*TeamData) Create ¶
func (t *TeamData) Create(userid int, name string, tag string, flag string, logo string, auths []string, publicteam bool) (*TeamData, error)
Create Register Team information into DB.
func (*TeamData) GetNameURLHtml ¶
GetNameURLHtml Get team page and name as a-tag. for gorazor template
func (*TeamData) GetPlayers ¶
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:UserID"` Teams []*TeamData `gorm:"ForeignKey:UserID"` Matches []*MatchData `gorm:"ForeignKey:UserID"` }
UserData Struct for "user" table.
func (*UserData) GetOrCreate ¶
GetOrCreate Get or Register Userdata by their steamid into DB.
func (*UserData) GetRecentMatches ¶
GetRecentMatches Gets match history
func (*UserData) GetSteamURL ¶
GetSteamURL Get user's steam page URL by their steamid64
type UserMaxResources ¶ added in v0.1.2
var ( // MaxResource per user MaxResource UserMaxResources )
type UserPageData ¶
UserPageData Struct for /user/{userID} page.