Fix angular interpolation error

pull/8/head
Daniel Asher Resnick 2 years ago
parent fc9edd2b48
commit 117365ed8e
  1. 12
      src/public/js/burning-service.js
  2. 32
      src/public/js/burning.js

@ -330,18 +330,6 @@ function BurningDataService($http) {
myself.startingStatPts[stock] = new StartingStatPoints(myself.stocks[stock].starting_stats);
myself.defineStockEvent(stock, "lifepathsLoaded");
myself.defineStockEvent(stock, "resourcesLoaded");
// Log events
myself.registerStockEvent(stock, "lifepathsLoaded", function () {
// console.log("Loaded " + Object.keys(myself.lifepaths[stock]).length + " lifepaths for " + stock + ".");
// DEBUG:
console.log("Loaded " + stock, myself.lifepaths[stock]);
});
myself.registerStockEvent(stock, "resourcesLoaded", function () {
// console.log("Loaded " + Object.keys(myself.resources[stock]).length + " resources for " + stock + ".");
// DEBUG:
console.log("Loaded " + stock, myself.resources[stock]);
});
}
myself.triggerEvent("stocksLoaded");
}).

@ -206,12 +206,6 @@ function BurningCtrl($scope, $http, $modal, $timeout, settings, appropriateWeapo
// Character name
$scope.name = "";
// Character stock. One of man, dwarf, orc, elf
// if ( ! isValidStock(stock) ){
// console.log("Invalid stock '"+stock+"' passed to BurningCtrl.initialize. Defaulting to man");
// stock = "man";
// }
$scope.stock = stock;
// Character id (server side id)
@ -365,7 +359,18 @@ function BurningCtrl($scope, $http, $modal, $timeout, settings, appropriateWeapo
$scope.onStockChange = function(){
if(!$scope.stock) return;
if(!$scope.stockSelected) {
$scope.stocks.shift();
$scope.stockSelected = true;
}
var oldName = $scope.name;
if(!burningData.lifepaths[$scope.stock]) {
burningData.loadLifepathsForStock($scope.stock);
}
if(!burningData.resources[$scope.stock]) {
burningData.loadResourcesForStock($scope.stock);
}
// TODO: technically a bug — only want this registered once per stock...
burningData.registerStockEvent($scope.stock, "lifepathsLoaded", function () {
// Make a blank character sheet
$scope.initialize($scope.stock);
@ -379,14 +384,6 @@ function BurningCtrl($scope, $http, $modal, $timeout, settings, appropriateWeapo
calculateCurrentSettingLifepathNames($scope, burningData);
calculateSpecialTraitsForDisplay($scope, burningData);
});
if(!burningData.lifepaths[$scope.stock]) {
burningData.loadLifepathsForStock($scope.stock);
}
if(!burningData.resources[$scope.stock]) {
burningData.loadResourcesForStock($scope.stock);
}
}
$scope.onSettingChange = function(){
@ -412,13 +409,11 @@ function BurningCtrl($scope, $http, $modal, $timeout, settings, appropriateWeapo
calculateUnspentSkillPoints($scope);
}
// burningData.registerOnAllDatasetsLoaded(function(){
// onLifepathsLoad($scope, burningData);
// });
burningData.registerEvent("stocksLoaded", function() {
$scope.stocks = [{ name: "Select a stock" }]
$scope.stocks = $scope.stocks.concat(Object.values(burningData.stocks));
$scope.stockSelected = false;
});
$scope.$on('$locationChangeStart', function(event, nextUrl, currentUrl) {
@ -1038,7 +1033,8 @@ function BurningCtrl($scope, $http, $modal, $timeout, settings, appropriateWeapo
return {"shade" : "", "exp" : 10 - $scope.statsByName["Will"].exp() + bonus};
}
else if ( "Stride" == name ){
var stride = burningData.stocks[$scope.stock].stride;
// This is a hack: if stock is unselected, use 0 for stride to not throw error; it shouldn't be displayed anyway
var stride = $scope.stock ? burningData.stocks[$scope.stock].stride : 0;
stride += bonus;
return {"shade" : "", "exp" : stride};
}

Loading…
Cancel
Save