User:Falterfire/wikia.js

// -calculater //WFstats function calculate_str { var WarframeSTR = (1 + getCurrent("Intensify") + getCurrent("Power_Drift") + getCurrent("Blind_Rage") + getCurrent("Transient_Fortitude") + getCurrent("Energy_Conversion") + getCurrentMalus('Overextended') + getCurrent('Growing_Power') + getCurrent("Pacify_&_Provoke")) * getCurrent("Parasitic_Link") * getCurrent("Corruption"); document.getElementById('abilitySTR').value = (WarframeSTR * 100).toFixed(2) + "%"; } function calculate_dur { var WarframeDUR = 1 + getCurrent("Primed_Continuity") + getCurrent("Constitution") + getCurrent("Narrow_Minded") + getCurrentMalus("Transient_Fortitude") + getCurrentMalus("Fleeting_Expertise"); document.getElementById('abilityDUR').value = (WarframeDUR * 100).toFixed(2) + "%"; } function calculate_rng { var WarframeRNG = (1 + getCurrent('Stretch') + getCurrent('Cunning_Drift') + getCurrent('Overextended') + getCurrentMalus("Narrow_Minded")) * getCurrent("Corruption"); document.getElementById('abilityRNG').value = (WarframeRNG * 100).toFixed(2) + "%"; } function calculate_eff { var WarframeEFF = 1 + getCurrent('Streamline') + getCurrent('Fleeting_Expertise') + getCurrentMalus("Blind_Rage"); document.getElementById('abilityEFF').value = (WarframeEFF * 100).toFixed(2) + "%"; } //armor function calculate_arm { var modBonus = (1 + getCurrent('Steel_Fiber') + getCurrent('Armored_Agility') + getCurrent('Stone_Shape') + getCurrent('Stone_Armor') + getCurrent('Warcry') + getCurrent('Hallowed_Ground') + getCurrent('Elemental_Ward')) * getCurrent('Vex_Armor'); document.getElementById('frameArmor').value = '+'+(modBonus * 100).toFixed(1) +'%'; netArmor = document.getElementById('base_armor').value * modBonus; document.getElementById('arm_result').value = netArmor.toFixed(2); document.getElementById('arm_reduct').value =(100*netArmor/(300+netArmor)).toFixed(2)+'%'; document.getElementById('arm_effhealth').value = (1/(1-netArmor/(300+netArmor))).toFixed(2); } function calculate { if ($('#MaximizationContainer').length) { calculate_str; calculate_dur; calculate_eff; calculate_rng; }	if ($('#ArmorContainer').length) { calculate_arm; } //var WarframeDamage = document.getElementById('baseDamage').value; //document.getElementById('result').value = (WarframeDamage * WarframeSTR).toFixed(2); } function getCurrent(name) { parent = document.getElementById(name); if (parent.getElementsByClassName('check')[0].checked) { return parent.getElementsByClassName('currentEffect')[0].value / 100; } else if (parent.className == "*") { return 1; } else { return 0; } } function getCurrentMalus(name) { parent = document.getElementById(name); if (parent.getElementsByClassName('check')[0].checked) { return parent.getElementsByClassName('currentEffect')[1].value / 100; } else { return 0; } } // -- loader $(document).ready(function { if ($('#MaximizationContainer').length) {    // stuff before the frame stats    var html = " ";    html += makeRow("Base damage", "baseDamage", "", 100);    html += " ";    // occasional stuff    html += " ";

html += "

";   html += loadBuff('Energy Conversion', , 1, 50, 'STR', '+');    html += loadBuff('Growing Power', , 8, 25, 'STR', '+');    html += loadBuff('Pacify & Provoke', , 80, 1, 'STR', '+');    html += loadBuff('Parasitic Link', , 200, 1, 'STR', '*');    html += loadBuff('Roar', , 187, 1, 'DMG', '*');    html += loadBuff('Corruption', 'Void_Relic#Relic_Corruption', 1, 200, 'STR & RNG', '*');    html += " ";    //ability stats    html += " ";   html += makeRow("[PH] STR Result", "result", "Result", "");    document.getElementById('MaximizationContainer').innerHTML = html + " ";    // occasional stuff    html += " ";

html += "

