Class: Australium::PlayerRoleChange

Inherits:
Event
  • Object
show all
Defined in:
lib/australium/events/player_role_change.rb

Constant Summary collapse

LOG_REGEX =
/"(?<player>.+)" changed role to "(?<role>.+)"/

Constants inherited from Event

Event::PROPERTY_REGEX, Event::TIMESTAMP_REGEX

Instance Attribute Summary collapse

Attributes inherited from Event

#raw

Instance Method Summary collapse

Methods inherited from Event

inherited, #to_s

Constructor Details

#initialize(data) ⇒ PlayerRoleChange

Returns a new instance of PlayerRoleChange.



11
12
13
14
15
16
17
# File 'lib/australium/events/player_role_change.rb', line 11

def initialize(data)
  super(data)
  unless state.nil?
    player = state.players.find { |p| p.nick == self.player.nick }
    player.role = role
  end
end

Instance Attribute Details

#playerPlayer

Returns the Australium::Player who changed role.

Returns:



11
12
13
14
15
16
17
# File 'lib/australium/events/player_role_change.rb', line 11

def initialize(data)
  super(data)
  unless state.nil?
    player = state.players.find { |p| p.nick == self.player.nick }
    player.role = role
  end
end

#roleString

Returns the name of the role the player changed to.

Returns:

  • (String)

    the name of the role the player changed to.



11
12
13
14
15
16
17
# File 'lib/australium/events/player_role_change.rb', line 11

def initialize(data)
  super(data)
  unless state.nil?
    player = state.players.find { |p| p.nick == self.player.nick }
    player.role = role
  end
end