From 2fd4b625ce0d6368166318c452a71969bb78f303 Mon Sep 17 00:00:00 2001 From: Daniel Asher Resnick Date: Thu, 23 Feb 2023 19:21:16 -0600 Subject: [PATCH] Fix custom stock loading using put_or_merge --- src/lib/data/custom.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/lib/data/custom.rb b/src/lib/data/custom.rb index a64abd9..c357ee5 100644 --- a/src/lib/data/custom.rb +++ b/src/lib/data/custom.rb @@ -12,17 +12,13 @@ module Charred verbose_merge data[:traits], json_get(file) when ".stock" stock = Stock.new(json_get(file)) - if(data[:stocks][stock.key]) - verbose_merge data[:stocks][stock.key], stock - else - data[:stocks][stock.key] = stock - end + put_or_merge data[:stocks], stock.key, stock when ".lifepaths" contents = json_get(file) - verbose_merge data[:lifepaths][contents.stock], contents.settings + put_or_merge data[:lifepaths], contents["stock"], contents["settings"] when ".resources" contents = json_get(file) - verbose_merge data[:resources][contents.stock], contents.settings + put_or_merge data[:resources], contents["stock"], contents["resources"] end end }