diff --git a/Quant.txt b/Quant.txt index d5ccb04..3911954 100644 --- a/Quant.txt +++ b/Quant.txt @@ -1,5 +1,5 @@ ## Title: Quant -## Version: 0.4 +## Version: 0.5 ## Author: Sasky ## APIVersion: 100011 ## SavedVariables: QuantData diff --git a/README b/README index 47e2233..f30935a 100644 --- a/README +++ b/README @@ -6,27 +6,26 @@ afterwords. This is not an easy setup. I've made it as easy as possible, but there are a lot of moving parts. Furthermore, you still have to do a lot of the work afterwords. -This addon can use a lot of lua memory to export data. Consider disabling other addons when running. -As well, you'll want to delete/move the saved variables for this when you're done. +This addon can use a lot of lua memory to export data, depending on how many items you use. +Consider disabling other addons when running. As well, you'll want to delete/move the saved +variables for this when you're done. -Also, your game may appear to freeze while doing some of the commands. This is normal. +Your game may appear to freeze while doing some of the commands. This is normal. A lot of the commands involve a lot of processing, and it's not really a priority to make the game run smoothly during them. -Health data is not recorded yet. This will make some of the skill formulas wildly inaccurate. -Pay close attention to the R squared value. +Checking the set data will bind unbound gear in your bags. # Installation -1) Install the addon in-game - a) Install Wykkyd's Outfitter (required for some modules) - b) Put into addon folder for game - -2) Install R (http://www.r-project.org/) - a) Install Rserve. Within the R cli, type the following command: +1. Install the addon in-game (place in folder). + Note: You can place all the files in the addon directory just fine. +2. Install Wykkyd's Outfitter (required for skill curve module) +3. Install R (http://www.r-project.org/) +4. Install Rserve. Within the R cli, type the following command: `install.packages("Rserve")` NOTE: Stand-alone Rserve can be used if desired for most functionality -3) Install Scilua / LuaJIT +5. Install Scilua + LuaJIT a) Follow the directions on http://www.scilua.org/get.html b) Make sure to get the main Xsys library and the Rclient library. @@ -40,10 +39,25 @@ Type `/quant` in the chat box to see a list of commands and a brief description. * Champion system -- (`cs` and `cs-desc`) dumping champion system per-point data and descriptions * Stats dump -- Exports character current character stats * Skill dump -- Exports description and details about skills -* Skill curve -- Iterates through gear to record skill tooltip numbers at different stats* +* Skill curve -- See below. Requires extensive setup * Sets dump -- Exports a dump of all set info * Power register -- crude dumping of stamina/magicka changes to chatbox +### Skill Curve module +This module iterates through gear combinations recording tooltip data. It's decently automated, but +does require some setup. This is best done on PTS. + +1. Use a base VR14 character (no attributes, skill points, or champion points). +2. Prepare gear sets: health, magicka, and stamina enchants. Try to keep set bonuses neutral. +3. Prepare 6-12 bows of different power (Level 1 to VR14 gold). +4. Have all gear sets and bows in inventory. Don't put anything else in inventory. +If you have unbound gear items, this command WILL bind them to your character. +Alt+F4 or /reloadui to stop this running +5. Run /quant itr-all-skills +6. Wait 3-6 minutes. It takes awhile +7. Reload UI or logout to make sure data is saved. +8. Repeat for other classes. Can just do /quant skills for this + ## External Lua Several commands write out to the game's `SavedVariables`. A few of the scripts are designed to extract @@ -56,26 +70,35 @@ To access, run the `runScripts.lua` file in the base directory. Files will be ou There's a brief summary, buts see the individual scripts for more details. ## HTML -I've started working on some HTML for displaying. After exporting the data to JSON, move the JSON into the +Under the HTML directory, there's HTML for displaying. After exporting the data to JSON, move the JSON into the same folder as the HTML. You can then open the HTML in Firefox. Note: Unless you actually host it on a site (or some complicated workarounds), Chrome will not load local files. +This is currently hosted on http://skills.mhguild.com/ + ----------------------------------------------------- # Cleanup -Delete `Quant.lua` from your SavedVariables directory when you are done with it +Delete `Quant.lua` from your SavedVariables directory when you are done with it. +Also feel free to contact me if you want to include a module. + +# Extending Quant +This is fairly modular so can be easily extended. You can use/extend however (under the GPL). -# Extension In-game * See `modules/Template.lua` for a documented example of the framework. * After adding a module, include its path in `Quant.txt` at the end. -External -* There are several convenience functions in `scripts/inc` to help out +External Lua +* There are several convenience functions under `scripts/inc` to help out * Consider adding to the `runScript.lua` to make it easier to access +HTML +* It should be straightforward. Data is primarily output as JSON here. + # Changelog +0.5 - Add HTML to initial release. Cleanup modules 0.4 - Add sets, initialize Git 0.3 - Begin limited release to Mostly Harmless and Wagonborn 0.2 - Personal use (Skill iteration) diff --git a/html/abn_tree.css b/html/abn_tree.css deleted file mode 100644 index 48864e9..0000000 --- a/html/abn_tree.css +++ /dev/null @@ -1,121 +0,0 @@ -/* - abn-tree.css - - style for the angular-bootstrap-nav-tree - for both Bootstrap 2 and Bootstrap 3 - -*/ - - - -/* ------------------------------------------ -AngularJS Animations... - -The first selector is for Angular 1.1.5 -The second selector is for Angular 1.2.0 - -*/ -.abn-tree-animate-enter, -li.abn-tree-row.ng-enter { - transition: 200ms linear all; - position: relative; - display: block; - opacity: 0; - max-height:0px; -} -.abn-tree-animate-enter.abn-tree-animate-enter-active, -li.abn-tree-row.ng-enter-active{ - opacity: 1; - max-height:30px; -} - -.abn-tree-animate-leave, -li.abn-tree-row.ng-leave { - transition: 200ms linear all; - position: relative; - display: block; - height:30px; - max-height: 30px; - opacity: 1; -} -.abn-tree-animate-leave.abn-tree-animate-leave-active, -li.abn-tree-row.ng-leave-active { - height: 0px; - max-height:0px; - opacity: 0; -} - - -/* ------------------------------------------- -Angular 1.2.0 Animation -*/ - - -.abn-tree-animate.ng-enter{ - -} -.abn-tree-animate.ng-enter{ - -} - - - - -/* - end animation stuff ------------------------------------------ - begin normal css stuff -*/ -ul.abn-tree li.abn-tree-row { - padding: 0px; - margin:0px; -} - -ul.abn-tree li.abn-tree-row a { - padding: 3px 10px; -} - -ul.abn-tree i.indented { - padding: 2px; -} - -.abn-tree { - cursor: pointer; -} -ul.nav.abn-tree .level-1 .indented { - position: relative; - left: 0px; -} -ul.nav.abn-tree .level-2 .indented { - position: relative; - left: 20px; -} -ul.nav.abn-tree .level-3 .indented { - position: relative; - left: 40px; -} -ul.nav.abn-tree .level-4 .indented { - position: relative; - left: 60px; -} -ul.nav.abn-tree .level-5 .indented { - position: relative; - left: 80px; -} -ul.nav.abn-tree .level-6 .indented { - position: relative; - left: 100px; -} -ul.nav.nav-list.abn-tree .level-7 .indented { - position: relative; - left: 120px; -} -ul.nav.nav-list.abn-tree .level-8 .indented { - position: relative; - left: 140px; -} -ul.nav.nav-list.abn-tree .level-9 .indented { - position: relative; - left: 160px; -} diff --git a/html/abn_tree_directive.js b/html/abn_tree_directive.js deleted file mode 100644 index f309995..0000000 --- a/html/abn_tree_directive.js +++ /dev/null @@ -1,492 +0,0 @@ -(function() { - var module, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - - module = angular.module('angularBootstrapNavTree', []); - - module.directive('abnTree', [ - '$timeout', function($timeout) { - return { - restrict: 'E', - template: "<ul class=\"nav nav-list nav-pills nav-stacked abn-tree\">\n <li ng-repeat=\"row in tree_rows | filter:{visible:true} track by row.branch.uid\" ng-animate=\"'abn-tree-animate'\" ng-class=\"'level-' + {{ row.level }} + (row.branch.selected ? ' active':'') + ' ' +row.classes.join(' ')\" class=\"abn-tree-row\"><a ng-click=\"user_clicks_branch(row.branch)\"><i ng-class=\"row.tree_icon\" ng-click=\"row.branch.expanded = !row.branch.expanded\" class=\"indented tree-icon\"> </i><span class=\"indented tree-label\">{{ row.label }} </span></a></li>\n</ul>", - replace: true, - scope: { - treeData: '=', - onSelect: '&', - initialSelection: '@', - treeControl: '=' - }, - link: function(scope, element, attrs) { - var error, expand_all_parents, expand_level, for_all_ancestors, for_each_branch, get_parent, n, on_treeData_change, select_branch, selected_branch, tree; - error = function(s) { - console.log('ERROR:' + s); - debugger; - return void 0; - }; - if (attrs.iconExpand == null) { - attrs.iconExpand = 'icon-plus glyphicon glyphicon-plus fa fa-plus'; - } - if (attrs.iconCollapse == null) { - attrs.iconCollapse = 'icon-minus glyphicon glyphicon-minus fa fa-minus'; - } - if (attrs.iconLeaf == null) { - attrs.iconLeaf = 'icon-file glyphicon glyphicon-file fa fa-file'; - } - if (attrs.expandLevel == null) { - attrs.expandLevel = '3'; - } - expand_level = parseInt(attrs.expandLevel, 10); - if (!scope.treeData) { - alert('no treeData defined for the tree!'); - return; - } - if (scope.treeData.length == null) { - if (treeData.label != null) { - scope.treeData = [treeData]; - } else { - alert('treeData should be an array of root branches'); - return; - } - } - for_each_branch = function(f) { - var do_f, root_branch, _i, _len, _ref, _results; - do_f = function(branch, level) { - var child, _i, _len, _ref, _results; - f(branch, level); - if (branch.children != null) { - _ref = branch.children; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - child = _ref[_i]; - _results.push(do_f(child, level + 1)); - } - return _results; - } - }; - _ref = scope.treeData; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - root_branch = _ref[_i]; - _results.push(do_f(root_branch, 1)); - } - return _results; - }; - selected_branch = null; - select_branch = function(branch) { - if (!branch) { - if (selected_branch != null) { - selected_branch.selected = false; - } - selected_branch = null; - return; - } - if (branch !== selected_branch) { - if (selected_branch != null) { - selected_branch.selected = false; - } - branch.selected = true; - selected_branch = branch; - expand_all_parents(branch); - if (branch.onSelect != null) { - return $timeout(function() { - return branch.onSelect(branch); - }); - } else { - if (scope.onSelect != null) { - return $timeout(function() { - return scope.onSelect({ - branch: branch - }); - }); - } - } - } - }; - scope.user_clicks_branch = function(branch) { - if (branch !== selected_branch) { - return select_branch(branch); - } - }; - get_parent = function(child) { - var parent; - parent = void 0; - if (child.parent_uid) { - for_each_branch(function(b) { - if (b.uid === child.parent_uid) { - return parent = b; - } - }); - } - return parent; - }; - for_all_ancestors = function(child, fn) { - var parent; - parent = get_parent(child); - if (parent != null) { - fn(parent); - return for_all_ancestors(parent, fn); - } - }; - expand_all_parents = function(child) { - return for_all_ancestors(child, function(b) { - return b.expanded = true; - }); - }; - scope.tree_rows = []; - on_treeData_change = function() { - var add_branch_to_list, root_branch, _i, _len, _ref, _results; - for_each_branch(function(b, level) { - if (!b.uid) { - return b.uid = "" + Math.random(); - } - }); - console.log('UIDs are set.'); - for_each_branch(function(b) { - var child, _i, _len, _ref, _results; - if (angular.isArray(b.children)) { - _ref = b.children; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - child = _ref[_i]; - _results.push(child.parent_uid = b.uid); - } - return _results; - } - }); - scope.tree_rows = []; - for_each_branch(function(branch) { - var child, f; - if (branch.children) { - if (branch.children.length > 0) { - f = function(e) { - if (typeof e === 'string') { - return { - label: e, - children: [] - }; - } else { - return e; - } - }; - return branch.children = (function() { - var _i, _len, _ref, _results; - _ref = branch.children; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - child = _ref[_i]; - _results.push(f(child)); - } - return _results; - })(); - } - } else { - return branch.children = []; - } - }); - add_branch_to_list = function(level, branch, visible) { - var child, child_visible, tree_icon, _i, _len, _ref, _results; - if (branch.expanded == null) { - branch.expanded = false; - } - if (branch.classes == null) { - branch.classes = []; - } - if (!branch.noLeaf && (!branch.children || branch.children.length === 0)) { - tree_icon = attrs.iconLeaf; - if (__indexOf.call(branch.classes, "leaf") < 0) { - branch.classes.push("leaf"); - } - } else { - if (branch.expanded) { - tree_icon = attrs.iconCollapse; - } else { - tree_icon = attrs.iconExpand; - } - } - scope.tree_rows.push({ - level: level, - branch: branch, - label: branch.label, - classes: branch.classes, - tree_icon: tree_icon, - visible: visible - }); - if (branch.children != null) { - _ref = branch.children; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - child = _ref[_i]; - child_visible = visible && branch.expanded; - _results.push(add_branch_to_list(level + 1, child, child_visible)); - } - return _results; - } - }; - _ref = scope.treeData; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - root_branch = _ref[_i]; - _results.push(add_branch_to_list(1, root_branch, true)); - } - return _results; - }; - scope.$watch('treeData', on_treeData_change, true); - if (attrs.initialSelection != null) { - for_each_branch(function(b) { - if (b.label === attrs.initialSelection) { - return $timeout(function() { - return select_branch(b); - }); - } - }); - } - n = scope.treeData.length; - console.log('num root branches = ' + n); - for_each_branch(function(b, level) { - b.level = level; - return b.expanded = b.level < expand_level; - }); - if (scope.treeControl != null) { - if (angular.isObject(scope.treeControl)) { - tree = scope.treeControl; - tree.expand_all = function() { - return for_each_branch(function(b, level) { - return b.expanded = true; - }); - }; - tree.collapse_all = function() { - return for_each_branch(function(b, level) { - return b.expanded = false; - }); - }; - tree.get_first_branch = function() { - n = scope.treeData.length; - if (n > 0) { - return scope.treeData[0]; - } - }; - tree.select_first_branch = function() { - var b; - b = tree.get_first_branch(); - return tree.select_branch(b); - }; - tree.get_selected_branch = function() { - return selected_branch; - }; - tree.get_parent_branch = function(b) { - return get_parent(b); - }; - tree.select_branch = function(b) { - select_branch(b); - return b; - }; - tree.get_children = function(b) { - return b.children; - }; - tree.select_parent_branch = function(b) { - var p; - if (b == null) { - b = tree.get_selected_branch(); - } - if (b != null) { - p = tree.get_parent_branch(b); - if (p != null) { - tree.select_branch(p); - return p; - } - } - }; - tree.add_branch = function(parent, new_branch) { - if (parent != null) { - parent.children.push(new_branch); - parent.expanded = true; - } else { - scope.treeData.push(new_branch); - } - return new_branch; - }; - tree.add_root_branch = function(new_branch) { - tree.add_branch(null, new_branch); - return new_branch; - }; - tree.expand_branch = function(b) { - if (b == null) { - b = tree.get_selected_branch(); - } - if (b != null) { - b.expanded = true; - return b; - } - }; - tree.collapse_branch = function(b) { - if (b == null) { - b = selected_branch; - } - if (b != null) { - b.expanded = false; - return b; - } - }; - tree.get_siblings = function(b) { - var p, siblings; - if (b == null) { - b = selected_branch; - } - if (b != null) { - p = tree.get_parent_branch(b); - if (p) { - siblings = p.children; - } else { - siblings = scope.treeData; - } - return siblings; - } - }; - tree.get_next_sibling = function(b) { - var i, siblings; - if (b == null) { - b = selected_branch; - } - if (b != null) { - siblings = tree.get_siblings(b); - n = siblings.length; - i = siblings.indexOf(b); - if (i < n) { - return siblings[i + 1]; - } - } - }; - tree.get_prev_sibling = function(b) { - var i, siblings; - if (b == null) { - b = selected_branch; - } - siblings = tree.get_siblings(b); - n = siblings.length; - i = siblings.indexOf(b); - if (i > 0) { - return siblings[i - 1]; - } - }; - tree.select_next_sibling = function(b) { - var next; - if (b == null) { - b = selected_branch; - } - if (b != null) { - next = tree.get_next_sibling(b); - if (next != null) { - return tree.select_branch(next); - } - } - }; - tree.select_prev_sibling = function(b) { - var prev; - if (b == null) { - b = selected_branch; - } - if (b != null) { - prev = tree.get_prev_sibling(b); - if (prev != null) { - return tree.select_branch(prev); - } - } - }; - tree.get_first_child = function(b) { - var _ref; - if (b == null) { - b = selected_branch; - } - if (b != null) { - if (((_ref = b.children) != null ? _ref.length : void 0) > 0) { - return b.children[0]; - } - } - }; - tree.get_closest_ancestor_next_sibling = function(b) { - var next, parent; - next = tree.get_next_sibling(b); - if (next != null) { - return next; - } else { - parent = tree.get_parent_branch(b); - return tree.get_closest_ancestor_next_sibling(parent); - } - }; - tree.get_next_branch = function(b) { - var next; - if (b == null) { - b = selected_branch; - } - if (b != null) { - next = tree.get_first_child(b); - if (next != null) { - return next; - } else { - next = tree.get_closest_ancestor_next_sibling(b); - return next; - } - } - }; - tree.select_next_branch = function(b) { - var next; - if (b == null) { - b = selected_branch; - } - if (b != null) { - next = tree.get_next_branch(b); - if (next != null) { - tree.select_branch(next); - return next; - } - } - }; - tree.last_descendant = function(b) { - var last_child; - if (b == null) { - debugger; - } - n = b.children.length; - if (n === 0) { - return b; - } else { - last_child = b.children[n - 1]; - return tree.last_descendant(last_child); - } - }; - tree.get_prev_branch = function(b) { - var parent, prev_sibling; - if (b == null) { - b = selected_branch; - } - if (b != null) { - prev_sibling = tree.get_prev_sibling(b); - if (prev_sibling != null) { - return tree.last_descendant(prev_sibling); - } else { - parent = tree.get_parent_branch(b); - return parent; - } - } - }; - return tree.select_prev_branch = function(b) { - var prev; - if (b == null) { - b = selected_branch; - } - if (b != null) { - prev = tree.get_prev_branch(b); - if (prev != null) { - tree.select_branch(prev); - return prev; - } - } - }; - } - } - } - }; - } - ]); - -}).call(this); diff --git a/html/abntree/LICENSE b/html/abntree/LICENSE new file mode 100644 index 0000000..06594e7 --- /dev/null +++ b/html/abntree/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013 Nick Perkins + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/html/abntree/abn_tree.css b/html/abntree/abn_tree.css new file mode 100644 index 0000000..48864e9 --- /dev/null +++ b/html/abntree/abn_tree.css @@ -0,0 +1,121 @@ +/* + abn-tree.css + + style for the angular-bootstrap-nav-tree + for both Bootstrap 2 and Bootstrap 3 + +*/ + + + +/* ------------------------------------------ +AngularJS Animations... + +The first selector is for Angular 1.1.5 +The second selector is for Angular 1.2.0 + +*/ +.abn-tree-animate-enter, +li.abn-tree-row.ng-enter { + transition: 200ms linear all; + position: relative; + display: block; + opacity: 0; + max-height:0px; +} +.abn-tree-animate-enter.abn-tree-animate-enter-active, +li.abn-tree-row.ng-enter-active{ + opacity: 1; + max-height:30px; +} + +.abn-tree-animate-leave, +li.abn-tree-row.ng-leave { + transition: 200ms linear all; + position: relative; + display: block; + height:30px; + max-height: 30px; + opacity: 1; +} +.abn-tree-animate-leave.abn-tree-animate-leave-active, +li.abn-tree-row.ng-leave-active { + height: 0px; + max-height:0px; + opacity: 0; +} + + +/* +------------------------------------------ +Angular 1.2.0 Animation +*/ + + +.abn-tree-animate.ng-enter{ + +} +.abn-tree-animate.ng-enter{ + +} + + + + +/* + end animation stuff +----------------------------------------- + begin normal css stuff +*/ +ul.abn-tree li.abn-tree-row { + padding: 0px; + margin:0px; +} + +ul.abn-tree li.abn-tree-row a { + padding: 3px 10px; +} + +ul.abn-tree i.indented { + padding: 2px; +} + +.abn-tree { + cursor: pointer; +} +ul.nav.abn-tree .level-1 .indented { + position: relative; + left: 0px; +} +ul.nav.abn-tree .level-2 .indented { + position: relative; + left: 20px; +} +ul.nav.abn-tree .level-3 .indented { + position: relative; + left: 40px; +} +ul.nav.abn-tree .level-4 .indented { + position: relative; + left: 60px; +} +ul.nav.abn-tree .level-5 .indented { + position: relative; + left: 80px; +} +ul.nav.abn-tree .level-6 .indented { + position: relative; + left: 100px; +} +ul.nav.nav-list.abn-tree .level-7 .indented { + position: relative; + left: 120px; +} +ul.nav.nav-list.abn-tree .level-8 .indented { + position: relative; + left: 140px; +} +ul.nav.nav-list.abn-tree .level-9 .indented { + position: relative; + left: 160px; +} diff --git a/html/abntree/abn_tree_directive.js b/html/abntree/abn_tree_directive.js new file mode 100644 index 0000000..f309995 --- /dev/null +++ b/html/abntree/abn_tree_directive.js @@ -0,0 +1,492 @@ +(function() { + var module, + __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + + module = angular.module('angularBootstrapNavTree', []); + + module.directive('abnTree', [ + '$timeout', function($timeout) { + return { + restrict: 'E', + template: "<ul class=\"nav nav-list nav-pills nav-stacked abn-tree\">\n <li ng-repeat=\"row in tree_rows | filter:{visible:true} track by row.branch.uid\" ng-animate=\"'abn-tree-animate'\" ng-class=\"'level-' + {{ row.level }} + (row.branch.selected ? ' active':'') + ' ' +row.classes.join(' ')\" class=\"abn-tree-row\"><a ng-click=\"user_clicks_branch(row.branch)\"><i ng-class=\"row.tree_icon\" ng-click=\"row.branch.expanded = !row.branch.expanded\" class=\"indented tree-icon\"> </i><span class=\"indented tree-label\">{{ row.label }} </span></a></li>\n</ul>", + replace: true, + scope: { + treeData: '=', + onSelect: '&', + initialSelection: '@', + treeControl: '=' + }, + link: function(scope, element, attrs) { + var error, expand_all_parents, expand_level, for_all_ancestors, for_each_branch, get_parent, n, on_treeData_change, select_branch, selected_branch, tree; + error = function(s) { + console.log('ERROR:' + s); + debugger; + return void 0; + }; + if (attrs.iconExpand == null) { + attrs.iconExpand = 'icon-plus glyphicon glyphicon-plus fa fa-plus'; + } + if (attrs.iconCollapse == null) { + attrs.iconCollapse = 'icon-minus glyphicon glyphicon-minus fa fa-minus'; + } + if (attrs.iconLeaf == null) { + attrs.iconLeaf = 'icon-file glyphicon glyphicon-file fa fa-file'; + } + if (attrs.expandLevel == null) { + attrs.expandLevel = '3'; + } + expand_level = parseInt(attrs.expandLevel, 10); + if (!scope.treeData) { + alert('no treeData defined for the tree!'); + return; + } + if (scope.treeData.length == null) { + if (treeData.label != null) { + scope.treeData = [treeData]; + } else { + alert('treeData should be an array of root branches'); + return; + } + } + for_each_branch = function(f) { + var do_f, root_branch, _i, _len, _ref, _results; + do_f = function(branch, level) { + var child, _i, _len, _ref, _results; + f(branch, level); + if (branch.children != null) { + _ref = branch.children; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + _results.push(do_f(child, level + 1)); + } + return _results; + } + }; + _ref = scope.treeData; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + root_branch = _ref[_i]; + _results.push(do_f(root_branch, 1)); + } + return _results; + }; + selected_branch = null; + select_branch = function(branch) { + if (!branch) { + if (selected_branch != null) { + selected_branch.selected = false; + } + selected_branch = null; + return; + } + if (branch !== selected_branch) { + if (selected_branch != null) { + selected_branch.selected = false; + } + branch.selected = true; + selected_branch = branch; + expand_all_parents(branch); + if (branch.onSelect != null) { + return $timeout(function() { + return branch.onSelect(branch); + }); + } else { + if (scope.onSelect != null) { + return $timeout(function() { + return scope.onSelect({ + branch: branch + }); + }); + } + } + } + }; + scope.user_clicks_branch = function(branch) { + if (branch !== selected_branch) { + return select_branch(branch); + } + }; + get_parent = function(child) { + var parent; + parent = void 0; + if (child.parent_uid) { + for_each_branch(function(b) { + if (b.uid === child.parent_uid) { + return parent = b; + } + }); + } + return parent; + }; + for_all_ancestors = function(child, fn) { + var parent; + parent = get_parent(child); + if (parent != null) { + fn(parent); + return for_all_ancestors(parent, fn); + } + }; + expand_all_parents = function(child) { + return for_all_ancestors(child, function(b) { + return b.expanded = true; + }); + }; + scope.tree_rows = []; + on_treeData_change = function() { + var add_branch_to_list, root_branch, _i, _len, _ref, _results; + for_each_branch(function(b, level) { + if (!b.uid) { + return b.uid = "" + Math.random(); + } + }); + console.log('UIDs are set.'); + for_each_branch(function(b) { + var child, _i, _len, _ref, _results; + if (angular.isArray(b.children)) { + _ref = b.children; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + _results.push(child.parent_uid = b.uid); + } + return _results; + } + }); + scope.tree_rows = []; + for_each_branch(function(branch) { + var child, f; + if (branch.children) { + if (branch.children.length > 0) { + f = function(e) { + if (typeof e === 'string') { + return { + label: e, + children: [] + }; + } else { + return e; + } + }; + return branch.children = (function() { + var _i, _len, _ref, _results; + _ref = branch.children; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + _results.push(f(child)); + } + return _results; + })(); + } + } else { + return branch.children = []; + } + }); + add_branch_to_list = function(level, branch, visible) { + var child, child_visible, tree_icon, _i, _len, _ref, _results; + if (branch.expanded == null) { + branch.expanded = false; + } + if (branch.classes == null) { + branch.classes = []; + } + if (!branch.noLeaf && (!branch.children || branch.children.length === 0)) { + tree_icon = attrs.iconLeaf; + if (__indexOf.call(branch.classes, "leaf") < 0) { + branch.classes.push("leaf"); + } + } else { + if (branch.expanded) { + tree_icon = attrs.iconCollapse; + } else { + tree_icon = attrs.iconExpand; + } + } + scope.tree_rows.push({ + level: level, + branch: branch, + label: branch.label, + classes: branch.classes, + tree_icon: tree_icon, + visible: visible + }); + if (branch.children != null) { + _ref = branch.children; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + child = _ref[_i]; + child_visible = visible && branch.expanded; + _results.push(add_branch_to_list(level + 1, child, child_visible)); + } + return _results; + } + }; + _ref = scope.treeData; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + root_branch = _ref[_i]; + _results.push(add_branch_to_list(1, root_branch, true)); + } + return _results; + }; + scope.$watch('treeData', on_treeData_change, true); + if (attrs.initialSelection != null) { + for_each_branch(function(b) { + if (b.label === attrs.initialSelection) { + return $timeout(function() { + return select_branch(b); + }); + } + }); + } + n = scope.treeData.length; + console.log('num root branches = ' + n); + for_each_branch(function(b, level) { + b.level = level; + return b.expanded = b.level < expand_level; + }); + if (scope.treeControl != null) { + if (angular.isObject(scope.treeControl)) { + tree = scope.treeControl; + tree.expand_all = function() { + return for_each_branch(function(b, level) { + return b.expanded = true; + }); + }; + tree.collapse_all = function() { + return for_each_branch(function(b, level) { + return b.expanded = false; + }); + }; + tree.get_first_branch = function() { + n = scope.treeData.length; + if (n > 0) { + return scope.treeData[0]; + } + }; + tree.select_first_branch = function() { + var b; + b = tree.get_first_branch(); + return tree.select_branch(b); + }; + tree.get_selected_branch = function() { + return selected_branch; + }; + tree.get_parent_branch = function(b) { + return get_parent(b); + }; + tree.select_branch = function(b) { + select_branch(b); + return b; + }; + tree.get_children = function(b) { + return b.children; + }; + tree.select_parent_branch = function(b) { + var p; + if (b == null) { + b = tree.get_selected_branch(); + } + if (b != null) { + p = tree.get_parent_branch(b); + if (p != null) { + tree.select_branch(p); + return p; + } + } + }; + tree.add_branch = function(parent, new_branch) { + if (parent != null) { + parent.children.push(new_branch); + parent.expanded = true; + } else { + scope.treeData.push(new_branch); + } + return new_branch; + }; + tree.add_root_branch = function(new_branch) { + tree.add_branch(null, new_branch); + return new_branch; + }; + tree.expand_branch = function(b) { + if (b == null) { + b = tree.get_selected_branch(); + } + if (b != null) { + b.expanded = true; + return b; + } + }; + tree.collapse_branch = function(b) { + if (b == null) { + b = selected_branch; + } + if (b != null) { + b.expanded = false; + return b; + } + }; + tree.get_siblings = function(b) { + var p, siblings; + if (b == null) { + b = selected_branch; + } + if (b != null) { + p = tree.get_parent_branch(b); + if (p) { + siblings = p.children; + } else { + siblings = scope.treeData; + } + return siblings; + } + }; + tree.get_next_sibling = function(b) { + var i, siblings; + if (b == null) { + b = selected_branch; + } + if (b != null) { + siblings = tree.get_siblings(b); + n = siblings.length; + i = siblings.indexOf(b); + if (i < n) { + return siblings[i + 1]; + } + } + }; + tree.get_prev_sibling = function(b) { + var i, siblings; + if (b == null) { + b = selected_branch; + } + siblings = tree.get_siblings(b); + n = siblings.length; + i = siblings.indexOf(b); + if (i > 0) { + return siblings[i - 1]; + } + }; + tree.select_next_sibling = function(b) { + var next; + if (b == null) { + b = selected_branch; + } + if (b != null) { + next = tree.get_next_sibling(b); + if (next != null) { + return tree.select_branch(next); + } + } + }; + tree.select_prev_sibling = function(b) { + var prev; + if (b == null) { + b = selected_branch; + } + if (b != null) { + prev = tree.get_prev_sibling(b); + if (prev != null) { + return tree.select_branch(prev); + } + } + }; + tree.get_first_child = function(b) { + var _ref; + if (b == null) { + b = selected_branch; + } + if (b != null) { + if (((_ref = b.children) != null ? _ref.length : void 0) > 0) { + return b.children[0]; + } + } + }; + tree.get_closest_ancestor_next_sibling = function(b) { + var next, parent; + next = tree.get_next_sibling(b); + if (next != null) { + return next; + } else { + parent = tree.get_parent_branch(b); + return tree.get_closest_ancestor_next_sibling(parent); + } + }; + tree.get_next_branch = function(b) { + var next; + if (b == null) { + b = selected_branch; + } + if (b != null) { + next = tree.get_first_child(b); + if (next != null) { + return next; + } else { + next = tree.get_closest_ancestor_next_sibling(b); + return next; + } + } + }; + tree.select_next_branch = function(b) { + var next; + if (b == null) { + b = selected_branch; + } + if (b != null) { + next = tree.get_next_branch(b); + if (next != null) { + tree.select_branch(next); + return next; + } + } + }; + tree.last_descendant = function(b) { + var last_child; + if (b == null) { + debugger; + } + n = b.children.length; + if (n === 0) { + return b; + } else { + last_child = b.children[n - 1]; + return tree.last_descendant(last_child); + } + }; + tree.get_prev_branch = function(b) { + var parent, prev_sibling; + if (b == null) { + b = selected_branch; + } + if (b != null) { + prev_sibling = tree.get_prev_sibling(b); + if (prev_sibling != null) { + return tree.last_descendant(prev_sibling); + } else { + parent = tree.get_parent_branch(b); + return parent; + } + } + }; + return tree.select_prev_branch = function(b) { + var prev; + if (b == null) { + b = selected_branch; + } + if (b != null) { + prev = tree.get_prev_branch(b); + if (prev != null) { + tree.select_branch(prev); + return prev; + } + } + }; + } + } + } + }; + } + ]); + +}).call(this); diff --git a/html/demo.html b/html/demo.html index eec7874..906d42f 100644 --- a/html/demo.html +++ b/html/demo.html @@ -5,14 +5,14 @@ <script src="ui-bootstrap-tpls-0.12.1.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0-rc.0/angular-sanitize.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> - <script src="abn_tree_directive.js"></script> + <script src="abntree/abn_tree_directive.js"></script> <script src="dragdrop/lvl-uuid.js"></script> <script src="dragdrop/lvl-drag-drop.js"></script> <script src="skillData.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css"> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> - <link rel="stylesheet" href="abn_tree.css"> + <link rel="stylesheet" href="abntree/abn_tree.css"> <link rel="stylesheet" href="style.css"> </head> <body ng-controller="SkillMainDataController"> diff --git a/html/lines.html b/html/lines.html index 2c49d41..8ec4353 100644 --- a/html/lines.html +++ b/html/lines.html @@ -5,11 +5,11 @@ <script src="ui-bootstrap-tpls-0.12.1.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0-rc.0/angular-sanitize.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> - <script src="abn_tree_directive.js"></script> + <script src="abntree/abn_tree_directive.js"></script> <script src="skillLinesControl.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css"> - <link rel="stylesheet" href="abn_tree.css"> + <link rel="stylesheet" href="abntree/abn_tree.css"> <link rel="stylesheet" href="style.css"> </head> <body ng-controller="SkillLineControl"> diff --git a/html/skillFormulas.html b/html/skillFormulas.html index bbcdb46..e530424 100644 --- a/html/skillFormulas.html +++ b/html/skillFormulas.html @@ -5,14 +5,14 @@ <script src="ui-bootstrap-tpls-0.12.1.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0-rc.0/angular-sanitize.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> - <script src="abn_tree_directive.js"></script> + <script src="abntree/abn_tree_directive.js"></script> <script src="dragdrop/lvl-uuid.js"></script> <script src="dragdrop/lvl-drag-drop.js"></script> <script src="skillData.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css"> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> - <link rel="stylesheet" href="abn_tree.css"> + <link rel="stylesheet" href="abntree/abn_tree.css"> <link rel="stylesheet" href="style.css"> </head> <body ng-controller="SkillMainDataController"> diff --git a/modules/SkillCurve.lua b/modules/SkillCurve.lua index 850a7f0..4fdb22d 100644 --- a/modules/SkillCurve.lua +++ b/modules/SkillCurve.lua @@ -171,7 +171,7 @@ function skpwr:addWeaponIterations() end end -Quant:registerCmd("itr-all-skills", "Generate damage data for all active skills", function() +Quant:registerCmd("itr-all-skills", "|cFF0000WARNING. See README for instructions", function() d("Beginning skill iteration. This may take awhile.") skpwr.filter = { SKILL_TYPE_TRADESKILL = 0, @@ -182,7 +182,7 @@ Quant:registerCmd("itr-all-skills", "Generate damage data for all active skills" skpwr:prepScan() end) -Quant:registerCmd("itr-class-skills", "Generate damage data for class skills only", function() +Quant:registerCmd("itr-class-skills", "|cFF0000WARNING. See README for instructions", function() d("Beginning class skill iteration. This may take awhile.") skpwr.filter = { SKILL_TYPE_TRADESKILL = 0, @@ -200,7 +200,7 @@ Quant:registerCmd("itr-class-skills", "Generate damage data for class skills onl end) --Try to execute all skills -Quant:registerCmd("skills", "Dump class skills and iterate gear", function() +Quant:registerCmd("skills", "|cFF0000WARNING. See README for instructions", function() Quant:cli('itr-class-skills') Quant:cli('skill-full') --Just do these on naked char for standard end) \ No newline at end of file diff --git a/runScript.lua b/runScript.lua index 8ba2c83..20cd490 100644 --- a/runScript.lua +++ b/runScript.lua @@ -11,7 +11,7 @@ local scripts = { { file = "scripts/DumpForR.lua", desc = "Single Skill Info -> for R" }, { file = "scripts/dumpSkillDataJson.lua", desc = "Skill Fit -> JSON" }, { file = "scripts/skillDataExtract.lua", desc = "Skill Fit -> DAT (tab-separated)" }, - { file = "scripts/SkillFormulaDump.lua", desc = "Skill Formulas only -> CSV" }, + { file = "scripts/SkillFormulaDump.lua", desc = "Skill Formulas only -> CSV. Requires DAT skill fit run first" }, { file = "scripts/skillNamesByLine.lua", desc = "Skill Names -> console" }, } diff --git a/scripts/SkillFormulaDump.lua b/scripts/SkillFormulaDump.lua index 8d85024..c64829e 100644 --- a/scripts/SkillFormulaDump.lua +++ b/scripts/SkillFormulaDump.lua @@ -1,3 +1,23 @@ +-- This file is part of Quant +-- +-- (C) 2015 Scott Yeskie (Sasky) +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. + +---Used to get just skill formulas in CSV +---Required: skillDataExtract.lua run and .dat file in local directory + local fin = io.open("./skilldata.dat", "r") local fout = io.open("./formulae.csv", "w") @@ -16,13 +36,16 @@ end for line in fin:lines() do local keys = split(line,"\t") - for i=17,#keys,4 do + --For DAT, formulas are just sets 5 numbers at the end of set columns + --So iterate in groups of 5 to get + for i=17,#keys,5 do local row = { - keys[1].."-"..(i-13)/4, + keys[1].."-"..(i-12)/5, keys[i], keys[i+1], keys[i+2], - keys[i+3] + keys[i+3], + keys[i+4] } fout:write(table.concat(row,","),"\n") end diff --git a/scripts/inc/extract.lua b/scripts/inc/extract.lua index f5cade2..3f78566 100644 --- a/scripts/inc/extract.lua +++ b/scripts/inc/extract.lua @@ -1,3 +1,23 @@ +-- This file is part of Quant +-- +-- (C) 2015 Scott Yeskie (Sasky) +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. + +---Description: Utility function to process skill data into formulas +---Note: initiates connection to R, so RServe must be running + --Main fit find function local R = require "rclient" local r = R.connect() diff --git a/scripts/inc/jsonManual.lua b/scripts/inc/jsonManual.lua deleted file mode 100644 index cd7ff1c..0000000 --- a/scripts/inc/jsonManual.lua +++ /dev/null @@ -1,43 +0,0 @@ -local function line(indent, string) - f:write(string.rep(" ",indent)) - f:write(string) - f:write("\n") - f:flush() -end - -local function escape(str) return '"' .. str:gsub('"','\"') .. '"' end - -line(0,"{") -line(1, '"bonus": {') -local last -for key,t in ipairs(setdata.bonuses) do - if t.desc then - if last then line(2, last .. ",") end - last = key .. ': ' .. escape(t.desc):gsub("|cffffff",""):gsub("|r","") - end -end -if last then line(2,last) end -line(1,"},") - -line(1, '"set": {') -local last -for key,t in ipairs(setdata.sets) do - if last then line(2, last .. ",") end - line(2, key .. ": {") - line(3, '"name": ' .. escape(t.name) .. ",") - line(3, '"bonuses": [') - if t.bonuses then - local lastBonus - for _,bonus in pairs(t.bonuses) do - if lastBonus then line(4, lastBonus .. ",") end - lastBonus = '{ "req": ' .. bonus.n .. ', "id": ' .. bonus.id .. ' }' - end - line(4,lastBonus) - end - line(3,"]") - last = "}" -end -line(2,last) -line(1, '"}') -line(0,"}") -setdata.items = {} --This is way too big to handle at the moment \ No newline at end of file diff --git a/scripts/inc/loadfile.lua b/scripts/inc/loadfile.lua index fb49039..2a2a36b 100644 --- a/scripts/inc/loadfile.lua +++ b/scripts/inc/loadfile.lua @@ -1,3 +1,22 @@ +-- This file is part of Quant +-- +-- (C) 2015 Scott Yeskie (Sasky) +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. + +---Description: Loads Quant data from SavedVariables + local M = {} function M:loadSavedVariables(account, server) if self.data ~=nil then return end diff --git a/scripts/inc/util.lua b/scripts/inc/util.lua index 0b956e2..2a27267 100644 --- a/scripts/inc/util.lua +++ b/scripts/inc/util.lua @@ -1,10 +1,33 @@ +-- This file is part of Quant +-- +-- (C) 2015 Scott Yeskie (Sasky) +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. + +---Description: Various utility functions + +---Inspect: Quick formatted output of Lua table local u = {} local inspect = require('inspect') function u.dump(v) print(inspect(v)) end +---nn: Makes sure value is not NIL function u.nn(v) if v == nil then return "##NIL/UNKNOWN" end return v end +---bl: Converts boolean to text true/false function u.bl(v) if v then return "TRUE" end return "FALSE" end +---Sort utility function u.sortSet(set) local array = {} for k in pairs(set) do @@ -14,13 +37,15 @@ function u.sortSet(set) return array end +---Translates ESO constants to Magicka, Stamina, and Ultimate function u.getMechanicName(mechanic) if mechanic == 0 then return "Magicka" elseif mechanic == 6 then return "Stamina" elseif mechanic == 10 then return "Ultimate" - else return "Unknown: " .. nn(mechanic) end + else return "Unknown: " .. u.nn(mechanic) end end +---For nested tables, creates tables down to depth as needed function u.makeDepth(t, list) if not t then return end @@ -33,6 +58,7 @@ function u.makeDepth(t, list) end end +---Joins values into a unique, key value. Currently just concat function u.makeKey(...) return table.concat({...},"/") end diff --git a/scripts/skillDataExtract.lua b/scripts/skillDataExtract.lua index b445ad0..94c6360 100644 --- a/scripts/skillDataExtract.lua +++ b/scripts/skillDataExtract.lua @@ -18,19 +18,21 @@ --- Used to extract SavedVariables --- Required: /quant itr-all-skills or /quant itr-class-skills and /quant skill-full in-game --- Required: Rserve must be running for this script ---- Edit the following to your account name to use: -local account = "@Sasky" ---- Edit server to which saved variables: "live", "liveeu", "pts" -local server = "pts" ---- -require("inc.util") -local sv = require("inc.loadfile") -sv.loadSavedVariables(account, server) -require("inc.extract") +print("Loading libraries") +local cfg = cfg or assert(loadfile("cfg.lua"))() +local u = inc("util") +local sv = inc("loadfile") +local r = inc("extract") -local skilldata = sv.getSVEntry("SkillsCurve") -local skillfull = sv.getSVEntry("SkillsFullInfo") +print("Account: " .. cfg.account) +print("Server: " .. cfg.server) + +print("Loading saved variables") +sv:loadSavedVariables(cfg.account, cfg.server) +local skilldata = sv:getSVEntry("SkillsCurve") +local skillfull = sv:getSVEntry("SkillsFullInfo") +local skillref = r:initSkillData(sv) --Header local header = { @@ -62,22 +64,22 @@ for skill_lvl,numbers in pairs(skilldata) do local row = { skill, - nn(ref.type), - nn(ref.line), + u.nn(ref.type), + u.nn(ref.line), 4, --Hardcoding rank 4, though possible want different ranks later - nn(data.description), - nn(data.descriptionHeader), - getMechanicName(data.mechanic), - nn(data.cost), - nn(data.targetDescription), - nn(data.minRangeCM), - nn(data.maxRangeCM), - nn(data.radiusCM), - nn(data.distanceCM), - bl(data.channeled), - nn(data.castTime), - nn(data.channelTime), - nn(data.durationMS) + u.nn(data.description), + u.nn(data.descriptionHeader), + u.getMechanicName(data.mechanic), + u.nn(data.cost), + u.nn(data.targetDescription), + u.nn(data.minRangeCM), + u.nn(data.maxRangeCM), + u.nn(data.radiusCM), + u.nn(data.distanceCM), + u.bl(data.channeled), + u.nn(data.castTime), + u.nn(data.channelTime), + u.nn(data.durationMS) } local DESCR = 5 @@ -86,7 +88,7 @@ for skill_lvl,numbers in pairs(skilldata) do local formulaNum = 1 local formulae = {} for _,rawnumbers in ipairs(numbers) do - local fit = getFitData(rawnumbers) + local fit = r:getFitData(rawnumbers) local delta = 1E-5 if fit.main < delta then fit.main = 0 end if fit.power < delta then fit.power = 0 end @@ -99,7 +101,7 @@ for skill_lvl,numbers in pairs(skilldata) do local formulasig = fit.main .. "/" .. fit.power .. "/" .. fit.int .. "/" .. fit.rsq if fit.const then - row[DESCR] = replaceOne(desc, toReplace, fit.int) + row[DESCR] = r:replaceNumberInDescription(desc, toReplace, fit.int) else if not formulae[formulasig] then table.insert(row,fit.main) @@ -110,7 +112,7 @@ for skill_lvl,numbers in pairs(skilldata) do formulae[formulasig] = "##f" .. formulaNum .. "##" formulaNum = formulaNum + 1 end - row[DESCR] = replaceNumberInDescription(desc, toReplace, formulae[formulasig]) + row[DESCR] = r:replaceNumberInDescription(desc, toReplace, formulae[formulasig]) end end diff --git a/scripts/skillNamesByLine.lua b/scripts/skillNamesByLine.lua index 18bb963..4f60c9e 100644 --- a/scripts/skillNamesByLine.lua +++ b/scripts/skillNamesByLine.lua @@ -1,10 +1,24 @@ ---[[ -Description: Print a list of skills in a tree of type/skill line. - -Known issue: For some reason, 3 skills show up in every skill line: -Mages Wrath, Mage's Fury, Endless Fury - ]] - +-- This file is part of Quant +-- +-- (C) 2015 Scott Yeskie (Sasky) +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. + +---Description: Print a list of skills in a tree of type/skill line. +---Known issue: For some reason, 3 skills show up in every skill line: +--- Mages Wrath, Mage's Fury, Endless Fury +---Required: /quant skill-full in-game local inspect = require('inspect') @@ -25,5 +39,3 @@ for type,lines in pairs(skillfull) do end end end - ---print(inspect(skillfull)) \ No newline at end of file