Anonymous
×
Create a new article
Write your page title here:
We currently have 496 articles on WIKI - Idle Pixel. Type your article name above or click on one of the titles below and start writing!



WIKI - Idle Pixel
Revision as of 00:06, 20 February 2024 by Dounford (talk | contribs)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
var weaponDPS = {
    WithoutWeapon: [0,1,3,6,10,15,21,25],
    WoodenSword: [0.125,0.25,0.5,0.875,1.375,2,2.75,3.25],
    Stinger: [0.25,0.375,0.625,1,1.5,2.125,2.875,3.375],
    PoisonStinger: [0.333333333,0.458333333,0.708333333,1.083333333,1.583333333,2.208333333,2.958333333,3.458333333],
    IronDagger: [0.333333333,0.5,0.833333333,1.333333333,2,2.833333333,3.833333333,4.5],
    SkeletonSword: [0.625,0.75,1,1.375,1.875,2.5,3.25,3.75],
    Club: [0.666666667,0.75,0.916666667,1.166666667,1.5,1.916666667,2.416666667,2.75],
    SpikedClub: [1,1.083333333,1.25,1.5,1.833333333,2.25,2.75,3.083333333],
    Scythe: [1,1.125,1.375,1.75,2.25,2.875,3.625,4.125],
    StingerDagger: [0.25,0.5625,0.9375,1.5,2.25,3.1875,4.3125,5.0625],
    PoisonStingerDagger: [0.583333333,0.895833333,1.270833333,1.833333333,2.583333333,3.520833333,4.645833333,5.395833333],
    Rapier: [1.5,1.625,1.875,2.25,2.75,3.375,4.125,4.625],
    PoisonRapier: [1.916666667,2.041666667,2.291666667,2.666666667,3.166666667,3.791666667,4.541666667,5.041666667],
    DenseClub: [1.666666667,1.75,1.916666667,2.166666667,2.5,2.916666667,3.416666667,3.75],
    SpikedDenseClub: [2.5,2.583333333,2.75,3,3.333333333,3.75,4.25,4.583333333],
    GoldenRapier: [2,2.166666667,2.5,3,3.666666667,4.5,5.5,6.166666667],
    PoisonGoldenRapier: [2.777777778,2.944444444,3.277777778,3.777777778,4.444444444,5.277777778,6.277777778,6.944444444],
    Ballista: [1.166666667,1.333333333,1.666666667,2.166666667,2.833333333,3.666666667,4.666666667,5.333333333],
    HauntedBow: [0.875,1,1.25,1.625,2.125,2.75,3.5,4]
};

function compareDPS(value,id) {
	document.getElementById('compareDPST0Row'+id).innerText = Math.round(weaponDPS[value][0] * 100) / 100;
	document.getElementById('compareDPST1Row'+id).innerText = Math.round(weaponDPS[value][1] * 100) / 100;
	document.getElementById('compareDPST2Row'+id).innerText = Math.round(weaponDPS[value][2] * 100) / 100;
	document.getElementById('compareDPST3Row'+id).innerText = Math.round(weaponDPS[value][3] * 100) / 100;
	document.getElementById('compareDPST4Row'+id).innerText = Math.round(weaponDPS[value][4] * 100) / 100;
	document.getElementById('compareDPST5Row'+id).innerText = Math.round(weaponDPS[value][5] * 100) / 100;
	document.getElementById('compareDPST6Row'+id).innerText = Math.round(weaponDPS[value][6] * 100) / 100;
	document.getElementById('compareDPST7Row'+id).innerText = Math.round(weaponDPS[value][7] * 100) / 100;
}

function addSelects(id) {
	return '<select onchange="compareDPS(this.value,'+id+')">\
		<option value="" disabled selected>Weapon '+id+'</option>\
		<option value="WithoutWeapon">Without Weapon</option>\
		<option value="WoodenSword">Wooden Sword</option>\
		<option value="Stinger">Stinger</option>\
		<option value="PoisonStinger">Poison Stinger</option>\
		<option value="IronDagger">Iron Dagger</option>\
		<option value="SkeletonSword">Skeleton Sword</option>\
		<option value="Club">Club</option>\
		<option value="SpikedClub">Spiked Club</option>\
		<option value="Scythe">Scythe</option>\
		<option value="StingerDagger">Stinger Dagger</option>\
		<option value="PoisonStingerDagger">Poison Stinger Dagger</option>\
		<option value="Rapier">Rapier</option>\
		<option value="PoisonRapier">Poison Rapier</option>\
		<option value="DenseClub">Dense Club</option>\
		<option value="SpikedDenseClub">Spiked Dense Club</option>\
		<option value="GoldenRapier">Golden Rapier</option>\
		<option value="PoisonGoldenRapier">Poison Golden Rapier</option>\
		<option value="Ballista">Ballista</option>\
		<option value="HauntedBow">Haunted Bow</option>\
	</select>'
}

