User:DeletedUser010919/Sandbox5

RLQ.push( function { $(document).ready(function { load_cargo_data; }); });

var srcData;

function load_cargo_data { var srcUrl = 'https://dragalialost.gamepedia.com/api.php?action=cargoquery&tables=Skills&fields=_pageName=Name,Description1=Skill1,Description2=Skill2,Description3=Skill3,HideLevel3=Hidden&where=Description1+LIKE+"%recovery%20potency%"&format=json'; $.getJSON(srcUrl, function(returnData) { processSrcUrl(returnData.cargoquery); }); function processSrcUrl(data) { srcData = data; // so you can access this variable in console for testing populate_skill_box("Skill1"); showSkillValue; selectSkillLevel(document.getElementById("skillSelect").selectedIndex); }; };

function populate_skill_box(skillLevel) { var defaultSkill = document.getElementById("skillSelect").selectedIndex; document.getElementById("skillSelect").innerHTML = "" var skillSelect = $("#skillSelect"); var skillCount = srcData.length; for (var i = 0; i < skillCount; i++) { var opt = $(" "); opt.attr("value", srcData[i].title[skillLevel].match(/\d+/)); opt.html(srcData[i].title.Name); skillSelect.append(opt); } $("#skillSelect option:eq(defaultSkill)").prop('selected', true); };

function selectSkillLevel(skill) { document.getElementById("skillLevelSelect1").innerHTML = 'Lv.1 '; document.getElementById("skillLevelSelect2").innerHTML = 'Lv.2 '; if (srcData[skill].title.Hidden == 0) { document.getElementById("skillLevelSelect3").innerHTML = 'Lv.3 '; } else { document.getElementById("skillLevelSelect3").innerHTML = "" } };

function showSkillValue { var skillValue = document.getElementById("skillSelect")[document.getElementById("skillSelect").selectedIndex].value; document.getElementById("skillSelectValue").innerHTML = skillValue; };

function calculate { var HP = document.getElementById('HP').value; var STR = document.getElementById('STR').value; var PTNCY = document.getElementById("skillSelect")[document.getElementById("skillSelect").selectedIndex].value / 100; var PTNCYB = document.getElementById('PTNCYB').value / 100 + 1; var COBUFF = document.getElementById("coAbility")[document.getElementById("coAbility").selectedIndex].value / 100 + 1; if (document.getElementById('ELEM').checked) { var EBUFF = 1.2; } else { var EBUFF = 1; } if (document.getElementById('RAID').checked) { var TARG = 16; } else { var TARG = 4; } if (checkbox.checked) { var DUR = document.getElementById('DUR').value; var FREQ = document.getElementById('FREQ').value; var REGEN = document.getElementById('REGEN').value / 100; var TIMES = Math.floor(DUR/FREQ); var RTOTAL = (((0.65*HP + 0.2*STR) * REGEN * PTNCYB * COBUFF) / TARG) * EBUFF * TIMES; var TOTAL = (((0.65*HP + 0.2*STR) * PTNCY * PTNCYB * COBUFF) / TARG) * EBUFF + RTOTAL; } else { var TOTAL = (((0.65*HP + 0.2*STR) * PTNCY * PTNCYB * COBUFF) / TARG) * EBUFF; } document.getElementById("total").innerHTML = Math.floor(TOTAL); console.log(TOTAL); } function display { var hot = document.getElementById("HOT"); if (document.getElementById('checkbox').checked) { hot.style.display = "block"; } else { hot.style.display = "none"; } } HP:  STR:  Skill:   Potency %: Potency Buff %:  CoAbility %:  Recovery Potency +2% Recovery Potency +4% Recovery Potency +6% Recovery Potency +8% Recovery Potency +10% Recovery Potency +12% Recovery Potency +14% Recovery Potency +16% Recovery Potency +20% Same Element?:  Check for yes. Raid?: Check for yes. Include Healing Over Time?Check for yes. REGEN%:  DURATION: <input type="number" id="DUR"class='a'> HEAL FREQUENCY: <input type="number" id="FREQ"class='a'> Total Heal: <button onclick="calculate">Calculate