forked from smogon/pokemon-showdown-client
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathladder.php
47 lines (39 loc) · 1.37 KB
/
ladder.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
include 'lib/ntbb-ladder.lib.php';
$serverid = 'showdown';
$formatid = 'OU';
$output = @$_REQUEST['output'];
if (@$_REQUEST['format']) $formatid = $_REQUEST['format'];
if (@$_REQUEST['server']) $serverid = $_REQUEST['server'];
if (!ctype_alnum($formatid)) {
die('denied');
}
$ladder = new NTBBLadder($serverid, $formatid);
?>
<table>
<tr>
<th></th><th>Name</th><th><abbr title="Advanced Conservative Rating Estimate = R − RD×1.4">ACRE</abbr></th><th><abbr title="user's percentage chance of winning a random battle (aka GLIXARE)">GXE</abbr></th><th><abbr title="Glicko2 rating system: rating±deviation (provisional if deviation>50)">Glicko2</abbr></th>
</tr>
<?php
$toplist = $ladder->getTop();
$i=0;
if (!count($toplist))
{
?>
<tr>
<td colspan="8"><em>No one has played any ranked games yet.</em></td>
</tr>
<?php
}
foreach ($toplist as $row)
{
$i++;
?>
<tr<?php if (floatval($row['rprd']) > 100) echo ' style="color:#999"';?>>
<td><?php echo $i; ?></td><td><?php echo htmlspecialchars($row['username']); ?></td><td><strong><?php echo round($row['acre']); ?></strong></td><td><?php echo number_format($row['gxe'],1); ?></td>
<td><?php echo '<em>'.round($row['rpr']).'<small> ± '.round($row['rprd']).'</small></em>'; if (floatval($row['rprd']) > 100) echo ' <small>(provisional)</small>'; ?></td>
</tr>
<?php
}
?>
</table>