MediaWiki:SlayerPointsCalc.js: Difference between revisions
Jump to navigation
Jump to search
(Created page with "mw.hook('wikipage.content').add(function ($content) { if (document.getElementById("slayerPointsCalc")) return; const container = document.createElement("div"); container.id = "slayerPointsCalc"; container.innerHTML = ` <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 P...") |
No edit summary |
||
| Line 1: | Line 1: | ||
function initSlayerPointsCalculator(container) { | |||
const html = ` | |||
const | |||
<h3>Slayer Points Calculator</h3> | <h3>Slayer Points Calculator</h3> | ||
| Line 26: | Line 21: | ||
`; | `; | ||
container.innerHTML = html; | |||
const tasks = [ | const tasks = [ | ||
| Line 57: | Line 52: | ||
document.getElementById("slayerTable").innerHTML = html; | document.getElementById("slayerTable").innerHTML = html; | ||
} | } | ||
| Line 62: | Line 58: | ||
updateTable(); | updateTable(); | ||
} | |||
} | |||
Revision as of 00:31, 7 March 2026
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();
}