Actually implement custom stock loading...

pull/11/head
Daniel Asher Resnick 2 years ago
parent 48cda4860a
commit 0b3e725c85
  1. 63
      src/lib/data/custom.rb

@ -3,46 +3,29 @@ require 'json'
module Charred module Charred
module Custom module Custom
def load_custom(data) def load_custom(data)
#Dir.glob("data/custom/**/*") { |file| Dir.glob("data/custom/**/*") { |file|
# if File.file?(file) if File.file?(file)
# case File.extname(file) case File.extname(file)
# when "skills" when ".skills"
# verbose_merge data[:skills], json_get(file) verbose_merge data[:skills], json_get(file)
# when "traits" when ".traits"
# verbose_merge data[:traits], json_get(file) verbose_merge data[:traits], json_get(file)
# when "stock" when ".stock"
# stock = Stock.new(json_get(file)) stock = Stock.new(json_get(file))
# data[:stocks][stock.key] = stock # This overwrites existing data... if(data[:stocks][stock.key])
# when "lifepaths" verbose_merge data[:stocks][stock.key], stock
# # else
# when "resources" data[:stocks][stock.key] = stock
# # end
# end when ".lifepaths"
# end contents = json_get(file)
#} verbose_merge data[:lifepaths][contents.stock], contents.settings
# Dir.glob("data/custom/*/") { |dir| when ".resources"
# stock_name = File.basename(dir) contents = json_get(file)
verbose_merge data[:resources][contents.stock], contents.settings
# if File.readable?("dir/skills.json") end
# skills = json_get("dir/skills.json") end
# verbose_merge data[:skills], skills }
# end
# if File.readable?("dir/traits.json")
# traits = json_get("dir/traits.json")
# verbose_merge data[:traits], traits
# end
# if File.readable?("dir/lifepaths.json")
# lifepaths = json_get("dir/lifepaths.json")
# data[:lifepaths][stock_name] = lifepaths
# end
# if File.readable?("dir/resources.json")
# resources = json_get("dir/resources.json")
# data[:resources][stock_name] = resources
# end
# }
end end
end end
end end

Loading…
Cancel
Save