diff --git a/README.md b/README.md index 28da724..72775a2 100644 --- a/README.md +++ b/README.md @@ -1 +1,6 @@ -# ancient +# Clicker Heroes Ancient Optimizer +A HTML form to help calculate what levels your ancients should be at for optimum play. +* Forked from https://github.com/hsoptimizer/ancient + +## Changelog +* Added an "apply optimization" button. diff --git a/index.html b/index.html index 5fef1dc..1f71f55 100644 --- a/index.html +++ b/index.html @@ -66,7 +66,8 @@   - + + Ancient diff --git a/scripts/mathmagician.js b/scripts/mathmagician.js index 7c0e215..01a4f7e 100644 --- a/scripts/mathmagician.js +++ b/scripts/mathmagician.js @@ -783,6 +783,47 @@ function optimize() { saveSettings(); } +function apply_optimize() +{ + optimize(); + + // update HTML + for(key in anc) + { + var ancient = anc[key]; + + if((ancient.maxLevel != 0 && ancient.levelOld == ancient.maxLevel) || (ancient.levelOld == 0 && key != 0) || (playstyle=='idle' && ancient.clicking)) + { + $('#anc'+key).css('display', 'none'); + } + else + { + console.log('poop'); +// Show the Ancient. + $('#anc'+key).css('display', 'table-row'); + $('#old'+key).val(ancient.levelNew) + ancient.levelOld = ancient.levelNew + console.log('poop'); +// Clear the Delta + $('#delta'+key).text(''); +// Remove previous mouse over except for "Souls in bank:" + if (key != 0) + $('#delta'+key).removeAttr("onmouseover"); + + if(ancient.levelOld > 0) + { + $('#name'+key).attr("onmouseover", "nhpup.popup('Current level:
"+ancient.getBonus(ancient.levelOld)+"');"); + } + else + { + $('#name'+key).attr("onmouseover", "nhpup.popup('"+ancient.Name+"
First level: "+ancient.getBonus(1)+"');"); + } + } + } + permaLink(); + saveSettings(); +} + function import_save(evt) { if(evt && evt.keyCode == 17) {