diff --git a/src/app.rb b/src/app.rb index 290c391..c4cc8ff 100644 --- a/src/app.rb +++ b/src/app.rb @@ -49,12 +49,12 @@ get '/traits' do json DATA[:traits] end -get '/stock_objs' do - json DATA[:stock_objs] +get '/stocks' do + json DATA[:stocks] end get '/lifepaths/:stock' do - if DATA[:stock_objs].keys.include? params['stock'] + if DATA[:stocks].keys.include? params['stock'] json DATA[:lifepaths][params['stock']] else 404 @@ -62,7 +62,7 @@ get '/lifepaths/:stock' do end get '/starting_stat_pts/:stock' do - if DATA[:stock_objs].keys.include? params['stock'] + if DATA[:stocks].keys.include? params['stock'] json DATA[:stat_pts][params['stock']] else 404 @@ -70,7 +70,7 @@ get '/starting_stat_pts/:stock' do end get '/resources/:stock' do - if DATA[:stock_objs].keys.include? params['stock'] + if DATA[:stocks].keys.include? params['stock'] json DATA[:resources][params['stock']] else 404 diff --git a/src/lib/data.rb b/src/lib/data.rb index 1470d96..b672f46 100644 --- a/src/lib/data.rb +++ b/src/lib/data.rb @@ -15,7 +15,7 @@ module Charred def initialize @data = {} - @data[:stock_objs] = {} + @data[:stocks] = {} puts 'loading gold' load_gold(@data) diff --git a/src/lib/data/gold.rb b/src/lib/data/gold.rb index 6f991a0..557c548 100644 --- a/src/lib/data/gold.rb +++ b/src/lib/data/gold.rb @@ -13,11 +13,11 @@ module Charred lifepaths = {} resources = {} stat_pts = {} - stock_objs = {} + stocks = {} - stocks = ['dwarf', 'elf', 'man', 'orc', 'roden', 'wolf'] + gold_stocks = ['dwarf', 'elf', 'man', 'orc', 'roden', 'wolf'] - stocks.each do |stock| + gold_stocks.each do |stock| file = File.read("data/gold/lifepaths/#{stock}.json") lifepaths[stock] = JSON.parse(file) @@ -25,7 +25,7 @@ module Charred resources[stock] = JSON.parse(file) file = File.read("data/gold/stocks/#{stock}.json") - stock_objs[stock] = Stock.new(JSON.parse(file)) + stocks[stock] = Stock.new(JSON.parse(file)) end data.merge!({ @@ -34,7 +34,7 @@ module Charred :lifepaths => lifepaths, :resources => resources, :stat_pts => stat_pts, - :stock_objs => stock_objs + :stocks => stocks }) end end diff --git a/src/lib/data/troll.rb b/src/lib/data/troll.rb index bec97d1..1f9b834 100644 --- a/src/lib/data/troll.rb +++ b/src/lib/data/troll.rb @@ -22,7 +22,7 @@ module Charred file = File.read("data/troll/stock.json") stock = JSON.parse(file) - data[:stock_objs]['troll'] = Stock.new(stock) + data[:stocks]['troll'] = Stock.new(stock) end end end diff --git a/src/public/js/burning-service.js b/src/public/js/burning-service.js index ba306b6..7227394 100644 --- a/src/public/js/burning-service.js +++ b/src/public/js/burning-service.js @@ -292,10 +292,10 @@ function BurningDataService($http) { var myself = this; var stocks; - $http.get("/stock_objs", {'timeout': 3000}). + $http.get("/stocks", {'timeout': 3000}). success(function(data,status,headers,config){ console.log(data); - myself.stock_objs = data; + myself.stocks = data; stocks = Object.keys(data); for (var i = 0; i < stocks.length; i++) { loadLifepathsForStock(stocks[i]); @@ -334,7 +334,7 @@ function BurningDataService($http) { console.log("Loading starting stat points failed: asked to load pts for invalid stock " + stock); return } - myself.startingStatPts[stock] = new StartingStatPoints(myself.stock_objs[stock].starting_stats); + myself.startingStatPts[stock] = new StartingStatPoints(myself.stocks[stock].starting_stats); } /* Load resources from server */ diff --git a/src/public/js/burning.js b/src/public/js/burning.js index 9ac2a50..d59402c 100644 --- a/src/public/js/burning.js +++ b/src/public/js/burning.js @@ -1024,7 +1024,7 @@ function BurningCtrl($scope, $http, $modal, $timeout, settings, appropriateWeapo return {"shade" : "", "exp" : 10 - $scope.statsByName["Will"].exp() + bonus}; } else if ( "Stride" == name ){ - var stride = burningData.stock_objs[$scope.stock].stride; + var stride = burningData.stocks[$scope.stock].stride; stride += bonus; return {"shade" : "", "exp" : stride}; } @@ -2316,7 +2316,7 @@ function setCommonTraits($scope, burningData){ if( $scope.selectedLifepaths.length == 0 ) return; - var common = burningData.stock_objs[$scope.stock].common_traits; + var common = burningData.stocks[$scope.stock].common_traits; if(common.length > 0){ for(var j = 0; j < common.length; j++){ var name = common[j];