User:Kiokurashi/common.js: Difference between revisions
From IdleOn MMO Wiki
imported>Kiokurashi No edit summary |
imported>Kiokurashi No edit summary |
||
Line 24: | Line 24: | ||
$('.resultM', container).text(Math.floor(materialCost).toLocaleString()); | $('.resultM', container).text(Math.floor(materialCost).toLocaleString()); | ||
} else { | } else { | ||
$('.resultM', container).text(i4 - (inVal % i4) | $('.resultM', container).text(i4 - ((inVal - offset) % i4) + " Upgrades left before you need to increase max level."); | ||
} | } | ||
}); | }); | ||
}); | }); | ||
}); | }); |
Revision as of 05:18, 12 March 2022
$(document).ready(function(){
$.each($('.stampDiv'), function(){
var container = $(this);
var x1 = parseFloat($(this).data('x1'));
var x2 = parseFloat($(this).data('x2'));
var func = $(this).data('func');
var i4 = parseFloat($(this).data('i4'));
var i6 = parseFloat($(this).data('i6'));
var i7 = parseFloat($(this).data('i7'));
var i8 = parseFloat($(this).data('i8'));
var i9 = parseFloat($(this).data('i9'));
var offset = parseInt($(this).data('offset'));
$('.resultB', container).text(0);
$('.resultC', container).text(0);
$('.resultM', container).text(0);
$('.valInput', this).html('<input id="inField" type="number" min="0" placeholder=" Level " style="max-width: 100px;"/>');
$("#inField", this).change(function(){
var inVal = parseInt($(this).val());
var goldCost = i8 * Math.pow(i9 - (inVal / (inVal + 5 * i4)) * 0.25, inVal * (10 / i4));
var materialCost = i6 * Math.pow(i7, Math.pow(Math.round(inVal / i4) - 1, 0.8));
$('.resultB', container).text(lavaFunc(func,inVal,x1,x2));
$('.resultC', container).html(coindisplay(Math.floor(goldCost)));
if (inVal % i4 == offset){
$('.resultM', container).text(Math.floor(materialCost).toLocaleString());
} else {
$('.resultM', container).text(i4 - ((inVal - offset) % i4) + " Upgrades left before you need to increase max level.");
}
});
});
});