Skip to content

Commit 15beede

Browse files
author
=
committed
backend.go y mas
1 parent f0c2070 commit 15beede

File tree

2 files changed

+52
-3
lines changed

2 files changed

+52
-3
lines changed

endOfMatchProcessing.go

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ func endOfMatchProcessing(game *game) {
8888
game.totalPlayerStats[steam].suppRounds += player.suppRounds
8989
game.totalPlayerStats[steam].rwk += player.rwk
9090
game.totalPlayerStats[steam].mip += player.mip
91+
game.totalPlayerStats[steam].eac += player.eac
9192

9293
if player.isBot {
9394
game.totalPlayerStats[steam].isBot = true

main.go

+51-3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const DEBUG = false
4545
//globals
4646
const printChatLog = true
4747
const printDebugLog = true
48+
const FORCE_NEW_STATS_UPLOAD = false
4849

4950
const tradeCutoff = 4 // in seconds
5051
var multikillBonus = [...]float64{0, 0, 0.3, 0.7, 1.2, 2}
@@ -69,6 +70,7 @@ var killValues = map[string]float64{
6970

7071
type game struct {
7172
//winnerID int
73+
coreID string
7274
winnerClanName string
7375
rounds []*round
7476
potentialRound *round
@@ -231,6 +233,7 @@ type playerStats struct {
231233
wlp float64
232234
mip float64
233235
rws float64 //round win shares
236+
eac int //effective assist contributions
234237

235238
rwk int //rounds with kills
236239

@@ -294,6 +297,35 @@ type playerStats struct {
294297
damageList map[uint64]int
295298
}
296299

300+
type Accolades struct {
301+
awp int
302+
deagle int
303+
knife int
304+
dinks int
305+
blindKills int
306+
bombPlants int
307+
jumps int
308+
teamDMG int
309+
selfDMG int
310+
ping int
311+
footsteps int //unnecessary processing?
312+
bombTaps int
313+
killsThroughSmoke int
314+
penetrations int
315+
noScopes int
316+
midairKills int
317+
crouchedKills int
318+
bombzoneKills int
319+
killsWhileMoving int
320+
mostMoneySpent int
321+
mostShotsOnLegs int
322+
shotsFired int
323+
ak int
324+
m4 int
325+
pistol int
326+
scout int
327+
}
328+
297329
func main() {
298330
input_dir := "in"
299331
files, _ := ioutil.ReadDir(input_dir)
@@ -308,8 +340,6 @@ func main() {
308340

309341
var input string
310342
fmt.Scanln(&input)
311-
312-
//authenticate()
313343
}
314344

315345
func initGameObject() *game {
@@ -347,6 +377,12 @@ func processDemo(demoName string) {
347377
}
348378
defer f.Close()
349379

380+
tempCoreID := strings.Split(demoName, "mid")
381+
if len(tempCoreID) > 1 {
382+
//we have a CSC match
383+
game.coreID = strings.Split(strings.Split(demoName, "mid")[1], ".")[0]
384+
}
385+
350386
p := dem.NewParser(f)
351387
defer p.Close()
352388

@@ -1012,15 +1048,17 @@ func processDemo(demoName string) {
10121048
for deadGuySteam, deadTick := range (*game.potentialRound).playerStats[e.Victim.SteamID64].tradeList {
10131049
if tick-deadTick < tradeCutoff*game.tickRate {
10141050
pS[deadGuySteam].traded = 1
1051+
pS[deadGuySteam].eac += 1
10151052
pS[deadGuySteam].kastRounds = 1
10161053
}
10171054
}
10181055
}
10191056

10201057
//assist logic
10211058
if assisterExists && victimExists && e.Assister.TeamState.ID() != e.Victim.TeamState.ID() {
1022-
//this logic needs to be replaced
1059+
//this logic needs to be replaced -yeti does not remember why he wrote this
10231060
pS[e.Assister.SteamID64].assists += 1
1061+
pS[e.Assister.SteamID64].eac += 1
10241062
pS[e.Assister.SteamID64].kastRounds = 1
10251063
pS[e.Assister.SteamID64].suppRounds = 1
10261064
assisted = true
@@ -1030,6 +1068,7 @@ func processDemo(demoName string) {
10301068
} else if float64(p.GameState().IngameTick()) < pS[e.Victim.SteamID64].mostRecentFlashVal {
10311069
//this will trigger if there is both a flash assist and a damage assist
10321070
pS[pS[e.Victim.SteamID64].mostRecentFlasher].fAss += 1
1071+
pS[pS[e.Victim.SteamID64].mostRecentFlasher].eac += 1
10331072
pS[pS[e.Victim.SteamID64].mostRecentFlasher].suppRounds = 1
10341073
flashAssisted = true
10351074
}
@@ -1331,6 +1370,15 @@ func processDemo(demoName string) {
13311370

13321371
endOfMatchProcessing(game)
13331372

1373+
if game.coreID != "" {
1374+
client := authenticate()
1375+
if verifyOriginalMatch(client, game.coreID) || FORCE_NEW_STATS_UPLOAD {
1376+
addMatch(client, game)
1377+
}
1378+
} else {
1379+
fmt.Println("This is not a CSC demo D:")
1380+
}
1381+
13341382
fmt.Println("Demo is complete!")
13351383
//cleanup()
13361384

0 commit comments

Comments
 (0)