tf2_line_parser 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +60 -51
- data/lib/tf2_line_parser/events/airshot.rb +24 -5
- data/lib/tf2_line_parser/events/assist.rb +4 -0
- data/lib/tf2_line_parser/events/capture_block.rb +3 -3
- data/lib/tf2_line_parser/events/charge_deployed.rb +3 -3
- data/lib/tf2_line_parser/events/chat.rb +14 -3
- data/lib/tf2_line_parser/events/connect.rb +3 -3
- data/lib/tf2_line_parser/events/damage.rb +23 -5
- data/lib/tf2_line_parser/events/disconnect.rb +3 -3
- data/lib/tf2_line_parser/events/domination.rb +4 -0
- data/lib/tf2_line_parser/events/event.rb +111 -4
- data/lib/tf2_line_parser/events/headshot_damage.rb +4 -5
- data/lib/tf2_line_parser/events/heal.rb +4 -5
- data/lib/tf2_line_parser/events/kill.rb +4 -5
- data/lib/tf2_line_parser/events/medic_death.rb +4 -5
- data/lib/tf2_line_parser/events/pickup_item.rb +4 -0
- data/lib/tf2_line_parser/events/player_action_event.rb +3 -3
- data/lib/tf2_line_parser/events/pvp_event.rb +4 -5
- data/lib/tf2_line_parser/events/revenge.rb +4 -0
- data/lib/tf2_line_parser/events/role_change.rb +4 -0
- data/lib/tf2_line_parser/events/spawn.rb +4 -0
- data/lib/tf2_line_parser/events/suicide.rb +4 -0
- data/lib/tf2_line_parser/player.rb +3 -2
- data/lib/tf2_line_parser/version.rb +1 -1
- data/spec/lib/tf2_line_parser/parser_spec.rb +95 -47
- data/spec/lib/tf2_line_parser/player_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -3
- data/tf2_line_parser.gemspec +4 -3
- metadata +27 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01e322507f92ef5ebd648bf65a7412a916e3a84b118c58bb322edcee2539f85e
|
4
|
+
data.tar.gz: f1af28f6e5cc32f7579e80f73eb353cb4406c3902ae72ecb8fd13f4cf20c2a23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2e66e19141bb1109c3c35ea0cd993f5b67c7a688f1022e31595aae187a038c2aee6618d0a2b51b5988e99eede992710ba1426730674b80bf41da9162882806a
|
7
|
+
data.tar.gz: 67d849993089b15ff95af89cabd3fe680d49afcc4640a5a8b245bd9dfdc3d7ddedbe5a24de88fae73acc27998329c41b27e66c86a45570bec0f4df1c85f328d7
|
data/Gemfile.lock
CHANGED
@@ -1,74 +1,83 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tf2_line_parser (0.2.
|
4
|
+
tf2_line_parser (0.2.3)
|
5
5
|
activesupport
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (
|
11
|
-
|
10
|
+
activesupport (8.0.2)
|
11
|
+
base64
|
12
|
+
benchmark (>= 0.3)
|
13
|
+
bigdecimal
|
14
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
15
|
+
connection_pool (>= 2.2.5)
|
16
|
+
drb
|
12
17
|
i18n (>= 1.6, < 2)
|
18
|
+
logger (>= 1.4.2)
|
13
19
|
minitest (>= 5.1)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
securerandom (>= 0.3)
|
21
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
22
|
+
uri (>= 0.13.1)
|
23
|
+
base64 (0.3.0)
|
24
|
+
benchmark (0.4.1)
|
25
|
+
bigdecimal (3.2.2)
|
26
|
+
concurrent-ruby (1.3.5)
|
27
|
+
connection_pool (2.5.3)
|
28
|
+
coveralls_reborn (0.29.0)
|
29
|
+
simplecov (~> 0.22.0)
|
30
|
+
term-ansicolor (~> 1.7)
|
31
|
+
thor (~> 1.2)
|
32
|
+
tins (~> 1.32)
|
33
|
+
diff-lcs (1.6.2)
|
34
|
+
docile (1.4.1)
|
35
|
+
drb (2.2.3)
|
36
|
+
i18n (1.14.7)
|
27
37
|
concurrent-ruby (~> 1.0)
|
28
|
-
json (2.
|
29
|
-
|
30
|
-
minitest (5.
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
rspec (3.5
|
38
|
-
rspec-core (~> 3.5.0)
|
39
|
-
rspec-expectations (~> 3.5.0)
|
40
|
-
rspec-mocks (~> 3.5.0)
|
41
|
-
rspec-core (3.5.4)
|
42
|
-
rspec-support (~> 3.5.0)
|
43
|
-
rspec-expectations (3.5.0)
|
38
|
+
json (2.12.2)
|
39
|
+
logger (1.7.0)
|
40
|
+
minitest (5.25.5)
|
41
|
+
rspec (3.13.1)
|
42
|
+
rspec-core (~> 3.13.0)
|
43
|
+
rspec-expectations (~> 3.13.0)
|
44
|
+
rspec-mocks (~> 3.13.0)
|
45
|
+
rspec-core (3.13.4)
|
46
|
+
rspec-support (~> 3.13.0)
|
47
|
+
rspec-expectations (3.13.5)
|
44
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
-
rspec-support (~> 3.
|
46
|
-
rspec-mocks (3.5
|
49
|
+
rspec-support (~> 3.13.0)
|
50
|
+
rspec-mocks (3.13.5)
|
47
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
-
rspec-support (~> 3.
|
49
|
-
rspec-support (3.
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
simplecov-html (~> 0.
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
rspec-support (~> 3.13.0)
|
53
|
+
rspec-support (3.13.4)
|
54
|
+
securerandom (0.4.1)
|
55
|
+
simplecov (0.22.0)
|
56
|
+
docile (~> 1.1)
|
57
|
+
simplecov-html (~> 0.11)
|
58
|
+
simplecov_json_formatter (~> 0.1)
|
59
|
+
simplecov-html (0.13.1)
|
60
|
+
simplecov_json_formatter (0.1.4)
|
61
|
+
sync (0.5.0)
|
62
|
+
term-ansicolor (1.11.2)
|
57
63
|
tins (~> 1.0)
|
58
|
-
thor (
|
59
|
-
tins (1.
|
60
|
-
|
64
|
+
thor (1.3.2)
|
65
|
+
tins (1.38.0)
|
66
|
+
bigdecimal
|
67
|
+
sync
|
68
|
+
tzinfo (2.0.6)
|
61
69
|
concurrent-ruby (~> 1.0)
|
62
|
-
|
70
|
+
uri (1.0.3)
|
63
71
|
|
64
72
|
PLATFORMS
|
65
73
|
ruby
|
66
74
|
|
67
75
|
DEPENDENCIES
|
68
|
-
|
69
|
-
|
70
|
-
rspec
|
76
|
+
coveralls_reborn
|
77
|
+
json
|
78
|
+
rspec
|
79
|
+
simplecov
|
71
80
|
tf2_line_parser!
|
72
81
|
|
73
82
|
BUNDLED WITH
|
74
|
-
|
83
|
+
2.3.16
|
@@ -12,14 +12,33 @@ module TF2LineParser
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.attributes
|
15
|
-
@attributes ||= %i[time
|
16
|
-
target_team value weapon airshot]
|
15
|
+
@attributes ||= %i[time player_section target_section weapon airshot]
|
17
16
|
end
|
18
17
|
|
19
|
-
def
|
18
|
+
def self.regex_results(matched_line)
|
19
|
+
time = matched_line['time']
|
20
|
+
player_section = matched_line['player_section']
|
21
|
+
target_section = matched_line['target_section']
|
22
|
+
value = matched_line['value']
|
23
|
+
weapon = matched_line['weapon']
|
24
|
+
airshot = matched_line['airshot']
|
25
|
+
|
26
|
+
# Parse player section
|
27
|
+
player_name, player_uid, player_steamid, player_team = parse_player_section(player_section)
|
28
|
+
|
29
|
+
# Parse target section if present
|
30
|
+
target_name, target_uid, target_steamid, target_team = nil, nil, nil, nil
|
31
|
+
if target_section
|
32
|
+
target_name, target_uid, target_steamid, target_team = parse_target_section(target_section)
|
33
|
+
end
|
34
|
+
|
35
|
+
[time, player_name, player_uid, player_steamid, player_team, target_name, target_uid, target_steamid, target_team, value, weapon, airshot]
|
36
|
+
end
|
37
|
+
|
38
|
+
def initialize(time, player_name, player_uid, player_steamid, player_team, target_name, target_uid, target_steamid, target_team, value, weapon, airshot)
|
20
39
|
@time = parse_time(time)
|
21
|
-
@player = Player.new(player_name, player_steamid, player_team)
|
22
|
-
@target = Player.new(target_name, target_steamid, target_team) if target_name
|
40
|
+
@player = Player.new(player_name, player_uid, player_steamid, player_team)
|
41
|
+
@target = Player.new(target_name, target_uid, target_steamid, target_team) if target_name
|
23
42
|
@value = value.to_i
|
24
43
|
@weapon = weapon
|
25
44
|
@airshot = (airshot.to_i == 1)
|
@@ -8,12 +8,12 @@ module TF2LineParser
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.attributes
|
11
|
-
@attributes ||= %i[time
|
11
|
+
@attributes ||= %i[time player_section cp_number cp_name]
|
12
12
|
end
|
13
13
|
|
14
|
-
def initialize(time, player_name, player_steam_id, player_team, cap_number, cap_name)
|
14
|
+
def initialize(time, player_name, player_uid, player_steam_id, player_team, cap_number, cap_name)
|
15
15
|
@time = parse_time(time)
|
16
|
-
@player = Player.new(player_name, player_steam_id, player_team)
|
16
|
+
@player = Player.new(player_name, player_uid, player_steam_id, player_team)
|
17
17
|
@cap_number = cap_number
|
18
18
|
@cap_name = cap_name
|
19
19
|
end
|
@@ -8,12 +8,12 @@ module TF2LineParser
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.attributes
|
11
|
-
@attributes ||= %i[time
|
11
|
+
@attributes ||= %i[time player_section]
|
12
12
|
end
|
13
13
|
|
14
|
-
def initialize(time, name, steam_id, team)
|
14
|
+
def initialize(time, name, uid, steam_id, team)
|
15
15
|
@time = parse_time(time)
|
16
|
-
@player = Player.new(name, steam_id, team)
|
16
|
+
@player = Player.new(name, uid, steam_id, team)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -3,14 +3,25 @@
|
|
3
3
|
module TF2LineParser
|
4
4
|
module Events
|
5
5
|
class Chat < Event
|
6
|
-
def initialize(time, player_name, player_steam_id, player_team, message)
|
6
|
+
def initialize(time, player_name, player_uid, player_steam_id, player_team, message)
|
7
7
|
@time = parse_time(time)
|
8
|
-
@player = Player.new(player_name, player_steam_id, player_team)
|
8
|
+
@player = Player.new(player_name, player_uid, player_steam_id, player_team)
|
9
9
|
@message = message
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.attributes
|
13
|
-
@attributes ||= %i[time
|
13
|
+
@attributes ||= %i[time player_section message]
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.regex_results(matched_line)
|
17
|
+
time = matched_line['time']
|
18
|
+
player_section = matched_line['player_section']
|
19
|
+
message = matched_line['message']
|
20
|
+
|
21
|
+
# Parse player section
|
22
|
+
player_name, player_uid, player_steamid, player_team = parse_player_section(player_section)
|
23
|
+
|
24
|
+
[time, player_name, player_uid, player_steamid, player_team, message]
|
14
25
|
end
|
15
26
|
end
|
16
27
|
|
@@ -3,14 +3,14 @@
|
|
3
3
|
module TF2LineParser
|
4
4
|
module Events
|
5
5
|
class Connect < Event
|
6
|
-
def initialize(time, player_name, player_steam_id, player_team, message)
|
6
|
+
def initialize(time, player_name, player_uid, player_steam_id, player_team, message)
|
7
7
|
@time = parse_time(time)
|
8
|
-
@player = Player.new(player_name, player_steam_id, player_team)
|
8
|
+
@player = Player.new(player_name, player_uid, player_steam_id, player_team)
|
9
9
|
@message = message
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.attributes
|
13
|
-
@attributes ||= %i[time
|
13
|
+
@attributes ||= %i[time player_section message]
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.regex
|
@@ -20,14 +20,32 @@ module TF2LineParser
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.attributes
|
23
|
-
@attributes ||= %i[time
|
24
|
-
target_team value weapon]
|
23
|
+
@attributes ||= %i[time player_section target_section value weapon]
|
25
24
|
end
|
26
25
|
|
27
|
-
def
|
26
|
+
def self.regex_results(matched_line)
|
27
|
+
time = matched_line['time']
|
28
|
+
player_section = matched_line['player_section']
|
29
|
+
target_section = matched_line['target_section']
|
30
|
+
value = matched_line['value']
|
31
|
+
weapon = matched_line['weapon']
|
32
|
+
|
33
|
+
# Parse player section
|
34
|
+
player_name, player_uid, player_steamid, player_team = parse_player_section(player_section)
|
35
|
+
|
36
|
+
# Parse target section if present
|
37
|
+
target_name, target_uid, target_steamid, target_team = nil, nil, nil, nil
|
38
|
+
if target_section
|
39
|
+
target_name, target_uid, target_steamid, target_team = parse_target_section(target_section)
|
40
|
+
end
|
41
|
+
|
42
|
+
[time, player_name, player_uid, player_steamid, player_team, target_name, target_uid, target_steamid, target_team, value, weapon]
|
43
|
+
end
|
44
|
+
|
45
|
+
def initialize(time, player_name, player_uid, player_steamid, player_team, target_name, target_uid, target_steamid, target_team, value, weapon)
|
28
46
|
@time = parse_time(time)
|
29
|
-
@player = Player.new(player_name, player_steamid, player_team)
|
30
|
-
@target = Player.new(target_name, target_steamid, target_team) if target_name
|
47
|
+
@player = Player.new(player_name, player_uid, player_steamid, player_team)
|
48
|
+
@target = Player.new(target_name, target_uid, target_steamid, target_team) if target_name
|
31
49
|
@value = value.to_i
|
32
50
|
@weapon = weapon
|
33
51
|
end
|
@@ -3,14 +3,14 @@
|
|
3
3
|
module TF2LineParser
|
4
4
|
module Events
|
5
5
|
class Disconnect < Event
|
6
|
-
def initialize(time, player_name, player_steam_id, player_team, message)
|
6
|
+
def initialize(time, player_name, player_uid, player_steam_id, player_team, message)
|
7
7
|
@time = parse_time(time)
|
8
|
-
@player = Player.new(player_name, player_steam_id, player_team)
|
8
|
+
@player = Player.new(player_name, player_uid, player_steam_id, player_team)
|
9
9
|
@message = message
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.attributes
|
13
|
-
@attributes ||= %i[time
|
13
|
+
@attributes ||= %i[time player_section message]
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.regex
|
@@ -15,11 +15,11 @@ module TF2LineParser
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.regex_player
|
18
|
-
@regex_player ||=
|
18
|
+
@regex_player ||= /"(?<player_section>.*?)"/
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.regex_target
|
22
|
-
@regex_target ||=
|
22
|
+
@regex_target ||= /"(?<target_section>.*?)"/
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.regex_cap
|
@@ -43,14 +43,121 @@ module TF2LineParser
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def self.regex_results(matched_line)
|
46
|
-
|
47
|
-
|
46
|
+
out = []
|
47
|
+
attributes.each do |attribute|
|
48
|
+
case attribute
|
49
|
+
when :player_section
|
50
|
+
if matched_line['player_section']
|
51
|
+
out.concat(parse_player_section(matched_line['player_section']))
|
52
|
+
else
|
53
|
+
out.concat([nil, nil, nil, nil])
|
54
|
+
end
|
55
|
+
when :target_section
|
56
|
+
if matched_line['target_section']
|
57
|
+
out.concat(parse_target_section(matched_line['target_section']))
|
58
|
+
else
|
59
|
+
out.concat([nil, nil, nil, nil])
|
60
|
+
end
|
61
|
+
else
|
62
|
+
out << matched_line[attribute]
|
63
|
+
end
|
48
64
|
end
|
65
|
+
out
|
49
66
|
end
|
50
67
|
|
51
68
|
def parse_time(time_string)
|
52
69
|
Time.strptime(time_string, Event.time_format)
|
53
70
|
end
|
71
|
+
|
72
|
+
def self.parse_player_section(section)
|
73
|
+
return [nil, nil, nil, nil] unless section
|
74
|
+
|
75
|
+
# Find all <...> groups in the section
|
76
|
+
parts = section.scan(/<([^>]*)>/)
|
77
|
+
return [nil, nil, nil, nil] if parts.length < 2
|
78
|
+
|
79
|
+
# For the cheeky name tests, we need to find the last complete set of uid/steamid/team
|
80
|
+
# Look for the pattern: <uid><steamid><team> at the end
|
81
|
+
if parts.length >= 3
|
82
|
+
# Try to find the last complete set of 3 groups
|
83
|
+
# Start from the end and work backwards
|
84
|
+
last_valid_set = nil
|
85
|
+
(parts.length - 2).downto(0) do |i|
|
86
|
+
if i + 2 < parts.length
|
87
|
+
uid = parts[i][0]
|
88
|
+
steamid = parts[i + 1][0]
|
89
|
+
team = parts[i + 2][0]
|
90
|
+
|
91
|
+
# Check if this looks like a valid set (uid is numeric, steamid looks like steam id, team is valid)
|
92
|
+
if uid.match?(/^\d+$/) && (steamid.start_with?('STEAM_') || steamid.start_with?('[U:')) && ['Red', 'Blue', 'Unassigned', 'Spectator', ''].include?(team)
|
93
|
+
# This looks like a valid player info set
|
94
|
+
last_valid_set = [i, uid, steamid, team]
|
95
|
+
break # Take the last (rightmost) valid set
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
if last_valid_set
|
101
|
+
i, uid, steamid, team = last_valid_set
|
102
|
+
# The name is everything before the first <...> group of this set
|
103
|
+
uid_start = section.index("<#{uid}>")
|
104
|
+
if uid_start
|
105
|
+
name = section[0...uid_start]
|
106
|
+
return [name, uid, steamid, team]
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# Handle cases with 2 or 3 groups (normal case)
|
112
|
+
if parts.length == 2
|
113
|
+
# Only uid and steamid, no team
|
114
|
+
uid = parts[0][0]
|
115
|
+
steamid = parts[1][0]
|
116
|
+
team = ""
|
117
|
+
else
|
118
|
+
# uid, steamid, and team
|
119
|
+
uid = parts[-3][0]
|
120
|
+
steamid = parts[-2][0]
|
121
|
+
team = parts[-1][0]
|
122
|
+
end
|
123
|
+
|
124
|
+
# The name is everything before the first <...> group
|
125
|
+
name_end = section.index("<#{uid}>")
|
126
|
+
return [nil, nil, nil, nil] unless name_end
|
127
|
+
|
128
|
+
name = section[0...name_end]
|
129
|
+
|
130
|
+
[name, uid, steamid, team]
|
131
|
+
end
|
132
|
+
|
133
|
+
def self.parse_target_section(section)
|
134
|
+
return [nil, nil, nil, nil] unless section
|
135
|
+
|
136
|
+
# Same logic as player but for targets
|
137
|
+
parts = section.scan(/<([^>]*)>/)
|
138
|
+
return [nil, nil, nil, nil] if parts.length < 2
|
139
|
+
|
140
|
+
# Handle cases with 2 or 3 groups
|
141
|
+
if parts.length == 2
|
142
|
+
# Only uid and steamid, no team
|
143
|
+
uid = parts[0][0]
|
144
|
+
steamid = parts[1][0]
|
145
|
+
team = ""
|
146
|
+
else
|
147
|
+
# uid, steamid, and team
|
148
|
+
uid = parts[-3][0]
|
149
|
+
steamid = parts[-2][0]
|
150
|
+
team = parts[-1][0]
|
151
|
+
end
|
152
|
+
|
153
|
+
# The name is everything before the first <...> group
|
154
|
+
name_end = section.index("<#{uid}>")
|
155
|
+
return [nil, nil, nil, nil] unless name_end
|
156
|
+
|
157
|
+
name = section[0...name_end]
|
158
|
+
|
159
|
+
[name, uid, steamid, team]
|
160
|
+
end
|
54
161
|
end
|
55
162
|
end
|
56
163
|
end
|
@@ -12,14 +12,13 @@ module TF2LineParser
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.attributes
|
15
|
-
@attributes ||= %i[time
|
16
|
-
target_team value weapon]
|
15
|
+
@attributes ||= %i[time player_section target_section value weapon]
|
17
16
|
end
|
18
17
|
|
19
|
-
def initialize(time, player_name, player_steamid, player_team, target_name, target_steamid, target_team, value, weapon)
|
18
|
+
def initialize(time, player_name, player_uid, player_steamid, player_team, target_name, target_uid, target_steamid, target_team, value, weapon)
|
20
19
|
@time = parse_time(time)
|
21
|
-
@player = Player.new(player_name, player_steamid, player_team)
|
22
|
-
@target = Player.new(target_name, target_steamid, target_team) if target_name
|
20
|
+
@player = Player.new(player_name, player_uid, player_steamid, player_team)
|
21
|
+
@target = Player.new(target_name, target_uid, target_steamid, target_team) if target_name
|
23
22
|
@value = value.to_i
|
24
23
|
@weapon = weapon
|
25
24
|
end
|
@@ -8,14 +8,13 @@ module TF2LineParser
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.attributes
|
11
|
-
@attributes ||= %i[time
|
12
|
-
target_team value]
|
11
|
+
@attributes ||= %i[time player_section target_section value]
|
13
12
|
end
|
14
13
|
|
15
|
-
def initialize(time, player_name, player_steam_id, player_team, target_name, target_steam_id, target_team, value)
|
14
|
+
def initialize(time, player_name, player_uid, player_steam_id, player_team, target_name, target_uid, target_steam_id, target_team, value)
|
16
15
|
@time = parse_time(time)
|
17
|
-
@player = Player.new(player_name, player_steam_id, player_team)
|
18
|
-
@target = Player.new(target_name, target_steam_id, target_team)
|
16
|
+
@player = Player.new(player_name, player_uid, player_steam_id, player_team)
|
17
|
+
@target = Player.new(target_name, target_uid, target_steam_id, target_team)
|
19
18
|
@value = value.to_i
|
20
19
|
end
|
21
20
|
end
|
@@ -16,14 +16,13 @@ module TF2LineParser
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.attributes
|
19
|
-
@attributes ||= %i[time
|
20
|
-
target_team weapon customkill]
|
19
|
+
@attributes ||= %i[time player_section target_section weapon customkill]
|
21
20
|
end
|
22
21
|
|
23
|
-
def initialize(time, player_name, player_steam_id, player_team, target_name, target_steam_id, target_team, weapon, customkill)
|
22
|
+
def initialize(time, player_name, player_uid, player_steam_id, player_team, target_name, target_uid, target_steam_id, target_team, weapon, customkill)
|
24
23
|
@time = parse_time(time)
|
25
|
-
@player = Player.new(player_name, player_steam_id, player_team)
|
26
|
-
@target = Player.new(target_name, target_steam_id, target_team)
|
24
|
+
@player = Player.new(player_name, player_uid, player_steam_id, player_team)
|
25
|
+
@target = Player.new(target_name, target_uid, target_steam_id, target_team)
|
27
26
|
@weapon = weapon
|
28
27
|
@customkill = customkill
|
29
28
|
end
|
@@ -12,14 +12,13 @@ module TF2LineParser
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.attributes
|
15
|
-
@attributes ||= %i[time
|
16
|
-
target_team healing ubercharge]
|
15
|
+
@attributes ||= %i[time player_section target_section healing ubercharge]
|
17
16
|
end
|
18
17
|
|
19
|
-
def initialize(time, player_name, player_steam_id, player_team, target_name, target_steam_id, target_team, healing, ubercharge)
|
18
|
+
def initialize(time, player_name, player_uid, player_steam_id, player_team, target_name, target_uid, target_steam_id, target_team, healing, ubercharge)
|
20
19
|
@time = parse_time(time)
|
21
|
-
@player = Player.new(player_name, player_steam_id, player_team)
|
22
|
-
@target = Player.new(target_name, target_steam_id, target_team)
|
20
|
+
@player = Player.new(player_name, player_uid, player_steam_id, player_team)
|
21
|
+
@target = Player.new(target_name, target_uid, target_steam_id, target_team)
|
23
22
|
@healing = healing.to_i
|
24
23
|
@ubercharge = (ubercharge == '1')
|
25
24
|
end
|
@@ -8,12 +8,12 @@ module TF2LineParser
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.attributes
|
11
|
-
@attributes ||= [:time, :
|
11
|
+
@attributes ||= [:time, :player_section, :item]
|
12
12
|
end
|
13
13
|
|
14
|
-
def initialize(time, player_name, player_steam_id, player_team, item = self.class.item)
|
14
|
+
def initialize(time, player_name, player_uid, player_steam_id, player_team, item = self.class.item)
|
15
15
|
@time = parse_time(time)
|
16
|
-
@player = Player.new(player_name, player_steam_id, player_team)
|
16
|
+
@player = Player.new(player_name, player_uid, player_steam_id, player_team)
|
17
17
|
instance_variable_set("@#{self.class.item}", item)
|
18
18
|
end
|
19
19
|
end
|
@@ -4,14 +4,13 @@ module TF2LineParser
|
|
4
4
|
module Events
|
5
5
|
class PVPEvent < Event
|
6
6
|
def self.attributes
|
7
|
-
@attributes ||= %i[time
|
8
|
-
target_team]
|
7
|
+
@attributes ||= %i[time player_section target_section]
|
9
8
|
end
|
10
9
|
|
11
|
-
def initialize(time, player_name, player_steam_id, player_team, target_name, target_steam_id, target_team)
|
10
|
+
def initialize(time, player_name, player_uid, player_steam_id, player_team, target_name, target_uid, target_steam_id, target_team)
|
12
11
|
@time = parse_time(time)
|
13
|
-
@player = Player.new(player_name, player_steam_id, player_team)
|
14
|
-
@target = Player.new(target_name, target_steam_id, target_team)
|
12
|
+
@player = Player.new(player_name, player_uid, player_steam_id, player_team)
|
13
|
+
@target = Player.new(target_name, target_uid, target_steam_id, target_team)
|
15
14
|
end
|
16
15
|
end
|
17
16
|
end
|
@@ -2,10 +2,11 @@
|
|
2
2
|
|
3
3
|
module TF2LineParser
|
4
4
|
class Player
|
5
|
-
attr_accessor :name, :steam_id, :team
|
5
|
+
attr_accessor :name, :uid, :steam_id, :team
|
6
6
|
|
7
|
-
def initialize(name, steam_id, team)
|
7
|
+
def initialize(name, uid, steam_id, team)
|
8
8
|
@name = name
|
9
|
+
@uid = uid
|
9
10
|
@steam_id = steam_id
|
10
11
|
@team = team
|
11
12
|
end
|
@@ -34,42 +34,47 @@ module TF2LineParser
|
|
34
34
|
it 'recognizes damage' do
|
35
35
|
line = log_lines[1001]
|
36
36
|
player_name = 'Epsilon numlocked'
|
37
|
+
player_uid = '4'
|
37
38
|
player_steam_id = 'STEAM_0:1:16347045'
|
38
39
|
player_team = 'Red'
|
39
40
|
value = '69'
|
40
41
|
weapon = nil
|
41
|
-
expect(Events::Damage).to receive(:new).with(anything, player_name, player_steam_id, player_team, nil, nil,
|
42
|
-
nil, value, weapon)
|
42
|
+
expect(Events::Damage).to receive(:new).with(anything, player_name, player_uid, player_steam_id, player_team, nil, nil,
|
43
|
+
nil, nil, value, weapon)
|
43
44
|
parse(line)
|
44
45
|
end
|
45
46
|
|
46
47
|
it 'recognizes new steam id log lines with detailed damage' do
|
47
48
|
line = new_log_lines[0]
|
48
49
|
player_name = 'iM yUKi intel @i52'
|
50
|
+
player_uid = '6'
|
49
51
|
player_steam_id = '[U:1:3825470]'
|
50
52
|
player_team = 'Blue'
|
51
|
-
target_team = 'Red'
|
52
53
|
target_name = 'mix^ enigma @ i52'
|
54
|
+
target_uid = '8'
|
53
55
|
target_steam_id = '[U:1:33652944]'
|
56
|
+
target_team = 'Red'
|
54
57
|
value = '78'
|
55
58
|
weapon = 'tf_projectile_rocket'
|
56
|
-
expect(Events::Damage).to receive(:new).with(anything, player_name, player_steam_id, player_team, target_name,
|
57
|
-
target_steam_id, target_team, value, weapon)
|
59
|
+
expect(Events::Damage).to receive(:new).with(anything, player_name, player_uid, player_steam_id, player_team, target_name,
|
60
|
+
target_uid, target_steam_id, target_team, value, weapon)
|
58
61
|
parse(line)
|
59
62
|
end
|
60
63
|
|
61
64
|
it 'recognizes detailed damage' do
|
62
65
|
line = detailed_log_lines[61]
|
63
66
|
player_name = 'LittleLies'
|
67
|
+
player_uid = '16'
|
64
68
|
player_steam_id = 'STEAM_0:0:55031498'
|
65
69
|
player_team = 'Blue'
|
66
70
|
target_name = 'Aquila'
|
71
|
+
target_uid = '15'
|
67
72
|
target_steam_id = 'STEAM_0:0:43087158'
|
68
73
|
target_team = 'Red'
|
69
74
|
value = '102'
|
70
75
|
weapon = 'tf_projectile_pipe'
|
71
|
-
expect(Events::Damage).to receive(:new).with(anything, player_name, player_steam_id, player_team, target_name,
|
72
|
-
target_steam_id, target_team, value, weapon)
|
76
|
+
expect(Events::Damage).to receive(:new).with(anything, player_name, player_uid, player_steam_id, player_team, target_name,
|
77
|
+
target_uid, target_steam_id, target_team, value, weapon)
|
73
78
|
parse(line)
|
74
79
|
end
|
75
80
|
|
@@ -77,31 +82,33 @@ module TF2LineParser
|
|
77
82
|
line = airshot_log_lines[0]
|
78
83
|
weapon = 'tf_projectile_rocket'
|
79
84
|
airshot = '1'
|
80
|
-
expect(Events::Airshot).to receive(:new).with(anything, anything, anything, anything, anything, anything,
|
81
|
-
anything, anything, weapon, airshot)
|
85
|
+
expect(Events::Airshot).to receive(:new).with(anything, anything, anything, anything, anything, anything, anything,
|
86
|
+
anything, anything, anything, weapon, airshot)
|
82
87
|
parse(line).inspect
|
83
88
|
end
|
84
89
|
|
85
90
|
it 'recognizes sniper headshot damage' do
|
86
91
|
line = detailed_log_lines[3645]
|
87
92
|
weapon = 'sniperrifle'
|
88
|
-
expect(Events::HeadshotDamage).to receive(:new).with(anything, anything, anything, anything, anything,
|
89
|
-
anything, anything, anything, weapon)
|
93
|
+
expect(Events::HeadshotDamage).to receive(:new).with(anything, anything, anything, anything, anything, anything,
|
94
|
+
anything, anything, anything, anything, weapon)
|
90
95
|
parse(line).inspect
|
91
96
|
end
|
92
97
|
|
93
98
|
it 'ignores realdamage' do
|
94
99
|
line = detailed_log_lines[65]
|
95
100
|
player_name = 'LittleLies'
|
101
|
+
player_uid = '16'
|
96
102
|
player_steam_id = 'STEAM_0:0:55031498'
|
97
103
|
player_team = 'Blue'
|
98
104
|
target_name = 'Aquila'
|
105
|
+
target_uid = '15'
|
99
106
|
target_steam_id = 'STEAM_0:0:43087158'
|
100
107
|
target_team = 'Red'
|
101
108
|
value = '98'
|
102
109
|
weapon = 'tf_projectile_pipe'
|
103
|
-
expect(Events::Damage).to receive(:new).with(anything, player_name, player_steam_id, player_team, target_name,
|
104
|
-
target_steam_id, target_team, value, weapon)
|
110
|
+
expect(Events::Damage).to receive(:new).with(anything, player_name, player_uid, player_steam_id, player_team, target_name,
|
111
|
+
target_uid, target_steam_id, target_team, value, weapon)
|
105
112
|
parse(line)
|
106
113
|
end
|
107
114
|
|
@@ -143,29 +150,33 @@ module TF2LineParser
|
|
143
150
|
it 'recognizes a heal' do
|
144
151
|
line = log_lines[1433]
|
145
152
|
player_name = 'Epsilon KnOxXx'
|
153
|
+
player_uid = '5'
|
146
154
|
player_steam_id = 'STEAM_0:1:12124893'
|
147
155
|
player_team = 'Red'
|
148
156
|
target_name = 'Epsilon numlocked'
|
157
|
+
target_uid = '4'
|
149
158
|
target_steam_id = 'STEAM_0:1:16347045'
|
150
159
|
target_team = 'Red'
|
151
160
|
value = '1'
|
152
|
-
expect(Events::Heal).to receive(:new).with(anything, player_name, player_steam_id, player_team, target_name,
|
153
|
-
target_steam_id, target_team, value)
|
161
|
+
expect(Events::Heal).to receive(:new).with(anything, player_name, player_uid, player_steam_id, player_team, target_name,
|
162
|
+
target_uid, target_steam_id, target_team, value)
|
154
163
|
parse(line)
|
155
164
|
end
|
156
165
|
|
157
166
|
it 'recognizes a kill' do
|
158
167
|
line = log_lines[1761]
|
159
168
|
player_name = 'Epsilon basH.'
|
169
|
+
player_uid = '7'
|
160
170
|
player_steam_id = 'STEAM_0:1:15829615'
|
161
171
|
player_team = 'Red'
|
162
172
|
target_name = 'broder jukebox'
|
173
|
+
target_uid = '11'
|
163
174
|
target_steam_id = 'STEAM_0:1:13978585'
|
164
175
|
target_team = 'Blue'
|
165
176
|
weapon = 'pistol_scout'
|
166
177
|
customkill = nil
|
167
|
-
expect(Events::Kill).to receive(:new).with(anything, player_name, player_steam_id, player_team, target_name,
|
168
|
-
target_steam_id, target_team, weapon, customkill)
|
178
|
+
expect(Events::Kill).to receive(:new).with(anything, player_name, player_uid, player_steam_id, player_team, target_name,
|
179
|
+
target_uid, target_steam_id, target_team, weapon, customkill)
|
169
180
|
parse(line)
|
170
181
|
end
|
171
182
|
|
@@ -173,73 +184,81 @@ module TF2LineParser
|
|
173
184
|
line = log_lines[1951]
|
174
185
|
weapon = 'sniperrifle'
|
175
186
|
customkill = 'headshot'
|
176
|
-
expect(Events::Kill).to receive(:new).with(anything, anything, anything, anything, anything, anything,
|
177
|
-
anything, weapon, customkill)
|
187
|
+
expect(Events::Kill).to receive(:new).with(anything, anything, anything, anything, anything, anything, anything,
|
188
|
+
anything, anything, weapon, customkill)
|
178
189
|
parse(line)
|
179
190
|
end
|
180
191
|
|
181
192
|
it 'recognizes an assist' do
|
182
193
|
line = log_lines[1451]
|
183
194
|
player_name = 'broder jukebox'
|
195
|
+
player_uid = '11'
|
184
196
|
player_steam_id = 'STEAM_0:1:13978585'
|
185
197
|
player_team = 'Blue'
|
186
198
|
target_name = 'Epsilon Mitsy'
|
199
|
+
target_uid = '12'
|
187
200
|
target_steam_id = 'STEAM_0:0:16858056'
|
188
201
|
target_team = 'Red'
|
189
|
-
expect(Events::Assist).to receive(:new).with(anything, player_name, player_steam_id, player_team, target_name,
|
190
|
-
target_steam_id, target_team)
|
202
|
+
expect(Events::Assist).to receive(:new).with(anything, player_name, player_uid, player_steam_id, player_team, target_name,
|
203
|
+
target_uid, target_steam_id, target_team)
|
191
204
|
parse(line)
|
192
205
|
end
|
193
206
|
|
194
207
|
it 'recognizes connect' do
|
195
208
|
line = log_lines[9]
|
196
209
|
name = 'Epsilon numlocked'
|
210
|
+
uid = '4'
|
197
211
|
steam_id = 'STEAM_0:1:16347045'
|
198
212
|
team = ''
|
199
213
|
message = '0.0.0.0:27005'
|
200
|
-
expect(Events::Connect).to receive(:new).with(anything, name, steam_id, team, message)
|
214
|
+
expect(Events::Connect).to receive(:new).with(anything, name, uid, steam_id, team, message)
|
201
215
|
parse(line)
|
202
216
|
end
|
203
217
|
|
204
218
|
it 'recognizes disconnect' do
|
205
219
|
line = log_lines[4542]
|
206
220
|
name = 'cc//TviQ'
|
221
|
+
uid = '8'
|
207
222
|
steam_id = 'STEAM_0:0:8520477'
|
208
223
|
team = 'Blue'
|
209
224
|
message = 'Disconnect by user.'
|
210
|
-
expect(Events::Disconnect).to receive(:new).with(anything, name, steam_id, team, message)
|
225
|
+
expect(Events::Disconnect).to receive(:new).with(anything, name, uid, steam_id, team, message)
|
211
226
|
parse(line)
|
212
227
|
end
|
213
228
|
|
214
229
|
it 'recognizes chat' do
|
215
230
|
line = log_lines[89]
|
216
231
|
name = 'Epsilon KnOxXx'
|
232
|
+
uid = '5'
|
217
233
|
steam_id = 'STEAM_0:1:12124893'
|
218
234
|
team = 'Red'
|
219
235
|
message = "it's right for the ping"
|
220
|
-
expect(Events::Say).to receive(:new).with(anything, name, steam_id, team, message)
|
236
|
+
expect(Events::Say).to receive(:new).with(anything, name, uid, steam_id, team, message)
|
221
237
|
parse(line)
|
222
238
|
end
|
223
239
|
|
224
240
|
it 'recognizes team chat' do
|
225
241
|
line = log_lines[303]
|
226
242
|
name = 'broder mirelin'
|
243
|
+
uid = '16'
|
227
244
|
steam_id = 'STEAM_0:1:18504112'
|
228
245
|
team = 'Blue'
|
229
246
|
message = '>>> USING UBER <<<[info] '
|
230
|
-
expect(Events::TeamSay).to receive(:new).with(anything, name, steam_id, team, message)
|
247
|
+
expect(Events::TeamSay).to receive(:new).with(anything, name, uid, steam_id, team, message)
|
231
248
|
parse(line)
|
232
249
|
end
|
233
250
|
|
234
251
|
it 'recognizes dominations' do
|
235
252
|
line = log_lines[1948]
|
236
253
|
name = 'Epsilon basH.'
|
254
|
+
uid = '7'
|
237
255
|
steam_id = 'STEAM_0:1:15829615'
|
238
256
|
team = 'Red'
|
239
257
|
target_name = 'broder jukebox'
|
258
|
+
target_uid = '11'
|
240
259
|
target_steam_id = 'STEAM_0:1:13978585'
|
241
260
|
target_team = 'Blue'
|
242
|
-
expect(Events::Domination).to receive(:new).with(anything, name, steam_id, team, target_name, target_steam_id,
|
261
|
+
expect(Events::Domination).to receive(:new).with(anything, name, uid, steam_id, team, target_name, target_uid, target_steam_id,
|
243
262
|
target_team)
|
244
263
|
parse(line)
|
245
264
|
end
|
@@ -247,12 +266,14 @@ module TF2LineParser
|
|
247
266
|
it 'recognizes revenges' do
|
248
267
|
line = log_lines[2354]
|
249
268
|
name = 'broder jukebox'
|
269
|
+
uid = '11'
|
250
270
|
steam_id = 'STEAM_0:1:13978585'
|
251
271
|
team = 'Blue'
|
252
272
|
target_name = 'Epsilon basH.'
|
273
|
+
target_uid = '7'
|
253
274
|
target_steam_id = 'STEAM_0:1:15829615'
|
254
275
|
target_team = 'Red'
|
255
|
-
expect(Events::Revenge).to receive(:new).with(anything, name, steam_id, team, target_name, target_steam_id,
|
276
|
+
expect(Events::Revenge).to receive(:new).with(anything, name, uid, steam_id, team, target_name, target_uid, target_steam_id,
|
256
277
|
target_team)
|
257
278
|
parse(line)
|
258
279
|
end
|
@@ -276,10 +297,11 @@ module TF2LineParser
|
|
276
297
|
it 'recognizes item pickup' do
|
277
298
|
line = log_lines[51]
|
278
299
|
name = 'Epsilon Mike'
|
300
|
+
uid = '6'
|
279
301
|
steam_id = 'STEAM_0:1:1895232'
|
280
302
|
team = 'Blue'
|
281
303
|
item = 'medkit_medium'
|
282
|
-
expect(Events::PickupItem).to receive(:new).with(anything, name, steam_id, team, item)
|
304
|
+
expect(Events::PickupItem).to receive(:new).with(anything, name, uid, steam_id, team, item)
|
283
305
|
parse(line)
|
284
306
|
end
|
285
307
|
|
@@ -292,54 +314,59 @@ module TF2LineParser
|
|
292
314
|
it 'recognizes ubercharges' do
|
293
315
|
line = log_lines[1416]
|
294
316
|
name = 'broder mirelin'
|
317
|
+
uid = '17'
|
295
318
|
steam_id = 'STEAM_0:1:18504112'
|
296
319
|
team = 'Blue'
|
297
|
-
expect(Events::ChargeDeployed).to receive(:new).with(anything, name, steam_id, team)
|
320
|
+
expect(Events::ChargeDeployed).to receive(:new).with(anything, name, uid, steam_id, team)
|
298
321
|
parse(line)
|
299
322
|
|
300
323
|
line = detailed_log_lines[782]
|
301
324
|
name = 'flo ❤'
|
325
|
+
uid = '24'
|
302
326
|
steam_id = 'STEAM_0:1:53945481'
|
303
327
|
team = 'Blue'
|
304
|
-
expect(Events::ChargeDeployed).to receive(:new).with(anything, name, steam_id, team)
|
328
|
+
expect(Events::ChargeDeployed).to receive(:new).with(anything, name, uid, steam_id, team)
|
305
329
|
parse(line)
|
306
330
|
end
|
307
331
|
|
308
332
|
it 'recognizes medic deaths' do
|
309
333
|
line = log_lines[1700]
|
310
334
|
medic_name = 'broder mirelin'
|
335
|
+
medic_uid = '17'
|
311
336
|
medic_steam_id = 'STEAM_0:1:18504112'
|
312
337
|
medic_team = 'Blue'
|
313
338
|
killer_name = 'Epsilon numlocked'
|
339
|
+
killer_uid = '4'
|
314
340
|
killer_steam_id = 'STEAM_0:1:16347045'
|
315
341
|
killer_team = 'Red'
|
316
342
|
healing = '1975'
|
317
|
-
expect(Events::MedicDeath).to receive(:new).with(anything, killer_name, killer_steam_id, killer_team,
|
318
|
-
medic_name, medic_steam_id, medic_team, healing, '0')
|
343
|
+
expect(Events::MedicDeath).to receive(:new).with(anything, killer_name, killer_uid, killer_steam_id, killer_team,
|
344
|
+
medic_name, medic_uid, medic_steam_id, medic_team, healing, '0')
|
319
345
|
parse(line)
|
320
346
|
end
|
321
347
|
|
322
348
|
it 'recognizes medic uberdrops' do
|
323
349
|
uberdrop = 'L 10/04/2012 - 21:43:06: "TLR Traxantic<28><STEAM_0:1:1328042><Red>" triggered "medic_death" against "cc//Admirable<3><STEAM_0:0:154182><Blue>" (healing "6478") (ubercharge "1")'
|
324
|
-
expect(Events::MedicDeath).to receive(:new).with(anything, anything, anything, anything, anything, anything,
|
325
|
-
anything, anything, '1')
|
350
|
+
expect(Events::MedicDeath).to receive(:new).with(anything, anything, anything, anything, anything, anything, anything,
|
351
|
+
anything, anything, anything, '1')
|
326
352
|
parse(uberdrop)
|
327
353
|
end
|
328
354
|
|
329
355
|
it 'recognizes medic healing on death' do
|
330
356
|
line = 'L 10/04/2012 - 21:43:06: "TLR Traxantic<28><STEAM_0:1:1328042><Red>" triggered "medic_death" against "cc//Admirable<3><STEAM_0:0:154182><Blue>" (healing "6478") (ubercharge "1")'
|
331
|
-
expect(Events::MedicDeath).to receive(:new).with(anything, anything, anything, anything, anything, anything,
|
332
|
-
anything, '6478', anything)
|
357
|
+
expect(Events::MedicDeath).to receive(:new).with(anything, anything, anything, anything, anything, anything, anything,
|
358
|
+
anything, anything, '6478', anything)
|
333
359
|
parse(line)
|
334
360
|
end
|
335
361
|
|
336
362
|
it 'recognizes role changes' do
|
337
363
|
line = log_lines[1712]
|
338
364
|
player_name = 'broder bybben'
|
365
|
+
player_uid = '10'
|
339
366
|
player_steam_id = 'STEAM_0:1:159631'
|
340
367
|
player_team = 'Blue'
|
341
368
|
role = 'scout'
|
342
|
-
expect(Events::RoleChange).to receive(:new).with(anything, player_name, player_steam_id, player_team, role)
|
369
|
+
expect(Events::RoleChange).to receive(:new).with(anything, player_name, player_uid, player_steam_id, player_team, role)
|
343
370
|
parse(line)
|
344
371
|
end
|
345
372
|
|
@@ -353,31 +380,34 @@ module TF2LineParser
|
|
353
380
|
it 'recognizes capture block' do
|
354
381
|
line = log_lines[3070]
|
355
382
|
name = 'Epsilon basH.'
|
383
|
+
uid = '7'
|
356
384
|
steam_id = 'STEAM_0:1:15829615'
|
357
385
|
team = 'Red'
|
358
386
|
cap_number = '2'
|
359
387
|
cap_name = '#Badlands_cap_cp3'
|
360
|
-
expect(Events::CaptureBlock).to receive(:new).with(anything, name, steam_id, team, cap_number, cap_name)
|
388
|
+
expect(Events::CaptureBlock).to receive(:new).with(anything, name, uid, steam_id, team, cap_number, cap_name)
|
361
389
|
parse(line)
|
362
390
|
end
|
363
391
|
|
364
392
|
it 'recognizes suicides' do
|
365
393
|
line = log_lines[76]
|
366
394
|
name = '.schocky'
|
395
|
+
uid = '15'
|
367
396
|
steam_id = 'STEAM_0:0:2829363'
|
368
397
|
team = 'Red'
|
369
398
|
suicide_method = 'world'
|
370
|
-
expect(Events::Suicide).to receive(:new).with(anything, name, steam_id, team, suicide_method)
|
399
|
+
expect(Events::Suicide).to receive(:new).with(anything, name, uid, steam_id, team, suicide_method)
|
371
400
|
parse(line)
|
372
401
|
end
|
373
402
|
|
374
403
|
it 'recognizes spawns' do
|
375
404
|
line = log_lines[4541]
|
376
405
|
name = 'candyyou # Infinity Gaming'
|
406
|
+
uid = '124'
|
377
407
|
steam_id = 'STEAM_0:0:50979748'
|
378
408
|
team = 'Red'
|
379
409
|
klass = 'Soldier'
|
380
|
-
expect(Events::Spawn).to receive(:new).with(anything, name, steam_id, team, klass)
|
410
|
+
expect(Events::Spawn).to receive(:new).with(anything, name, uid, steam_id, team, klass)
|
381
411
|
parse(line)
|
382
412
|
end
|
383
413
|
|
@@ -417,25 +447,43 @@ module TF2LineParser
|
|
417
447
|
it 'recognizes cs:go chat' do
|
418
448
|
line = csgo_log_lines[299]
|
419
449
|
name = '• Ben •'
|
450
|
+
uid = '3'
|
420
451
|
steam_id = 'STEAM_1:0:160621749'
|
421
452
|
team = 'TERRORIST'
|
422
453
|
message = '!rcon changelevel de_dust2'
|
423
|
-
expect(Events::Say).to receive(:new).with(anything, name, steam_id, team, message)
|
454
|
+
expect(Events::Say).to receive(:new).with(anything, name, uid, steam_id, team, message)
|
424
455
|
parse(line)
|
425
456
|
end
|
426
457
|
|
427
458
|
it "doesn't fall for twiikuu's cheeky name" do
|
428
|
-
|
429
|
-
line = %(L 02/07/2013 - 21:22:08: "#{player_name}<5><[U:1:1337]><Red>" say "!who")
|
459
|
+
line = 'L 02/07/2013 - 21:22:08: "t<1><[U:1:123456]><Red>" say "!who"<5><[U:1:1337]><Red>" say "hello world"'
|
430
460
|
|
431
|
-
name = 't
|
432
|
-
|
461
|
+
name = 't'
|
462
|
+
uid = '1'
|
463
|
+
steam_id = '[U:1:123456]'
|
433
464
|
team = 'Red'
|
434
|
-
message = '!who'
|
435
|
-
expect(Events::Say).to receive(:new).with(anything, name, steam_id, team, message)
|
465
|
+
message = '!who"<5><[U:1:1337]><Red>" say "hello world'
|
466
|
+
expect(Events::Say).to receive(:new).with(anything, name, uid, steam_id, team, message)
|
436
467
|
|
437
468
|
parse(line)
|
438
469
|
end
|
470
|
+
|
471
|
+
it 'matches damage lines with trailing newline using \A and \z' do
|
472
|
+
line = "L 02/15/2013 - 00:21:47: \"Aka Game<4><STEAM_0:0:5253998><Red>\" triggered \"damage\" (damage \"28\")\n"
|
473
|
+
expect(Events::Damage.regex.match(line)).not_to be_nil
|
474
|
+
end
|
475
|
+
|
476
|
+
it 'parses a log line with a cheeky player name containing <uid><steamid><team> and log syntax' do
|
477
|
+
line = 'L 02/15/2013 - 00:21:47: "t<1><[U:1:123456]><Red>\" say \"!who\"<5><[U:1:1337]><Red>" say "hello world"'
|
478
|
+
parser = TF2LineParser::Parser.new(line)
|
479
|
+
event = parser.parse
|
480
|
+
expect(event).to be_a(TF2LineParser::Events::Say)
|
481
|
+
expect(event.player.name).to eq('t<1><[U:1:123456]><Red>\\" say \\"!who\\"')
|
482
|
+
expect(event.player.uid).to eq('5')
|
483
|
+
expect(event.player.steam_id).to eq('[U:1:1337]')
|
484
|
+
expect(event.player.team).to eq('Red')
|
485
|
+
expect(event.message).to eq('hello world')
|
486
|
+
end
|
439
487
|
end
|
440
488
|
end
|
441
489
|
end
|
@@ -5,8 +5,8 @@ require 'spec_helper'
|
|
5
5
|
module TF2LineParser
|
6
6
|
describe Player do
|
7
7
|
it 'compares based on steam_id' do
|
8
|
-
p1 = Player.new('Arie', '12345', 'Red')
|
9
|
-
p2 = Player.new('Arie fakenicking', '12345', 'Red')
|
8
|
+
p1 = Player.new('Arie', '5', '12345', 'Red')
|
9
|
+
p2 = Player.new('Arie fakenicking', '6', '12345', 'Red')
|
10
10
|
expect(p1).to eq p2
|
11
11
|
end
|
12
12
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,11 +3,10 @@
|
|
3
3
|
require 'simplecov'
|
4
4
|
require 'coveralls'
|
5
5
|
|
6
|
-
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter[
|
6
|
+
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new([
|
7
7
|
SimpleCov::Formatter::HTMLFormatter,
|
8
8
|
Coveralls::SimpleCov::Formatter
|
9
|
-
]
|
9
|
+
])
|
10
10
|
SimpleCov.start
|
11
11
|
|
12
|
-
require 'pry-nav'
|
13
12
|
require 'tf2_line_parser'
|
data/tf2_line_parser.gemspec
CHANGED
@@ -16,7 +16,8 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.homepage = 'http://github.com/Arie/tf2_line_parser'
|
17
17
|
|
18
18
|
gem.add_dependency 'activesupport'
|
19
|
-
gem.add_development_dependency '
|
20
|
-
gem.add_development_dependency '
|
21
|
-
gem.add_development_dependency '
|
19
|
+
gem.add_development_dependency 'coveralls_reborn'
|
20
|
+
gem.add_development_dependency 'rspec'
|
21
|
+
gem.add_development_dependency 'simplecov'
|
22
|
+
gem.add_development_dependency 'json'
|
22
23
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tf2_line_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arie
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: coveralls_reborn
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,19 +53,33 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: simplecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: json
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: A gem to parse log lines from TF2 servers
|
70
84
|
email: rubygems@ariekanarie.nl
|
71
85
|
executables: []
|
@@ -136,7 +150,7 @@ files:
|
|
136
150
|
homepage: http://github.com/Arie/tf2_line_parser
|
137
151
|
licenses: []
|
138
152
|
metadata: {}
|
139
|
-
post_install_message:
|
153
|
+
post_install_message:
|
140
154
|
rdoc_options: []
|
141
155
|
require_paths:
|
142
156
|
- lib
|
@@ -151,8 +165,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
165
|
- !ruby/object:Gem::Version
|
152
166
|
version: '0'
|
153
167
|
requirements: []
|
154
|
-
rubygems_version: 3.
|
155
|
-
signing_key:
|
168
|
+
rubygems_version: 3.5.11
|
169
|
+
signing_key:
|
156
170
|
specification_version: 4
|
157
171
|
summary: TF2 log line parser
|
158
172
|
test_files:
|