MediaWiki:SlayerPointsCalc.js

From Roat Pkz
Revision as of 00:31, 7 March 2026 by Hefner (talk | contribs)
Jump to navigation Jump to search

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.
function initSlayerPointsCalculator(container) {

const html = `
<h3>Slayer Points Calculator</h3>

<label>Boost:</label>
<select id="boostSelect">
<option value="1">None</option>
<option value="1.75">Divine Donator (+75%)</option>
</select>

<table class="wikitable">
<thead>
<tr>
<th>Task Milestone</th>
<th>Slayer Points</th>
</tr>
</thead>
<tbody id="slayerTable"></tbody>
</table>
`;

container.innerHTML = html;

const tasks = [
{ name: "Normal Task", points: 10 },
{ name: "Every 10th Task", points: 50 },
{ name: "Every 50th Task", points: 150 },
{ name: "Every 100th Task", points: 300 },
{ name: "Every 250th Task", points: 500 },
{ name: "Every 1000th Task", points: 1000 }
];

function updateTable() {

const multiplier = parseFloat(document.getElementById("boostSelect").value);

let html = "";

tasks.forEach(task => {

const boosted = Math.floor(task.points * multiplier);

html += `
<tr>
<td>${task.name}</td>
<td>${boosted}</td>
</tr>
`;

});

document.getElementById("slayerTable").innerHTML = html;

}

document.getElementById("boostSelect").addEventListener("change", updateTable);

updateTable();
}