<html>
<?php
include_once "../../site.class.php";
include_once $PATH_TO_CODE."/modules/dungeon/dungeonconstante.class.php";
include_once $PATH_TO_CODE."/modules/dungeon/unit/dungeonrealobject.class.php";
include_once $PATH_TO_CODE."/modules/dungeon/dungeonconstante.class.php";
include_once $PATH_TO_CODE."/script/connect.php";
include_once $PATH_TO_CODE."/script/fonction.php";
?>
<head>
<?php echoBaseHead()?>
<link rel="stylesheet" href="css/phpblock.css" type="text/css" />
<link rel="stylesheet" href="modules/dungeon/css/interface.css" type="text/css" />
<script type="text/javascript" src="script/javascript/fonction.js"></script>
<script type="text/javascript" src="script/javascript/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="script/javascript/jqueryinterfaceeyecon.js"></script>
<title>
Dungeon: The underground - Ranking
</title>
</head>
<body class="dungeonstyle">
<table width="100%">
<tr>
<th width="50%">Ranking with unit
<th width="50%">Ranking with population
</tr>
<tr>
<td valign='top'>
<?php
showRequestInTable(array("player", "0x", "color", "unit in battle", "unit count", "average unit level"),
"SELECT player.login, player.color, SUM(IF(object.isBattling>0,1,0)), COUNT(object.objectId) objectCount, AVG(objectInfo.value) averageLevel
FROM object, objectInfo, player
WHERE object.playerId=player.playerId
AND objectInfo.objectId=object.objectId
AND objectInfo.type1=".DungeonRealObject::$REAL_OBJECT_INFO_TYPE1_LEVEL."
AND objectInfo.type2=".DungeonRealObject::$REAL_OBJECT_INFO_TYPE2_CURRENT_POINT."
AND object.isLobotomize<>".RealObject::$UNIT_IS_DEAD."
AND object.visibleState=".RealObject::$REAL_OBJECT_VISIBLE_STATE_VISIBLE_BY_ALL."
GROUP BY object.playerId
ORDER BY objectCount DESC");
?>
<td valign='top'>
<?php
showRequestInTable(array("player", "0x", "color", "population", "average population per city", "block count"),
"SELECT player.login, player.color,
CONVERT(SUM(zone.population)/100, SIGNED INTEGER) sumPopulation,
CONVERT(AVG(zone.population)/100, SIGNED INTEGER),
COUNT(DISTINCT(block.blockId))
FROM player, block, zone
WHERE block.playerId=player.playerId
AND zone.blockId=block.blockId
AND zone.population > 0
GROUP BY block.playerId
ORDER BY sumPopulation DESC");
?>
</tr>
<!--
<tr>
<th width="50%">Ranking with block count<th>
</tr>
<tr>
<td valign='top'>
<?php/*
showRequestInTable(array("player", "0x", "color", "total block"),
"SELECT player.login, player.color, COUNT(block.blockId) countBlock
FROM player, block
WHERE block.playerId=player.playerId
GROUP BY block.playerId
ORDER BY countBlock DESC");
*/
?>
</tr>
-->
</table>
</body>
</html>