MediaWiki:Maximization.js

/* Kselia and Tuna: magic interactive stuff */ // -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('Gladiator_Aegis')  + getCurrent('Stone_Skin') + getCurrent('Warcry') + getCurrent('Elemental_Ward')) * getCurrent('Vex_Armor'); document.getElementById('frameArmor').value = '+'+((modBonus-1) * 100).toFixed(1) +'%'; netArmor = document.getElementById('base_armor').value * modBonus + getCurrent('Renewal')*100 + getCurrent('Hallowed_Reckoning')*100; 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 = " ";    //frame stats    html += " ";    // occasional stuff    html += " ";    //ability stats    html += " ";  }	if ($('#ArmorContainer').length) {	//ability stats    var html = " ";    document.getElementById('ArmorContainer').innerHTML = html;	}	calculate; });

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 class='resultingStat' id=" + id + " readonly placeholder=" + ph + " value=" + value + ">  "; } function makeRowInput(text1, id, ph, value) { return " " + text1 + ":  <input class='currentRank' type='number' onchange='calculate' id=" + id + " placeholder=" + ph + " value=" + value + ">  "; }

function statCell(stat, id, numOfMods) { return "<td rowspan=" + numOfMods + " class='statCell'>" + stat + "</a>: <input class='resultingStat' id=" + id + " readonly value='100.00%'> "; }

function spaaaace { return "<tr class='MaxiSpacer'>  "; }

// 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! } //);

/* END: Kselia and Tuna: magic interactive stuff */