|
|
|
@ -3,6 +3,8 @@ package steam
|
|
|
|
|
import (
|
|
|
|
|
"bytes"
|
|
|
|
|
"fmt"
|
|
|
|
|
"io"
|
|
|
|
|
"strings"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type DotaMatch struct {
|
|
|
|
@ -21,7 +23,7 @@ func (d DotaMatch) Oneline() string {
|
|
|
|
|
for _, player := range d.Players {
|
|
|
|
|
fmt.Fprintf(&buf, "-\t-\t-\t%d\t%d\t%d\n", player.AccountId, player.PlayerSlot, player.HeroId)
|
|
|
|
|
}
|
|
|
|
|
return buf.String()
|
|
|
|
|
return strings.TrimSpace(buf.String())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DotaMatchPlayer struct {
|
|
|
|
@ -30,67 +32,107 @@ type DotaMatchPlayer struct {
|
|
|
|
|
HeroId int `json:"hero_id"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
{
|
|
|
|
|
"match_id": 1680503925,
|
|
|
|
|
"match_seq_num": 1497692382,
|
|
|
|
|
"start_time": 1438511639,
|
|
|
|
|
"lobby_type": 0,
|
|
|
|
|
"radiant_team_id": 0,
|
|
|
|
|
"dire_team_id": 0,
|
|
|
|
|
"players": [
|
|
|
|
|
{
|
|
|
|
|
"account_id": 4294967295,
|
|
|
|
|
"player_slot": 0,
|
|
|
|
|
"hero_id": 61
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"account_id": 4294967295,
|
|
|
|
|
"player_slot": 1,
|
|
|
|
|
"hero_id": 56
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"account_id": 4294967295,
|
|
|
|
|
"player_slot": 2,
|
|
|
|
|
"hero_id": 41
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"account_id": 264612072,
|
|
|
|
|
"player_slot": 3,
|
|
|
|
|
"hero_id": 48
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"account_id": 4294967295,
|
|
|
|
|
"player_slot": 4,
|
|
|
|
|
"hero_id": 95
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"account_id": 176784521,
|
|
|
|
|
"player_slot": 128,
|
|
|
|
|
"hero_id": 99
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"account_id": 4294967295,
|
|
|
|
|
"player_slot": 129,
|
|
|
|
|
"hero_id": 5
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"account_id": 4294967295,
|
|
|
|
|
"player_slot": 130,
|
|
|
|
|
"hero_id": 17
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"account_id": 62572906,
|
|
|
|
|
"player_slot": 131,
|
|
|
|
|
"hero_id": 46
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"account_id": 111126659,
|
|
|
|
|
"player_slot": 132,
|
|
|
|
|
"hero_id": 66
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
type DotaMatchDetails struct {
|
|
|
|
|
RadiantWin bool `json:"radian_win"`
|
|
|
|
|
Duration int `json:"duration"`
|
|
|
|
|
StartTime int `json:"start_time"`
|
|
|
|
|
Id uint64 `json:"match_id"`
|
|
|
|
|
SeqNum uint64 `json:"match_seq_num"`
|
|
|
|
|
TowerStatusRadiant int `json:"tower_status_radiant"`
|
|
|
|
|
TowerStatusDire int `json:"tower_status_dire"`
|
|
|
|
|
Cluster int `json:"cluster"`
|
|
|
|
|
FirstBloodTime int `json:"first_blood_time"`
|
|
|
|
|
LobbyTime int `json:"lobby_time"`
|
|
|
|
|
HumanPlayers int `json:"human_players"`
|
|
|
|
|
LeagueId int `json:"leagueid"`
|
|
|
|
|
PositiveVotes int `json:"positive_votes"`
|
|
|
|
|
NegativeVotes int `json:"negative_votes"`
|
|
|
|
|
GameMode int `json:"game_mode"`
|
|
|
|
|
Engine int `json:"engine"`
|
|
|
|
|
Players []DotaMatchPlayerDetails `json:"players"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (d DotaMatchDetails) Display(w io.Writer) {
|
|
|
|
|
if d.RadiantWin {
|
|
|
|
|
fmt.Fprintln(w, "Radiant Victory")
|
|
|
|
|
} else {
|
|
|
|
|
fmt.Fprintln(w, "Dire Victory")
|
|
|
|
|
}
|
|
|
|
|
fmt.Fprintf(w, "Duration: %d\n", d.Duration)
|
|
|
|
|
fmt.Fprintf(w, "StartTime: %d\n", d.StartTime)
|
|
|
|
|
fmt.Fprintf(w, "Id: %d\n", d.Id)
|
|
|
|
|
fmt.Fprintf(w, "SeqNum: %d\n", d.SeqNum)
|
|
|
|
|
fmt.Fprintf(w, "TowerStatusRadiant: %d\n", d.TowerStatusRadiant)
|
|
|
|
|
fmt.Fprintf(w, "TowerStatusDire: %d\n", d.TowerStatusDire)
|
|
|
|
|
fmt.Fprintf(w, "Cluster: %d\n", d.Cluster)
|
|
|
|
|
fmt.Fprintf(w, "FirstBloodTime: %d\n", d.FirstBloodTime)
|
|
|
|
|
fmt.Fprintf(w, "LobbyTime: %d\n", d.LobbyTime)
|
|
|
|
|
fmt.Fprintf(w, "HumanPlayers: %d\n", d.HumanPlayers)
|
|
|
|
|
fmt.Fprintf(w, "LeagueId: %d\n", d.LeagueId)
|
|
|
|
|
fmt.Fprintf(w, "PositiveVotes: %d\n", d.PositiveVotes)
|
|
|
|
|
fmt.Fprintf(w, "NegativeVotes: %d\n", d.NegativeVotes)
|
|
|
|
|
fmt.Fprintf(w, "GameMode: %d\n", d.GameMode)
|
|
|
|
|
fmt.Fprintf(w, "Engine: %d\n", d.Engine)
|
|
|
|
|
for _, player := range d.Players {
|
|
|
|
|
player.Display(w)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
type DotaMatchPlayerDetails struct {
|
|
|
|
|
AccountId uint64 `json:"account_id"`
|
|
|
|
|
PlayerSlot int `json:"player_slot"`
|
|
|
|
|
HeroId int `json:"hero_id"`
|
|
|
|
|
Item0 int `json:"item_0"`
|
|
|
|
|
Item1 int `json:"item_1"`
|
|
|
|
|
Item2 int `json:"item_2"`
|
|
|
|
|
Item3 int `json:"item_3"`
|
|
|
|
|
Item4 int `json:"item_4"`
|
|
|
|
|
Item5 int `json:"item_5"`
|
|
|
|
|
Kills int `json:"kills"`
|
|
|
|
|
Deaths int `json:"deaths"`
|
|
|
|
|
Assists int `json:"assists"`
|
|
|
|
|
LeaverStatus int `json:"leaver_status"`
|
|
|
|
|
Gold int `json:"gold"`
|
|
|
|
|
LastHits int `json:"last_hits"`
|
|
|
|
|
Denies int `json:"denies"`
|
|
|
|
|
GoldPerMinute int `json:"gold_per_min"`
|
|
|
|
|
XPPerMinute int `json:"xp_per_min"`
|
|
|
|
|
GoldSpent int `json:"gold_spent"`
|
|
|
|
|
HeroDamage int `json:"hero_damage"`
|
|
|
|
|
TowerDamage int `json:"tower_damage"`
|
|
|
|
|
HeroHealing int `json:"hero_healing"`
|
|
|
|
|
Level int `json:"level"`
|
|
|
|
|
AbilityUpgrades []DotaAbilityUpgrades `json:"ability_upgrades"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
func (p DotaMatchPlayerDetails) Display(w io.Writer) {
|
|
|
|
|
fmt.Fprintf(w, "AccountId: %d\n", p.AccountId)
|
|
|
|
|
fmt.Fprintf(w, "PlayerSlot: %d\n", p.PlayerSlot)
|
|
|
|
|
fmt.Fprintf(w, "HeroId: %d\n", p.HeroId)
|
|
|
|
|
fmt.Fprintf(w, "Item0: %d\n", p.Item0)
|
|
|
|
|
fmt.Fprintf(w, "Item1: %d\n", p.Item1)
|
|
|
|
|
fmt.Fprintf(w, "Item2: %d\n", p.Item2)
|
|
|
|
|
fmt.Fprintf(w, "Item3: %d\n", p.Item3)
|
|
|
|
|
fmt.Fprintf(w, "Item4: %d\n", p.Item4)
|
|
|
|
|
fmt.Fprintf(w, "Item5: %d\n", p.Item5)
|
|
|
|
|
fmt.Fprintf(w, "Kills: %d\n", p.Kills)
|
|
|
|
|
fmt.Fprintf(w, "Deaths: %d\n", p.Deaths)
|
|
|
|
|
fmt.Fprintf(w, "Assists: %d\n", p.Assists)
|
|
|
|
|
fmt.Fprintf(w, "LeaverStatus: %d\n", p.LeaverStatus)
|
|
|
|
|
fmt.Fprintf(w, "Gold: %d\n", p.Gold)
|
|
|
|
|
fmt.Fprintf(w, "LastHits: %d\n", p.LastHits)
|
|
|
|
|
fmt.Fprintf(w, "Denies: %d\n", p.Denies)
|
|
|
|
|
fmt.Fprintf(w, "GoldPerMinute: %d\n", p.GoldPerMinute)
|
|
|
|
|
fmt.Fprintf(w, "XPPerMinute: %d\n", p.XPPerMinute)
|
|
|
|
|
fmt.Fprintf(w, "GoldSpent: %d\n", p.GoldSpent)
|
|
|
|
|
fmt.Fprintf(w, "HeroDamage: %d\n", p.HeroDamage)
|
|
|
|
|
fmt.Fprintf(w, "TowerDamage: %d\n", p.TowerDamage)
|
|
|
|
|
fmt.Fprintf(w, "HeroHealing: %d\n", p.HeroHealing)
|
|
|
|
|
fmt.Fprintf(w, "Level: %d\n", p.Level)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type DotaAbilityUpgrades struct {
|
|
|
|
|
Ability int `json:"ability"`
|
|
|
|
|
Time int `json:"time"`
|
|
|
|
|
Level int `json:"level"`
|
|
|
|
|
}
|
|
|
|
|