require 'json' require_relative '../stock' module Charred module Gold def load_gold(data) file = File.read('data/gold/skills.json') skills = JSON.parse(file) file = File.read('data/gold/traits.json') traits = JSON.parse(file) lifepaths = {} resources = {} stocks = {} gold_stocks = ['dwarf', 'elf', 'man', 'orc', 'roden', 'wolf'] gold_stocks.each do |stock| file = File.read("data/gold/lifepaths/#{stock}.json") lifepaths[stock] = JSON.parse(file) file = File.read("data/gold/resources/#{stock}.json") resources[stock] = JSON.parse(file) file = File.read("data/gold/stocks/#{stock}.json") stocks[stock] = Stock.new(JSON.parse(file)) end data.merge!({ :skills => skills, :traits => traits, :lifepaths => lifepaths, :resources => resources, :stocks => stocks }) end end end