- D20 Studios Wiki

Leaderboard: Difference between revisions

Created page with "<noinclude> This widget fetches the Top 25 leaderboard from the Abalon database. Usage: {{#widget:Leaderboard}} </noinclude> <div id="leaderboard-container">Loading leaderboard...</div> <script> (function() { // URL to your PHP script - UPDATE THIS TO YOUR ACTUAL URL const scriptUrl = 'https://d20studios.com/abalon/services/abalonStatBot.php'; fetch(scriptUrl, { method: 'POST', headers: { 'Content-Type: application/json' }, body: J..."
 
Replaced content with "== Abalon Top 25 == The leaderboard is updated in real-time from the game servers. <div id="abalon-leaderboard">Leaderboard loading...</div>"
Tag: Replaced
Line 1: Line 1:
<noinclude>
== Abalon Top 25 ==
This widget fetches the Top 25 leaderboard from the Abalon database.
The leaderboard is updated in real-time from the game servers.
Usage: {{#widget:Leaderboard}}
</noinclude>


<div id="leaderboard-container">Loading leaderboard...</div>
<div id="abalon-leaderboard">Leaderboard loading...</div>
 
<script>
(function() {
    // URL to your PHP script - UPDATE THIS TO YOUR ACTUAL URL
    const scriptUrl = 'https://d20studios.com/abalon/services/abalonStatBot.php';
 
    fetch(scriptUrl, {
        method: 'POST',
        headers: { 'Content-Type: application/json' },
        body: JSON.stringify({ type: 'leaderboardTop', limit: 25 })
    })
    .then(response => response.json())
    .then(data => {
        if (data.status === 'success') {
            let html = '<table class="wikitable sortable" style="width:100%; text-align:left;">';
            html += '<tr><th>Placement</th><th>Username</th><th>Score</th></tr>';
           
            data.topPlayers.forEach((player, index) => {
                html += `<tr>
                    <td>#${index + 1}</td>
                    <td>${player.playerName}</td>
                    <td>${Number(player.score).toLocaleString()}</td>
                </tr>`;
            });
           
            html += '</table>';
            document.getElementById('leaderboard-container').innerHTML = html;
        } else {
            document.getElementById('leaderboard-container').innerHTML = 'Error loading leaderboard data.';
        }
    })
    .catch(error => {
        console.error('Error:', error);
        document.getElementById('leaderboard-container').innerHTML = 'Failed to connect to the leaderboard service.';
    });
})();
</script>

Revision as of 02:54, 8 February 2026

Abalon Top 25

The leaderboard is updated in real-time from the game servers.

Leaderboard loading...

Chat with us live on DISCORD

Newsletter Signup