Skip to content

Commit 8d01c6f

Browse files
Rossiarjanstuemmel
authored andcommitted
fix, Player Names with Special Characters (#4)
* fix, handle player names with special characters * fix, update to go1.13 closes #4
1 parent 09647e7 commit 8d01c6f

4 files changed

Lines changed: 86 additions & 84 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: go
22
go:
3-
- '1.11'
3+
- '1.13'
44
script: go test -v -covermode=count -coverprofile=coverage.out -bench=.
55
after_success:
66
- go get github.com/mattn/goveralls

csgolog.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -360,49 +360,49 @@ const (
360360
// TeamNoticePattern regular expression
361361
TeamNoticePattern = `Team "(CT|TERRORIST)" triggered "(\w+)" \(CT "(\d+)"\) \(T "(\d+)"\)`
362362
// PlayerConnectedPattern regular expression
363-
PlayerConnectedPattern = `"(\w+)<(\d+)><([\w:]+)><>" connected, address "(.*)"`
363+
PlayerConnectedPattern = `"(.+)<(\d+)><([\w:]+)><>" connected, address "(.*)"`
364364
// PlayerDisconnectedPattern regular expression
365-
PlayerDisconnectedPattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT|Unassigned|)>" disconnected \(reason "(.+)"\)`
365+
PlayerDisconnectedPattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT|Unassigned|)>" disconnected \(reason "(.+)"\)`
366366
// PlayerEnteredPattern regular expression
367-
PlayerEnteredPattern = `"(\w+)<(\d+)><([\w:]+)><>" entered the game`
367+
PlayerEnteredPattern = `"(.+)<(\d+)><([\w:]+)><>" entered the game`
368368
// PlayerBannedPattern regular expression
369-
PlayerBannedPattern = `Banid: "(\w+)<(\d+)><([\w:]+)><\w*>" was banned "([\w. ]+)" by "(\w+)"`
369+
PlayerBannedPattern = `Banid: "(.+)<(\d+)><([\w:]+)><\w*>" was banned "([\w. ]+)" by "(\w+)"`
370370
// PlayerSwitchedPattern regular expression
371-
PlayerSwitchedPattern = `"(\w+)<(\d+)><([\w:]+)>" switched from team <(Unassigned|TERRORIST|CT)> to <(Unassigned|TERRORIST|CT)>`
371+
PlayerSwitchedPattern = `"(.+)<(\d+)><([\w:]+)>" switched from team <(Unassigned|TERRORIST|CT)> to <(Unassigned|TERRORIST|CT)>`
372372
// PlayerSayPattern regular expression
373-
PlayerSayPattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" say(_team)? "(.*)"`
373+
PlayerSayPattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" say(_team)? "(.*)"`
374374
// PlayerPurchasePattern regular expression
375-
PlayerPurchasePattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" purchased "(\w+)"`
375+
PlayerPurchasePattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" purchased "(\w+)"`
376376
// PlayerKillPattern regular expression
377-
PlayerKillPattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" \[(-?\d+) (-?\d+) (-?\d+)\] killed "(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" \[(-?\d+) (-?\d+) (-?\d+)\] with "(\w+)" ?(\(?(headshot|penetrated|headshot penetrated)?\))?`
377+
PlayerKillPattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" \[(-?\d+) (-?\d+) (-?\d+)\] killed "(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" \[(-?\d+) (-?\d+) (-?\d+)\] with "(\w+)" ?(\(?(headshot|penetrated|headshot penetrated)?\))?`
378378
// PlayerKillAssistPattern regular expression
379-
PlayerKillAssistPattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" assisted killing "(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>"`
379+
PlayerKillAssistPattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" assisted killing "(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>"`
380380
// PlayerAttackPattern regular expression
381-
PlayerAttackPattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" \[(-?\d+) (-?\d+) (-?\d+)\] attacked "(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" \[(-?\d+) (-?\d+) (-?\d+)\] with "(\w+)" \(damage "(\d+)"\) \(damage_armor "(\d+)"\) \(health "(\d+)"\) \(armor "(\d+)"\) \(hitgroup "([\w ]+)"\)`
381+
PlayerAttackPattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" \[(-?\d+) (-?\d+) (-?\d+)\] attacked "(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" \[(-?\d+) (-?\d+) (-?\d+)\] with "(\w+)" \(damage "(\d+)"\) \(damage_armor "(\d+)"\) \(health "(\d+)"\) \(armor "(\d+)"\) \(hitgroup "([\w ]+)"\)`
382382
// PlayerKilledBombPattern regular expression
383-
PlayerKilledBombPattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" \[(-?\d+) (-?\d+) (-?\d+)\] was killed by the bomb\.`
383+
PlayerKilledBombPattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" \[(-?\d+) (-?\d+) (-?\d+)\] was killed by the bomb\.`
384384
// PlayerKilledSuicidePattern regular expression
385-
PlayerKilledSuicidePattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" \[(-?\d+) (-?\d+) (-?\d+)\] committed suicide with "(.*)"`
385+
PlayerKilledSuicidePattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" \[(-?\d+) (-?\d+) (-?\d+)\] committed suicide with "(.*)"`
386386
// PlayerPickedUpPattern regular expression
387-
PlayerPickedUpPattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" picked up "(\w+)"`
387+
PlayerPickedUpPattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" picked up "(\w+)"`
388388
// PlayerDroppedPattern regular expression
389-
PlayerDroppedPattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT|Unassigned)>" dropped "(\w+)"`
389+
PlayerDroppedPattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT|Unassigned)>" dropped "(\w+)"`
390390
// PlayerMoneyChangePattern regular expression
391-
PlayerMoneyChangePattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" money change (\d+)\+?(-?\d+) = \$(\d+) \(tracked\)( \(purchase: (\w+)\))?`
391+
PlayerMoneyChangePattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" money change (\d+)\+?(-?\d+) = \$(\d+) \(tracked\)( \(purchase: (\w+)\))?`
392392
// PlayerBombGotPattern regular expression
393-
PlayerBombGotPattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" triggered "Got_The_Bomb"`
393+
PlayerBombGotPattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" triggered "Got_The_Bomb"`
394394
// PlayerBombPlantedPattern regular expression
395-
PlayerBombPlantedPattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" triggered "Planted_The_Bomb"`
395+
PlayerBombPlantedPattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" triggered "Planted_The_Bomb"`
396396
// PlayerBombDroppedPattern regular expression
397-
PlayerBombDroppedPattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" triggered "Dropped_The_Bomb"`
397+
PlayerBombDroppedPattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" triggered "Dropped_The_Bomb"`
398398
// PlayerBombBeginDefusePattern regular expression
399-
PlayerBombBeginDefusePattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" triggered "Begin_Bomb_Defuse_With(out)?_Kit"`
399+
PlayerBombBeginDefusePattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" triggered "Begin_Bomb_Defuse_With(out)?_Kit"`
400400
// PlayerBombDefusedPattern regular expression
401-
PlayerBombDefusedPattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" triggered "Defused_The_Bomb"`
401+
PlayerBombDefusedPattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" triggered "Defused_The_Bomb"`
402402
// PlayerThrewPattern regular expression
403-
PlayerThrewPattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" threw (\w+) \[(-?\d+) (-?\d+) (-?\d+)\]( flashbang entindex (\d+))?\)?`
403+
PlayerThrewPattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" threw (\w+) \[(-?\d+) (-?\d+) (-?\d+)\]( flashbang entindex (\d+))?\)?`
404404
// PlayerBlindedPattern regular expression
405-
PlayerBlindedPattern = `"(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" blinded for ([\d.]+) by "(\w+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" from flashbang entindex (\d+)`
405+
PlayerBlindedPattern = `"(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" blinded for ([\d.]+) by "(.+)<(\d+)><([\w:]+)><(TERRORIST|CT)>" from flashbang entindex (\d+)`
406406
// ProjectileSpawnedPattern regular expression
407407
ProjectileSpawnedPattern = `Molotov projectile spawned at (-?\d+\.\d+) (-?\d+\.\d+) (-?\d+\.\d+), velocity (-?\d+\.\d+) (-?\d+\.\d+) (-?\d+\.\d+)`
408408
// GameOverPattern regular expression

0 commit comments

Comments
 (0)