tf2_line_parser 0.6.0 → 0.6.1
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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d62fb60bbb31b6578bbf54b7f5101f8f7fc93689c432494a08679f3e9d48cdca
|
|
4
|
+
data.tar.gz: 9a94a4deffdcda33dddffd7efdaf4c08f3b8e97a17758fd5c46c705cf67ddb77
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1f4c05bec771e0abc994ae0d83f63e6ccda3bd7cf3296defe2690603c1754cbd474836714de8abf45aa368251a974431663287077033f277a1ad1abf6154bf24
|
|
7
|
+
data.tar.gz: 190f40d4da42c17ef659af94bcba4d890e98f5fec17ca6f1e472f3095f9058e138a22bac59a710804343a9758f7c2f9d53336bf213ca55e5e25635731da62d6c
|
data/Gemfile.lock
CHANGED
|
@@ -4,8 +4,8 @@ module TF2LineParser
|
|
|
4
4
|
module Events
|
|
5
5
|
class Airshot < Damage
|
|
6
6
|
def self.regex
|
|
7
|
-
# Airshot can appear after weapon, with optional
|
|
8
|
-
@regex ||= /#{regex_time} #{regex_player} triggered "damage" #{regex_damage_against}\(damage "(?'value'\d+)"\)#{regex_realdamage}#{regex_weapon}#{regex_airshot}#{regex_height}/.freeze
|
|
7
|
+
# Airshot can appear after weapon, with optional crit/healing between weapon and airshot
|
|
8
|
+
@regex ||= /#{regex_time} #{regex_player} triggered "damage" #{regex_damage_against}\(damage "(?'value'\d+)"\)#{regex_realdamage}#{regex_weapon}#{regex_healing}#{regex_crit}#{regex_airshot}#{regex_height}/.freeze
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def self.regex_airshot
|
|
@@ -17,7 +17,7 @@ module TF2LineParser
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def self.attributes
|
|
20
|
-
@attributes ||= %i[time player_section target_section realdamage weapon airshot]
|
|
20
|
+
@attributes ||= %i[time player_section target_section realdamage weapon healing crit airshot]
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def self.regex_results(matched_line)
|
|
@@ -27,6 +27,8 @@ module TF2LineParser
|
|
|
27
27
|
value = matched_line['value']
|
|
28
28
|
realdamage = matched_line['realdamage']
|
|
29
29
|
weapon = matched_line['weapon']
|
|
30
|
+
healing = matched_line['healing']
|
|
31
|
+
crit = matched_line['crit']
|
|
30
32
|
airshot = matched_line['airshot']
|
|
31
33
|
|
|
32
34
|
# Parse player section
|
|
@@ -38,10 +40,10 @@ module TF2LineParser
|
|
|
38
40
|
target_name, target_uid, target_steamid, target_team = parse_target_section(target_section)
|
|
39
41
|
end
|
|
40
42
|
|
|
41
|
-
[time, player_name, player_uid, player_steamid, player_team, target_name, target_uid, target_steamid, target_team, value, realdamage, weapon, airshot]
|
|
43
|
+
[time, player_name, player_uid, player_steamid, player_team, target_name, target_uid, target_steamid, target_team, value, realdamage, weapon, healing, crit, airshot]
|
|
42
44
|
end
|
|
43
45
|
|
|
44
|
-
def initialize(time, player_name, player_uid, player_steamid, player_team, target_name, target_uid, target_steamid, target_team, value, realdamage, weapon, airshot)
|
|
46
|
+
def initialize(time, player_name, player_uid, player_steamid, player_team, target_name, target_uid, target_steamid, target_team, value, realdamage, weapon, healing, crit, airshot)
|
|
45
47
|
@time = parse_time(time)
|
|
46
48
|
@player = Player.new(player_name, player_uid, player_steamid, player_team)
|
|
47
49
|
@target = Player.new(target_name, target_uid, target_steamid, target_team) if target_name
|
|
@@ -49,8 +51,8 @@ module TF2LineParser
|
|
|
49
51
|
@damage = @value
|
|
50
52
|
@realdamage = realdamage.to_i if realdamage && !realdamage.empty?
|
|
51
53
|
@weapon = weapon
|
|
52
|
-
@healing =
|
|
53
|
-
@crit =
|
|
54
|
+
@healing = healing.to_i if healing
|
|
55
|
+
@crit = crit
|
|
54
56
|
@headshot = nil
|
|
55
57
|
@airshot = (airshot.to_i == 1)
|
|
56
58
|
end
|
data/lib/tf2_line_parser/line.rb
CHANGED
|
@@ -5,3 +5,4 @@ L 12/18/2025 - 22:10:55: "fy<14><[U:1:442791013]><Blue>" triggered "damage" agai
|
|
|
5
5
|
L 12/18/2025 - 22:12:57: "tantwo<17><[U:1:191375689]><Blue>" triggered "damage" against "keicam<9><[U:1:163231154]><Red>" (damage "105") (weapon "quake_rl") (airshot "1") (height "318")
|
|
6
6
|
L 12/18/2025 - 22:12:58: "tantwo<17><[U:1:191375689]><Blue>" triggered "damage" against "keicam<9><[U:1:163231154]><Red>" (damage "99") (realdamage "9") (weapon "quake_rl") (airshot "1") (height "427")
|
|
7
7
|
L 12/18/2025 - 22:15:21: "fy<14><[U:1:442791013]><Blue>" triggered "damage" against "gibusmain<19><[U:1:258908204]><Red>" (damage "109") (realdamage "66") (weapon "tf_projectile_rocket") (airshot "1") (height "228")
|
|
8
|
+
L 03/21/2026 - 22:02:55: "Bass Windu<15><[U:1:156982175]><Blue>" triggered "damage" against "auto<14><[U:1:101982160]><Red>" (damage "152") (weapon "rocketlauncher_directhit") (crit "mini") (airshot "1") (height "242")
|
|
@@ -89,7 +89,7 @@ module TF2LineParser
|
|
|
89
89
|
weapon = 'tf_projectile_rocket'
|
|
90
90
|
airshot = '1'
|
|
91
91
|
expect(Events::Airshot).to receive(:new).with(anything, anything, anything, anything, anything, anything, anything,
|
|
92
|
-
anything, anything, anything, nil, weapon, airshot)
|
|
92
|
+
anything, anything, anything, nil, weapon, nil, nil, airshot)
|
|
93
93
|
parse(line).inspect
|
|
94
94
|
end
|
|
95
95
|
|
|
@@ -120,6 +120,23 @@ module TF2LineParser
|
|
|
120
120
|
expect(result.airshot).to eq(true)
|
|
121
121
|
end
|
|
122
122
|
|
|
123
|
+
it 'recognizes airshots with crit' do
|
|
124
|
+
line = airshot_log_lines[7]
|
|
125
|
+
result = parse(line)
|
|
126
|
+
expect(result).to be_a(Events::Airshot)
|
|
127
|
+
expect(result.player.name).to eq('Bass Windu')
|
|
128
|
+
expect(result.player.steam_id).to eq('[U:1:156982175]')
|
|
129
|
+
expect(result.player.team).to eq('Blue')
|
|
130
|
+
expect(result.target.name).to eq('auto')
|
|
131
|
+
expect(result.target.steam_id).to eq('[U:1:101982160]')
|
|
132
|
+
expect(result.target.team).to eq('Red')
|
|
133
|
+
expect(result.damage).to eq(152)
|
|
134
|
+
expect(result.realdamage).to be_nil
|
|
135
|
+
expect(result.weapon).to eq('rocketlauncher_directhit')
|
|
136
|
+
expect(result.crit).to eq('mini')
|
|
137
|
+
expect(result.airshot).to eq(true)
|
|
138
|
+
end
|
|
139
|
+
|
|
123
140
|
it 'recognizes airshot heals (Crusader Crossbow mid-air)' do
|
|
124
141
|
line = airshot_log_lines[2]
|
|
125
142
|
result = parse(line)
|