Switch all lifepath files to wrapped format

And change loading accordingly
pull/11/head
Daniel Asher Resnick 2 years ago
parent 4b4b847644
commit 38a49c8327
  1. 3
      src/data/gold/lifepaths/dwarf.json
  2. 3
      src/data/gold/lifepaths/elf.json
  3. 3
      src/data/gold/lifepaths/man.json
  4. 3
      src/data/gold/lifepaths/orc.json
  5. 3
      src/data/gold/lifepaths/roden.json
  6. 3
      src/data/gold/lifepaths/wolf.json
  7. 34
      src/lib/data/custom.rb
  8. 3
      src/lib/data/dark_elf.rb
  9. 3
      src/lib/data/gold.rb
  10. 3
      src/lib/data/troll.rb
  11. 3
      src/lib/data/wizard.rb

@ -1,4 +1,6 @@
{
"stock": "dwarf",
"settings": {
"Clansman Setting": {
"Born Clansman": {
"time": 20,
@ -1936,4 +1938,5 @@
]
}
}
}
}

@ -1,4 +1,6 @@
{
"stock": "elf",
"settings": {
"Wilderlands Setting": {
"Born Wilder Elf": {
"time": 20,
@ -2021,4 +2023,5 @@
]
}
}
}
}

@ -1,4 +1,6 @@
{
"stock": "man",
"settings": {
"Peasant Setting": {
"Born Peasant": {
"time": 8,
@ -11811,4 +11813,5 @@
]
}
}
}
}

@ -1,4 +1,6 @@
{
"stock": "orc",
"settings": {
"Chattel Setting": {
"Born Chattel": {
"time": 10,
@ -1574,4 +1576,5 @@
]
}
}
}
}

@ -1,4 +1,6 @@
{
"stock": "roden",
"settings": {
"Field Setting": {
"Born To The Fields": {
"time": 8,
@ -1719,4 +1721,5 @@
]
}
}
}
}

@ -1,4 +1,6 @@
{
"stock": "wolf",
"settings": {
"Wild Pack Setting": {
"Born To The Pack": {
"time": 1,
@ -948,4 +950,5 @@
]
}
}
}
}

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

@ -12,7 +12,8 @@ module Charred
verbose_merge data[:traits], traits
file = File.read('data/dark_elf/lifepaths.json')
lifepaths = JSON.parse(file)
contents = JSON.parse(file)
lifepaths = contents["settings"]
file = File.read("data/dark_elf/resources.json")
resources = JSON.parse(file)

@ -18,7 +18,8 @@ module Charred
gold_stocks.each do |stock|
file = File.read("data/gold/lifepaths/#{stock}.json")
lifepaths[stock] = JSON.parse(file)
contents = JSON.parse(file)
lifepaths[stock] = contents["settings"]
file = File.read("data/gold/resources/#{stock}.json")
resources[stock] = JSON.parse(file)

@ -13,7 +13,8 @@ module Charred
verbose_merge data[:traits], traits
file = File.read('data/troll/lifepaths.json')
lifepaths = JSON.parse(file)
contents = JSON.parse(file)
lifepaths = contents["settings"]
data[:lifepaths]['troll'] = lifepaths
file = File.read("data/troll/resources.json")

@ -4,7 +4,8 @@ module Charred
module Wizard
def load_wizard(data)
file = File.read('data/wizard/lifepaths.json')
wizard_data = JSON.parse(file)
contents = JSON.parse(file)
wizard_data = contents["settings"]
file = File.read('data/wizard/skills.json')
wizard_skills = JSON.parse(file)

Loading…
Cancel
Save