Class: TF2LineParser::Events::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/tf2_line_parser/events/event.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#airshotObject

Returns the value of attribute airshot.



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

def airshot
  @airshot
end

#cap_nameObject

Returns the value of attribute cap_name.



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

def cap_name
  @cap_name
end

#cap_numberObject

Returns the value of attribute cap_number.



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

def cap_number
  @cap_number
end

#customkillObject

Returns the value of attribute customkill.



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

def customkill
  @customkill
end

#healingObject

Returns the value of attribute healing.



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

def healing
  @healing
end

#itemObject

Returns the value of attribute item.



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

def item
  @item
end

#lengthObject

Returns the value of attribute length.



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

def length
  @length
end

#messageObject

Returns the value of attribute message.



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

def message
  @message
end

#methodObject

Returns the value of attribute method.



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

def method
  @method
end

#playerObject

Returns the value of attribute player.



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

def player
  @player
end

#roleObject

Returns the value of attribute role.



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

def role
  @role
end

#scoreObject

Returns the value of attribute score.



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

def score
  @score
end

#targetObject

Returns the value of attribute target.



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

def target
  @target
end

#teamObject

Returns the value of attribute team.



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

def team
  @team
end

#timeObject

Returns the value of attribute time.



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

def time
  @time
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

#uberchargeObject

Returns the value of attribute ubercharge.



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

def ubercharge
  @ubercharge
end

#unknownObject

Returns the value of attribute unknown.



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

def unknown
  @unknown
end

#valueObject

Returns the value of attribute value.



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

def value
  @value
end

#weaponObject

Returns the value of attribute weapon.



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

def weapon
  @weapon
end

Class Method Details

.regex_capObject



25
26
27
# File 'lib/tf2_line_parser/events/event.rb', line 25

def self.regex_cap
  @regex_cap ||= '\(cp "(?\'cp_number\'\d+)"\) \(cpname "(?\'cp_name\'.\w*)'
end

.regex_consoleObject



29
30
31
# File 'lib/tf2_line_parser/events/event.rb', line 29

def self.regex_console
  @regex_console ||= '"Console<0><Console><Console>"'
end

.regex_messageObject



33
34
35
# File 'lib/tf2_line_parser/events/event.rb', line 33

def self.regex_message
  @regex_message ||= '"(?\'message\'.*)"'
end

.regex_playerObject



17
18
19
# File 'lib/tf2_line_parser/events/event.rb', line 17

def self.regex_player
  @regex_player ||= '"(?\'player_nick\'.+)<(?\'player_uid\'\d+)><(?\'player_steamid\'(\[\S+\]|STEAM_\S+))><(?\'player_team\'Red|Blue|Spectator|TERRORIST|CT||)>"'
end

.regex_results(matched_line) ⇒ Object



45
46
47
48
49
# File 'lib/tf2_line_parser/events/event.rb', line 45

def self.regex_results(matched_line)
  attributes.collect do |attribute|
    matched_line[attribute]
  end
end

.regex_targetObject



21
22
23
# File 'lib/tf2_line_parser/events/event.rb', line 21

def self.regex_target
  @regex_target ||= '"(?\'target_nick\'.+)<(?\'target_uid\'\d+)><(?\'target_steamid\'(\[\S+\]|STEAM_\S+))><(?\'target_team\'Red|Blue|TERRORIST|CT)>"'
end

.regex_timeObject



13
14
15
# File 'lib/tf2_line_parser/events/event.rb', line 13

def self.regex_time
  @regex_time ||= 'L (?\'time\'.*):'
end

.time_formatObject



9
10
11
# File 'lib/tf2_line_parser/events/event.rb', line 9

def self.time_format
  @time_format ||= '%m/%d/%Y - %T'
end

.typesObject



37
38
39
40
41
42
43
# File 'lib/tf2_line_parser/events/event.rb', line 37

def self.types
  # ordered by how common the messages are
  @types ||= [Damage, Heal, PickupItem, Assist, Kill, CaptureBlock, PointCapture, ChargeDeployed,
              MedicDeath, RoleChange, Spawn, Airshot, HeadshotDamage, Suicide, Say, TeamSay, Domination, Revenge, RoundWin, CurrentScore,
              RoundLength, RoundStart, Connect, Disconnect, RconCommand, ConsoleSay, MatchEnd, FinalScore,
              RoundStalemate, Unknown].freeze
end

Instance Method Details

#parse_time(time_string) ⇒ Object



51
52
53
# File 'lib/tf2_line_parser/events/event.rb', line 51

def parse_time(time_string)
  Time.strptime(time_string, Event.time_format)
end