Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DemoParser ¶
type DemoParser struct { Match *InfoStruct // contains filtered or unexported fields }
DemoParser holds all methods to parse a demo file into a infostruct
func NewDemoParser ¶
func NewDemoParser(client *steamclient.SteamClient) DemoParser
NewDemoParser constructor for a new demoparser
func (*DemoParser) NewScoreBoardPlayer ¶
func (p *DemoParser) NewScoreBoardPlayer(player *common.Player) ScoreboardPlayer
NewScoreBoardPlayer constructor for a ScoreboardPlayer. Initializes some values with defaults
func (*DemoParser) Parse ¶
func (p *DemoParser) Parse(path string, m *InfoStruct) error
Parse starts the parsing process and fills the infostruct with values gathered form the demo file
type InfoStruct ¶
type InfoStruct struct { MatchID string `json:"match_id" db:"match_id"` MatchValid bool `json:"match_valid" db:"match_valid"` General ScoreboardGeneral `json:"general" db:"general"` Players ScoreboardPlayers `json:"players" db:"players"` Rounds []ScoreboardRound `json:"rounds" db:"rounds"` }
InfoStruct holds the data of one demo file in it's parsed form
func GetMatchInfo ¶
func GetMatchInfo(path string, steamClient *steamclient.SteamClient) (InfoStruct, error)
GetMatchInfo parses a demo file and returns a infostruct containing it's data
func (*InfoStruct) Damages ¶
func (is *InfoStruct) Damages() interface{}
Damages returns all damages that where dealt during a match
func (InfoStruct) GetScoreboard ¶
func (is InfoStruct) GetScoreboard() ScoreboardPlayers
GetScoreboard returns the scoreboard of match
func (*InfoStruct) Scan ¶
func (is *InfoStruct) Scan(value interface{}) error
Scan : Make the InfoStruct struct implement the sql.Scanner interface. This method simply decodes a JSON-encoded value into the struct fields.
func (InfoStruct) Value ¶
func (is InfoStruct) Value() (driver.Value, error)
Value : Make the InfoStruct struct implement the driver.Valuer interface. This method simply returns the JSON-encoded representation of the struct.
func (*InfoStruct) Weapons ¶
func (is *InfoStruct) Weapons() interface{}
Weapons lists all weapons used in the match with it's stats
type PlayerDamages ¶
PlayerDamages holds the damage of a player to each other player
func NewPlayerDamages ¶
func NewPlayerDamages() PlayerDamages
NewPlayerDamages constructor for player damages struct
type RoundKill ¶
type RoundKill struct { Time time.Duration `json:"time" db:"time"` KillerTeamString string `json:"killer_team_string" db:"killer_team_string"` VictimTeamString string `json:"victim_team_string" db:"victim_team_string"` AssisterTeamString string `json:"assister_team_string" db:"assister_team_string"` IsHeadshot bool `json:"is_headshot" db:"is_headshot"` Victim *ScoreboardPlayer `json:"victim" db:"victim"` Killer *ScoreboardPlayer `json:"killer" db:"killer"` Assister *ScoreboardPlayer `json:"assister" db:"assister"` KillerWeapon common.EquipmentType `json:"weapon" db:"weapon"` }
RoundKill holds information about a kill that happenend during the match
func (*RoundKill) MarshalJSON ¶
MarshalJSON marshals a RoundKill struct to json, e.g. for the api
type Score ¶
type Score struct { //ID of the player SteamID string //Points earned from won matches ScoreMatch int //Points earned from won rounds ScoreRound int //Points earned from planting bomb ScorePlant int //Points earned from defusing bomb ScoreDefuse int //Points earned from MVP stars ScoreMvp int //Points earned from kills ScoreKill int //Points earned from assist ScoreAssist int //Points earned from 3-kills Score3k int //Points earned from 4-kills Score4k int //Points earned from aces Score5k int //Points earned from entryfrag ScoreEntryfrag int //Points earned from clutches v1 ScoreClutchv1 int //Points earned from clutches v2 ScoreClutchv2 int //Points earned from clutches v3 ScoreClutchv3 int //Points earned from clutches v4 ScoreClutchv4 int //Points earned from clutches v5 ScoreClutchv5 int //Points lost due to teamkills ScoreTeamkill int //Points lost due to teamflashes ScoreTeamflash int //Points lost due to teamdamage ScoreTeamdamage int //Points lost due to kick ScoreKick int //Points lost due to dying with HE/knive ScoreNoWeapon int }
Score holds the information about one players score. It normally represents the summarized information of all matches the player has played
type ScoreboardGeneral ¶
type ScoreboardGeneral struct { ClanWonMatch bool `json:"clan_won_round" db:"clan_won_round"` ScoreClan int `json:"score_clan" db:"score_clan"` ScoreEnemy int `json:"score_enemy" db:"score_enemy"` MapName string `json:"map_name" db:"map_name"` MapIconURL string `json:"map_icon_url" db:"map_icon_url"` UploadTime time.Time `json:"upload_time" db:"upload_time"` MatchDuration time.Duration `json:"match_duration" db:"match_duration"` DemoLinkURL string `json:"demo_link_url" db:"demo_link_url"` }
ScoreboardGeneral holds general information about the match
type ScoreboardPlayer ¶
type ScoreboardPlayer struct { WeaponStats WeaponStats `json:"weapon_stats" db:"weapon_stats"` PlayerDamages PlayerDamages `json:"player_damages" db:"player_damages"` IsBot bool `json:"isbot" db:"isbot"` IsClanMember bool `json:"isclanmember" db:"isclanmember"` Steamid64 uint64 `json:"steamid64" db:"steamid64"` Name string `json:"name" db:"name"` Clantag string `json:"clantag" db:"clantag"` AvatarURL string `json:"avatar_url" db:"avatar_url"` Rank int `json:"rank" db:"rank"` Kills int `json:"kills" db:"kills"` MVPs int `json:"mvps" db:"mvps"` Deaths int `json:"deaths" db:"deaths"` Assists int `json:"assists" db:"assists"` Kd float64 `json:"kd" db:"kd"` Adr int `json:"adr" db:"adr"` Headshots int `json:"headshots" db:"headshots"` Hsprecent float64 `json:"hsprecent" db:"hsprecent"` Firstkills int `json:"firstkills" db:"firstkills"` Firstdeaths int `json:"firstdeaths" db:"firstdeaths"` Tradekills int `json:"tradekills" db:"tradekills"` Tradedeaths int `json:"tradedeaths" db:"tradedeaths"` Tradefirstkills int `json:"tradefirstkills" db:"tradefirstkills"` Tradefirstdeaths int `json:"tradefirstdeaths" db:"tradefirstdeaths"` Roundswonv5 int `json:"roundswonv5" db:"roundswonv5"` Roundswonv4 int `json:"roundswonv4" db:"roundswonv4"` Roundswonv3 int `json:"roundswonv3" db:"roundswonv3"` Rounds5K int `json:"rounds5k" db:"rounds5k"` Rounds4K int `json:"rounds4k" db:"rounds4k"` Rounds3K int `json:"rounds3k" db:"rounds3k"` }
ScoreboardPlayer holds the information about the player of a match
type ScoreboardPlayers ¶
type ScoreboardPlayers struct {
Players []ScoreboardPlayer `json:"players" db:"players"`
}
ScoreboardPlayers thin wrapper around the list of players to implment methods
func (*ScoreboardPlayers) AllWeaponsUsed ¶
func (sp *ScoreboardPlayers) AllWeaponsUsed() []common.EquipmentType
AllWeaponsUsed returns all weapons shot at least once during the match
func (ScoreboardPlayers) Clan ¶
func (sp ScoreboardPlayers) Clan() []ScoreboardPlayer
Clan returns all players of the clan team
func (ScoreboardPlayers) Enemy ¶
func (sp ScoreboardPlayers) Enemy() []ScoreboardPlayer
Enemy returns all players of the enemy team
func (ScoreboardPlayers) PlayerNumByID ¶
func (sp ScoreboardPlayers) PlayerNumByID(steamID uint64) (int, error)
PlayerNumByID returns the a players's position in the Players[] list of a match
type ScoreboardRound ¶
type ScoreboardRound struct { ClanWonRound bool `json:"clan_won_round" db:"clan_won_round"` Duration time.Duration `json:"duration" db:"duration"` ClanKills []RoundKill `json:"kills_clan" db:"kills_clan"` EnemyKills []RoundKill `json:"kills_enemy" db:"kills_enemy"` ScoreClan int `json:"score_clan" db:"score_clan"` ScoreEnemy int `json:"score_enemy" db:"score_enemy"` ClanSurvivors int `json:"survivivors_clan" db:"survivivors_clan"` EnemySurvivors int `json:"survivors_enemy" db:"survivors_enemy"` TeamWon common.Team `json:"team_won" db:"team_won"` TotalDamageGiven int `json:"total_damage_given" db:"total_damage_given"` TotalDamageTaken int `json:"total_damage_taken" db:"total_damage_taken"` WinReason events.RoundEndReason `json:"win_reason" db:"win_reason"` WinnerTeam common.Team `json:"winner_team" db:"winner_team"` }
ScoreboardRound holds the information about a round in a match
type WeaponStats ¶
type WeaponStats struct { // Number of Kills Kills map[common.EquipmentType]int `json:"kills" db:"kills"` // Number of Headshots Headshots map[common.EquipmentType]int `json:"headshots" db:"headshots"` // Percent shots hit of shots fired Accuracy map[common.EquipmentType]int `json:"accuracy" db:"accuracy"` // Damage caused Damage map[common.EquipmentType]int `json:"damage" db:"damage"` // Shots fired Shots map[common.EquipmentType]int `json:"shots" db:"shots"` // Shots hit Hits map[common.EquipmentType]int `json:"hits" db:"hits"` }
WeaponStats maps weapons to the player stats