Class: Tassadar::SC2::Replay

Inherits:
Object
  • Object
show all
Defined in:
lib/tassadar/sc2/replay.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, data = nil) ⇒ Replay

Returns a new instance of Replay.



13
14
15
16
17
18
19
20
# File 'lib/tassadar/sc2/replay.rb', line 13

def initialize(filename, data=nil)
  @mpq = MPQ::MPQ.read(data.nil? ? File.read(filename) : data)
  @attributes = Attributes.read(@mpq.read_file("replay.attributes.events"))
  @details = Details.read(@mpq.read_file("replay.details"))

  @players = @details.data[0].map {|h| Player.new(h, @attributes.attributes)}
  @game = Game.new(self)
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



11
12
13
# File 'lib/tassadar/sc2/replay.rb', line 11

def attributes
  @attributes
end

#detailsObject

Returns the value of attribute details.



11
12
13
# File 'lib/tassadar/sc2/replay.rb', line 11

def details
  @details
end

#gameObject

Returns the value of attribute game.



11
12
13
# File 'lib/tassadar/sc2/replay.rb', line 11

def game
  @game
end

#mpqObject

Returns the value of attribute mpq.



11
12
13
# File 'lib/tassadar/sc2/replay.rb', line 11

def mpq
  @mpq
end

#playersObject

Returns the value of attribute players.



11
12
13
# File 'lib/tassadar/sc2/replay.rb', line 11

def players
  @players
end