Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Dungeon Leadboard: Difference between revisions

From Treeverse
No edit summary
No edit summary
Line 1: Line 1:
/* ===========================
= 🏆 Dungeon Run Leaderboard =
  Dungeon Leaderboard Script
  =========================== */


mw.hook('wikipage.content').add(function ($content) {
{| style="width:100%; margin-bottom:15px;"
|-
| style="vertical-align:middle;" |
'''Global Speed Rankings'''
Fastest verified completion times across all Treeverse dungeons.
| style="text-align:right; vertical-align:middle;" |


    const table = document.getElementById("leaderboardTable");
<span id="leaderboardControls">
    if (!table) return;


    const dungeonFilter = document.getElementById("filterDungeon");
'''Dungeon:''' 
    const typeFilter = document.getElementById("filterType");
<select id="filterDungeon">
    const addBtn = document.getElementById("addRunBtn");
<option value="All">All</option>
<option>Wolf's Den</option>
<option>Wolf's Den II</option>
<option>Wolf's Den III</option>
<option>The Red Nest</option>
<option>For The Eggs</option>
<option>Scarlet Revenge</option>
<option>Scarlet Revenge II</option>
<option>Promised One</option>
<option>Promised One II</option>
<option>Promised One III</option>
<option>Lost and Found</option>
<option>The Hostage</option>
<option>Cactus On Fire</option>
<option>Deep Echoes</option>
<option>Deep Echoes II</option>
<option>Deep Echoes III</option>
</select>


    if (!addBtn) return;
'''Type:''' 
<select id="filterType">
<option value="All">All</option>
<option>Solo</option>
<option>Party</option>
</select>


    function parseTime(t) {
<button id="addRunBtn">➕ Submit Run</button>
        if (!t || !t.includes(":")) return 999999;
        const parts = t.split(":");
        return parseInt(parts[0]) * 60 + parseInt(parts[1]);
    }


    function sortAndRank() {
</span>
        const rows = Array.from(table.rows).slice(1);
|}
----


        rows.sort((a, b) => {
== Submission Rules ==
            return parseTime(a.cells[6].innerText) - parseTime(b.cells[6].innerText);
        });


        rows.forEach(row => table.appendChild(row));
* Screenshot of final completion screen required 
* Solo runs = Party Size automatically 1 
* Party runs may include 1–4 players 
* Time format must be MM:SS 
* No known exploits 


        rows.forEach((row, index) => {
----
            const rankCell = row.cells[0];
            if (index === 0) rankCell.innerHTML = "🥇 1";
            else if (index === 1) rankCell.innerHTML = "🥈 2";
            else if (index === 2) rankCell.innerHTML = "🥉 3";
            else rankCell.innerText = index + 1;
        });
    }


    function filterTable() {
== Leaderboard ==
        const selectedDungeon = dungeonFilter.value;
        const selectedType = typeFilter.value;


        Array.from(table.rows).slice(1).forEach(row => {
{| class="wikitable sortable" id="leaderboardTable" style="width:100%; text-align:center;"
            const dungeon = row.cells[1].innerText.trim();
! Rank
            const type = row.cells[2].innerText.trim();
! Dungeon
 
! Type
            const show =
! Party Size
                (selectedDungeon === "All" || dungeon === selectedDungeon) &&
! Player / Party
                (selectedType === "All" || type === selectedType);
! Weapon (Solo Only)
 
! Time
            row.style.display = show ? "" : "none";
! Date
        });
! Screenshot
    }
|}
 
    if (dungeonFilter) dungeonFilter.addEventListener("change", filterTable);
    if (typeFilter) typeFilter.addEventListener("change", filterTable);
 
    addBtn.addEventListener("click", function () {
        alert("Button working — modal should appear next.");
    });
 
    sortAndRank();
});