if (document.getElementById('compareSelect1')) {
	document.getElementById('compareSelect1').innerHTML = addSelects(1)
}
if (document.getElementById('compareSelect2')) {
	document.getElementById('compareSelect2').innerHTML = addSelects(2)
}

mw.loader.load('https://cdn.jsdelivr.net/gh/cferdinandi/tabby@12/dist/js/tabby.polyfills.min.js')


setTimeout(function(){
	if (document.querySelector('[id^="dtab"]')) {
		document.querySelectorAll('[id^="dtab"]').forEach(function (data) {
			var ulContent = data.innerText;
			var tabsArray = ulContent.split(',');
			var ulElement = data;
			ulElement.innerHTML = '';
			tabsArray.forEach(function(tab,index) {
				var liElement = document.createElement('li');
				var aElement = document.createElement('a');
				aElement.href = '#' + tab.toLowerCase().replace(/\s+/g, '');
				aElement.textContent = tab;
				if (index == 0) {aElement.setAttribute("data-tabby-default", "")}
				liElement.appendChild(aElement);
				ulElement.appendChild(liElement);
			});
			var tabs = new Tabby('#'+data.id)
		})
	}
},3000);

if (document.querySelector('[id^="hitChance"]')) {
	document.querySelectorAll('[id^="hitChance"]').forEach(function (data) {
		var opts = data.innerText.split(',');
		var accuracy = opts[0];
		var defense = opts[1];
		var attacker = opts[2]; //1 = player hitchance || 2 = monster hitchance || 0 or '' = either
		if (attacker == 2) {
			data.innerHTML = 'Accuracy: <input type="number" id="accuracy' + attacker + '" value="' + accuracy + '" disabled="disabled" style="display:inline;width:40px" oninput="hitRateCalc(' + attacker + ')">\
			<br>\
			Defense: <input type="number" id="defense' + attacker + '" value="' + defense + '" style="display:inline;width:40px" oninput="hitRateCalc(' + attacker + ')">\
			<br>\
			Hit Chance: <span id="hitRate' + attacker + '">100.00</span>%'
		} else if (attacker == 1) {
			data.innerHTML = 'Accuracy: <input type="number" id="accuracy' + attacker + '" value="' + accuracy + '" style="display:inline;width:40px" oninput="hitRateCalc(' + attacker + ')">\
			<br>\
			Defense: <input type="number" id="defense' + attacker + '" value="' + defense + '" disabled="disabled" style="display:inline;width:40px" oninput="hitRateCalc(' + attacker + ')">\
			<br>\
			Hit Chance: <span id="hitRate' + attacker + '">100.00</span>%'
		} else {
			data.innerHTML = 'Accuracy: <input type="number" id="accuracy' + attacker + '" value="' + accuracy + '" style="display:inline;width:40px" oninput="hitRateCalc(' + attacker + ')">\
			<br>\
			Defense: <input type="number" id="defense' + attacker + '" value="' + defense + '" style="display:inline;width:40px" oninput="hitRateCalc(' + attacker + ')">\
			<br>\
			Hit Chance: <span id="hitRate' + attacker + '">100.00</span>%'
		}
	})
}
function hitRateCalc(attacker) {
	var defense = document.getElementById("defense" + attacker).value;
	var accuracy = document.getElementById("accuracy" + attacker).value;

	var hitChance = 0;

	if (((defense / 2) - accuracy) > 4) {
		hitChance = 1 / (Math.max(1, ((defense / 2) - accuracy)) + 1);
	} else if (((defense / 2) - accuracy) <= 0) {
		hitChance = 1;
	} else {
		hitChance = 1 - (((defense / 2) - accuracy) * 2 / 10);
	}

	var hitChancePercentage = (hitChance * 100).toFixed(2);
	document.getElementById("hitRate" + attacker).innerText = hitChancePercentage;
}