Class: Australium::PlayerKill

Inherits:
Event show all
Defined in:
lib/australium/events/player_kill.rb

Constant Summary collapse

LOG_REGEX =
/"(?<attacker>.+)" killed "(?<victim>.+)" with "(?<weapon>[^"]+)"/

Constants inherited from Event

Event::PROPERTY_REGEX, Event::TIMESTAMP_FORMAT, Event::TIMESTAMP_REGEX

Instance Attribute Summary collapse

Attributes inherited from Event

#raw

Instance Method Summary collapse

Methods inherited from Event

inherited, #to_s

Methods inherited from OpenStruct

#initialize_clone

Constructor Details

#initialize(data) ⇒ PlayerKill

Returns a new instance of PlayerKill


13
14
15
16
17
18
19
# File 'lib/australium/events/player_kill.rb', line 13

def initialize(data)
  super(data)
  [attacker, victim].each do |player|
    player[:connected?, timestamp] = true
    player[:in_game?, timestamp] = true
  end
end

Instance Attribute Details

#attackerPlayer

Returns the Australium::Player responsible for the kill.

Returns:


13
14
15
16
17
18
19
# File 'lib/australium/events/player_kill.rb', line 13

def initialize(data)
  super(data)
  [attacker, victim].each do |player|
    player[:connected?, timestamp] = true
    player[:in_game?, timestamp] = true
  end
end

#victimPlayer

Returns the Australium::Player who was killed.

Returns:


13
14
15
16
17
18
19
# File 'lib/australium/events/player_kill.rb', line 13

def initialize(data)
  super(data)
  [attacker, victim].each do |player|
    player[:connected?, timestamp] = true
    player[:in_game?, timestamp] = true
  end
end

#weaponString

Returns the name of the weapon used to kill (can be World).

Returns:

  • (String)

    the name of the weapon used to kill (can be World).


13
14
15
16
17
18
19
# File 'lib/australium/events/player_kill.rb', line 13

def initialize(data)
  super(data)
  [attacker, victim].each do |player|
    player[:connected?, timestamp] = true
    player[:in_game?, timestamp] = true
  end
end