added avg ping recording
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"git.harting.dev/csgowtf/csgowtfd/ent"
|
||||
"git.harting.dev/csgowtf/csgowtfd/ent/matchplayer"
|
||||
"git.harting.dev/csgowtf/csgowtfd/utils"
|
||||
"github.com/aclements/go-moremath/stats"
|
||||
"github.com/golang/geo/r2"
|
||||
"github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs"
|
||||
"github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs/common"
|
||||
@@ -249,9 +250,10 @@ workloop:
|
||||
EqV int
|
||||
Bank int
|
||||
Spent int
|
||||
}, 0)
|
||||
})
|
||||
encounters := make([]*Encounter, 0)
|
||||
spays := make([]*Sprays, 0)
|
||||
pingMap := make(map[uint64][]float64)
|
||||
|
||||
cfg := demoinfocs.DefaultParserConfig
|
||||
if len(demo.DecryptionKey) == 16 { //nolint:gomnd
|
||||
@@ -374,6 +376,11 @@ workloop:
|
||||
Spent int
|
||||
}{Round: gs.TotalRoundsPlayed(), EqV: p.EquipmentValueCurrent(), Bank: p.Money(), Spent: p.MoneySpentThisRound()})
|
||||
}
|
||||
|
||||
// track ping
|
||||
for _, p := range gs.Participants().Playing() {
|
||||
pingMap[p.SteamID64] = append(pingMap[p.SteamID64], float64(p.Ping()))
|
||||
}
|
||||
})
|
||||
|
||||
// onPlayerFlashed
|
||||
@@ -474,6 +481,8 @@ workloop:
|
||||
tMatchPlayer.Color = matchplayer.ColorGrey
|
||||
}
|
||||
|
||||
avgPing := stats.GeoMean(pingMap[tMatchPlayer.PlayerStats])
|
||||
|
||||
nMatchPLayer, err := tMatchPlayer.Update().
|
||||
SetDmgTeam(tMatchPlayer.DmgTeam).
|
||||
SetDmgEnemy(tMatchPlayer.DmgEnemy).
|
||||
@@ -484,6 +493,7 @@ workloop:
|
||||
SetRankOld(tMatchPlayer.RankOld).
|
||||
SetRankNew(tMatchPlayer.RankNew).
|
||||
SetColor(tMatchPlayer.Color).
|
||||
SetAvgPing(avgPing).
|
||||
SetCrosshair(tMatchPlayer.Crosshair).
|
||||
SetFlashDurationTeam(tMatchPlayer.FlashDurationTeam).
|
||||
SetFlashDurationSelf(tMatchPlayer.FlashDurationSelf).
|
||||
|
Reference in New Issue
Block a user