Add calculation of values

Sasky [04-25-15 - 04:03]
Add calculation of values
Filename
html/demo.html
html/skill-template.html
html/skillData.js
html/skillFormulas.html
html/style.css
diff --git a/html/demo.html b/html/demo.html
index c1411c4..eec7874 100644
--- a/html/demo.html
+++ b/html/demo.html
@@ -17,6 +17,7 @@
 </head>
 <body ng-controller="SkillMainDataController">
 <h1>Skill data</h1>
+<p>This page is a scratchpad. Some mockups, some WIP.</p>

 <div class="row container center-block" id="root">
 <div class="col-md-2">
diff --git a/html/skill-template.html b/html/skill-template.html
index a3f46b4..24274ed 100644
--- a/html/skill-template.html
+++ b/html/skill-template.html
@@ -15,6 +15,7 @@
 	<div class="formula" ng-repeat="(id,fit) in skill.fit">
 		<span class="formulaID">{{id}}</span>
 		<span class="rsq label {{fit.rsq|fitQualityClass}}">R<sup>2</sup>: {{fit.rsq|number:4}}</span>
+		<span ng-show="calc" class="calcResult">{{calc(fit, skill.mechanic)}}</span>
 		<div class="eqn">
 			= <formula-part value="{{fit.mainCoef|number:4}}" label="MainStat"></formula-part>
 			<formula-part value="{{fit.healthCoef|number:4}}" label="Health"></formula-part>
diff --git a/html/skillData.js b/html/skillData.js
index e39494e..5404720 100644
--- a/html/skillData.js
+++ b/html/skillData.js
@@ -105,6 +105,30 @@ SkillData.controller('LoadoutController', ['$scope', function ($scope) {
 	$scope.defined = function(v) {
 		return v.name != ""
 	}
+	$scope.haveValues = true
+	$scope.magicka = 15000
+	$scope.stamina = 15000
+	$scope.health = 15000
+	$scope.spellpower = 1200
+	$scope.weaponpower = 1200
+	$scope.calc = function(fit, type) {
+		var main = 0
+		var power = 0
+		switch(type) {
+			case 'Magicka':
+				main = $scope.magicka
+				power = $scope.spellpower
+				break
+			case 'Stamina':
+				main = $scope.stamina
+				power = $scope.weaponpower
+				break
+			case 'Ultimate':
+				main = Max($scope.magicka, $scope.stamina)
+				power = Max($scope.spellpower, $scope.weaponpower)
+		}
+		return Math.round(main*fit.mainCoef + power*fit.powerCoef + $scope.health*fit.healthCoef + fit.intercept)
+	}
 }]);
 SkillData.filter('fitQualityClass', function() {
   return function(input) {
@@ -178,11 +202,12 @@ SkillData.directive('skillFull', function() {
 	return {
 		restrict: 'E',
 		scope: {
-			skill: '=info'
+			skill: '=info',
 		},
 		templateUrl: 'skill-template.html',
-		link: function(scope) {
+		link: function(scope, element, attrs) {
 			scope.description = scope.skill.description
+			scope.calc = scope.$parent.calc
 		}
 	}
 });
diff --git a/html/skillFormulas.html b/html/skillFormulas.html
index 3520d32..9c91ebf 100644
--- a/html/skillFormulas.html
+++ b/html/skillFormulas.html
@@ -35,6 +35,15 @@
     </div>
 </div>
 <div class="col-md-5" ng-controller="LoadoutController" id="loadout">
+	<div class="row">
+	<label class="col-md-4">Health:</label>	<label class="col-md-4">Magicka:</label><label class="col-md-4">Stamina:</label>
+	</div><div class="row">
+	<input class="col-md-4" ng-model="health"/><input class="col-md-4" ng-model="magicka"/><input class="col-md-4" ng-model="stamina"/>
+	</div><div class="row">
+	<label class="col-md-4">Spell Power:</label><input class="col-md-2" ng-model="spellpower"/>
+	<label class="col-md-4">Weapon Dmg:</label><input class="col-md-2" ng-model="weaponpower"/>
+	</div>
+	<br />
     <div class="skill-list">
     	<div x-lvl-drop-target='true' x-on-drop='dropped(dragEl, 0)'><skill-full info="skills[0]"></skill-full></div>
     	<div x-lvl-drop-target='true' x-on-drop='dropped(dragEl, 1)'><skill-full info="skills[1]"></skill-full></div>
@@ -46,6 +55,14 @@
     </div>
 	<br /><br />
 	<hr>
+	<h3>Changelog</h3>
+	<ul>
+	<li>4/24 - Add value calculation for formulas</li>
+	<li>4/23 - Add drag &amp; drop to collect skills</li>
+	<li>4/23 - Add health info. NOTE: Only templar skills currently.</li>
+	<li>4/19 - Add skill tree for selection</li>
+	<li>4/18 - Initial release</li>
+	</ul>
 	<p><a href="demo.html">Samples of upcoming changes</a></p>
 </div>
 </div>
diff --git a/html/style.css b/html/style.css
index a1d9b17..386d515 100644
--- a/html/style.css
+++ b/html/style.css
@@ -116,4 +116,15 @@ div.paginateContain .pagination { margin: 0px auto; }

 #loadout .skill .info {
 	display: none;
+}
+
+.calcResult {
+	display: inline-block;
+	margin: 0px 15px;
+	width: 50px;
+	text-align: center;
+	font-weight: bold;
+	background-color: #FFE;
+	border: 1px solid #ABC;
+	border-radius: 6px;
 }
\ No newline at end of file