| 1 |
<?php |
| 2 |
/** |
| 3 |
* File functions: |
| 4 |
* Clean city and earn money |
| 5 |
* |
| 6 |
* @name : landfill.php |
| 7 |
* @copyright : (C) 2004,2005,2007 Vallheru Team based on Gamers-Fusion ver 2.5 |
| 8 |
* @author : thindil <thindil@users.sourceforge.net> |
| 9 |
* @version : 1.4 |
| 10 |
* @since : 09.03.2007 |
| 11 |
* |
| 12 |
*/ |
| 13 |
|
| 14 |
// |
| 15 |
// |
| 16 |
// This program is free software; you can redistribute it and/or modify |
| 17 |
// it under the terms of the GNU General Public License as published by |
| 18 |
// the Free Software Foundation; either version 2 of the License, or |
| 19 |
// (at your option) any later version. |
| 20 |
// |
| 21 |
// This program is distributed in the hope that it will be useful, |
| 22 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 23 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 24 |
// GNU General Public License for more details. |
| 25 |
// |
| 26 |
// You should have received a copy of the GNU General Public License |
| 27 |
// along with this program; if not, write to the Free Software |
| 28 |
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 29 |
// |
| 30 |
// $Id$ |
| 31 |
|
| 32 |
$title = "Oczyszczanie miasta"; |
| 33 |
require_once("includes/head.php"); |
| 34 |
|
| 35 |
/** |
| 36 |
* Get the localization for game |
| 37 |
*/ |
| 38 |
require_once("languages/".$player -> lang."/landfill.php"); |
| 39 |
|
| 40 |
if ($player -> location != 'Altara' && $player -> location != 'Ardulith') |
| 41 |
{ |
| 42 |
error (ERROR); |
| 43 |
} |
| 44 |
|
| 45 |
if ($player -> hp == 0) |
| 46 |
{ |
| 47 |
error (YOU_DEAD." (<a href=\"city.php\">".BACK."</a>)"); |
| 48 |
} |
| 49 |
|
| 50 |
if (!isset($_GET['action'])) |
| 51 |
{ |
| 52 |
$_GET['action'] = ''; |
| 53 |
$gain = ($player -> level*2 + 25); |
| 54 |
$smarty -> assign(array("Gold" => $gain, |
| 55 |
"Landinfo" => LAND_INFO, |
| 56 |
"Landinfo2" => GOLD_COINS, |
| 57 |
"Awork" => A_WORK, |
| 58 |
"Times" => TIMES)); |
| 59 |
} |
| 60 |
else |
| 61 |
{ |
| 62 |
if (!isset($_POST['amount'])) |
| 63 |
{ |
| 64 |
error(NO_AMOUNT); |
| 65 |
} |
| 66 |
integercheck($_POST['amount']); |
| 67 |
if (!ereg("^[1-9][0-9]*$", $_POST['amount'])) |
| 68 |
{ |
| 69 |
error(ERROR); |
| 70 |
} |
| 71 |
if ($player -> energy < $_POST['amount']) |
| 72 |
{ |
| 73 |
error (NO_ENERGY); |
| 74 |
} |
| 75 |
$gain = (($player -> level*2 + 25) * $_POST['amount']); |
| 76 |
$db -> Execute("UPDATE players SET energy=energy-".$_POST['amount'].", credits=credits+".$gain." WHERE id=".$player -> id); |
| 77 |
$smarty -> assign(array("Gain" => $gain, |
| 78 |
"Amount" => $_POST['amount'], |
| 79 |
"Inwork" => IN_WORK, |
| 80 |
"Inwork2" => IN_WORK2, |
| 81 |
"Goldcoins" => GOLD_COINS, |
| 82 |
"Aback" => A_BACK)); |
| 83 |
} |
| 84 |
|
| 85 |
/** |
| 86 |
* Assign variables to template and display page |
| 87 |
*/ |
| 88 |
$smarty -> assign ("Action", $_GET['action']); |
| 89 |
$smarty -> display ('landfill.tpl'); |
| 90 |
|
| 91 |
require_once("includes/foot.php"); |
| 92 |
?> |