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: 2ccca85756ff65c53f9ae713abb9b065ff9fbd5fc4141bd936c7f36726f35ddb
4
- data.tar.gz: b791765db72f6cbb01c19ebe2ed85b408633359fe6ce463e713e914162ebf41c
3
+ metadata.gz: d62fb60bbb31b6578bbf54b7f5101f8f7fc93689c432494a08679f3e9d48cdca
4
+ data.tar.gz: 9a94a4deffdcda33dddffd7efdaf4c08f3b8e97a17758fd5c46c705cf67ddb77
5
5
  SHA512:
6
- metadata.gz: 46b65da5de6c037e0b092149837f0dc8614a3c3f79ea64f82bda2ab0263e81b14763c86bd71d74feaaa15401d42538eb7bb3fd030848e811b09177492187471b
7
- data.tar.gz: a77d21150501dff565387b89bbdb07017d5739705fb30e1e442aef90bcddfab79071da01a92e88011dec8997530cd73aa2e18875d3c7982767a0a44bdce6504a
6
+ metadata.gz: 1f4c05bec771e0abc994ae0d83f63e6ccda3bd7cf3296defe2690603c1754cbd474836714de8abf45aa368251a974431663287077033f277a1ad1abf6154bf24
7
+ data.tar.gz: 190f40d4da42c17ef659af94bcba4d890e98f5fec17ca6f1e472f3095f9058e138a22bac59a710804343a9758f7c2f9d53336bf213ca55e5e25635731da62d6c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tf2_line_parser (0.6.0)
4
+ tf2_line_parser (0.6.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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 height at the end
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 = nil
53
- @crit = nil
54
+ @healing = healing.to_i if healing
55
+ @crit = crit
54
56
  @headshot = nil
55
57
  @airshot = (airshot.to_i == 1)
56
58
  end
@@ -157,7 +157,7 @@ module TF2LineParser
157
157
  if suffix.include?('(headshot "')
158
158
  [Events::HeadshotDamage]
159
159
  elsif suffix.include?('(airshot "')
160
- [Events::Airshot]
160
+ [Events::Airshot, Events::Damage]
161
161
  else
162
162
  [Events::Damage]
163
163
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TF2LineParser
4
- VERSION = '0.6.0'
4
+ VERSION = '0.6.1'
5
5
  end
@@ -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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tf2_line_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arie