Class: TF2LineParser::Events::Kill
Instance Attribute Summary
Attributes inherited from Event
#airshot, #cap_name, #cap_number, #customkill, #healing, #item, #length, #message, #method, #player, #role, #score, #target, #team, #time, #type, #ubercharge, #unknown, #value, #weapon
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Event
#parse_time, regex_cap, regex_console, regex_message, regex_player, regex_results, regex_target, regex_time, time_format, types
Constructor Details
#initialize(time, player_name, player_steam_id, player_team, target_name, target_steam_id, target_team, weapon, customkill) ⇒ Kill
Returns a new instance of Kill.
23
24
25
26
27
28
29
|
# File 'lib/tf2_line_parser/events/kill.rb', line 23
def initialize(time, player_name, player_steam_id, player_team, target_name, target_steam_id, target_team, weapon, customkill)
@time = parse_time(time)
@player = Player.new(player_name, player_steam_id, player_team)
@target = Player.new(target_name, target_steam_id, target_team)
@weapon = weapon
@customkill = customkill
end
|
Class Method Details
.attributes ⇒ Object
19
20
21
|
# File 'lib/tf2_line_parser/events/kill.rb', line 19
def self.attributes
@attributes ||= [:time, :player_nick, :player_steamid, :player_team, :target_nick, :target_steamid, :target_team, :weapon, :customkill]
end
|
.regex ⇒ Object
7
8
9
|
# File 'lib/tf2_line_parser/events/kill.rb', line 7
def self.regex
@regex ||= /#{regex_time} #{regex_player} killed #{regex_target} #{regex_weapon} #{regex_customkill}/.freeze
end
|
.regex_customkill ⇒ Object
15
16
17
|
# File 'lib/tf2_line_parser/events/kill.rb', line 15
def self.regex_customkill
@regex_customkill ||= /(\(customkill "(?'customkill'\w*)"\))?/.freeze
end
|
.regex_weapon ⇒ Object
11
12
13
|
# File 'lib/tf2_line_parser/events/kill.rb', line 11
def self.regex_weapon
@regex_weapon ||= 'with "(?\'weapon\'\w*)"'.freeze
end
|