Difference between revisions of "User:DeletedUser010919/Sandbox5"
Jump to navigation
Jump to search
>@DeletedUser41383047 (Created page with "→Any JavaScript here will be loaded for all users on every page load.: /** * Countdown * * @version 2.1 * * @author Pecoes <http://c.wikia.com/wiki/User:Pecoes> * @...") |
>@DeletedUser41383047 |
||
| (401 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | + | <includeonly> | |
| − | + | <script> | |
| − | + | 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 = $("<option></option>"); | ||
| + | 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 = '<input type="radio" value=1 name="Skill Level" oninput="populate_skill_box("Skill1")" checked=1><label for="skillLevelSelect1">Lv.1</label>'; | |
| − | + | document.getElementById("skillLevelSelect2").innerHTML = '<input type="radio" value=2 name="Skill Level" oninput="populate_skill_box("Skill2")"><label for="skillLevelSelect2">Lv.2</label>'; | |
| − | + | if (srcData[skill].title.Hidden == 0) { | |
| − | + | document.getElementById("skillLevelSelect3").innerHTML = '<input type="radio" value=3 name="Skill Level" oninput="populate_skill_box("Skill3")"><label for="skillLevelSelect3">Lv.3</label>'; | |
| + | } 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"; | ||
| + | } | ||
| + | } | ||
| + | </script> | ||
| + | <p>HP: <input type="number" id="HP" class="a"></p> | ||
| + | <p>STR: <input type="number" id="STR" class='a'></p> | ||
| + | <p>Skill: <select id="skillSelect" name="skillSelect" onclick="showSkillValue(); selectSkillLevel(document.getElementById('skillSelect').selectedIndex);"></select> | ||
| + | <form id="skillLevelSelect" style="display:inline;"> | ||
| + | <div id="skillLevelSelect1" style="display:inline;"></div> | ||
| + | <div id="skillLevelSelect2" style="display:inline;"></div> | ||
| + | <div id="skillLevelSelect3" style="display:inline;"></div> | ||
| + | </form> | ||
| + | <p>Potency %: <span id="skillSelectValue"></span></p> | ||
| + | <p>Potency Buff %: <input type="number" id="PTNCYB" class='a'></p> | ||
| + | <p>CoAbility %: <select id="coAbility" name="coAbility"> | ||
| + | <option value="2">Recovery Potency +2%</option> | ||
| + | <option value="4">Recovery Potency +4%</option> | ||
| + | <option value="6">Recovery Potency +6%</option> | ||
| + | <option value="8">Recovery Potency +8%</option> | ||
| + | <option value="10">Recovery Potency +10%</option> | ||
| + | <option value="12">Recovery Potency +12%</option> | ||
| + | <option value="14">Recovery Potency +14%</option> | ||
| + | <option value="16">Recovery Potency +16%</option> | ||
| + | <option value="20">Recovery Potency +20%</option> | ||
| + | </select> | ||
| + | </p> | ||
| + | <p>Same Element?: <input type="checkbox" id="ELEM"> Check for yes.</p> | ||
| + | <p>Raid?: <input type= "checkbox" id="RAID">Check for yes.</p> | ||
| + | <p>Include Healing Over Time?<input type="checkbox" id="checkbox" onclick="display()">Check for yes.</p> | ||
| + | <div id="HOT" style="display:none"> | ||
| + | <p>REGEN%: <input type="number" id="REGEN" class='a'></p> | ||
| + | <p>DURATION: <input type="number" id="DUR"class='a'></p> | ||
| + | <p>HEAL FREQUENCY: <input type="number" id="FREQ"class='a'></p> | ||
| + | </div> | ||
| + | <p>Total Heal:</p> | ||
| + | <p id="total"> </p> | ||
| + | <button onclick="calculate()">Calculate</button> | ||
| + | </includeonly> | ||