Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
<tr><td colspan="5" class="filler">&nbsp;</td></tr>
<tr>
<td class="filler" id="permalink"></td>
<td colspan="4" class="button"><input type="button" onclick="optimize()" value="Do the math"></td>
<td colspan="2" class="button"><input type="button" onclick="optimize()" value="Do the math"></td>
<td colspan="2" class="button"><input type="button" onclick="apply_optimize()" value="Apply the math"></td>
</tr>
<tr>
<th>Ancient</th>
Expand Down
41 changes: 41 additions & 0 deletions scripts/mathmagician.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('<u>Current level:</u><br>"+ancient.getBonus(ancient.levelOld)+"');");
}
else
{
$('#name'+key).attr("onmouseover", "nhpup.popup('<u>"+ancient.Name+"</u><br>First level: "+ancient.getBonus(1)+"');");
}
}
}
permaLink();
saveSettings();
}

function import_save(evt) {

if(evt && evt.keyCode == 17) {
Expand Down