tf2_line_parser 0.3.2 → 0.3.3
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: 1add1102437c87d844bcd3c06190cafcca93b330126d328e5d7c540d28a9420e
|
|
4
|
+
data.tar.gz: eff574693d8fe5e44e9bf6ff231bed3fe36a52f81c52d320984451931daafb38
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 18afd840b134e1b5d6381b2bb2e78c9eb28592697e0ae8d110d1e1c64f32c6d557f160042c6e2b44fa4213e8a65d2d7795cf887e3b752a5c59ecd73e81d00a3d
|
|
7
|
+
data.tar.gz: 37f0f684beb8eff537644b047f20a68c7133c54ed45bc260e5271a225ef17905d9d67d508d3e674bba68decb8f6e50ffd02a6e88d9dfa58d3bcb0e1da6eb6069
|
|
@@ -37,7 +37,7 @@ module TF2LineParser
|
|
|
37
37
|
def self.types
|
|
38
38
|
# ordered by how common the messages are
|
|
39
39
|
@types ||= [Damage, Heal, PickupItem, Assist, Kill, CaptureBlock, PointCapture, ChargeDeployed,
|
|
40
|
-
MedicDeath, MedicDeathEx, RoleChange, Spawn, Airshot, HeadshotDamage, Suicide, Say, TeamSay, Domination, Revenge, RoundWin, CurrentScore,
|
|
40
|
+
MedicDeath, MedicDeathEx, RoleChange, Spawn, Airshot, HeadshotDamage, Suicide, KilledObject, Say, TeamSay, Domination, Revenge, RoundWin, CurrentScore,
|
|
41
41
|
RoundLength, RoundStart, Connect, Disconnect, RconCommand, ConsoleSay, MatchEnd, FinalScore,
|
|
42
42
|
RoundStalemate, Unknown].freeze
|
|
43
43
|
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
module TF2LineParser
|
|
2
|
+
module Events
|
|
3
|
+
class KilledObject < Event
|
|
4
|
+
attr_reader :time, :player, :object, :weapon, :objectowner
|
|
5
|
+
|
|
6
|
+
def self.regex
|
|
7
|
+
@regex ||= /#{regex_time} #{regex_player} triggered "killedobject" #{regex_object_info}#{regex_attacker_position}?/.freeze
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def self.regex_object_info
|
|
11
|
+
@regex_object_info ||= '\(object "(?\'object\'[^"]+)"\) \(weapon "(?\'weapon\'[^"]+)"\) \(objectowner "(?\'objectowner_section\'.*?)"\)'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.regex_attacker_position
|
|
15
|
+
@regex_attacker_position ||= / \(attacker_position "[^"]+"\)/
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.attributes
|
|
19
|
+
@attributes ||= %i[time player_section object weapon objectowner_section]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.regex_results(matched_line)
|
|
23
|
+
out = []
|
|
24
|
+
attributes.each do |attribute|
|
|
25
|
+
case attribute
|
|
26
|
+
when :player_section
|
|
27
|
+
if matched_line['player_section']
|
|
28
|
+
out.concat(parse_player_section(matched_line['player_section']))
|
|
29
|
+
else
|
|
30
|
+
out.concat([nil, nil, nil, nil])
|
|
31
|
+
end
|
|
32
|
+
when :objectowner_section
|
|
33
|
+
if matched_line['objectowner_section']
|
|
34
|
+
out.concat(parse_player_section(matched_line['objectowner_section']))
|
|
35
|
+
else
|
|
36
|
+
out.concat([nil, nil, nil, nil])
|
|
37
|
+
end
|
|
38
|
+
else
|
|
39
|
+
out << matched_line[attribute]
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
out
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def initialize(time, player_name, player_uid, player_steam_id, player_team, object, weapon, objectowner_name, objectowner_uid, objectowner_steam_id, objectowner_team)
|
|
46
|
+
@time = parse_time(time)
|
|
47
|
+
@player = Player.new(player_name, player_uid, player_steam_id, player_team)
|
|
48
|
+
@object = object
|
|
49
|
+
@weapon = weapon
|
|
50
|
+
@objectowner = Player.new(objectowner_name, objectowner_uid, objectowner_steam_id, objectowner_team)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -411,6 +411,22 @@ module TF2LineParser
|
|
|
411
411
|
parse(line)
|
|
412
412
|
end
|
|
413
413
|
|
|
414
|
+
it 'recognizes killed object' do
|
|
415
|
+
line = 'L 12/30/2025 - 03:08:01: "poo<5><[U:1:435117887]><Red>" triggered "killedobject" (object "OBJ_SENTRYGUN") (weapon "obj_attachment_sapper") (objectowner "ck<24><[U:1:161147993]><Blue>") (attacker_position "-192 1630 1646")'
|
|
416
|
+
player_name = 'poo'
|
|
417
|
+
player_uid = '5'
|
|
418
|
+
player_steam_id = '[U:1:435117887]'
|
|
419
|
+
player_team = 'Red'
|
|
420
|
+
object = 'OBJ_SENTRYGUN'
|
|
421
|
+
weapon = 'obj_attachment_sapper'
|
|
422
|
+
objectowner_name = 'ck'
|
|
423
|
+
objectowner_uid = '24'
|
|
424
|
+
objectowner_steam_id = '[U:1:161147993]'
|
|
425
|
+
objectowner_team = 'Blue'
|
|
426
|
+
expect(Events::KilledObject).to receive(:new).with(anything, player_name, player_uid, player_steam_id, player_team, object, weapon, objectowner_name, objectowner_uid, objectowner_steam_id, objectowner_team)
|
|
427
|
+
parse(line)
|
|
428
|
+
end
|
|
429
|
+
|
|
414
430
|
it 'recognizes spawns' do
|
|
415
431
|
line = log_lines[4541]
|
|
416
432
|
name = 'candyyou # Infinity Gaming'
|
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.3.
|
|
4
|
+
version: 0.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Arie
|
|
@@ -110,6 +110,7 @@ files:
|
|
|
110
110
|
- lib/tf2_line_parser/events/headshot_damage.rb
|
|
111
111
|
- lib/tf2_line_parser/events/heal.rb
|
|
112
112
|
- lib/tf2_line_parser/events/kill.rb
|
|
113
|
+
- lib/tf2_line_parser/events/killed_object.rb
|
|
113
114
|
- lib/tf2_line_parser/events/match_end.rb
|
|
114
115
|
- lib/tf2_line_parser/events/medic_death.rb
|
|
115
116
|
- lib/tf2_line_parser/events/medic_death_ex.rb
|