diff --git a/src/public/js/stocked.js b/src/public/js/stocked.js index f981a46..582397d 100644 --- a/src/public/js/stocked.js +++ b/src/public/js/stocked.js @@ -1843,6 +1843,17 @@ function StockedSetting(name, charredSettingData) { } StockedSetting.prototype.addLifepath = function() { this.lifepaths.push(new StockedLifePath(this.newLifepathName, {})); + this.newLifepathName = ""; +} +StockedSetting.prototype.removeLifepath = function(index) { + this.lifepaths.splice(index, 1); +} +StockedSetting.prototype.toCharred = function() { + let charred = {}; + // "setting" in name + // common traits + // stride + return charred; } function StockedLifePath(name, charredPathData) { @@ -1923,6 +1934,7 @@ StockedLifePathSkills.prototype.toString = function() { }; function StockedLifePathTraits(charredTraitData) { + this.lpTraits = []; if(charredTraitData) { this.points = charredTraitData[0]; this.lpTraits = charredTraitData.slice(1); @@ -1952,7 +1964,9 @@ function StockedSkill(name, charredSkillData) { Agility: false, Speed: false, }; - charredSkillData.roots.map(rootName => this.roots[rootName] = true); + if(charredSkillData.roots){ + charredSkillData.roots.map(rootName => this.roots[rootName] = true); + } this.stockSpecific = "TODO"; } @@ -1981,8 +1995,8 @@ function StockedCtrl($scope, burningData) { $scope.general = { 'Name': '', 'Stride': 7, - 'CommonTraits': ['foo', 'baz'], - 'selectedTrait': 'bar' + 'CommonTraits': [], + 'selectedTrait': '' }; $scope.parseStock = function (stockData){ @@ -2013,6 +2027,11 @@ function StockedCtrl($scope, burningData) { $scope.addSetting = function (){ this.settings.push(new StockedSetting(this.newSettingName, {})); + this.newSettingName = ""; + } + + $scope.removeSetting = function (index) { + this.settings.splice(index, 1); } $scope.addSkill = function (){ diff --git a/src/views/partials/stocked.erb b/src/views/partials/stocked.erb index 615595f..97d36cd 100644 --- a/src/views/partials/stocked.erb +++ b/src/views/partials/stocked.erb @@ -87,6 +87,13 @@