class RPG::Class

Public Class Methods

new(hash) click to toggle source
# File lib/rmxp_extractor/classnames.rb, line 767
def initialize(hash)
  @id = hash["id"]
  @name = hash["name"]
  @position = hash["position"]
  @weapon_set = hash["weapon_set"]
  @armor_set = hash["armor_set"]
  @element_ranks = Table.new hash["element_ranks"], false
  @state_ranks = Table.new hash["state_ranks"], false
  @learnings = []
  hash["learnings"].each_with_index do |value|
    @learnings << RPG::Class::Learning.new(value)
  end
end

Public Instance Methods

hash() click to toggle source
# File lib/rmxp_extractor/classnames.rb, line 795
def hash
  dump = {
    id: @id,
    name: @name,
    position: @position,
    weapon_set: @weapon_set,
    armor_set: @armor_set,
    element_ranks: @element_ranks.hash,
    state_ranks: @state_ranks.hash,
    learnings: [],
  }
  @learnings.each_with_index do |value|
    dump[:learnings] << value.hash
  end
  dump
end