Class: Australium::GameEnd

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

Overview

A special Event injected by Australium to indicate the end of a Game log. Note that this may not be the actual end of a game, i.e. if logging was interrupted, but it is the end of what Australium has available to parse.

Constant Summary

Constants inherited from Event

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

Instance Attribute Summary

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) ⇒ GameEnd

Returns a new instance of GameEnd


8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/australium/events/game_end.rb', line 8

def initialize(data)
  super(data)

  unless self.state.nil? || self.state.players.nil?
    self.state.players.each do |player|

      [:connected?, :in_game?].each { |attr| player[attr, timestamp] = false }

      player.time_connected = player.durations(:connected?)[true] rescue 0
      player.time_ingame = player.durations(:in_game?)[true] rescue 0

    end
  end
end