Fix angular interpolation error

Daniel Asher Resnick 2 years ago
parent 61bd349f1a
commit 8557200e36
  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.startingStatPts[stock] = new StartingStatPoints(myself.stocks[stock].starting_stats);
myself.defineStockEvent(stock, "lifepathsLoaded"); myself.defineStockEvent(stock, "lifepathsLoaded");
myself.defineStockEvent(stock, "resourcesLoaded"); 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"); myself.triggerEvent("stocksLoaded");
}). }).

@ -206,12 +206,6 @@ function BurningCtrl($scope, $http, $modal, $timeout, settings, appropriateWeapo
// Character name // Character name
$scope.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; $scope.stock = stock;
// Character id (server side id) // Character id (server side id)
@ -365,7 +359,18 @@ function BurningCtrl($scope, $http, $modal, $timeout, settings, appropriateWeapo
$scope.onStockChange = function(){ $scope.onStockChange = function(){
if(!$scope.stock) return; if(!$scope.stock) return;
if(!$scope.stockSelected) {
$scope.stocks.shift();
$scope.stockSelected = true;
}
var oldName = $scope.name; 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 () { burningData.registerStockEvent($scope.stock, "lifepathsLoaded", function () {
// Make a blank character sheet // Make a blank character sheet
$scope.initialize($scope.stock); $scope.initialize($scope.stock);
@ -379,14 +384,6 @@ function BurningCtrl($scope, $http, $modal, $timeout, settings, appropriateWeapo
calculateCurrentSettingLifepathNames($scope, burningData); calculateCurrentSettingLifepathNames($scope, burningData);
calculateSpecialTraitsForDisplay($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(){ $scope.onSettingChange = function(){
@ -412,13 +409,11 @@ function BurningCtrl($scope, $http, $modal, $timeout, settings, appropriateWeapo
calculateUnspentSkillPoints($scope); calculateUnspentSkillPoints($scope);
} }
// burningData.registerOnAllDatasetsLoaded(function(){
// onLifepathsLoad($scope, burningData);
// });
burningData.registerEvent("stocksLoaded", function() { burningData.registerEvent("stocksLoaded", function() {
$scope.stocks = [{ name: "Select a stock" }] $scope.stocks = [{ name: "Select a stock" }]
$scope.stocks = $scope.stocks.concat(Object.values(burningData.stocks)); $scope.stocks = $scope.stocks.concat(Object.values(burningData.stocks));
$scope.stockSelected = false;
}); });
$scope.$on('$locationChangeStart', function(event, nextUrl, currentUrl) { $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}; return {"shade" : "", "exp" : 10 - $scope.statsByName["Will"].exp() + bonus};
} }
else if ( "Stride" == name ){ 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; stride += bonus;
return {"shade" : "", "exp" : stride}; return {"shade" : "", "exp" : stride};
} }

Loading…
Cancel
Save