Class: D3MPQ::CoreData::GameBalance::Base

Inherits:
MPQ
  • Object
show all
Defined in:
lib/d3_mpq/core_data/game_balance/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.content(&block) ⇒ Object

Main method to use



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/d3_mpq/core_data/game_balance/base.rb', line 30

def content(&block)
  array :content,
        :initial_length => lambda { data_num_bytes / struct_size },
        :adjust_offset  => lambda { data_offset + 16 },
        &block


  count_bytes_remaining :bytes_remaining
  hide  :variable_content
  array :variable_content, :initial_length => lambda { bytes_remaining / 4 } do
    string :length => 4
  end

  hide  :rest
  rest  :rest
end

.struct_sizeObject



47
48
49
# File 'lib/d3_mpq/core_data/game_balance/base.rb', line 47

def struct_size
  @struct_size ||= 0
end

.struct_size=(value) ⇒ Object



51
52
53
# File 'lib/d3_mpq/core_data/game_balance/base.rb', line 51

def struct_size=(value)
  @struct_size = value
end

Instance Method Details

#data_offsetObject

data start offset (relative to the starts of the GamHeader



19
20
21
# File 'lib/d3_mpq/core_data/game_balance/base.rb', line 19

def data_offset
  data_array_entries.last
end

#struct_sizeObject



57
58
59
# File 'lib/d3_mpq/core_data/game_balance/base.rb', line 57

def struct_size
  self.class.struct_size
end