added spray patterns
This commit is contained in:
@@ -62,7 +62,7 @@ func SteamId2AccountId(steamId uint64) uint32 {
|
||||
return uint32(steamId - 76561197960265728)
|
||||
}
|
||||
|
||||
func playerStatsFromRound(round *protobuf.CMsgGCCStrike15V2_MatchmakingServerRoundStats, p *ent.Player) (int32, int32, int32, int32, int32, int32) {
|
||||
func playerStatsFromRound(round *protobuf.CMsgGCCStrike15V2_MatchmakingServerRoundStats, p *ent.Player) (kills int32, deaths int32, assists int32, headshots int32, score int32, mvps int32) {
|
||||
for i, acc := range round.GetReservation().GetAccountIds() {
|
||||
if AccountId2SteamId(acc) == p.ID {
|
||||
return round.GetKills()[i], round.GetDeaths()[i], round.GetAssists()[i], round.GetEnemyHeadshots()[i], round.GetScores()[i], round.GetMvps()[i]
|
||||
@@ -431,7 +431,7 @@ func (d *DemoMatchLoader) gcWorker(apiKey string, rl ratelimit.Limiter) {
|
||||
}
|
||||
|
||||
kills, deaths, assists, hs, score, mvp := playerStatsFromRound(lastRound, mPlayer)
|
||||
err := d.db.Stats.Create().
|
||||
err := d.db.MatchPlayer.Create().
|
||||
SetMatches(tMatch).
|
||||
SetPlayers(mPlayer).
|
||||
SetTeamID(teamId).
|
||||
@@ -451,15 +451,21 @@ func (d *DemoMatchLoader) gcWorker(apiKey string, rl ratelimit.Limiter) {
|
||||
}
|
||||
}
|
||||
|
||||
// clear cache for player
|
||||
// clear cache or regen values player
|
||||
for _, p := range players {
|
||||
err = d.cache.Delete(context.Background(), fmt.Sprintf(utils.SideMetaCacheKey, p.ID))
|
||||
if err != nil {
|
||||
log.Warningf("[DL] Unable to delete cache key %s: %v", fmt.Sprintf(utils.SideMetaCacheKey, p.ID), err)
|
||||
}
|
||||
err = d.cache.Delete(context.Background(), fmt.Sprintf(utils.MatchMetaCacheKey, p.ID))
|
||||
|
||||
w, l, t, err := utils.GetWinLossTieForPlayer(p)
|
||||
if err != nil {
|
||||
log.Warningf("[DL] Unable to delete cache key %s: %v", fmt.Sprintf(utils.MatchMetaCacheKey, p.ID), err)
|
||||
log.Warningf("[DL] Failure to calculate WinLossTie for player %d: %v", p.ID, err)
|
||||
continue
|
||||
}
|
||||
err = p.Update().SetWins(w).SetTies(t).SetLooses(l).Exec(context.Background())
|
||||
if err != nil {
|
||||
log.Warningf("[DL] Failure to save WinLossTie for player %d: %v", p.ID, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user