Class: RawReader

Inherits:
Object
  • Object
show all
Defined in:
lib/RawReader.rb

Constant Summary collapse

STATE_TRANSITION =
{
  :undef         => { pattern: /== Advantage Skill ==/,                 next: :innate },
  :innate        => { pattern: /== Disadvantage Skill ==/,              next: :strain_disadv },
  :strain_disadv => { pattern: /== Disabled Innate Skill ==/,           next: :strain_block },
  :strain_block  => { pattern: /== Innate Skill Prerequisite ==/,       next: :innate_preq },
  :innate_preq   => { pattern: /== Profession Concentration ==/,        next: :prof_concent },
  :prof_concent  => { pattern: /== Concentration Hierarchy ==/,         next: :prof_hierarc },
  :prof_hierarc  => { pattern: /== Concentration Group ==/,             next: :conc_group },
  :conc_group    => { pattern: /== Profession Concentration Skills ==/, next: :conc_skills },
  :conc_skills   => { pattern: /== Advanced Profession ==/,             next: :adv_prof },
  :adv_prof      => { pattern: /== Advanced Profession Skills ==/,      next: :adv_skills },
  :adv_skills    => { pattern: /== Strain Profession Restriction ==/,   next: :strain_rtrs },
  :strain_rtrs   => { pattern: /== Strain Stats ==/,                    next: :strain_stats }, 
  :strain_stats  => { pattern: /== Strain Specific Skills ==/,          next: :strain_specs },
  :strain_specs  => { pattern: /== Open Skill ==/,                      next: :open },
  :open          => { pattern: /==/,                                    next: :profession },
  :profession    => { pattern: /== Skill Group ==/,                     next: :skill_group },
  :skill_group   => { pattern: /== Skill Counters ==/,                  next: :skill_counter },
  :skill_counter => { pattern: /== Profession Extension ==/,            next: :prof_ext },
  :prof_ext      => { pattern: /== Skill List ==/,                      next: :list },
  :list          => { pattern: /./,                                     next: :list }
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath:) ⇒ RawReader

Returns a new instance of RawReader.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/RawReader.rb', line 34

def initialize filepath:
  f = nil
  @skill_list = Hash.new
  @skill_cat = Hash.new
  @advanced_cat = Hash.new
  @concentration_cat = Hash.new
  @strains = Set.new
  @strain_restrictions = Hash.new
  @skill_group = Hash.new
  @skill_counters = Hash.new
  @skill_countered = Hash.new
  @strain_specs = Hash.new
  @strain_stats = Hash.new
  @professions = Set.new
  @profession_concentrations = Hash.new
  @profession_advanced = Hash.new
  @profession_concentration_hierarchy = Hash.new
  @profession_concentration_group = Hash.new
  @profession_extension = Hash.new
  @skill_mp_cost = Hash.new

  @mutiline_state = nil

  begin
    f = File.read(filepath)
  rescue Errno::ENOENT => e
    puts "File not found: #{filepath}"
    puts e.backtrace
    exit 1
  end

  split_by_sections(raw: f)
  post_process_sets

  #ap @skill_cat
  #ap @advanced_cat
  #ap @profession_concentrations
  #ap @concentration_cat
  # ap @skill_counters
  # ap @skill_countered
  # ap @profession_concentration_group
  # ap @skill_list
  # ap @skill_mp_cost
end

Instance Attribute Details

#advanced_catObject (readonly)

Returns the value of attribute advanced_cat.



4
5
6
# File 'lib/RawReader.rb', line 4

def advanced_cat
  @advanced_cat
end

#concentration_catObject (readonly)

Returns the value of attribute concentration_cat.



4
5
6
# File 'lib/RawReader.rb', line 4

def concentration_cat
  @concentration_cat
end

#profession_advancedObject (readonly)

Returns the value of attribute profession_advanced.



4
5
6
# File 'lib/RawReader.rb', line 4

def profession_advanced
  @profession_advanced
end

#profession_concentration_groupObject (readonly)

Returns the value of attribute profession_concentration_group.



4
5
6
# File 'lib/RawReader.rb', line 4

def profession_concentration_group
  @profession_concentration_group
end

#profession_concentration_hierarchyObject (readonly)

Returns the value of attribute profession_concentration_hierarchy.



4
5
6
# File 'lib/RawReader.rb', line 4

def profession_concentration_hierarchy
  @profession_concentration_hierarchy
end

#profession_concentrationsObject (readonly)

Returns the value of attribute profession_concentrations.



4
5
6
# File 'lib/RawReader.rb', line 4

def profession_concentrations
  @profession_concentrations
end

#profession_extensionObject (readonly)

Returns the value of attribute profession_extension.



4
5
6
# File 'lib/RawReader.rb', line 4

def profession_extension
  @profession_extension
end

#professionsObject (readonly)

Returns the value of attribute professions.



4
5
6
# File 'lib/RawReader.rb', line 4

def professions
  @professions
end

#skill_catObject (readonly)

Returns the value of attribute skill_cat.



4
5
6
# File 'lib/RawReader.rb', line 4

def skill_cat
  @skill_cat
end

#skill_counteredObject (readonly)

Returns the value of attribute skill_countered.



4
5
6
# File 'lib/RawReader.rb', line 4

def skill_countered
  @skill_countered
end

#skill_countersObject (readonly)

Returns the value of attribute skill_counters.



4
5
6
# File 'lib/RawReader.rb', line 4

def skill_counters
  @skill_counters
end

#skill_groupObject (readonly)

Returns the value of attribute skill_group.



4
5
6
# File 'lib/RawReader.rb', line 4

def skill_group
  @skill_group
end

#skill_listObject (readonly)

Returns the value of attribute skill_list.



4
5
6
# File 'lib/RawReader.rb', line 4

def skill_list
  @skill_list
end

#skill_mp_costObject (readonly)

Returns the value of attribute skill_mp_cost.



4
5
6
# File 'lib/RawReader.rb', line 4

def skill_mp_cost
  @skill_mp_cost
end

#strain_restrictionsObject (readonly)

Returns the value of attribute strain_restrictions.



4
5
6
# File 'lib/RawReader.rb', line 4

def strain_restrictions
  @strain_restrictions
end

#strain_specsObject (readonly)

Returns the value of attribute strain_specs.



4
5
6
# File 'lib/RawReader.rb', line 4

def strain_specs
  @strain_specs
end

#strain_statsObject (readonly)

Returns the value of attribute strain_stats.



4
5
6
# File 'lib/RawReader.rb', line 4

def strain_stats
  @strain_stats
end

#strainsObject (readonly)

Returns the value of attribute strains.



4
5
6
# File 'lib/RawReader.rb', line 4

def strains
  @strains
end