update admin panel

This commit is contained in:
Shadow
2014-03-04 12:44:25 +02:00
parent 77d49433f4
commit 19767cf6a6
14 changed files with 804 additions and 602 deletions
+61
View File
@@ -0,0 +1,61 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename addABTroops.tpl ##
## Developed by: ronix ##
## License: TravianZ Project ##
## Thanks to: Dzoki & itay2277(Add troops) ##
## Copyright: TravianZ (c) 2010-2014. All rights reserved. ##
## ##
#################################################################################
$unarray = array(1=>U1,U2,U3,U4,U5,U6,U7,U8,U9,U10,U11,U12,U13,U14,U15,U16,U17,U18,U19,U20,U21,U22,U23,U24,U25,U26,U27,U28,U29,U30,U31,U32,U33,U34,U35,U36,U37,U38,U39,U40,U41,U42,U43,U44,U45,U46,U47,U48,U49,U50,U99,U0);
if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
$id = $_GET['did'];
if(isset($id))
{
$village = $database->getVillage($id);
$user = $database->getUserArray($village['owner'],1);
$abtech = $database->getABTech($id); // Armory/blacksmith level
$units = $database->getUnit($village['wref']);
$coor = $database->getCoor($village['wref']);
$tribe = $user['tribe'];
if($tribe ==1){ $img = 0;}
if($tribe ==2){ $img = 10;}
if($tribe ==3){ $img = 20;}
if($tribe ==4){ $img = 30;}
if($tribe ==5){ $img = 40;}
if($tribe ==6){ $img = 50;}
include("search2.tpl");
?>
<form action="../GameEngine/Admin/Mods/addABTroops.php" method="POST">
<input type="hidden" name="id" id="id" value="<?php echo $_GET['did']; ?>">
<input type="hidden" name="admid" id="admid" value="<?php echo $_SESSION['id']; ?>">
<table id="member">
<thead>
<tr>
<th colspan="3">Upgrades AB Tech troops</th>
</tr></thead><tbody>
<tr><td align="center">Troop Type</td>
<td align="center">Armour</td>
<td align="center">Blackmith</td>
</tr>
<?php
for($i=1; $i<9; $i++) {
echo '<tr>
<td class="addTroops"><img src="../img/un/u/'.($img+$i).'.gif"></img> '.$unarray[$img+$i].'</td>
<td class="addTroops"><input class="addTroops" name="a'.$i.'" id="a'.$i.'" value="'.$abtech["a".$i].'" maxlength="10"></td>
<td class="addTroops"><input class="addTroops" name="b'.$i.'" id="b'.$i.'" value="'.$abtech["b".$i].'" maxlength="10"></td>
</tr>';
} ?>
</tbody></table>
<br />
<table width="100%">
<tr><td align="left"><a href="../Admin/admin.php?p=village&did=<?php echo $_GET['did'];?>"><< back</a></td>
<td align="right"><input type="image" border="0" src="../img/admin/b/ok1.gif"></td>
</tr>
</table>
</form>
<?php }?>
+30 -275
View File
@@ -4,297 +4,52 @@
## --------------------------------------------------------------------------- ##
## Filename addTroops.tpl ##
## Developed by: Dzoki & Advocatie ##
## License: TravianX Project ##
## Thanks to: Dzoki & itay2277(Edit troops) ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## License: TravianZ Project ##
## Reworks by: ronix ##
## Copyright: TravianZ (c) 2010-2014. All rights reserved. ##
## ##
#################################################################################
include("../GameEngine/Lang/".LANG.".php");
if($_SESSION['access'] < ADMIN) die("Access Denied: You are not Admin!");
$unarray = array(1=>U1,U2,U3,U4,U5,U6,U7,U8,U9,U10,U11,U12,U13,U14,U15,U16,U17,U18,U19,U20,U21,U22,U23,U24,U25,U26,U27,U28,U29,U30,U31,U32,U33,U34,U35,U36,U37,U38,U39,U40,U41,U42,U43,U44,U45,U46,U47,U48,U49,U50,U99,U0);
if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
$id = $_GET['did'];
if(isset($id))
{
$village = $database->getVillage($id);
$user = $database->getUserArray($village['owner'],1);
$units = $database->getUnit($village['wref']);
$coor = $database->getCoor($village['wref']);
$varray = $database->getProfileVillages($village['owner']);
$type = $database->getVillageType($village['wref']);
$fdata = $database->getResourceLevel($village['wref']);
$units = $database->getUnit($village['wref']); ?>
$tribe = $user['tribe'];
if($tribe ==1){ $img = 0;}
if($tribe ==2){ $img = 10;}
if($tribe ==3){ $img = 20;}
if($tribe ==4){ $img = 30;}
if($tribe ==5){ $img = 40;}
if($tribe ==6){ $img = 50;}
include("search2.tpl");
?>
<form action="../GameEngine/Admin/Mods/addTroops.php" method="POST">
<input type="hidden" name="id" id="id" value="<?php echo $id; ?>">
<input type="hidden" name="id" id="id" value="<?php echo $_GET['did']; ?>">
<input type="hidden" name="admid" id="admid" value="<?php echo $_SESSION['id']; ?>">
<table id="member">
<thead>
<tr>
<th colspan="2">Edit troops</th>
<?php if($user['tribe'] == 1){ ?>
</tr></thead><tbody>
<tr>
<td class="addTroops"><img src="../img/un/u/1.gif"></img> <?php echo U1; ?></td>
<td class="addTroops"><input class="addTroops" name="u1" id="u1" value="<?php echo $units['u1']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u1']; ?></b><font></td>
</tr>
<tr>
<td><img src="../img/un/u/2.gif"></img> <?php echo U2; ?></td>
<td><input class="addTroops" name="u2" id="u2" value="<?php echo $units['u2']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u2']; ?></b><font></td>
</tr>
<tr>
<td><img src="../img/un/u/3.gif"></img> <?php echo U3; ?></td>
<td><input class="addTroops" name="u3" id="u3" value="<?php echo $units['u3']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u3']; ?></b><font></td>
</tr>
<tr>
<td><img src="../img/un/u/4.gif"></img> <?php echo U4; ?></td>
<td><input class="addTroops" name="u4" id="u4" value="<?php echo $units['u4']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u4']; ?></b><font></td>
</tr>
<tr>
<td><img src="../img/un/u/5.gif"></img> <?php echo U5; ?></td>
<td><input class="addTroops" name="u5" id="u5" value="<?php echo $units['u5']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u5']; ?></b><font></td>
</tr>
<tr>
<td><img src="../img/un/u/6.gif"></img> <?php echo U6; ?></td>
<td><input class="addTroops" name="u6" id="u6" value="<?php echo $units['u6']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u6']; ?></b><font></td>
</tr>
<tr>
<td><img src="../img/un/u/7.gif"></img> <?php echo U7; ?></td>
<td><input class="addTroops" name="u7" id="u7" value="<?php echo $units['u7']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u7']; ?></b><font></td>
</tr>
<tr>
<td><img src="../img/un/u/8.gif"></img> <?php echo U8; ?></td>
<td><input class="addTroops" name="u8" id="u8" value="<?php echo $units['u8']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u8']; ?></b><font></td>
</tr>
<tr>
<td><img src="../img/un/u/9.gif"></img> <?php echo U9; ?></td>
<td><input class="addTroops" name="u9" id="u9" value="<?php echo $units['u9']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u9']; ?></b><font></td>
</tr>
<tr>
<td><img src="../img/un/u/10.gif"></img> <?php echo U10; ?></td>
<td><input class="addTroops" name="u10" id="u10" value="<?php echo $units['u10']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u10']; ?></b><font></td>
</tr>
<?php }
else if($user['tribe'] == 2){ ?>
</tr></thead><tbody>
<tr>
<td class="addTroops"><img src="../img/un/u/11.gif"></img> <?php echo U11; ?></td>
<td class="addTroops"><input class="addTroops" name="u11" id="u11" value="<?php echo $units['u11']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u11']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/12.gif"></img> <?php echo U12; ?></td>
<td><input class="addTroops" name="u12" id="u12" value="<?php echo $units['u12']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u12']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/13.gif"></img> <?php echo U13; ?></td>
<td><input class="addTroops" name="u13" id="u13" value="<?php echo $units['u13']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u13']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/14.gif"></img> <?php echo U14; ?></td>
<td><input class="addTroops" name="u14" id="u14" value="<?php echo $units['u14']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u14']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/15.gif"></img> <?php echo U15; ?></td>
<td><input class="addTroops" name="u15" id="u15" value="<?php echo $units['u15']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u15']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/16.gif"></img> <?php echo U16; ?></td>
<td><input class="addTroops" name="u16" id="u16" value="<?php echo $units['u16']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u16']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/17.gif"></img> <?php echo U17; ?></td>
<td><input class="addTroops" name="u17" id="u17" value="<?php echo $units['u17']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u17']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/18.gif"></img> <?php echo U18; ?></td>
<td><input class="addTroops" name="u18" id="u18" value="<?php echo $units['u18']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u18']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/19.gif"></img> <?php echo U19; ?></td>
<td><input class="addTroops" name="u19" id="u19" value="<?php echo $units['u19']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u19']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/20.gif"></img> <?php echo U20; ?></td>
<td><input class="addTroops" name="u20" id="u20" value="<?php echo $units['u20']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u20']; ?></td>
</tr>
<?php }
else if($user['tribe'] == 3){ ?>
</tr></thead><tbody>
<tr>
<td class="addTroops"><img src="../img/un/u/21.gif"></img> <?php echo U21; ?></td>
<td class="addTroops"><input class="addTroops" name="u21" id="u21" value="<?php echo $units['u21']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u21']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/22.gif"></img> <?php echo U22; ?></td>
<td><input class="addTroops" name="u22" id="u22" value="<?php echo $units['u22']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u22']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/23.gif"></img> <?php echo U23; ?></td>
<td><input class="addTroops" name="u23" id="u23" value="<?php echo $units['u23']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u23']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/24.gif"></img> <?php echo U24; ?></td>
<td><input class="addTroops" name="u24" id="u24" value="<?php echo $units['u24']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u24']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/25.gif"></img> <?php echo U25; ?></td>
<td><input class="addTroops" name="u25" id="u25" value="<?php echo $units['u25']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u25']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/26.gif"></img> <?php echo U26; ?></td>
<td><input class="addTroops" name="u26" id="u26" value="<?php echo $units['u26']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u26']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/27.gif"></img> <?php echo U27; ?></td>
<td><input class="addTroops" name="u27" id="u27" value="<?php echo $units['u27']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u27']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/28.gif"></img> <?php echo U28; ?></td>
<td><input class="addTroops" name="u28" id="u28" value="<?php echo $units['u28']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u28']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/29.gif"></img> <?php echo U29; ?></td>
<td><input class="addTroops" name="u29" id="u29" value="<?php echo $units['u29']; ?>"" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u29']; ?></td>
</tr>
<tr>
<td><img src="../img/un/u/30.gif"></img> <?php echo U30; ?></td>
<td><input class="addTroops" name="u30" id="u30" value="<?php echo $units['u30']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u30']; ?></td>
</tr>
<?php }
else if($user['tribe'] == 4){ ?>
</tr></thead><tbody>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/31.gif"></img> <?php echo U31; ?></td>
<td class="addTroops"><input class="addTroops" name="u31" id="u31" value="<?php echo $units['u31']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u31']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/32.gif"></img> <?php echo U32; ?></td>
<td><input class="addTroops" name="u32" id="u32" value="<?php echo $units['u32']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u32']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/33.gif"></img> <?php echo U33; ?></td>
<td><input class="addTroops" name="u33" id="u33" value="<?php echo $units['u33']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u33']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/34.gif"></img> <?php echo U34; ?></td>
<td><input class="addTroops" name="u34" id="u34" value="<?php echo $units['u34']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u34']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/35.gif"></img> <?php echo U35; ?></td>
<td><input class="addTroops" name="u35" id="u35" value="<?php echo $units['u35']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u35']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/36.gif"></img> <?php echo U36; ?></td>
<td><input class="addTroops" name="u36" id="u36" value="<?php echo $units['u36']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u36']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/37.gif"></img> <?php echo U37; ?></td>
<td><input class="addTroops" name="u37" id="u37" value="<?php echo $units['u37']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u37']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/38.gif"></img> <?php echo U38; ?></td>
<td><input class="addTroops" name="u38" id="u38" value="<?php echo $units['u38']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u38']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/39.gif"></img> <?php echo U39; ?></td>
<td><input class="addTroops" name="u39" id="u39" value="<?php echo $units['u39']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u39']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/40.gif"></img> <?php echo U40; ?></td>
<td><input class="addTroops" name="u40" id="u40" value="<?php echo $units['u40']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u40']; ?></td>
</tr>
<?php }
else if($user['tribe'] == 5){ ?>
</tr></thead><tbody>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/41.gif"></img> <?php echo U41; ?></td>
<td class="addTroops"><input class="addTroops" name="u41" id="u41" value="<?php echo $units['u41']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u41']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/42.gif"></img> <?php echo U42; ?></td>
<td><input class="addTroops" name="u42" id="u42" value="<?php echo $units['u42']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u42']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/43.gif"></img> <?php echo U43; ?></td>
<td><input class="addTroops" name="u43" id="u43" value="<?php echo $units['u43']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u43']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/44.gif"></img> <?php echo U44; ?></td>
<td><input class="addTroops" name="u44" id="u44" value="<?php echo $units['u44']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u44']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/45.gif"></img> <?php echo U45; ?></td>
<td><input class="addTroops" name="u45" id="u45" value="<?php echo $units['u45']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u45']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/46.gif"></img> <?php echo U46; ?></td>
<td><input class="addTroops" name="u46" id="u46" value="<?php echo $units['u46']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u46']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/47.gif"></img> <?php echo U47; ?></td>
<td><input class="addTroops" name="u47" id="u47" value="<?php echo $units['u47']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u47']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/48.gif"></img> <?php echo U48; ?></td>
<td><input class="addTroops" name="u48" id="u48" value="<?php echo $units['u48']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u48']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/49.gif"></img> <?php echo U49; ?></td>
<td><input class="addTroops" name="u49" id="u49" value="<?php echo $units['u49']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u49']; ?></td>
</tr>
<tr>
<td class="addTroops"><img src="../<?php echo GP_LOCATE; ?>img/u/50.gif"></img> <?php echo U50; ?></td>
<td><input class="addTroops" name="u50" id="u50" value="<?php echo $units['u50']; ?>" maxlength="10">&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b><?php echo $units['u50']; ?></td>
</tr>
<?php } ?>
<?php
for($i=1; $i<11; $i++) {
echo '<tr>
<td class="addTroops"><img src="../img/un/u/'.($img+$i).'.gif"></img> '.$unarray[$img+$i].'</td>
<td class="addTroops"><input class="addTroops" name="u'.($img+$i).'" id="u'.($img+$i).'" value="'.$units["u".($img+$i)].'" maxlength="10">
&nbsp;&nbsp;&nbsp;<font color="#bcbcbc" size="1">Currently: <b>'.$units["u".($img+$i)].'</b><font></td>
</tr>';
} ?>
</tbody></table>
<br />
<div align="right"><input type="image" border="0" src="../img/admin/b/ok1.gif">
<table width="100%">
<tr><td align="left"><a href="../Admin/admin.php?p=village&did=<?php echo $_GET['did'];?>"><< back</a></td>
<td align="right"><input type="image" border="0" src="../img/admin/b/ok1.gif"></td>
</tr>
</table>
</form>
<?php } ?>
<br /><br /><div align="right"><?php if(isset($_GET['d'])) { echo '<font color="Red"><b>Troops edited</font></b>';
<?php
} ?>
+13 -10
View File
@@ -10,16 +10,16 @@
#################################################################################
$id = $_GET['did'];
$village = $database->getVillage($id);
$user = $database->getUserArray($village['owner'],1);
$coor = $database->getCoor($village['wref']);
$varray = $database->getProfileVillages($village['owner']);
$type = $database->getVillageType($village['wref']);
$fdata = $database->getResourceLevel($village['wref']);
if(isset($id))
{
$village = $database->getVillage($id);
$user = $database->getUserArray($village['owner'],1);
$coor = $database->getCoor($village['wref']);
//$varray = $database->getProfileVillages($village['owner']);
//$type = $database->getVillageType($village['wref']);
//$fdata = $database->getResourceLevel($village['wref']);
include("search2.tpl"); ?>
<link href="../<?php echo GP_LOCATE; ?>lang/en/compact.css?f4b7c" rel="stylesheet" type="text/css">
<form action="../GameEngine/Admin/Mods/editResources.php" method="POST">
<input type="hidden" name="admid" id="admid" value="<?php echo $_SESSION['id']; ?>">
<input type="hidden" name="did" id="did" value="<?php echo $_GET['did']; ?>">
@@ -68,9 +68,12 @@ if(isset($id))
</tr>
</tbody>
</table>
<br /><br />
<center><input type="image" src="../img/admin/b/ok1.gif" value="submit"></center>
<br />
<table id="ejas" border="0" width="100%">
<tr><td align="left"><a href="../Admin/admin.php?p=village&did=<?php echo $_GET['did'];?>"><< back</a></td>
<td align="right"><input type="image" border="0" src="../img/admin/b/ok1.gif"></td>
</tr>
</table>
</form><?php
}
else
+1 -1
View File
@@ -20,7 +20,7 @@ if(isset($_POST['show1']) || isset($_POST['show2'])) {
$check1="checked ";
$criteria="WHERE tribe<>5";
}
if ($check1=="" && $check2=="") {$criteria="WHERE tribe NOT IN(1,2,3,4,5)";}
if ($check1=="" && $check2=="") {$criteria="WHERE tribe=0)";}
?>
<link rel="stylesheet" href="../img/admin/map.css" type="text/css" media="all">
<div id="start">
+7 -7
View File
@@ -12,14 +12,14 @@
$id = $_GET['uid'];
if(isset($id))
{
include("../GameEngine/Ranking.php");
include_once("../GameEngine/Ranking.php");
$varmedal = $database->getProfileMedal($id);
$displayarray = $database->getUserArray($id,1);
$user=$displayarray;
$profiel="".$user['desc1']."".md5('skJkev3')."".$user['desc2']."";
$separator="../";
require("../Templates/Profile/medal.php");
$profiel=explode("".md5('skJkev3')."", $profiel);
$displayarray = $database->getUserArray($id,1);
$user=$displayarray;
$profiel="".$user['desc1']."".md5('skJkev3')."".$user['desc2']."";
$separator="../";
require("../Templates/Profile/medal.php");
$profiel=explode("".md5('skJkev3')."", $profiel);
$varray = $database->getProfileVillages($id);
$refreshicon = "<img src=\"data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAAAkAAAAKCAIAAADpZ+PpAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
+6 -24
View File
@@ -4,32 +4,14 @@
## --------------------------------------------------------------------------- ##
## Filename search2.tpl ##
## Developed by: Dzoki ##
## Reworked: aggenkeech ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2012. All rights reserved. ##
## Reworked: aggenkeech && ronix ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2014. All rights reserved. ##
## ##
#################################################################################
$array_tribe=array('-',TRIBE1,TRIBE2,TRIBE3,TRIBE4,TRIBE5,TRIBE6);
$tribename = $array_tribe[$user['tribe']];
if($user['tribe'] == 1)
{
$tribename = "Roman";
}
else if($user['tribe'] == 2)
{
$tribename = "Teutons";
}
else if($user['tribe'] == 3)
{
$tribename = "Gauls";
}
else if($user['tribe'] == 4)
{
$tribename = "Nature";
}
else if($user['tribe'] == 5)
{
$tribename ="Natars";
}
$searchresults = $admin->search_player($user['username']);
$numsimplayers = count($searchresults);
$id = $user['id'];
@@ -55,7 +37,7 @@ foreach($varray as $vil)
</div>
<?php
if($_GET['did'])
if(isset($_GET['did']))
{ ?>
<div id="s_nav4">
<div align="left" style="font-size: 10pt;"><b>Village:</b> <a href="?p=village&did=<?php echo $village['wref'];?>"><?php echo $village['name'];?></a> (did: <?php echo $village['wref'];?>)</div>
+22 -3
View File
@@ -1,3 +1,6 @@
<?php
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
?>
<table id="member">
<thead>
<tr>
@@ -15,6 +18,10 @@
if($tribe ==1){ $img = ""; }
if($tribe ==2){ $img = "1";}
if($tribe ==3){ $img = "2";}
if($tribe ==4){ $img = "3";}
if($tribe ==5){ $img = "4";}
if($tribe ==6){ $img = "5";}
for($i=1; $i<9; $i++)
{
echo '<td><center><img src="../img/un/u/'.$img.''.$i.'.gif"></center></td>';
@@ -32,14 +39,26 @@
##A
for($i=1; $i<9; $i++)
{
echo '<td><center>'.$aupgrades['$i.'].'</center></td>';
if($tribe==5) { $abtech['a'.$i]="<font color=\"grey\">?</font>"; $abtech['b'.$i]="<font color=\"grey\">?</font>";}
echo '<td><center>'.$abtech['a'.$i].'</center></td>';
} ##B
for($i=1; $i<9; $i++)
{
echo '<td><center>'.$bupgrades['$i'].'</center></td>';
echo '<td><center>'.$abtech['b'.$i].'</center></td>';
}
?>
</tr>
</tfoot>
</table>
<a href="#">Edit Troop Upgrades</a>
<?php
if($_SESSION['access'] == ADMIN)
{
if($tribe==5) { echo '<span class="none">Upgrades Troops</span>';}
else { echo '<a href="admin.php?p=addABTroops&did='.$_GET['did'].'">Upgrades Troops</a>';}
}
if(isset($_GET['ab'])){
echo '<div align="right"><font color="Red"><b>AB Tech Troops upgrades</font></b></div>';
}
?>
+3 -1
View File
@@ -271,6 +271,8 @@
if($_SESSION['access'] == ADMIN)
{
echo '<a href="admin.php?p=addTroops&did='.$_GET['did'].'">Edit Troops</a>';
if(isset($_GET['d'])){
echo '<div align="right"><font color="Red"><b>Troops edited</font></b></div>';
}
}
?>
+50 -135
View File
@@ -6,10 +6,11 @@
## Developed by: Dzoki & Advocatie ##
## License: TravianX Project ##
## Thanks to: Dzoki & itay2277(Edit some additions) ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## Fix by: ronix (some additions) ##
## Copyright: TravianZ (c) 2010-2014. All rights reserved. ##
## Improved: aggenkeech ##
#################################################################################
error_reporting(0);
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
$id = $_GET['did'];
if(isset($id))
{
@@ -20,6 +21,7 @@ if(isset($id))
$type = $database->getVillageType($village['wref']);
$fdata = $database->getResourceLevel($village['wref']);
$units = $database->getUnit($village['wref']);
$abtech = $database->getABTech($id); // Armory/blacksmith level
if($type == 1){ $typ = array(3,3,3,9); }
elseif($type == 2){ $typ = array(3,4,5,6); }
elseif($type == 3){ $typ = array(4,4,4,6); }
@@ -32,14 +34,31 @@ if(isset($id))
elseif($type == 10){ $typ = array(3,5,4,6); }
elseif($type == 11){ $typ = array(4,5,3,6); }
elseif($type == 12){ $typ = array(5,4,3,6); }
$refreshicon = "<img src=\"data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAAAkAAAAKCAIAAADpZ+PpAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEQSURBVChTY/gPBkevHfRrtjMsU9bJ05+5eylE
kAGI117fKFsqYzhTNeSQY8xhP8vJJmVrK3eeP8Bw58kt03rTkHnRxdvrnKd4m83SCTtsaLZI1K7H
mGH2xpnHLh+GGPL7/7/S1dVKU2Usd6roTZBh+Pj3M0QCCL78+Fw6v1ooR1myWU2zzpjBb2Ko8xwf
91l+gRNDLzw6f+nepcsPrl14cPXW8wcMWqVaEYdtPdZYubUHww0AMs5cusygU68UtVUr87CPWbdd
9Ly83TcO7Lq2I7ozoXfZTAalCjWZemnlaYo2u0wVFkoJdwoyZDOZNDi//vqRwbkjac+dC827p2h3
Gyh3S6m0a0Qszrnz6RnQWAAxV5tT/VAiNQAAAABJRU5ErkJggg==\">";
$ocounter = array();
$wood = $clay = $iron =$crop = 0;
$q = "SELECT o.*, w.x, w.y FROM ".TB_PREFIX."odata AS o LEFT JOIN ".TB_PREFIX."wdata AS w ON o.wref=w.id WHERE conqured = ".$village['wref'];
$result = $database->query_return($q);
if(count($result) >0)
{
foreach($result as $row)
{
$type = $row['type'];
if($type==1) { $type = '<img src="../img/admin/r/1.gif"> + 25%'; $wood+=1;}
elseif($type==2) { $type = '<img src="../img/admin/r/1.gif"> + 25%'; $wood+=1;}
elseif($type==3) { $type = '<img src="../img/admin/r/1.gif"> + 25%<br /><img src="../img/admin/r/4.gif"> + 25%'; $wood+=1; $crop+=1;}
elseif($type==4) { $type = '<img src="../img/admin/r/2.gif"> + 25%'; $clay+=1;}
elseif($type==5) { $type = '<img src="../img/admin/r/2.gif"> + 25%'; $clay+=1;}
elseif($type==6) { $type = '<img src="../img/admin/r/2.gif"> + 25%<br /><img src="../img/admin/r/4.gif"> + 25%'; $clay+=1;$crop+=1;}
elseif($type==7) { $type = '<img src="../img/admin/r/3.gif"> + 25%'; $iron+=1;}
elseif($type==8) { $type = '<img src="../img/admin/r/3.gif"> + 25%'; $iron+=1;}
elseif($type==9) { $type = '<img src="../img/admin/r/3.gif"> + 25%<br /><img src="../img/admin/r/4.gif"> + 25%'; $iron+=1; $crop+=1;}
elseif($type==10){ $type = '<img src="../img/admin/r/4.gif"> + 25%'; $crop+=1;}
elseif($type==11){ $type = '<img src="../img/admin/r/4.gif"> + 25%'; $crop+=1;}
elseif($type==12){ $type = '<img src="../img/admin/r/4.gif"> + 50%'; $crop+=2;}
}
}
$ocounter = array($wood,$clay,$iron,$crop);
$production=$admin->calculateProduction($id,$user['id'],$user['b1'],$user['b2'],$user['b3'],$user['b4'],$fdata, $ocounter, $village['pop']);
$refreshiconfrm = "data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAAAkAAAAKCAIAAADpZ+PpAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEQSURBVChTY/gPBkevHfRrtjMsU9bJ05+5eylE
@@ -48,6 +67,8 @@ if(isset($id))
91l+gRNDLzw6f+nepcsPrl14cPXW8wcMWqVaEYdtPdZYubUHww0AMs5cusygU68UtVUr87CPWbdd
9Ly83TcO7Lq2I7ozoXfZTAalCjWZemnlaYo2u0wVFkoJdwoyZDOZNDi//vqRwbkjac+dC827p2h3
Gyh3S6m0a0Qszrnz6RnQWAAxV5tT/VAiNQAAAABJRU5ErkJggg==";
$refreshicon = "<img src=\"".$refreshiconfrm."\">";
class Generator
{
public function getMapCheck($wref)
@@ -56,6 +77,7 @@ if(isset($id))
}
};
$generator = new Generator;
if($village and $user)
{
include("search2.tpl"); ?>
@@ -98,7 +120,7 @@ if(isset($id))
</tr>
<tr>
<td>Coordinates:</td>
<td colspan="2"><a href="<?php echo HOMEPAGE ?>/karte.php?d=<?php echo $village['wref']; ?>&c=<?php echo $generator->getMapCheck($village['wref']); ?>" target="blank">(<?php echo $coor['x']; ?>|<?php echo $coor['y']; ?>)</a></td>
<td colspan="2"><a href="<?php echo HOMEPAGE ?>/karte.php?d=<?php echo $village['wref']; ?>&c=<?php echo $generator->getMapCheck($village['wref']); ?>" target="blank">(<?php echo $coor['x']."|".$coor['y']; ?>)</a></td>
</tr>
<tr>
<td>Village ID</td>
@@ -129,22 +151,12 @@ if(isset($id))
<table id="member">
<thead>
<tr>
<th colspan="8">Resources</th>
<th colspan="7">Resources <a href="admin.php?p=editResources&did=<?php echo $_GET['did']; ?>"><img src="../img/admin/edit.gif" title="Edit Resources and Capacity"></a></th>
</tr>
<tr>
<td>Resource</td>
<form action="../GameEngine/Admin/Mods/recalcWH.php" method="POST" accept-charset="UTF-8">
<input type="hidden" name="did" value="<?php echo $_GET['did']; ?>">
<input type="hidden" name="admid" id="admid" value="<?php echo $_SESSION['id']; ?>">
<?php
if($fdata['f'.$i.'t'] == 0)
{
$bu = "-";
}
?>
<td colspan="2">Warehouse <input type="image" src="<?php echo $refreshiconfrm; ?>" value="submit"></form></td>
<td colspan="2">Warehouse</td>
<td>Production</td>
<td><a href="admin.php?p=editResources&did=<?php echo $_GET['did']; ?>"><img src="../img/admin/edit.gif" title="Edit Resources and Capacity"></a></td>
</tr>
</thead>
<tbody>
@@ -152,28 +164,24 @@ if(isset($id))
<td><img class="r1" src="../img/x.gif"> Lumber</td>
<td><center><?php echo floor($village['wood']); ?></center></td>
<td rowspan="3"><center><?php echo $village['maxstore'];?></center></td>
<td><center>???</td>
<td><a href="admin.php?p=editResources&did=<?php echo $_GET['did']; ?>"><img src="../img/admin/edit.gif" title="Edit Resources and Capacity"></a></td>
<td><center><?php echo $production['wood'];?></td>
</tr>
</tr>
<tr>
<td><img class="r2" src="../img/x.gif"> Clay</td>
<td><center><?php echo floor($village['clay']); ?></center></td>
<td><center>???</center></td>
<td><a href="admin.php?p=editResources&did=<?php echo $_GET['did']; ?>"><img src="../img/admin/edit.gif" title="Edit Resources and Capacity"></a></td>
<td><center><?php echo $production['clay'];?></center></td>
</tr>
<tr>
<td><img class="r3" src="../img/x.gif"> Iron</td>
<td><center><?php echo floor($village['iron']); ?></center></td>
<td><center>???</center></td>
<td><a href="admin.php?p=editResources&did=<?php echo $_GET['did']; ?>"><img src="../img/admin/edit.gif" title="Edit Resources and Capacity"></a></td>
<td><center><?php echo $production['iron'];?></center></td>
</tr>
<tr>
<td><img class="r4" src="../img/x.gif"> Crop</td>
<td><center><?php echo floor($village['crop']); ?></center></td>
<td><center><?php echo $village['maxcrop'];?></center></td>
<td><center>???</center></td>
<td><a href="admin.php?p=editResources&did=<?php echo $_GET['did']; ?>"><img src="../img/admin/edit.gif" title="Edit Resources and Capacity"></a></td>
<td><center><?php echo $production['crop'];?></center></td>
</tr>
</tbody>
</table>
@@ -225,7 +233,7 @@ if(isset($id))
<table id="member" cellpadding="1" cellspacing="1" >
<thead>
<tr>
<th colspan="6">Oases</th>
<th colspan="6">Oasis</th>
</tr>
<tr>
<td class="ra"></td>
@@ -237,72 +245,21 @@ if(isset($id))
</thead>
<tbody>
<?php
/*
$oasisarray = $database->getOasis($id);
$oases = count($oasisarray);
for($o=0; $o<$oases; $o++)
if(count($result) >0)
{
$oasiscoor = $database->getCoor($oasisarray['$o']['wref']);
$type = $oasisarray['type'];
if($type==1) { $type = '<img src="../img/admin/r/1.gif"> + 25%'; }
elseif($type==2) { $type = '<img src="../img/admin/r/1.gif"> + 25%'; }
elseif($type==3) { $type = '<img src="../img/admin/r/1.gif"> + 25%<br /><img src="../img/admin/r/4.gif"> + 25%'; }
elseif($type==4) { $type = '<img src="../img/admin/r/2.gif"> + 25%'; }
elseif($type==5) { $type = '<img src="../img/admin/r/2.gif"> + 25%'; }
elseif($type==6) { $type = '<img src="../img/admin/r/2.gif"> + 25%<br /><img src="../img/admin/r/4.gif"> + 25%'; }
elseif($type==7) { $type = '<img src="../img/admin/r/3.gif"> + 25%'; }
elseif($type==8) { $type = '<img src="../img/admin/r/3.gif"> + 25%'; }
elseif($type==9) { $type = '<img src="../img/admin/r/3.gif"> + 25%<br /><img src="../img/admin/r/4.gif"> + 25%'; }
elseif($type==10){ $type = '<img src="../img/admin/r/4.gif"> + 25%'; }
elseif($type==11){ $type = '<img src="../img/admin/r/4.gif"> + 25%'; }
elseif($type==12){ $type = '<img src="../img/admin/r/4.gif"> + 50%'; }
echo '
<tr>
<td></td>
<td>'.$oasisarray['name'].'</td>
<td><a href="../karte.php?d='.$oasisarray['wref'].'&c='.$generator->getMapCheck($oasisarray['wref']).'" target="blank">('.$oasiscoor['x'].'|'.$oasiscoor['y'].')</a></td>
<td>'.$oasisarray['loyalty'].'</td>
<td>'.$type.'</td>
</tr>';
} */
?>
<?php
$oasisarray = $database->getOasis($village['wref']);
$isthere = count($oasisarray);
if($isthere >0)
{
$query = "SELECT * FROM ".TB_PREFIX."odata WHERE conqured = ".$village['wref']."";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result))
foreach($result as $row)
{
$oasiswref = $row['wref'];
$oasisx = mysql_result(mysql_query("SELECT x FROM ".TB_PREFIX."wdata WHERE id = ".$oasiswref.""), 0);
$oasisy = mysql_result(mysql_query("SELECT y FROM ".TB_PREFIX."wdata WHERE id = ".$oasiswref.""), 0);
$type = $row['type'];
if($type==1) { $type = '<img src="../img/admin/r/1.gif"> + 25%'; }
elseif($type==2) { $type = '<img src="../img/admin/r/1.gif"> + 25%'; }
elseif($type==3) { $type = '<img src="../img/admin/r/1.gif"> + 25%<br /><img src="../img/admin/r/4.gif"> + 25%'; }
elseif($type==4) { $type = '<img src="../img/admin/r/2.gif"> + 25%'; }
elseif($type==5) { $type = '<img src="../img/admin/r/2.gif"> + 25%'; }
elseif($type==6) { $type = '<img src="../img/admin/r/2.gif"> + 25%<br /><img src="../img/admin/r/4.gif"> + 25%'; }
elseif($type==7) { $type = '<img src="../img/admin/r/3.gif"> + 25%'; }
elseif($type==8) { $type = '<img src="../img/admin/r/3.gif"> + 25%'; }
elseif($type==9) { $type = '<img src="../img/admin/r/3.gif"> + 25%<br /><img src="../img/admin/r/4.gif"> + 25%'; }
elseif($type==10){ $type = '<img src="../img/admin/r/4.gif"> + 25%'; }
elseif($type==11){ $type = '<img src="../img/admin/r/4.gif"> + 25%'; }
elseif($type==12){ $type = '<img src="../img/admin/r/4.gif"> + 50%'; }
echo "
<tr>
<td><a href=\"?delOas&oid=\" onClick=\"return del('oas',".$varray[$i]['wref'].")\"><img src=\"../img/admin/del.gif\"></a></td>
<td><a href=\"?delOas&oid=\" onClick=\"return del('oas',".$row['wref'].")\"><img src=\"../img/admin/del.gif\"></a></td>
<td class=\"hab\">".$row['name']."</td>
<td class=\"hab\"><a href=\"../karte.php?d=".$row['wref']."&c=".$generator->getMapCheck($row['wref'])."\" target=\"blank\">(".$oasisx."|".$oasisy.")</a></td>
<td class=\"hab\"><a href=\"../karte.php?d=".$row['wref']."&c=".$generator->getMapCheck($row['wref'])."\" target=\"blank\">(".$row['x']."|".$row['y'].")</a></td>
<td class=\"hab\">".$row['loyalty']."%</td>
<td class=\"hab\">$type</td>
</tr>";
} ##<td class=\"hab\">".$row['wood']." <img src=\"../img/admin/r/1.gif\"><br />".$row['clay']." <img src=\"../img/admin/r/2.gif\"><br />".$row['iron']." <img src=\"../img/admin/r/3.gif\"><br />".$row['crop']." <img src=\"../img/admin/r/4.gif\"></td>
}
}
elseif($isthere ==0)
elseif($result ==0)
{
echo '<td colspan="5"><center>This village has no oases</center></td>';
}
@@ -315,7 +272,7 @@ if(isset($id))
?>
<?php
##include('troopUpgrades.tpl');
include('troopUpgrades.tpl');
?>
@@ -332,7 +289,7 @@ if(isset($id))
?>
</div>
<div id="map_details">
<!--<table>
<!-- <table>
<tbody>
<tr>
<td class="ico"><img class="r1" src="../img/x.gif"></td>
@@ -360,7 +317,7 @@ if(isset($id))
</tr>
</tbody>
</table> -->
</div>
</div>
</div></a>
<div id="content" class="village2" style="padding: 0; margin-left: -20px;">
<h1><?php echo $village['name']; ?></h1>
@@ -408,48 +365,6 @@ if(isset($id))
</div>
</div>
<!--<table id="member" cellpadding="1" cellspacing="1" >
<thead>
<tr>
<th colspan="4">Resources</th>
</tr>
<tr>
<td class="hab">Resource</td>
<td class="hab" colspan="2">Warehouse</td>
</tr>
</thead>
<tbody>
<tr>
<td><img src="../img/admin/r/1.gif"> Lumber</td>
<td class="hab"><?php echo floor($village['wood']);?></td>
<td class="hab" rowspan="3"><?php echo $village['maxstore'];?></td>
</tr>
<tr>
<td><img src="../img/admin/r/2.gif"> Clay</td>
<td class="hab"><?php echo floor($village['clay']);?></td>
</tr>
<tr>
<td><img src="../img/admin/r/3.gif"> Iron</td>
<td class="hab"><?php echo floor($village['iron']);?></td>
</tr>
<tr>
<td><img src="../img/admin/r/4.gif"> Crop</td>
<td class="hab"><?php echo floor($village['crop']);?></td>
<td class="hab"><?php echo $village['maxcrop'];?></td>
</tr>
</tbody>
</table>-->
<table id="member" cellpadding="1" cellspacing="1" >
<thead>
<tr>
@@ -500,4 +415,4 @@ else
include("404.tpl");
}
}
?>
?>
+2 -3
View File
@@ -11,11 +11,10 @@
#################################################################################
session_start();
include_once("../GameEngine/Database.php");
include_once ("../GameEngine/Lang/" . LANG . ".php");
include_once("../GameEngine/Admin/database.php");
include_once("../GameEngine/Data/buidata.php");
include_once ("../GameEngine/Lang/" . LANG . ".php");
include_once("../GameEngine/Data/buidata.php");
class timeFormatGenerator
{
+32
View File
@@ -0,0 +1,32 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename addABTroops.php ##
## Developed by: ronix ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2014. All rights reserved. ##
## ##
#################################################################################
if(!isset($_SESSION)) session_start();
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
include_once("../../Database.php");
$id = $_POST['id'];
$village = $database->getVillage($id);
$user = $database->getUserArray($village['owner'],1);
$atech="";
$btech="";
for($i=1; $i<9; $i++) {
$atech.="a".$i."=".$_POST['a'.$i].", ";
$btech.="b".$i."=".$_POST['b'.$i].(($i > 7) ? "" : ", ");
}
$q = "UPDATE ".TB_PREFIX."abdata SET ".$atech.$btech." WHERE vref = $id";
$database->query($q);
$database->query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Changed troop anmount in village <a href=\'admin.php?p=village&did=$id\'>$id</a> ',".time().")");
header("Location: ../../../Admin/admin.php?p=village&did=".$id."&ab");
?>
+20 -88
View File
@@ -1,105 +1,37 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename addTroops.php ##
## Developed by: Dzoki & Advocatie ##
## License: TravianX Project ##
## Thanks to: Dzoki & itay2277 (edit troops) ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## License: TravianZ Project ##
## Reworks by: ronix ##
## Copyright: TravianZ (c) 2010-2014. All rights reserved. ##
## ##
#################################################################################
if (!isset($_SESSION)) session_start();
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
include_once("../../Account.php");
mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS);
mysql_select_db(SQL_DB);
if(!isset($_SESSION)) session_start();
if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
include_once("../../Database.php");
$id = $_POST['id'];
$village = $database->getVillage($id);
$user = $database->getUserArray($village['owner'],1);
$coor = $database->getCoor($village['wref']);
$varray = $database->getProfileVillages($village['owner']);
$type = $database->getVillageType($village['wref']);
$fdata = $database->getResourceLevel($village['wref']);
$units = $database->getUnit($village['wref']);
$units="";
$tribe = $user['tribe'];
if($tribe ==1){ $u = 0;}
if($tribe ==2){ $u = 10;}
if($tribe ==3){ $u = 20;}
if($tribe ==4){ $u = 30;}
if($tribe ==5){ $u = 40;}
if($tribe ==6){ $u = 50;}
$u1 = $_POST['u1'];
$u2 = $_POST['u2'];
$u3 = $_POST['u3'];
$u4 = $_POST['u4'];
$u5 = $_POST['u5'];
$u6 = $_POST['u6'];
$u7 = $_POST['u7'];
$u8 = $_POST['u8'];
$u9 = $_POST['u9'];
$u10 = $_POST['u10'];
////////////////////
$u11 = $_POST['u11'];
$u12 = $_POST['u12'];
$u13 = $_POST['u13'];
$u14 = $_POST['u14'];
$u15 = $_POST['u15'];
$u16 = $_POST['u16'];
$u17 = $_POST['u17'];
$u18 = $_POST['u18'];
$u19 = $_POST['u19'];
$u20 = $_POST['u20'];
////////////////////
$u21 = $_POST['u21'];
$u22 = $_POST['u22'];
$u23 = $_POST['u23'];
$u24 = $_POST['u24'];
$u25 = $_POST['u25'];
$u26 = $_POST['u26'];
$u27 = $_POST['u27'];
$u28 = $_POST['u28'];
$u29 = $_POST['u29'];
$u30 = $_POST['u30'];
////////////////////
$u31 = $_POST['u31'];
$u32 = $_POST['u32'];
$u33 = $_POST['u33'];
$u34 = $_POST['u34'];
$u35 = $_POST['u35'];
$u36 = $_POST['u36'];
$u37 = $_POST['u37'];
$u38 = $_POST['u38'];
$u39 = $_POST['u39'];
$u40 = $_POST['u40'];
////////////////////
$u41 = $_POST['u41'];
$u42 = $_POST['u42'];
$u43 = $_POST['u43'];
$u44 = $_POST['u44'];
$u45 = $_POST['u45'];
$u46 = $_POST['u46'];
$u47 = $_POST['u47'];
$u48 = $_POST['u48'];
$u49 = $_POST['u49'];
$u50 = $_POST['u50'];
if($user['tribe'] == 1){
$q = "UPDATE ".TB_PREFIX."units SET u1 = $u1, u2 = $u2, u3 = $u3, u4 = $u4, u5 = $u5, u6 = $u6, u7 = $u7, u8 = $u8, u9 = $u9, u10 = $u10 WHERE vref = $id";
mysql_query($q);
} else if($user['tribe'] == 2){
$q = "UPDATE ".TB_PREFIX."units SET u11 = '$u11', u12 = '$u12', u13 = '$u13', u14 = '$u14', u15 = '$u15', u16 = '$u16', u17 = '$u17', u18 = '$u18', u19 = '$u19', u20 = '$u20' WHERE vref = $id";
mysql_query($q);
} else if($user['tribe'] == 3){
$q = "UPDATE ".TB_PREFIX."units SET u21 = '$u21', u22 = '$u22', u23 = '$u23', u24 = '$u24', u25 = '$u25', u26 = '$u26', u27 = '$u27', u28 = '$u28', u29 = '$u29', u30 = '$u30' WHERE vref = $id";
mysql_query($q);
} else if($user['tribe'] == 4){
$q = "UPDATE ".TB_PREFIX."units SET u31 = '$u31', u32 = '$u32', u33 = '$u33', u34 = '$u34', u35 = '$u35', u36 = '$u36', u37 = '$u37', u38 = '$u38', u39 = '$u39', u40 = '$u40' WHERE vref = $id";
mysql_query($q);
} else if($user['tribe'] == 5){
$q = "UPDATE ".TB_PREFIX."units SET u41 = '$u41', u42 = '$u42', u43 = '$u43', u44 = '$u44', u45 = '$u45', u46 = '$u46', u47 = '$u47', u48 = '$u48', u49 = '$u49', u50 = '$u50' WHERE vref = $id";
mysql_query($q);
for($i=1; $i<11; $i++) {
$units.="u".($u+$i)."=".$_POST['u'.($u+$i)].(($i < 10) ? ", " : "");
}
$q = "UPDATE ".TB_PREFIX."units SET ".$units." WHERE vref = $id";
$database->query($q);
$database->query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Changed troop anmount in village <a href=\'admin.php?p=village&did=$id\'>$id</a> ',".time().")");
mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Changed troop anmount in village <a href=\'admin.php?p=village&did=$id\'>$id</a> ',".time().")");
header("Location: ../../../Admin/admin.php?p=addTroops&did=".$id."&d");
header("Location: ../../../Admin/admin.php?p=village&did=".$id."&d");
?>
+25 -26
View File
@@ -1,14 +1,13 @@
<?php
############################################################################
## Filename addUsers.php ##
## Created by: KFCSpike ##
## Contributors: KFCSpike ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2014. All rights reserved. ##
## Filename addUsers.php ##
## Created by: KFCSpike ##
## Contributors: KFCSpike ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2014. All rights reserved. ##
############################################################################
if (!isset($_SESSION)) session_start();
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
include_once("../../config.php");
include_once("../../Session.php");
include_once("../../Automation.php");
@@ -50,7 +49,7 @@ else
// Random passwords disallow admin logging in to use the accounts
$password = $generator->generateRandStr(20);
// Leaving the line below but commented out - could be used to
// Leaving the line below but commented out - could be used to
// allow admin to log in to the generated accounts and play them
// Easily guessed by players so should only be used for testing
//$password = $baseName . $i . 'PASS';
@@ -72,7 +71,7 @@ else
$act = "";
// Check username not already registered
if($database->checkExist($userName,0))
if($database->checkExist($userName,0))
{
// Name already used, do nothing except update $skipped
$skipped ++;
@@ -81,24 +80,24 @@ else
{
// Register them and build the village
$uid = $database->register($userName, md5($password), $email, $tribe ,$act);
if($uid)
if($uid)
{
/*
* @TODO
*
* Allow option to create (random) bigger villages,
* upgrade fields, granary, warehouse, wall etc
*
* Allow option to create (random) troops in some villages
*
* Don't directly access the DB, create a $database function
* where required
*/
* @TODO
*
* Allow option to create (random) bigger villages,
* upgrade fields, granary, warehouse, wall etc
*
* Allow option to create (random) troops in some villages
*
* Don't directly access the DB, create a $database function
* where required
*/
// Show the dove in User Profile - will show this even if
// beginners protection is not checked
// Need a $database function for this
// (assuming we don't already have one as creating Natars also updates this way)
// Need a $database function for this
// (assuming we don't already have one as creating Natars also updates this way)
$q = "UPDATE " . TB_PREFIX . "users SET desc2 = '[#0]' WHERE id = $uid";
mysql_query($q) or die(mysql_error());
@@ -109,9 +108,9 @@ else
// also used in editProtection.php so assuming no function
// already exists
$protection = time();
mysql_query("UPDATE ".TB_PREFIX."users SET
protect = '".$protection."'
WHERE id = $uid") or die(mysql_error());
mysql_query("UPDATE ".TB_PREFIX."users SET
protect = '".$protection."'
WHERE id = $uid") or die(mysql_error());
}
$database->updateUserField($uid,"act","",1);
@@ -133,4 +132,4 @@ else
}
header("Location: ../../../Admin/admin.php?p=addUsers&g=OK&bn=$baseName&am=$created&sk=$skipped&bp=$beginnersProtection&tr=$postTribe");
}
?>
?>
+532 -29
View File
@@ -16,12 +16,12 @@
## Source code: http://www.github.com/ZZJHONS/ZravianX ##
## ##
#################################################################################
if($gameinstall == 1){
include("../../GameEngine/config.php");
include("../../GameEngine/Data/buidata.php");
if(isset($gameinstall) && $gameinstall == 1){
include_once("../../GameEngine/config.php");
include_once("../../GameEngine/Data/buidata.php");
}else{
include("../GameEngine/config.php");
include("../GameEngine/Data/buidata.php");
include_once("../GameEngine/Data/unitdata.php");
include_once("../GameEngine/Technology.php");
}
class adm_DB {
var $connection;
@@ -201,6 +201,9 @@ class adm_DB {
for ($i = 0; $i <= count($villages)-1; $i++) {
$this->DelVillage($villages[$i]['wref'], 1);
}
$q = "DELETE FROM ".TB_PREFIX."hero where uid = $uid";
mysql_query($q, $this->connection);
$name = $database->getUserField($uid,"username",0);
mysql_query("Insert into ".TB_PREFIX."admin_log values (0,$ID,'Deleted user <a>$name</a>',".time().")");
$q = "DELETE FROM ".TB_PREFIX."users WHERE `id` = $uid;";
@@ -227,33 +230,85 @@ class adm_DB {
}
function DelVillage($wref, $mode=0){
if($mode==0){
$q = "SELECT * FROM ".TB_PREFIX."vdata WHERE `wref` = $wref and capital = 0";
global $database;
if($mode==0){
$q = "SELECT * FROM ".TB_PREFIX."vdata WHERE `wref` = $wref and capital = 0";
}else{
$q = "SELECT * FROM ".TB_PREFIX."vdata WHERE `wref` = $wref";
$q = "SELECT * FROM ".TB_PREFIX."vdata WHERE `wref` = $wref";
}
$result = mysql_query($q, $this->connection);
if(mysql_num_rows($result) > 0){
mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Deleted village <b>$wref</b>',".time().")");
$q = "DELETE FROM ".TB_PREFIX."vdata WHERE `wref` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."units WHERE `vref` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."bdata WHERE `wid` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."abdata WHERE `wid` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."fdata WHERE `vref` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."training WHERE `vref` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."movement WHERE `from` = $wref";
mysql_query($q, $this->connection);
$q = "UPDATE ".TB_PREFIX."wdata SET `occupied` = '0' WHERE `id` = $wref";
mysql_query($q, $this->connection);
}
}
$result = mysql_query($q, $this->connection);
if(mysql_num_rows($result) > 0){
mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Deleted village <b>$wref</b>',".time().")");
$database->clearExpansionSlot($wref);
$q = "DELETE FROM ".TB_PREFIX."abdata where vref = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."bdata where wid = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."market where vref = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."odata where wref = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."research where vref = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."tdata where vref = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."fdata where vref = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."training where vref = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."units where vref = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."farmlist where wref = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."raidlist where towref = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."movement where `from` = $wref and proc=0";
mysql_query($q, $this->connection);
$getmovement = $database->getMovement(3,$wref,1);
foreach($getmovement as $movedata) {
$time = microtime(true);
$time2 = $time - $movedata['starttime'];
$database->setMovementProc($movedata['moveid']);
$database->addMovement(4,$movedata['to'],$movedata['from'],$movedata['ref'],$time,$time+$time2);
//$database->setMovementProc($movedata['moveid']);
}
//check return enforcement from del village
$this->returnTroops($wref);
$q = "DELETE FROM ".TB_PREFIX."vdata WHERE `wref` = $wref";
mysql_query($q, $this->connection);
if (mysql_affected_rows()>0) {
$q = "UPDATE ".TB_PREFIX."wdata set occupied = 0 where id = $wref";
mysql_query($q, $this->connection);
$getprisoners = $database->getPrisoners($wref);
foreach($getprisoners as $pris) {
$troops = 0;
for($i=1;$i<12;$i++){
$troops += $pris['t'.$i];
}
$database->modifyUnit($pris['wref'],array("99o"),array($troops),array(0));
$database->deletePrisoners($pris['id']);
}
$getprisoners = $database->getPrisoners3($wref);
foreach($getprisoners as $pris) {
$troops = 0;
for($i=1;$i<12;$i++){
$troops += $pris['t'.$i];
}
$database->modifyUnit($pris['wref'],array("99o"),array($troops),array(0));
$database->deletePrisoners($pris['id']);
}
}
}
}
function DelBan($uid,$id){
global $database;
$name = addslashes($database->getUserField($uid,"username",0));
@@ -344,7 +399,455 @@ class adm_DB {
return mysql_query($query, $this->connection);
}
public function getTypeLevel($tid,$vid) {
global $village,$database;
$keyholder = array();
if($vid == 0) {
$resourcearray = $village->resarray;
} else {
$resourcearray = $database->getResourceLevel($vid);
}
foreach(array_keys($resourcearray,$tid) as $key) {
if(strpos($key,'t')) {
$key = preg_replace("/[^0-9]/", '', $key);
array_push($keyholder, $key);
}
}
$element = count($keyholder);
if($element >= 2) {
if($tid <= 4) {
$temparray = array();
for($i=0;$i<=$element-1;$i++) {
array_push($temparray,$resourcearray['f'.$keyholder[$i]]);
}
foreach ($temparray as $key => $val) {
if ($val == max($temparray))
$target = $key;
}
}
else {
$target = 0;
for($i=1;$i<=$element-1;$i++) {
if($resourcearray['f'.$keyholder[$i]] > $resourcearray['f'.$keyholder[$target]]) {
$target = $i;
}
}
}
}
else if($element == 1) {
$target = 0;
}
else {
return 0;
}
if($keyholder[$target] != "") {
return $resourcearray['f'.$keyholder[$target]];
}
else {
return 0;
}
}
public function procDistanceTime($coor,$thiscoor,$ref,$vid) {
global $bid28,$bid14;
$xdistance = ABS($thiscoor['x'] - $coor['x']);
if($xdistance > WORLD_MAX) {
$xdistance = (2 * WORLD_MAX + 1) - $xdistance;
}
$ydistance = ABS($thiscoor['y'] - $coor['y']);
if($ydistance > WORLD_MAX) {
$ydistance = (2 * WORLD_MAX + 1) - $ydistance;
}
$distance = SQRT(POW($xdistance,2)+POW($ydistance,2));
$speed = $ref;
if($this->getTypeLevel(14,$vid) != 0 && $distance >= TS_THRESHOLD) {
$speed = $speed * ($bid14[$this->getTypeLevel(14,$vid)]['attri']/100) ;
}
if($speed!=0){
return round(($distance/$speed) * 3600 / INCREASE_SPEED);
}else{
return round($distance * 3600 / INCREASE_SPEED);
}
}
public function returnTroops($wref) {
global $database;
$getenforce=$database->getEnforceVillage($wref,0);
//if(($enforce['from']==$village->wid) || ($enforce['vref']==$village->wid)){
foreach($getenforce as $enforce) {
$to = $database->getVillage($enforce['from']);
$Gtribe = "";
if ($database->getUserField($to['owner'],'tribe',0) == '2'){ $Gtribe = "1"; }
else if ($database->getUserField($to['owner'],'tribe',0) == '3'){ $Gtribe = "2"; }
else if ($database->getUserField($to['owner'],'tribe',0) == '4'){ $Gtribe = "3"; }
else if ($database->getUserField($to['owner'],'tribe',0) == '5'){ $Gtribe = "4"; }
$start = ($database->getUserField($to['owner'],'tribe',0)-1)*10+1;
$end = ($database->getUserField($to['owner'],'tribe',0)*10);
$from = $database->getVillage($enforce['from']);
$fromcoor = $database->getCoor($enforce['from']);
$tocoor = $database->getCoor($enforce['vref']);
$fromCor = array('x'=>$tocoor['x'], 'y'=>$tocoor['y']);
$toCor = array('x'=>$fromcoor['x'], 'y'=>$fromcoor['y']);
$speeds = array();
//find slowest unit.
for($i=$start;$i<=$end;$i++){
if(intval($enforce['u'.$i]) > 0){
if($unitarray) { reset($unitarray); }
$unitarray = $GLOBALS["u".$i];
$speeds[] = $unitarray['speed'];
//echo print_r(array_keys($speeds))."unitspd\n".$i."trib\n";
} else {
$enforce['u'.$i]='0';
}
}
if( intval($enforce['hero']) > 0){
$q = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".$from['owner']."";
$result = mysql_query($q);
$hero_f=mysql_fetch_array($result);
$hero_unit=$hero_f['unit'];
$speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
} else {
$enforce['hero']='0';
}
$artefact = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($enforce['from'],2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($from['owner'],2,2,0));
if($artefact > 0){
$fastertroops = 3;
}else if($artefact1 > 0){
$fastertroops = 2;
}else if($artefact2 > 0){
$fastertroops = 1.5;
}else{
$fastertroops = 1;
}
$time = round($this->procDistanceTime($fromCor,$toCor,min($speeds),$enforce['from'])/$fastertroops);
$foolartefact2 = $database->getFoolArtefactInfo(2,$enforce['from'],$from['owner']);
if(count($foolartefact2) > 0){
foreach($foolartefact2 as $arte){
if($arte['bad_effect'] == 1){
$time *= $arte['effect2'];
}else{
$time /= $arte['effect2'];
$time = round($time);
}
}
}
$reference = $database->addAttack($enforce['from'],$enforce['u'.$start],$enforce['u'.($start+1)],$enforce['u'.($start+2)],$enforce['u'.($start+3)],$enforce['u'.($start+4)],$enforce['u'.($start+5)],$enforce['u'.($start+6)],$enforce['u'.($start+7)],$enforce['u'.($start+8)],$enforce['u'.($start+9)],$enforce['hero'],2,0,0,0,0);
$database->addMovement(4,$wref,$enforce['from'],$reference,time(),($time+time()));
$database->deleteReinf($enforce['id']);
}
}
public function calculateProduction($wid,$uid,$b1,$b2,$b3,$b4,$fdata,$ocounter,$pop) {
global $technology,$database;
$normalA = $database->getOwnArtefactInfoByType($wid,4);
$largeA = $database->getOwnUniqueArtefactInfo($uid,4,2);
$uniqueA = $database->getOwnUniqueArtefactInfo($uid,4,3);
$upkeep = $this->getUpkeep($this->getAllUnits($wid),0,$wid,$uid);
$production=array();
$production['wood'] = $this->getWoodProd($fdata, $ocounter,$b1);
$production['clay'] = $this->getClayProd($fdata, $ocounter,$b2);
$production['iron'] = $this->getIronProd($fdata, $ocounter,$b3);
if ($uniqueA['size']==3 && $uniqueA['owner']==$uid){
$production['crop'] = $this->getCropProd($fdata, $ocounter,$b4)-$pop-(($upkeep)-round($upkeep*0.50));
}elseif ($normalA['type']==4 && $normalA['size']==1 && $normalA['owner']==$uid){
$production['crop'] = $this->getCropProd($fdata, $ocounter,$b4)-$pop-(($upkeep)-round($upkeep*0.25));
}else if ($largeA['size']==2 && $largeA['owner']==$uid){
$production['crop'] = $this->getCropProd($fdata, $ocounter,$b4)-$pop-(($upkeep)-round($upkeep*0.25));
}else{
$production['crop'] = $this->getCropProd($fdata, $ocounter,$b4)-$pop-$upkeep;
}
return $production;
}
private function getWoodProd($fdata,$ocounter,$b1) {
global $bid1,$bid5;
$basewood = $sawmill = 0;
$woodholder = array();
for($i=1;$i<=38;$i++) {
if($fdata['f'.$i.'t'] == 1) {
array_push($woodholder,'f'.$i);
}
if($fdata['f'.$i.'t'] == 5) {
$sawmill = $fdata['f'.$i];
}
}
for($i=0;$i<=count($woodholder)-1;$i++) { $basewood+= $bid1[$fdata[$woodholder[$i]]]['prod']; }
$wood = $basewood + $basewood * 0.25 * $ocounter[0];
if($sawmill >= 1) {
$wood += $basewood / 100 * $bid5[$sawmill]['attri'];
}
if($b1 > time()) {
$wood *= 1.25;
}
$wood *= SPEED;
return round($wood);
}
private function getClayProd($fdata,$ocounter,$b2) {
global $bid2,$bid6,$session;
$baseclay = $clay = $brick = 0;
$clayholder = array();
for($i=1;$i<=38;$i++) {
if($fdata['f'.$i.'t'] == 2) {
array_push($clayholder,'f'.$i);
}
if($fdata['f'.$i.'t'] == 6) {
$brick = $fdata['f'.$i];
}
}
for($i=0;$i<=count($clayholder)-1;$i++) { $baseclay+= $bid2[$fdata[$clayholder[$i]]]['prod']; }
$clay = $baseclay + $baseclay * 0.25 * $ocounter[1];
if($brick >= 1) {
$clay += $baseclay / 100 * $bid6[$brick]['attri'];
}
if($b2 > time()) {
$clay *= 1.25;
}
$clay *= SPEED;
return round($clay);
}
private function getIronProd($fdata,$ocounter,$b3) {
global $bid3,$bid7;
$baseiron = $foundry = 0;
$ironholder = array();
for($i=1;$i<=38;$i++) {
if($fdata['f'.$i.'t'] == 3) {
array_push($ironholder,'f'.$i);
}
if($fdata['f'.$i.'t'] == 7) {
$foundry = $fdata['f'.$i];
}
}
for($i=0;$i<=count($ironholder)-1;$i++) { $baseiron+= $bid3[$fdata[$ironholder[$i]]]['prod']; }
$iron = $baseiron + $baseiron * 0.25 * $ocounter[2];
if($foundry >= 1) {
$iron += $baseiron / 100 * $bid7[$foundry]['attri'];
}
if($b3 > time()) {
$iron *= 1.25;
}
$iron *= SPEED;
return round($iron);
}
private function getCropProd($fdata,$ocounter,$b4) {
global $bid4,$bid8,$bid9;
$basecrop = $grainmill = $bakery = 0;
$cropholder = array();
for($i=1;$i<=38;$i++) {
if($fdata['f'.$i.'t'] == 4) {
array_push($cropholder,'f'.$i);
}
if($fdata['f'.$i.'t'] == 8) {
$grainmill = $fdata['f'.$i];
}
if($fdata['f'.$i.'t'] == 9) {
$bakery = $fdata['f'.$i];
}
}
for($i=0;$i<=count($cropholder)-1;$i++) { $basecrop+= $bid4[$fdata[$cropholder[$i]]]['prod']; }
$crop = $basecrop + $basecrop * 0.25 * $ocounter[3];
$jcrop=0;
if($grainmill >= 1) $jcrop=$bid8[$grainmill]['attri'];
if($bakery >= 1) $jcrop+=$bid9[$bakery]['attri'];
$crop += $basecrop /100 * $jcrop;
if($b4 > time()) {
$crop *= 1.25;
}
$crop *= SPEED;
return round($crop);
}
function getAllUnits($base,$InVillageOnly=False,$mode=0) {
global $database;
$ownunit = $database->getUnit($base);
$ownunit['u99'] -= $ownunit['u99'];
$ownunit['u99o'] -= $ownunit['u99o'];
$enforcementarray = $database->getEnforceVillage($base,0);
if(count($enforcementarray) > 0) {
foreach($enforcementarray as $enforce) {
for($i=1;$i<=50;$i++) {
$ownunit['u'.$i] += $enforce['u'.$i];
}
$ownunit['hero'] += $enforce['hero'];
}
}
if ($mode==0) {
$enforceoasis=$database->getOasisEnforce($base,0);
if(count($enforceoasis) > 0) {
foreach($enforceoasis as $enforce) {
for($i=1;$i<=50;$i++) {
$ownunit['u'.$i] += $enforce['u'.$i];
}
$ownunit['hero'] += $enforce['hero'];
}
}
//$enforcementarray = $database->getEnforceVillage($base,1);
$enforceoasis1=$database->getOasisEnforce($base,1);
if(count($enforceoasis1) > 0) {
foreach($enforceoasis1 as $enforce) {
for($i=1;$i<=50;$i++) {
$ownunit['u'.$i] += $enforce['u'.$i];
}
$ownunit['hero'] += $enforce['hero'];
}
}
$prisoners = $database->getPrisoners($base,1);
if(!empty($prisoners)) {
foreach($prisoners as $prisoner){
$owner = $database->getVillageField($base,"owner");
$ownertribe = $database->getUserField($owner,"tribe",0);
$start = ($ownertribe-1)*10+1;
$end = ($ownertribe*10);
for($i=$start;$i<=$end;$i++) {
$j = $i-$start+1;
$ownunit['u'.$i] += $prisoner['t'.$j];
}
$ownunit['hero'] += $prisoner['t11'];
}
}
}
if(!$InVillageOnly) {
$movement = $database->getVillageMovement($base);
if(!empty($movement)) {
for($i=1;$i<=50;$i++) {
if (isset($movement['u'.$i])) {
$ownunit['u'.$i] += $movement['u'.$i];
}
}
$ownunit['hero'] += $movement['hero'];
}
}
return $ownunit;
}
public function getUpkeep($array,$type,$vid,$uid,$prisoners=0) {
global $database;
$buildarray = array();
$buildarray = $database->getResourceLevel($vid);
$upkeep = 0;
switch($type) {
case 0:
$start = 1;
$end = 50;
break;
case 1:
$start = 1;
$end = 10;
break;
case 2:
$start = 11;
$end = 20;
break;
case 3:
$start = 21;
$end = 30;
break;
case 4:
$start = 31;
$end = 40;
break;
case 5:
$start = 41;
$end = 50;
break;
}
for($i=$start;$i<=$end;$i++) {
$k = $i-$start+1;
$unit = "u".$i;
$unit2 = "t".$k;
global $$unit;
$dataarray = $$unit;
for($j=19;$j<=38;$j++) {
if($buildarray['f'.$j.'t'] == 41) {
$horsedrinking = $j;
}
}
if($prisoners == 0){
if(isset($horsedrinking)){
if(($i==4 && $buildarray['f'.$horsedrinking] >= 10)
|| ($i==5 && $buildarray['f'.$horsedrinking] >= 15)
|| ($i==6 && $buildarray['f'.$horsedrinking] == 20)) {
$upkeep += ($dataarray['pop']-1) * $array[$unit];
} else {
$upkeep += $dataarray['pop'] * $array[$unit];
}}else{
$upkeep += $dataarray['pop'] * $array[$unit];
}
}else{
if(isset($horsedrinking)){
if(($i==4 && $buildarray['f'.$horsedrinking] >= 10)
|| ($i==5 && $buildarray['f'.$horsedrinking] >= 15)
|| ($i==6 && $buildarray['f'.$horsedrinking] == 20)) {
$upkeep += ($dataarray['pop']-1) * $array[$unit2];
} else {
$upkeep += $dataarray['pop'] * $array[$unit2];
}}else{
$upkeep += $dataarray['pop'] * $array[$unit2];
}
}
}
// $unit = "hero";
// global $$unit;
// $dataarray = $$unit;
if($prisoners == 0){
$upkeep += (isset($array['hero'])? $array['hero'] * 6:0);
}else{
$upkeep += (isset($array['t11'])? $array['t11'] * 6:0);
}
$artefact = count($database->getOwnUniqueArtefactInfo2($uid,4,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($vid,4,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($uid,4,2,0));
if($artefact > 0){
$upkeep /= 2;
$upkeep = round($upkeep);
}else if($artefact1 > 0){
$upkeep /= 2;
$upkeep = round($upkeep);
}else if($artefact2 > 0){
$upkeep /= 4;
$upkeep = round($upkeep);
$upkeep *= 3;
}
$foolartefact = $database->getFoolArtefactInfo(4,$vid,$uid);
if(count($foolartefact) > 0){
foreach($foolartefact as $arte){
if($arte['bad_effect'] == 1){
$upkeep *= $arte['effect2'];
}else{
$upkeep /= $arte['effect2'];
$upkeep = round($upkeep);
}
}
}
return $upkeep;
}
};
$admin = new adm_DB;