Update village.tpl

This commit is contained in:
Shadow
2014-03-04 09:00:14 +02:00
parent 5a9570c65f
commit f343a4a791
+134 -49
View File
@@ -6,11 +6,10 @@
## Developed by: Dzoki & Advocatie ## ## Developed by: Dzoki & Advocatie ##
## License: TravianX Project ## ## License: TravianX Project ##
## Thanks to: Dzoki & itay2277(Edit some additions) ## ## Thanks to: Dzoki & itay2277(Edit some additions) ##
## Fix by: ronix (some additions) ## ## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## Copyright: TravianZ (c) 2010-2014. All rights reserved. ##
## Improved: aggenkeech ## ## Improved: aggenkeech ##
################################################################################# #################################################################################
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!"); error_reporting(0);
$id = $_GET['did']; $id = $_GET['did'];
if(isset($id)) if(isset($id))
{ {
@@ -21,7 +20,6 @@ if(isset($id))
$type = $database->getVillageType($village['wref']); $type = $database->getVillageType($village['wref']);
$fdata = $database->getResourceLevel($village['wref']); $fdata = $database->getResourceLevel($village['wref']);
$units = $database->getUnit($village['wref']); $units = $database->getUnit($village['wref']);
$abtech = $database->getABTech($id); // Armory/blacksmith level
if($type == 1){ $typ = array(3,3,3,9); } if($type == 1){ $typ = array(3,3,3,9); }
elseif($type == 2){ $typ = array(3,4,5,6); } elseif($type == 2){ $typ = array(3,4,5,6); }
elseif($type == 3){ $typ = array(4,4,4,6); } elseif($type == 3){ $typ = array(4,4,4,6); }
@@ -34,31 +32,14 @@ if(isset($id))
elseif($type == 10){ $typ = array(3,5,4,6); } elseif($type == 10){ $typ = array(3,5,4,6); }
elseif($type == 11){ $typ = array(4,5,3,6); } elseif($type == 11){ $typ = array(4,5,3,6); }
elseif($type == 12){ $typ = array(5,4,3,6); } elseif($type == 12){ $typ = array(5,4,3,6); }
$ocounter = array(); $refreshicon = "<img src=\"data:image/png;base64,
$wood = $clay = $iron =$crop = 0; iVBORw0KGgoAAAANSUhEUgAAAAkAAAAKCAIAAADpZ+PpAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
$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']; jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEQSURBVChTY/gPBkevHfRrtjMsU9bJ05+5eylE
$result = $database->query_return($q); kAGI117fKFsqYzhTNeSQY8xhP8vJJmVrK3eeP8Bw58kt03rTkHnRxdvrnKd4m83SCTtsaLZI1K7H
if(count($result) >0) mGH2xpnHLh+GGPL7/7/S1dVKU2Usd6roTZBh+Pj3M0QCCL78+Fw6v1ooR1myWU2zzpjBb2Ko8xwf
{ 91l+gRNDLzw6f+nepcsPrl14cPXW8wcMWqVaEYdtPdZYubUHww0AMs5cusygU68UtVUr87CPWbdd
foreach($result as $row) 9Ly83TcO7Lq2I7ozoXfZTAalCjWZemnlaYo2u0wVFkoJdwoyZDOZNDi//vqRwbkjac+dC827p2h3
{ Gyh3S6m0a0Qszrnz6RnQWAAxV5tT/VAiNQAAAABJRU5ErkJggg==\">";
$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, $refreshiconfrm = "data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAAAkAAAAKCAIAAADpZ+PpAAAAAXNSR0IArs4c6QAAAARnQU1BAACx iVBORw0KGgoAAAANSUhEUgAAAAkAAAAKCAIAAADpZ+PpAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEQSURBVChTY/gPBkevHfRrtjMsU9bJ05+5eylE jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEQSURBVChTY/gPBkevHfRrtjMsU9bJ05+5eylE
@@ -67,8 +48,6 @@ if(isset($id))
91l+gRNDLzw6f+nepcsPrl14cPXW8wcMWqVaEYdtPdZYubUHww0AMs5cusygU68UtVUr87CPWbdd 91l+gRNDLzw6f+nepcsPrl14cPXW8wcMWqVaEYdtPdZYubUHww0AMs5cusygU68UtVUr87CPWbdd
9Ly83TcO7Lq2I7ozoXfZTAalCjWZemnlaYo2u0wVFkoJdwoyZDOZNDi//vqRwbkjac+dC827p2h3 9Ly83TcO7Lq2I7ozoXfZTAalCjWZemnlaYo2u0wVFkoJdwoyZDOZNDi//vqRwbkjac+dC827p2h3
Gyh3S6m0a0Qszrnz6RnQWAAxV5tT/VAiNQAAAABJRU5ErkJggg=="; Gyh3S6m0a0Qszrnz6RnQWAAxV5tT/VAiNQAAAABJRU5ErkJggg==";
$refreshicon = "<img src=\"".$refreshiconfrm."\">";
class Generator class Generator
{ {
public function getMapCheck($wref) public function getMapCheck($wref)
@@ -77,7 +56,6 @@ if(isset($id))
} }
}; };
$generator = new Generator; $generator = new Generator;
if($village and $user) if($village and $user)
{ {
include("search2.tpl"); ?> include("search2.tpl"); ?>
@@ -120,7 +98,7 @@ if(isset($id))
</tr> </tr>
<tr> <tr>
<td>Coordinates:</td> <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']."|".$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']; ?>|<?php echo $coor['y']; ?>)</a></td>
</tr> </tr>
<tr> <tr>
<td>Village ID</td> <td>Village ID</td>
@@ -151,12 +129,22 @@ if(isset($id))
<table id="member"> <table id="member">
<thead> <thead>
<tr> <tr>
<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> <th colspan="8">Resources</th>
</tr> </tr>
<tr> <tr>
<td>Resource</td> <td>Resource</td>
<td colspan="2">Warehouse</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>Production</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> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -164,24 +152,28 @@ if(isset($id))
<td><img class="r1" src="../img/x.gif"> Lumber</td> <td><img class="r1" src="../img/x.gif"> Lumber</td>
<td><center><?php echo floor($village['wood']); ?></center></td> <td><center><?php echo floor($village['wood']); ?></center></td>
<td rowspan="3"><center><?php echo $village['maxstore'];?></center></td> <td rowspan="3"><center><?php echo $village['maxstore'];?></center></td>
<td><center><?php echo $production['wood'];?></td> <td><center><?php echo $village->getProd("wood"); ?></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> </tr>
</tr> </tr>
<tr> <tr>
<td><img class="r2" src="../img/x.gif"> Clay</td> <td><img class="r2" src="../img/x.gif"> Clay</td>
<td><center><?php echo floor($village['clay']); ?></center></td> <td><center><?php echo floor($village['clay']); ?></center></td>
<td><center><?php echo $production['clay'];?></center></td> <td><center><?php echo $village->getProd("clay"); ?></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>
</tr> </tr>
<tr> <tr>
<td><img class="r3" src="../img/x.gif"> Iron</td> <td><img class="r3" src="../img/x.gif"> Iron</td>
<td><center><?php echo floor($village['iron']); ?></center></td> <td><center><?php echo floor($village['iron']); ?></center></td>
<td><center><?php echo $production['iron'];?></center></td> <td><center><?php echo $village->getProd("iron"); ?></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>
</tr> </tr>
<tr> <tr>
<td><img class="r4" src="../img/x.gif"> Crop</td> <td><img class="r4" src="../img/x.gif"> Crop</td>
<td><center><?php echo floor($village['crop']); ?></center></td> <td><center><?php echo floor($village['crop']); ?></center></td>
<td><center><?php echo $village['maxcrop'];?></center></td> <td><center><?php echo $village['maxcrop'];?></center></td>
<td><center><?php echo $production['crop'];?></center></td> <td><center><?php echo $village->getProd("crop"); ?></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>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -233,7 +225,7 @@ if(isset($id))
<table id="member" cellpadding="1" cellspacing="1" > <table id="member" cellpadding="1" cellspacing="1" >
<thead> <thead>
<tr> <tr>
<th colspan="6">Oasis</th> <th colspan="6">Oases</th>
</tr> </tr>
<tr> <tr>
<td class="ra"></td> <td class="ra"></td>
@@ -245,21 +237,72 @@ if(isset($id))
</thead> </thead>
<tbody> <tbody>
<?php <?php
if(count($result) >0) /*
$oasisarray = $database->getOasis($id);
$oases = count($oasisarray);
for($o=0; $o<$oases; $o++)
{ {
foreach($result as $row) $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))
{ {
$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 " echo "
<tr> <tr>
<td><a href=\"?delOas&oid=\" onClick=\"return del('oas',".$row['wref'].")\"><img src=\"../img/admin/del.gif\"></a></td> <td><a href=\"?delOas&oid=\" onClick=\"return del('oas',".$varray[$i]['wref'].")\"><img src=\"../img/admin/del.gif\"></a></td>
<td class=\"hab\">".$row['name']."</td> <td class=\"hab\">".$row['name']."</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\"><a href=\"../karte.php?d=".$row['wref']."&c=".$generator->getMapCheck($row['wref'])."\" target=\"blank\">(".$oasisx."|".$oasisy.")</a></td>
<td class=\"hab\">".$row['loyalty']."%</td> <td class=\"hab\">".$row['loyalty']."%</td>
<td class=\"hab\">$type</td> <td class=\"hab\">$type</td>
</tr>"; </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($result ==0) elseif($isthere ==0)
{ {
echo '<td colspan="5"><center>This village has no oases</center></td>'; echo '<td colspan="5"><center>This village has no oases</center></td>';
} }
@@ -272,7 +315,7 @@ if(isset($id))
?> ?>
<?php <?php
include('troopUpgrades.tpl'); ##include('troopUpgrades.tpl');
?> ?>
@@ -289,7 +332,7 @@ if(isset($id))
?> ?>
</div> </div>
<div id="map_details"> <div id="map_details">
<!-- <table> <!--<table>
<tbody> <tbody>
<tr> <tr>
<td class="ico"><img class="r1" src="../img/x.gif"></td> <td class="ico"><img class="r1" src="../img/x.gif"></td>
@@ -317,7 +360,7 @@ if(isset($id))
</tr> </tr>
</tbody> </tbody>
</table> --> </table> -->
</div> </div>
</div></a> </div></a>
<div id="content" class="village2" style="padding: 0; margin-left: -20px;"> <div id="content" class="village2" style="padding: 0; margin-left: -20px;">
<h1><?php echo $village['name']; ?></h1> <h1><?php echo $village['name']; ?></h1>
@@ -365,6 +408,48 @@ if(isset($id))
</div> </div>
</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" > <table id="member" cellpadding="1" cellspacing="1" >
<thead> <thead>
<tr> <tr>