tf2_line_parser 0.1.4 → 0.1.5
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41ffcb0e8974928c190db1522e7fd1c035b1c4b6
|
4
|
+
data.tar.gz: 8515b8d7f43dc0d1fbb9cd4ff0398f3267cac355
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f24272d19b049ddbcb1d28fbb985ff7314d9cef77e6d60a34240c45b4d741141b0cebdda92566e85914c253498c877864f857c41ccb25fcce54de1b331e27236
|
7
|
+
data.tar.gz: e69b22b7643352b0109d6dc27ee83d8660451ed9b6711921bce70aab67a12e081ff70e810ef8981d5ca9376f87550baf630b52955065fdd204525724025fae97
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tf2_line_parser (0.1.
|
4
|
+
tf2_line_parser (0.1.4)
|
5
5
|
activesupport
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (4.2.
|
10
|
+
activesupport (4.2.3)
|
11
11
|
i18n (~> 0.7)
|
12
12
|
json (~> 1.7, >= 1.7.7)
|
13
13
|
minitest (~> 5.1)
|
@@ -23,10 +23,10 @@ GEM
|
|
23
23
|
diff-lcs (1.2.5)
|
24
24
|
docile (1.1.5)
|
25
25
|
i18n (0.7.0)
|
26
|
-
json (1.8.
|
26
|
+
json (1.8.3)
|
27
27
|
method_source (0.8.2)
|
28
28
|
mime-types (2.4.3)
|
29
|
-
minitest (5.
|
29
|
+
minitest (5.7.0)
|
30
30
|
multi_json (1.10.1)
|
31
31
|
pry (0.10.1)
|
32
32
|
coderay (~> 1.1.0)
|
@@ -53,7 +53,7 @@ GEM
|
|
53
53
|
term-ansicolor (1.2.2)
|
54
54
|
tins (~> 0.8)
|
55
55
|
thor (0.18.1)
|
56
|
-
thread_safe (0.3.
|
56
|
+
thread_safe (0.3.5)
|
57
57
|
tins (0.13.2)
|
58
58
|
tzinfo (1.2.2)
|
59
59
|
thread_safe (~> 0.1)
|
@@ -66,3 +66,6 @@ DEPENDENCIES
|
|
66
66
|
pry-nav (~> 0.2.3)
|
67
67
|
rspec (~> 2.13.0)
|
68
68
|
tf2_line_parser!
|
69
|
+
|
70
|
+
BUNDLED WITH
|
71
|
+
1.10.5
|
@@ -40,7 +40,7 @@ module TF2LineParser
|
|
40
40
|
def self.types
|
41
41
|
#ordered by how common the messages are
|
42
42
|
@types ||= [Damage, Heal, PickupItem, Assist, Kill, CaptureBlock, PointCapture, ChargeDeployed,
|
43
|
-
MedicDeath, RoleChange, Spawn, Airshot, Suicide, Say, TeamSay, Domination, Revenge, RoundWin, CurrentScore,
|
43
|
+
MedicDeath, RoleChange, Spawn, Airshot, HeadshotDamage, Suicide, Say, TeamSay, Domination, Revenge, RoundWin, CurrentScore,
|
44
44
|
RoundLength, RoundStart, ConsoleSay, MatchEnd, FinalScore,
|
45
45
|
RoundStalemate, Unknown].freeze
|
46
46
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module TF2LineParser
|
2
|
+
module Events
|
3
|
+
|
4
|
+
class HeadshotDamage < Damage
|
5
|
+
|
6
|
+
def self.regex
|
7
|
+
@regex ||= /#{regex_time} #{regex_player} triggered "damage" #{regex_damage_against}\(damage "(?'value'\d+)"\)(?:( #{regex_realdamage})?( #{regex_weapon})?) #{regex_headshot}$/.freeze
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.regex_headshot
|
11
|
+
@regex_headshot ||= '\(headshot "(?\'headshot\'\d+)"\)'.freeze
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.attributes
|
15
|
+
@attributes ||= [:time, :player_nick, :player_steamid, :player_team, :target_nick, :target_steamid, :target_team, :value, :weapon]
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(time, player_name, player_steamid, player_team, target_name, target_steamid, target_team, value, weapon)
|
19
|
+
@time = parse_time(time)
|
20
|
+
@player = Player.new(player_name, player_steamid, player_team)
|
21
|
+
if target_name
|
22
|
+
@target = Player.new(target_name, target_steamid, target_team)
|
23
|
+
end
|
24
|
+
@value = value.to_i
|
25
|
+
@weapon = weapon
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -80,6 +80,13 @@ module TF2LineParser
|
|
80
80
|
parse(line).inspect
|
81
81
|
end
|
82
82
|
|
83
|
+
it 'recognizes sniper headshot damage' do
|
84
|
+
line = detailed_log_lines[3645]
|
85
|
+
weapon = "sniperrifle"
|
86
|
+
Events::HeadshotDamage.should_receive(:new).with(anything, anything, anything, anything, anything, anything, anything, anything, weapon)
|
87
|
+
parse(line).inspect
|
88
|
+
end
|
89
|
+
|
83
90
|
it 'ignores realdamage' do
|
84
91
|
line = detailed_log_lines[65]
|
85
92
|
player_name = "LittleLies"
|
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.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- lib/tf2_line_parser/events/domination.rb
|
92
92
|
- lib/tf2_line_parser/events/event.rb
|
93
93
|
- lib/tf2_line_parser/events/final_score.rb
|
94
|
+
- lib/tf2_line_parser/events/headshot_damage.rb
|
94
95
|
- lib/tf2_line_parser/events/heal.rb
|
95
96
|
- lib/tf2_line_parser/events/kill.rb
|
96
97
|
- lib/tf2_line_parser/events/match_end.rb
|
@@ -147,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
148
|
version: '0'
|
148
149
|
requirements: []
|
149
150
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
151
|
+
rubygems_version: 2.4.7
|
151
152
|
signing_key:
|
152
153
|
specification_version: 4
|
153
154
|
summary: TF2 log line parser
|