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.



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

def airshot
  @airshot
end

#cap_nameObject

Returns the value of attribute cap_name.



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

def cap_name
  @cap_name
end

#cap_numberObject

Returns the value of attribute cap_number.



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

def cap_number
  @cap_number
end

#customkillObject

Returns the value of attribute customkill.



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

def customkill
  @customkill
end

#healingObject

Returns the value of attribute healing.



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

def healing
  @healing
end

#itemObject

Returns the value of attribute item.



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

def item
  @item
end

#lengthObject

Returns the value of attribute length.



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

def length
  @length
end

#messageObject

Returns the value of attribute message.



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

def message
  @message
end

#methodObject

Returns the value of attribute method.



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

def method
  @method
end

#playerObject

Returns the value of attribute player.



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

def player
  @player
end

#roleObject

Returns the value of attribute role.



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

def role
  @role
end

#scoreObject

Returns the value of attribute score.



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

def score
  @score
end

#targetObject

Returns the value of attribute target.



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

def target
  @target
end

#teamObject

Returns the value of attribute team.



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

def team
  @team
end

#timeObject

Returns the value of attribute time.



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

def time
  @time
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

#uberchargeObject

Returns the value of attribute ubercharge.



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

def ubercharge
  @ubercharge
end

#unknownObject

Returns the value of attribute unknown.



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

def unknown
  @unknown
end

#valueObject

Returns the value of attribute value.



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

def value
  @value
end

#weaponObject

Returns the value of attribute weapon.



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

def weapon
  @weapon
end

Class Method Details

.regex_capObject



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

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

.regex_consoleObject



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

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

.regex_messageObject



37
38
39
# File 'lib/tf2_line_parser/events/event.rb', line 37

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

.regex_playerObject



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

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

.regex_results(matched_line) ⇒ Object



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

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

.regex_targetObject



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

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

.regex_timeObject



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

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

.time_formatObject



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

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

.typesObject



41
42
43
44
45
46
47
# File 'lib/tf2_line_parser/events/event.rb', line 41

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, ConsoleSay, MatchEnd, FinalScore,
              RoundStalemate, Unknown].freeze
end

Instance Method Details

#parse_time(time_string) ⇒ Object



55
56
57
# File 'lib/tf2_line_parser/events/event.rb', line 55

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