Class: TF2LineParser::Events::ShotHit

Inherits:
PlayerActionEvent show all
Defined in:
lib/tf2_line_parser/events/shot_hit.rb

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 PlayerActionEvent

regex

Methods inherited from Event

parse_player_section, parse_target_section, #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_uid, player_steam_id, player_team, weapon) ⇒ ShotHit

Returns a new instance of ShotHit.



22
23
24
25
26
# File 'lib/tf2_line_parser/events/shot_hit.rb', line 22

def initialize(time, player_name, player_uid, player_steam_id, player_team, weapon)
  @time = parse_time(time)
  @player = Player.new(player_name, player_uid, player_steam_id, player_team)
  @weapon = weapon
end

Class Method Details

.action_textObject



6
7
8
# File 'lib/tf2_line_parser/events/shot_hit.rb', line 6

def self.action_text
  @action_text ||= 'triggered "shot_hit"'
end

.attributesObject



18
19
20
# File 'lib/tf2_line_parser/events/shot_hit.rb', line 18

def self.attributes
  @attributes ||= %i[time player_section weapon]
end

.itemObject



14
15
16
# File 'lib/tf2_line_parser/events/shot_hit.rb', line 14

def self.item
  :weapon
end

.regex_actionObject



10
11
12
# File 'lib/tf2_line_parser/events/shot_hit.rb', line 10

def self.regex_action
  @regex_action ||= '\(weapon "(?\'weapon\'[^\"]+)"\)'
end