This commit is contained in:
Linrador 2025-07-31 17:42:19 +02:00
parent aa208a14d4
commit e41bb63fbd
3 changed files with 54 additions and 27 deletions

81
main.go
View File

@ -180,37 +180,44 @@ func main() {
})
p.RegisterEventHandler(func(e events.Kill) {
if e.Killer != nil && e.Killer.SteamID64 != e.Victim.SteamID64 {
stat := getOrCreate(*e.Killer)
stat.Kills++
if e.IsHeadshot {
stat.Headshots++
}
if e.NoScope {
stat.NoScopes++
}
if e.AttackerBlind {
stat.BlindKills++
}
if e.ThroughSmoke {
stat.SmokeKills++
}
if e.IsWallBang() {
stat.WallbangKills++
}
if e.Weapon != nil {
switch e.Weapon.Type {
case common.EqKnife:
stat.KnifeKills++
case common.EqZeus:
stat.ZeusKills++
if e.Killer != nil && e.Victim != nil && e.Killer.SteamID64 != e.Victim.SteamID64 {
killerTeam := e.Killer.Team
victimTeam := e.Victim.Team
if killerTeam != victimTeam && killerTeam != common.TeamSpectators {
stat := getOrCreate(*e.Killer)
stat.Kills++
if e.IsHeadshot {
stat.Headshots++
}
if e.NoScope {
stat.NoScopes++
}
if e.AttackerBlind {
stat.BlindKills++
}
if e.ThroughSmoke {
stat.SmokeKills++
}
if e.IsWallBang() {
stat.WallbangKills++
}
if e.Weapon != nil {
switch e.Weapon.Type {
case common.EqKnife:
stat.KnifeKills++
case common.EqZeus:
stat.ZeusKills++
}
}
}
}
if e.Victim != nil {
stat := getOrCreate(*e.Victim)
stat.Deaths++
}
if e.Assister != nil {
stat := getOrCreate(*e.Assister)
stat.Assists++
@ -227,7 +234,6 @@ func main() {
p.RegisterEventHandler(func(e events.PlayerHurt) {
if e.Attacker != nil && e.Attacker != e.Player {
stat := getOrCreate(*e.Attacker)
stat.TotalDamage += e.HealthDamage
if e.Weapon != nil {
switch e.Weapon.Type {
case common.EqHE, common.EqMolotov, common.EqIncendiary:
@ -301,8 +307,29 @@ func main() {
for _, stat := range playerStats {
sid, _ := parseSteamID(stat.SteamID)
if team, ok := teamHistory[1][sid]; ok {
stat.Team = team
lastTeam := ""
lastRound := 0
for roundNum, roundTeams := range teamHistory {
if team, ok := roundTeams[sid]; ok && roundNum > lastRound {
lastTeam = team
lastRound = roundNum
}
}
stat.Team = lastTeam
}
for _, player := range p.GameState().Participants().All() {
sid := player.SteamID64
stat, ok := playerStats[sid]
if !ok || player.Entity == nil {
continue
}
val, ok := player.Entity.PropertyValue("m_pActionTrackingServices.m_iDamage")
if ok {
stat.TotalDamage = val.Int()
}
}

Binary file not shown.

Binary file not shown.