tf2_line_parser 0.6.1 → 0.6.2
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: 8e3baffd4d9ebddf470c688dcc95d494a7067f97a751840a11937037a4c628c4
|
|
4
|
+
data.tar.gz: 06ff3fdc7686e001118279e09c66cbec031984076255edd5a125933f88a63e12
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d821617dfb99fe6a74ab3d109b6394a6ed76bcc729e7bfd3dba2eaaacf0a607be3765a318ce6cf8e3da2ac8c6d91d243e324a689729978a30598b8a07997a103
|
|
7
|
+
data.tar.gz: '047989cfbe3fd4fb6257d059c79aa2046692e18cca068b76873864f5c740a209ebc765ea9f01983156581ce1187754f33c9eee61fc44e83b6da8b09f6e70f7ef'
|
data/Gemfile.lock
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module TF2LineParser
|
|
4
|
+
module Events
|
|
5
|
+
class FeignDeath < PVPEvent
|
|
6
|
+
def self.regex
|
|
7
|
+
@regex ||= /#{regex_time} #{regex_player} killed #{regex_target} #{regex_weapon} #{regex_customkill}/.freeze
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.regex_weapon
|
|
11
|
+
@regex_weapon ||= 'with "(?\'weapon\'\w*)"'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.regex_customkill
|
|
15
|
+
@regex_customkill ||= /\(customkill "feign_death"\)/.freeze
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.attributes
|
|
19
|
+
@attributes ||= %i[time player_section target_section weapon]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def initialize(time, player_name, player_uid, player_steam_id, player_team, target_name, target_uid, target_steam_id, target_team, weapon)
|
|
23
|
+
@time = parse_time(time)
|
|
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)
|
|
26
|
+
@weapon = weapon
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/lib/tf2_line_parser/line.rb
CHANGED
|
@@ -53,8 +53,12 @@ module TF2LineParser
|
|
|
53
53
|
'position_report' => [Events::PositionReport],
|
|
54
54
|
}.freeze
|
|
55
55
|
|
|
56
|
-
# Fallback types when no keyword matches
|
|
56
|
+
# Fallback types when no keyword matches - ordered by specificity
|
|
57
57
|
FALLBACK_TYPES = [
|
|
58
|
+
Events::FeignDeath, Events::Kill, Events::PositionReport,
|
|
59
|
+
Events::TeamSay, Events::Say, Events::PickupItem,
|
|
60
|
+
Events::JoinedTeam, Events::EnteredGame, Events::RoleChange,
|
|
61
|
+
Events::Spawn, Events::Suicide, Events::Connect, Events::Disconnect,
|
|
58
62
|
Events::CurrentScore, Events::FinalScore, Events::RconCommand,
|
|
59
63
|
Events::ConsoleSay, Events::Unknown
|
|
60
64
|
].freeze
|
|
@@ -105,34 +109,7 @@ module TF2LineParser
|
|
|
105
109
|
end
|
|
106
110
|
end
|
|
107
111
|
|
|
108
|
-
|
|
109
|
-
if line.include?('" killed "')
|
|
110
|
-
[Events::Kill]
|
|
111
|
-
elsif line.include?('position_report')
|
|
112
|
-
[Events::PositionReport]
|
|
113
|
-
elsif line.include?('" say_team "')
|
|
114
|
-
[Events::TeamSay]
|
|
115
|
-
elsif line.include?('" say "')
|
|
116
|
-
[Events::Say]
|
|
117
|
-
elsif line.include?('picked up item')
|
|
118
|
-
[Events::PickupItem]
|
|
119
|
-
elsif line.include?('joined team "')
|
|
120
|
-
[Events::JoinedTeam]
|
|
121
|
-
elsif line.include?('entered the game')
|
|
122
|
-
[Events::EnteredGame]
|
|
123
|
-
elsif line.include?('changed role to')
|
|
124
|
-
[Events::RoleChange]
|
|
125
|
-
elsif line.include?('spawned as "')
|
|
126
|
-
[Events::Spawn]
|
|
127
|
-
elsif line.include?('committed suicide')
|
|
128
|
-
[Events::Suicide]
|
|
129
|
-
elsif line.include?('connected, address')
|
|
130
|
-
[Events::Connect]
|
|
131
|
-
elsif line.include?('disconnected (reason')
|
|
132
|
-
[Events::Disconnect]
|
|
133
|
-
else
|
|
134
|
-
FALLBACK_TYPES
|
|
135
|
-
end
|
|
112
|
+
FALLBACK_TYPES
|
|
136
113
|
end
|
|
137
114
|
|
|
138
115
|
def try_parse_types(line, types)
|
|
@@ -319,6 +319,16 @@ module TF2LineParser
|
|
|
319
319
|
parse(line)
|
|
320
320
|
end
|
|
321
321
|
|
|
322
|
+
it 'parses feign death as FeignDeath event (not Kill)' do
|
|
323
|
+
line = 'L 03/21/2026 - 22:08:05: "samir<32><[U:1:78482761]><Blue>" killed "vliwa<34><[U:1:68439644]><Red>" with "bleed_kill" (customkill "feign_death") (attacker_position "-1733 541 48") (victim_position "-3796 324 295")'
|
|
324
|
+
result = parse(line)
|
|
325
|
+
expect(result).to be_a(Events::FeignDeath)
|
|
326
|
+
expect(result).not_to be_a(Events::Kill)
|
|
327
|
+
expect(result.player.name).to eq('samir')
|
|
328
|
+
expect(result.target.name).to eq('vliwa')
|
|
329
|
+
expect(result.weapon).to eq('bleed_kill')
|
|
330
|
+
end
|
|
331
|
+
|
|
322
332
|
it 'recognizes an assist' do
|
|
323
333
|
line = log_lines[1451]
|
|
324
334
|
player_name = 'broder jukebox'
|
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.
|
|
4
|
+
version: 0.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Arie
|
|
@@ -98,6 +98,7 @@ files:
|
|
|
98
98
|
- lib/tf2_line_parser/events/empty_uber.rb
|
|
99
99
|
- lib/tf2_line_parser/events/entered_game.rb
|
|
100
100
|
- lib/tf2_line_parser/events/event.rb
|
|
101
|
+
- lib/tf2_line_parser/events/feign_death.rb
|
|
101
102
|
- lib/tf2_line_parser/events/final_score.rb
|
|
102
103
|
- lib/tf2_line_parser/events/first_heal_after_spawn.rb
|
|
103
104
|
- lib/tf2_line_parser/events/headshot_damage.rb
|