|
|
|
@ -263,32 +263,32 @@ function BurningDataService($http) { |
|
|
|
|
// A hash of StartingStatPoints objects keyed by stock.
|
|
|
|
|
this.startingStatPts = {}; |
|
|
|
|
|
|
|
|
|
this.dataSetsLoaded = 0; |
|
|
|
|
// Total data sets:
|
|
|
|
|
// lifepaths: 7 (man, dwarf, elf, orc, roden, wolf, troll)
|
|
|
|
|
// stat points: 7 (man, dwarf, elf, orc, roden, wolf, troll)
|
|
|
|
|
// skills
|
|
|
|
|
// traits
|
|
|
|
|
// resources: 7 (man, dwarf, elf, orc, roden, wolf. troll)
|
|
|
|
|
// TOTAL: 23
|
|
|
|
|
this.totalDataSets = 23; |
|
|
|
|
this.onAllDatasetsLoaded = null; |
|
|
|
|
this.registerOnAllDatasetsLoaded = function(callback){ |
|
|
|
|
if ( this.dataSetsLoaded >= this.totalDataSets ){ |
|
|
|
|
callback(); |
|
|
|
|
} |
|
|
|
|
this.onAllDatasetsLoaded = callback; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.datasetLoaded = function(){ |
|
|
|
|
this.dataSetsLoaded += 1; |
|
|
|
|
if ( this.onAllDatasetsLoaded && (this.dataSetsLoaded >= this.totalDataSets) ){ |
|
|
|
|
this.onAllDatasetsLoaded(); |
|
|
|
|
} |
|
|
|
|
if ( this.dataSetsLoaded > this.totalDataSets){ |
|
|
|
|
console.log("Error: the totalDataSets setting in BurningDataService is too low! This will cause wierd errors. Please adjust it"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// this.dataSetsLoaded = 0;
|
|
|
|
|
// // Total data sets:
|
|
|
|
|
// // lifepaths: 7 (man, dwarf, elf, orc, roden, wolf, troll)
|
|
|
|
|
// // stat points: 7 (man, dwarf, elf, orc, roden, wolf, troll)
|
|
|
|
|
// // skills
|
|
|
|
|
// // traits
|
|
|
|
|
// // resources: 7 (man, dwarf, elf, orc, roden, wolf. troll)
|
|
|
|
|
// // TOTAL: 23
|
|
|
|
|
// this.totalDataSets = 23;
|
|
|
|
|
// this.onAllDatasetsLoaded = null;
|
|
|
|
|
// this.registerOnAllDatasetsLoaded = function(callback){
|
|
|
|
|
// if ( this.dataSetsLoaded >= this.totalDataSets ){
|
|
|
|
|
// callback();
|
|
|
|
|
// }
|
|
|
|
|
// this.onAllDatasetsLoaded = callback;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// this.datasetLoaded = function(){
|
|
|
|
|
// this.dataSetsLoaded += 1;
|
|
|
|
|
// if ( this.onAllDatasetsLoaded && (this.dataSetsLoaded >= this.totalDataSets) ){
|
|
|
|
|
// this.onAllDatasetsLoaded();
|
|
|
|
|
// }
|
|
|
|
|
// if ( this.dataSetsLoaded > this.totalDataSets){
|
|
|
|
|
// console.log("Error: the totalDataSets setting in BurningDataService is too low! This will cause wierd errors. Please adjust it");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
var stocks; |
|
|
|
|
$http.get("/stock_objs", {'timeout': 3000}). |
|
|
|
@ -316,11 +316,11 @@ function BurningDataService($http) { |
|
|
|
|
$http.get("/lifepaths/" + stock, {'timeout': 3000} ). |
|
|
|
|
success(function(data,status,headers,config){ |
|
|
|
|
myself.lifepaths[stock] = data; |
|
|
|
|
myself.datasetLoaded(); |
|
|
|
|
// myself.datasetLoaded();
|
|
|
|
|
console.log("Loaded "+stock+" lifepaths. " + Object.keys(myself.lifepaths).length + " settings"); |
|
|
|
|
}). |
|
|
|
|
error(function(data,status,headers,config){ |
|
|
|
|
myself.datasetLoaded(); |
|
|
|
|
// myself.datasetLoaded();
|
|
|
|
|
console.log("Error: Getting "+stock+" lifepaths from server failed: HTTP code " + status + ": " + data); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -335,11 +335,11 @@ function BurningDataService($http) { |
|
|
|
|
$http.get("/starting_stat_pts/" + stock, {'timeout': 3000} ). |
|
|
|
|
success(function(data,status,headers,config){ |
|
|
|
|
myself.startingStatPts[stock] = new StartingStatPoints(data); |
|
|
|
|
myself.datasetLoaded(); |
|
|
|
|
// myself.datasetLoaded();
|
|
|
|
|
console.log("Loaded "+stock+" starting stat points. "); |
|
|
|
|
}). |
|
|
|
|
error(function(data,status,headers,config){ |
|
|
|
|
myself.datasetLoaded(); |
|
|
|
|
// myself.datasetLoaded();
|
|
|
|
|
console.log("Error: Getting "+stock+" stat points from server failed: HTTP code " + status + ": " + data); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -354,11 +354,11 @@ function BurningDataService($http) { |
|
|
|
|
$http.get("/resources/" + stock, {'timeout': 3000} ). |
|
|
|
|
success(function(data,status,headers,config){ |
|
|
|
|
myself.resources[stock] = data; |
|
|
|
|
myself.datasetLoaded(); |
|
|
|
|
// myself.datasetLoaded();
|
|
|
|
|
console.log("Loaded "+stock+" resources. "); |
|
|
|
|
}). |
|
|
|
|
error(function(data,status,headers,config){ |
|
|
|
|
myself.datasetLoaded(); |
|
|
|
|
// myself.datasetLoaded();
|
|
|
|
|
console.log("Error: Getting "+stock+" stat points from server failed: HTTP code " + status + ": " + data); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -368,11 +368,11 @@ function BurningDataService($http) { |
|
|
|
|
$http.get("/skills", {'timeout': 3000} ). |
|
|
|
|
success(function(data,status,headers,config){ |
|
|
|
|
myself.skills = data; |
|
|
|
|
myself.datasetLoaded(); |
|
|
|
|
// myself.datasetLoaded();
|
|
|
|
|
console.log("Loaded skills. "); |
|
|
|
|
}). |
|
|
|
|
error(function(data,status,headers,config){ |
|
|
|
|
myself.datasetLoaded(); |
|
|
|
|
// myself.datasetLoaded();
|
|
|
|
|
console.log("Error: Getting skills from server failed: HTTP code " + status + ": " + data); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
@ -380,11 +380,11 @@ function BurningDataService($http) { |
|
|
|
|
$http.get("/traits", {'timeout': 3000} ). |
|
|
|
|
success(function(data,status,headers,config){ |
|
|
|
|
myself.traits = data; |
|
|
|
|
myself.datasetLoaded(); |
|
|
|
|
// myself.datasetLoaded();
|
|
|
|
|
console.log("Loaded traits. "); |
|
|
|
|
}). |
|
|
|
|
error(function(data,status,headers,config){ |
|
|
|
|
myself.datasetLoaded(); |
|
|
|
|
// myself.datasetLoaded();
|
|
|
|
|
console.log("Error: Getting traits from server failed: HTTP code " + status + ": " + data); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|