Location: PHPKode > projects > PhpBlock > A9.8/modules/dungeon/income.php
<?php
//TODO : retirer width and height pour taille image ne mettre que size
include_once "../../site.class.php";
include_once $PATH_TO_CODE."/modules/dungeon/objectmanager.class.php";
include_once $PATH_TO_CODE."/script/connect.php";
include_once $PATH_TO_CODE."/modules/dungeon/dungeonconstante.class.php";
include_once $PATH_TO_CODE."/script/fonction.php";
include_once $PATH_TO_CODE."/script/player.class.php";
include_once $PATH_TO_CODE."/script/block.class.php";

beginPhpSession($locPlayerId);
global $gloObjectManager;
$locPlayer = $gloObjectManager->getPlayer($locPlayerId);
closeCurrentSession();

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<body>
<table border=1 align="center" width="100%">
<?php
$locCurrentCash=$locPlayer->cash;
$locNextCash=$locCurrentCash;
$locIncome=0;
$locUpkeep=0;
echo "<tr><th>Current cash<td><td>".$locCurrentCash;
echo "<tr><th colspan='3'>Income";
echo "<tr><td>Income for lord<td><td>".DungeonConstante::$INCOME_LORD_BEING;
$locIncome+=DungeonConstante::$INCOME_LORD_BEING;
/*no more gold in this version
$res = DungeonPlayer::selectIncomeForGoldMine($locPlayerId);
while($row  = mysql_fetch_array($res)) {
        $locCash = $row[1]*($locPlayer->playerType==DungeonConstante::$PLAYER_TYPE_HUMAN_KNIGHT?DungeonConstante::$HUMAN_RATIO_GOLD_POWER:DungeonConstante::$DUNGEON_MASTER_RATIO_GOLD_POWER);
        echo "<tr><td>Income for gold mine exploitation<td>".$locPlayer->getIncomeFormulaForGoldMine()."<td>$locCash";
        $locIncome+=$locCash;
}
*/
$res = DungeonPlayer::selectIncomeForUpToNullCash($locPlayerId);
while($row  = mysql_fetch_array($res)) {
        echo "<tr><td>Income to null cash (you have negative cash)<td>".$locPlayer->getIncomeFormulaForUpToNullCash()."<td>".$row[1];
        $locIncome+=$row[1];
}
$res = DungeonPlayer::selectIncomeForPopulation($locPlayerId);
while($row  = mysql_fetch_array($res)) {
        echo "<tr><td>Income for population<td>".$locPlayer->getIncomeFormulaForPopulation()."<td>".$row[1];
        $locIncome+=$row[1];
}
echo "<tr><th>Total income<th colspan='2'>$locIncome";
echo "<tr><th colspan='3'>Upkeep";
/*
$res = DungeonPlayer::selectIncomeForBlock($locPlayerId);
while($row  = mysql_fetch_array($res)) {
        echo "<tr><td>Upkeep for block management<td>".$locPlayer->getIncomeFormulaForBlock()."<td>".$row[1];
        $locUpkeep+=$row[1];
}
*/
$res = DungeonPlayer::selectIncomeTroopUpkeep($locPlayerId);
while($row  = mysql_fetch_array($res)) {
        echo "<tr><td>Troop upkeep<td>".$locPlayer->getIncomeFormulaTroopUpkeep()."<td>".$row[1];
        $locUpkeep+=$row[1];
}
/*
$res = DungeonPlayer::selectIncomeForBarrack($locPlayerId);
while($row  = mysql_fetch_array($res)) {
        echo "<tr><td>Barrack upkeep<td>".$locPlayer->getIncomeFormulaForBarrack()."<td>".$row[1];
        $locUpkeep+=$row[1];
}
*/
$res = DungeonPlayer::selectIncomeForShame($locPlayerId);
while($row  = mysql_fetch_array($res)) {
        echo "<tr><td>Income for shame (you had negative cash)<td>".$locPlayer->getIncomeFormulaForShame()."<td>".$row[1];
        $locUpkeep+=$row[1];
}
echo "<tr><th>Total upkeep<th  colspan='2'>$locUpkeep";

$locNextCash+=$locIncome+$locUpkeep;
$locDiffCash = ($locNextCash-$locCurrentCash);
echo "<tr><th>Next cash<th colspan='2'>$locCurrentCash + ($locIncome".($locDiffCash < 0?"":"+")."$locUpkeep=$locDiffCash) =$locNextCash";
?>
</body>
</html>
Return current item: PhpBlock