Class: TF2LineParser::Events::PickupItem

Inherits:
PlayerActionEvent show all
Defined in:
lib/tf2_line_parser/events/pickup_item.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, item, value = nil) ⇒ PickupItem

Returns a new instance of PickupItem.



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

def initialize(time, player_name, player_uid, player_steam_id, player_team, item, value = nil)
  @time = parse_time(time)
  @player = Player.new(player_name, player_uid, player_steam_id, player_team)
  @item = item
  @value = value&.to_i
  @healing = @value
end

Class Method Details

.action_textObject



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

def self.action_text
  @action_text ||= 'picked up item'
end

.attributesObject



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

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

.itemObject



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

def self.item
  :item
end

.regex_actionObject



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

def self.regex_action
  @regex_item ||= '\"(?\'item\'[^\"]+)\"(?: \\(healing \"(?\'value\'\\d+)\"\\))?'
end