";   html += loadBuff('Stone Shape', 'Focus/Unairu', 1, 12, , '+');    html += loadBuff('Stone Armor', 'Focus/Unairu', 1, 50, , '+');    html += loadBuff('Warcry', , 142, 1, , '+');    html += loadBuff('Hallowed Ground',,  59, 1, , '+');    html += loadBuff('Elemental Ward',, 524, 1, , '+');    html += loadBuff('Vex Armor',, 12.22, 100, , '*');    html += " ";    //ability stats    html += " ";

html += makeRowInput("Base Armor", "base_armor", "", 15); html += makeRow("Armor Result", "arm_result", "Result", ""); html += makeRow("Damage Reduction", "arm_reduct", "Result", ""); html += makeRow("Effective Health Multiplier", "arm_effhealth", "Result", "");

document.getElementById('ArmorContainer').innerHTML = html + " "; } }); function loadMod(name, ranks, bonus, malus, badStat, statCell) {

var html = "" + statCell + " " + name + "

";

html += " "; html += "

";

html += " "; html += " %

"; if (malus) { // checks if malus is unequal 0    html += " ";    html += " % " + badStat + " "; }  return html + " ";

} function loadBuff(name, link, buffstr, bonus, stat, operation) {

var html = " " + name + "

"; if (buffstr != 1) {		if ((operation == "*") && (stat == )) {

html += " ";

}else{

html += " ";

}    html += "<input class='maxbtn' type='button' value='max' onclick='clickMaxbtn(this)' disabled>

"; } else {    html += "<input class='currentRank' disabled Hidden><input class='maxbtn' onclick='clickMaxbtn(this)' Hidden disabled>";  }  html += "<input class='bonus' type='number' value=" + bonus + " Hidden>";	html += operation + "<input class='currentEffect' type='text' value=" + buffstr * bonus + " disabled>% " + stat + " "; return html + "

";

} function makeRow(text1, id, ph, value) {

return " " + text1 + ":<input id=" + id + " readonly placeholder=" + ph + " value=" + value + ">

";

} function makeRowInput(text1, id, ph, value) {

return " " + text1 + ":<input type='number' onchange='calculate' id=" + id + " placeholder=" + ph + " value=" + value + ">

";

} function statCell(stat, id, numOfMods) {

return " " + stat + "</a>: <input class='resultingStat' id=" + id + " readonly value='100.00%'>

";

} function spaaaace {

return "

";

} // updater--- //disable mod inputs as long as the mod is disabled //$('input:checkbox').change( function updateCheck(that) { var parent = that.closest("tr");  if (that.checked) {    parent.getElementsByClassName("currentRank")[0].disabled = false;    parent.getElementsByClassName("maxbtn")[0].disabled = false;    curr = parent.getElementsByClassName("currentEffect");    curr[0].style.color = "green";    if (curr.length > 1) {      curr[1].style.color = "red";    }    if (parent.id == "Corruption") {      document.body.style.backgroundColor = "lemonchiffon";    }    // count up cheat counter here  } else {    parent.getElementsByClassName("currentRank")[0].disabled = true;    parent.getElementsByClassName("maxbtn")[0].disabled = true;    curr = parent.getElementsByClassName("currentEffect");    curr[0].style.color = "#dadada";    if (curr.length > 1) {      curr[1].style.color = "#dadada";    }    if (parent.id == "Corruption") {      document.body.style.backgroundColor = "transparent"; }   // ... and down here } calculate; } //); // update bonus dynamically //$('.currentRank').change(function { function changeRank(that) { var parent = that.closest("tr"); curr = parent.getElementsByClassName("currentEffect"); bonus = parent.getElementsByClassName("bonus"); if (that.className == "currentRank count") { curr[0].value = parseFloat(that.value) * bonus[0].value; } else { curr[0].value = (parseFloat(that.value) + 1) * bonus[0].value; } if (curr.length > 1) { curr[1].value = (parseFloat(that.value) + 1) * bonus[1].value; } calculate; } //); //$('.maxbtn').click(function { function clickMaxbtn(that) { var rank = that.closest("tr").getElementsByClassName("currentRank")[0]; rank.value = rank.max; $(rank).trigger("change"); // force update! } //);