Load new-style stock files

pull/8/head
Daniel Asher Resnick 2 years ago
parent 9d3c8b8870
commit c7a3335bec
  1. 8
      src/lib/data/gold.rb

@ -1,4 +1,5 @@
require 'json' require 'json'
require_relative '../stock'
module Charred module Charred
module Gold module Gold
@ -12,6 +13,7 @@ module Charred
lifepaths = {} lifepaths = {}
resources = {} resources = {}
stat_pts = {} stat_pts = {}
stock_objs = {}
stocks = ['dwarf', 'elf', 'man', 'orc', 'roden', 'wolf'] stocks = ['dwarf', 'elf', 'man', 'orc', 'roden', 'wolf']
@ -24,6 +26,9 @@ module Charred
file = File.read("data/gold/starting_stat_pts/#{stock}.json") file = File.read("data/gold/starting_stat_pts/#{stock}.json")
stat_pts[stock] = JSON.parse(file) stat_pts[stock] = JSON.parse(file)
file = File.read("data/gold/stocks/#{stock}.json")
stock_objs[stock] = Stock.new(JSON.parse(file))
end end
data.merge!({ data.merge!({
@ -32,7 +37,8 @@ module Charred
:traits => traits, :traits => traits,
:lifepaths => lifepaths, :lifepaths => lifepaths,
:resources => resources, :resources => resources,
:stat_pts => stat_pts :stat_pts => stat_pts,
:stock_objs => stock_objs
}) })
end end
end end

Loading…
Cancel
Save