Refactor + BugFix

1. Fix a bug in Admin Panel that you can edit by yourself your rank, now you cannot edit your rank anymore.

2. Now Alliance Leader can edit his own Position

3. Fix negative value on Demolition Building, now in database at lvl is appear new level not -1

4. Refactor Ajax map, now all is alligned (Ajax folder and Map folder)

5. Fix bug from Palace (when change capital now Automation recount population automaticaly on old capital and new capital)
This commit is contained in:
novgorodschi catalin
2026-05-18 09:18:35 +03:00
parent 2bce101a27
commit 55e6dd60b5
96 changed files with 6176 additions and 6763 deletions
+200 -311
View File
@@ -1,315 +1,204 @@
<?php
if(isset($_GET['refresh'])){
$village->unitarray = $database->getUnit($village->wid, false);
// RALLY POINT
if (isset($_GET['refresh'])) {
$village->unitarray = $database->getUnit($village->wid, false);
}
?><div id="build" class="gid16">
<a href="#" onClick="return Popup(16,4);" class="build_logo"> <img
class="g16" src="img/x.gif" alt="Rally point"
title="<?php echo RALLYPOINT;?>" />
</a>
<h1><?php echo RALLYPOINT;?> <span class="level"><?php echo LEVEL;?> <?php echo $village->resarray['f'.$id]; ?></span>
</h1>
<p class="build_desc"><?php echo RALLYPOINT_DESC;?></p>
<?php
if($village->resarray['f39'] > 0){
include_once ("16_menu.tpl");
$units_type = $database->getMovement(34, $village->wid, 1);
$settlers = $database->getMovement(7, $village->wid, 1);
$oasis_incoming = 0;
$array = $database->getOasis($village->wid);
foreach($array as $conqured) $oasis_incoming += count($database->getMovement(6, $conqured['wref'], 0));
$units_incoming = count($units_type);
$settlers_incoming = count($settlers);
for($i = 0; $i < $units_incoming; $i++){
if($units_type[$i]['attack_type'] == 1 && $units_type[$i]['sort_type'] == 3) $units_incoming -= 1;
}
if($units_incoming > 0 || $settlers_incoming > 0 || $oasis_incoming > 0){
?>
<h4><?php echo INCOMING_TROOPS;?> (<?php echo $units_incoming+$settlers_incoming+$oasis_incoming; ?>)</h4>
<?php
include ("16_incomming.tpl");
}
?>
<h4><?php echo TROOPS_IN_THE_VILLAGE;?></h4>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead>
<tr>
<td class="role"><a
href="karte.php?d=<?php echo $village->wid."&c=".$generator->getMapCheck($village->wid); ?>"><?php echo $village->vname; ?></a></td>
<td
colspan="<?php echo $village->unitarray['hero'] == 0 ? 10 : 11; ?>">
<a href="spieler.php?uid=<?php echo $session->uid; ?>"><?php echo OWN_TROOPS;?></a>
</td>
</tr>
</thead>
<tbody class="units">
<?php
include ("16_troops.tpl");
?>
</tbody>
</table>
<?php
if(count($village->enforcetome) > 0){
foreach($village->enforcetome as $enforce){
$colspan = 10 + $enforce['hero'];
if($enforce['from'] != 0){
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a href=\"karte.php?d=".$enforce['from']."&c=".$generator->getMapCheck($enforce['from'])."\">".$database->getVillageField($enforce['from'], "name")."</a></td>
<td colspan=\"$colspan\">";
if(LANG == "es"){
echo "<a href=\"spieler.php?uid=".$database->getVillageField($enforce['from'], "owner")."\">".TROOPS." ".$database->getUserField($database->getVillageField($enforce['from'], "owner"), "username", 0)." </a>";
}else{
echo "<a href=\"spieler.php?uid=".$database->getVillageField($enforce['from'], "owner")."\">".$database->getUserField($database->getVillageField($enforce['from'], "owner"), "username", 0)." ".TROOPS."</a>";
}
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = $database->getUserField($database->getVillageField($enforce['from'], "owner"), "tribe", 0);
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($enforce['hero'] != 0){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = $start; $i <= ($start + 9); $i++){
if($enforce['u'.$i] == 0){
echo "<td class=\"none\">";
}else{
echo "<td>";
}
echo $enforce['u'.$i]."</td>";
}
if($enforce['hero'] != 0){
echo "<td>".$enforce['hero']."</td>";
}
echo "</tr></tbody>
<tbody class=\"infos\"><tr><th>".UPKEEP."</th><td colspan=\"$colspan\"><div class='sup'>".$technology->getUpkeep($enforce, $tribe)."<img class=\"r4\" src=\"img/x.gif\" title=\"Crop\" alt=\"Crop\" />".PER_HR."</div><div class='sback'><a href='a2b.php?w=".$enforce['id']."'>".SEND_BACK."</a></div></td></tr>";
echo "</tbody></table>";
}else{
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a>".TASKMASTER."</a></td>
<td colspan=\"$colspan\">";
echo "<a> ".VILLAGE_OF_THE_ELDERS_TROOPS."</a>";
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = 4;
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($enforce['hero'] != 0){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = $start; $i <= ($start + 9); $i++){
if($enforce['u'.$i] == 0){
echo "<td class=\"none\">";
}else{
echo "<td>";
}
echo $enforce['u'.$i]."</td>";
}
if($enforce['hero'] != 0){
echo "<td>".$enforce['hero']."</td>";
}
echo "</tr></tbody>
<tbody class=\"infos\"><tr><th>".UPKEEP."</th><td colspan=\"$colspan\"><div class='sup'>".$technology->getUpkeep($enforce, $tribe)."<img class=\"r4\" src=\"img/x.gif\" title=\"Crop\" alt=\"Crop\" />".PER_HR."</div><div class='sback'><span class=none><b>".SEND_BACK."</b></span></div></td></tr>";
echo "</tbody></table>";
}
}
}
$enforcevill = array();
$enforceoasis = array();
$allenforce = $village->enforcetoyou;
$enforcemeoasis = $village->enforceoasis;
if(count($allenforce) > 0){
foreach($allenforce as $enforce){
$conquredvid = $database->getOasisField($enforce['vref'], "conqured");
if($conquredvid > 0){
$enforce['conqured'] = $conquredvid;
array_push($enforceoasis, $enforce);
}else{
array_push($enforcevill, $enforce);
}
}
}
if(count($enforcemeoasis) > 0){
foreach($enforcemeoasis as $enforce){
array_push($enforceoasis, $enforce);
}
}
if(count($enforcevill) > 0){
echo "<h4>".TROOPS_IN_OTHER_VILLAGE."</h4>";
foreach($enforcevill as $enforce){
$colspan = 10 + $enforce['hero'];
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a href=\"karte.php?d=".$enforce['vref']."&c=".$generator->getMapCheck($enforce['from'])."\">".$database->getVillageField($enforce['from'], "name")."</a></td>
<td colspan=\"$colspan\">";
echo "<a href=\"karte.php?d=".$enforce['vref']."&c=".$generator->getMapCheck($enforce['vref'])."\">".REINFORCEMENTFOR." ".$database->getVillageField($enforce['vref'], "name")." </a>";
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = $database->getUserField($database->getVillageField($enforce['from'], "owner"), "tribe", 0);
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($enforce['hero'] != 0){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = $start; $i <= ($start + 9); $i++){
if($enforce['u'.$i] == 0){
echo "<td class=\"none\">";
}else{
echo "<td>";
}
echo $enforce['u'.$i]."</td>";
}
if($enforce['hero'] != 0){
echo "<td>".$enforce['hero']."</td>";
}
echo "</tr></tbody>
<tbody class=\"infos\"><tr><th>".UPKEEP."</th><td colspan=\"$colspan\"><div class='sup'>".$technology->getUpkeep($enforce, $tribe)."<img class=\"r4\" src=\"img/x.gif\" title=\"Crop\" alt=\"Crop\" />".PER_HR."</div><div class='sback'><a href='a2b.php?r=".$enforce['id']."'>".SEND_BACK."</a></div></td></tr>";
echo "</tbody></table>";
}
}
if(count($enforceoasis) > 0){
echo "<h4>".TROOPS_IN_OASIS."</h4>";
foreach($enforceoasis as $enforce){
$colspan = 10 + $enforce['hero'];
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a href=\"karte.php?d=".$enforce['vref']."&c=".$generator->getMapCheck($enforce['vref'])."\">".$database->getVillageField($enforce['conqured'], "name")."</a></td>
<td colspan=\"$colspan\">";
if(LANG == "es"){
echo "<a href=\"spieler.php?uid=".$database->getVillageField($enforce['from'], "owner")."\">".TROOPS." ".$database->getUserField($database->getVillageField($enforce['from'], "owner"), "username", 0)." </a> ".FROM." <a href=\"karte.php?d=".$enforce['from']."&c=".$generator->getMapCheck($enforce['from'])."\">".$database->getVillageField($enforce['from'], "name")."</a>";
}else{
echo "<a href=\"spieler.php?uid=".$database->getVillageField($enforce['from'], "owner")."\">".$database->getUserField($database->getVillageField($enforce['from'], "owner"), "username", 0)." ".TROOPS."</a> ".FROM." <a href=\"karte.php?d=".$enforce['from']."&c=".$generator->getMapCheck($enforce['from'])."\">".$database->getVillageField($enforce['from'], "name")."</a>";
}
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = $database->getUserField($database->getVillageField($enforce['from'], "owner"), "tribe", 0);
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($enforce['hero'] != 0){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = $start; $i <= ($start + 9); $i++){
if($enforce['u'.$i] == 0){
echo "<td class=\"none\">";
}else{
echo "<td>";
}
echo $enforce['u'.$i]."</td>";
}
if($enforce['hero'] != 0){
echo "<td>".$enforce['hero']."</td>";
}
echo "</tr></tbody>
<tbody class=\"infos\"><tr><th>".UPKEEP."</th><td colspan=\"$colspan\"><div class='sup'>".$technology->getUpkeep($enforce, $tribe)."<img class=\"r4\" src=\"img/x.gif\" title=\"Crop\" alt=\"Crop\" />".PER_HR."</div><div class='sback'><a href='a2b.php?r=".$enforce['id']."'>".SEND_BACK."</a></div></td></tr>";
echo "</tbody></table>";
}
}
if(count($database->getPrisoners3($village->wid)) > 0){
echo "<h4>".PRISONERS."</h4>";
foreach($database->getPrisoners3($village->wid) as $prisoners){
$colspan = 10 + $prisoners['t11'];
$colspan2 = $colspan + 1;
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a href=\"karte.php?d=".$prisoners['wref']."&c=".$generator->getMapCheck($prisoners['wref'])."\">".$database->getVillageField($prisoners['wref'], "name")."</a></td>
<td colspan=\"$colspan\">";
echo "<a href=\"karte.php?d=".$prisoners['wref']."&c=".$generator->getMapCheck($prisoners['wref'])."\">".PRISONERSIN." ".$database->getVillageField($prisoners['wref'], "name")."</a>";
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = $database->getUserField($database->getVillageField($prisoners['from'], "owner"), "tribe", 0);
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($prisoners['t11'] != 0){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = 1; $i <= 10; $i++){
if($prisoners['t'.$i] == 0){
echo "<td class=\"none\">";
}else
echo "<td>";
echo $prisoners['t'.$i]."</td>";
}
if($prisoners['t11'] > 0) echo "<td>".$prisoners['t11']."</td>";
echo "</tr></tbody>
<tbody class=\"infos\"><tr><th>".UPKEEP."</th><td colspan=\"$colspan2\"><div class='sup'>".$technology->getUpkeep($prisoners, $tribe, 0, 1)."<img class=\"r4\" src=\"img/x.gif\" title=\"Crop\" alt=\"Crop\" />".PER_HR."</div><div class='sback'><a href='a2b.php?delprisoners=".$prisoners['id']."'>".KILL."</a></div></td></tr>";
echo "</tbody></table>";
}
}
if(count($database->getPrisoners($village->wid)) > 0){
echo "<h4>".PRISONERS."</h4>";
foreach($database->getPrisoners($village->wid) as $prisoners){
$colspan = 10 + $prisoners['t11'];
$colspan2 = $colspan + 1;
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a href=\"karte.php?d=".$prisoners['from']."&c=".$generator->getMapCheck($prisoners['from'])."\">".$database->getVillageField($prisoners['from'], "name")."</a></td>
<td colspan=\"$colspan\">";
echo "<a href=\"karte.php?d=".$prisoners['from']."&c=".$generator->getMapCheck($prisoners['from'])."\">".PRISONERSFROM." ".$database->getVillageField($prisoners['from'], "name")."</a>";
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = $database->getUserField($database->getVillageField($prisoners['from'], "owner"), "tribe", 0);
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($prisoners['t11'] != 0){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = 1; $i <= 10; $i++){
if($prisoners['t'.$i] == 0){
echo "<td class=\"none\">";
}else
echo "<td>";
echo $prisoners['t'.$i]."</td>";
}
if($prisoners['t11'] > 0) echo "<td>".$prisoners['t11']."</td>";
echo "</tr></tbody>
<tbody class=\"infos\"><tr><td colspan=\"$colspan2\"><div class='sup'><img class=\"r6\" src=\"img/x.gif\" title=\"Crop\" alt=\"Crop\" /></div><div class='sback'><a href='a2b.php?delprisoners=".$prisoners['id']."'>".SEND_BACK."</a></div></td></tr>";
echo "</tbody></table>";
}
}
?>
<?php
$units_type = $database->getMovement(3, $village->wid, 0);
$settlers = $database->getMovement(5, $village->wid, 0);
$units_incoming = count($units_type);
for($i = 0; $i < $units_incoming; $i++){
if($units_type[$i]['vref'] != $village->wid) $units_incoming -= 1;
}
$units_incoming += count($settlers);
if($units_incoming >= 1){
echo "<h4>".TROOPS_ON_THEIR_WAY."</h4>";
include ("16_walking.tpl");
}
}
else echo '<b>'.RALLYPOINT_COMMENCE.'</b><br>';
include ("upgrade.tpl");
$hasRally = $village->resarray['f39'] > 0;
?>
</p>
<div id="build" class="gid16">
<a href="#" onclick="return Popup(16,4);" class="build_logo">
<img class="g16" src="img/x.gif" alt="Rally point" title="<?= RALLYPOINT ?>">
</a>
<h1><?= RALLYPOINT ?> <span class="level"><?= LEVEL ?> <?= $village->resarray['f'.$id] ?></span></h1>
<p class="build_desc"><?= RALLYPOINT_DESC ?></p>
<?php if ($hasRally): ?>
<?php include_once '16_menu.tpl'; ?>
<?php
// --- INCOMING ---
$units_type = $database->getMovement(34, $village->wid, 1);
$settlers = $database->getMovement(7, $village->wid, 1);
$oasis_incoming = 0;
foreach ($database->getOasis($village->wid) as $o) {
$oasis_incoming += count($database->getMovement(6, $o['wref'], 0));
}
$units_incoming = count($units_type);
foreach ($units_type as $u) if ($u['attack_type'] == 1 && $u['sort_type'] == 3) $units_incoming--;
$totalIncoming = $units_incoming + count($settlers) + $oasis_incoming;
?>
<?php if ($totalIncoming > 0): ?>
<h4><?= INCOMING_TROOPS ?> (<?= $totalIncoming ?>)</h4>
<?php include '16_incomming.tpl'; ?>
<?php endif; ?>
<!-- OWN TROOPS -->
<h4><?= TROOPS_IN_THE_VILLAGE ?></h4>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead>
<tr>
<td class="role"><a href="karte.php?d=<?= $village->wid ?>&c=<?= $generator->getMapCheck($village->wid) ?>"><?= $village->vname ?></a></td>
<td colspan="<?= $village->unitarray['hero'] ? 11 : 10 ?>"><a href="spieler.php?uid=<?= $session->uid ?>"><?= OWN_TROOPS ?></a></td>
</tr>
</thead>
<tbody class="units"><?php include '16_troops.tpl'; ?></tbody>
</table>
<!-- REINFORCEMENTS TO ME -->
<?php foreach ($village->enforcetome as $e):
$isTaskmaster = $e['from'] == 0;
$colspan = 10 + $e['hero'];
$tribe = $isTaskmaster ? 4 : $database->getUserField($database->getVillageField($e['from'],'owner'),'tribe',0);
$start = ($tribe-1)*10+1;
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead><tr>
<td class="role">
<?php if (!$isTaskmaster): ?>
<a href="karte.php?d=<?= $e['from'] ?>&c=<?= $generator->getMapCheck($e['from']) ?>"><?= $database->getVillageField($e['from'],'name') ?></a>
<?php else: ?><a><?= TASKMASTER ?></a><?php endif; ?>
</td>
<td colspan="<?= $colspan ?>">
<?php if (!$isTaskmaster):
$owner = $database->getVillageField($e['from'],'owner');
$uname = $database->getUserField($owner,'username',0);
?>
<a href="spieler.php?uid=<?= $owner ?>"><?= LANG=='es' ? TROOPS.' '.$uname : $uname.' '.TROOPS ?></a>
<?php else: ?><a><?= VILLAGE_OF_THE_ELDERS_TROOPS ?></a><?php endif; ?>
</td>
</tr></thead>
<tbody class="units">
<tr><th>&nbsp;</th><?php for($i=$start;$i<$start+10;$i++): ?><td><img src="img/x.gif" class="unit u<?= $i ?>" title="<?= $technology->getUnitName($i) ?>"></td><?php endfor; ?><?php if($e['hero']): ?><td><img src="img/x.gif" class="unit uhero" title="Hero"></td><?php endif; ?></tr>
<tr><th><?= TROOPS ?></th><?php for($i=$start;$i<$start+10;$i++): ?><td class="<?= $e['u'.$i]==0?'none':'' ?>"><?= $e['u'.$i] ?></td><?php endfor; ?><?php if($e['hero']): ?><td><?= $e['hero'] ?></td><?php endif; ?></tr>
</tbody>
<tbody class="infos"><tr><th><?= UPKEEP ?></th><td colspan="<?= $colspan ?>">
<div class="sup"><?= $technology->getUpkeep($e,$tribe) ?><img class="r4" src="img/x.gif"> <?= PER_HR ?></div>
<div class="sback"><?php if(!$isTaskmaster): ?><a href="a2b.php?w=<?= $e['id'] ?>"><?= SEND_BACK ?></a><?php else: ?><span class="none"><b><?= SEND_BACK ?></b></span><?php endif; ?></div>
</td></tr></tbody>
</table>
<?php endforeach; ?>
<?php
// split my reinforcements
$enforcevill = []; $enforceoasis = [];
foreach ($village->enforcetoyou as $e) {
$conq = (int)$database->getOasisField($e['vref'],'conqured');
if ($conq>0) { $e['conqured']=$conq; $enforceoasis[]=$e; } else $enforcevill[]=$e;
}
foreach ($village->enforceoasis as $e) $enforceoasis[]=$e;
?>
<!-- TROOPS IN OTHER VILLAGES -->
<?php if ($enforcevill): ?>
<h4><?= TROOPS_IN_OTHER_VILLAGE ?></h4>
<?php foreach ($enforcevill as $e):
$colspan=10+$e['hero']; $tribe=$database->getUserField($database->getVillageField($e['from'],'owner'),'tribe',0); $start=($tribe-1)*10+1;
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead><tr>
<td class="role"><a href="karte.php?d=<?= $e['from'] ?>&c=<?= $generator->getMapCheck($e['from']) ?>"><?= $database->getVillageField($e['from'],'name') ?></a></td>
<td colspan="<?= $colspan ?>"><a href="karte.php?d=<?= $e['vref'] ?>&c=<?= $generator->getMapCheck($e['vref']) ?>"><?= REINFORCEMENTFOR ?> <?= $database->getVillageField($e['vref'],'name') ?></a></td>
</tr></thead>
<tbody class="units">
<tr><th>&nbsp;</th><?php for($i=$start;$i<$start+10;$i++): ?><td><img src="img/x.gif" class="unit u<?= $i ?>" title="<?= $technology->getUnitName($i) ?>"></td><?php endfor; ?><?php if($e['hero']): ?><td><img src="img/x.gif" class="unit uhero"></td><?php endif; ?></tr>
<tr><th><?= TROOPS ?></th><?php for($i=$start;$i<$start+10;$i++): ?><td class="<?= $e['u'.$i]==0?'none':'' ?>"><?= $e['u'.$i] ?></td><?php endfor; ?><?php if($e['hero']): ?><td><?= $e['hero'] ?></td><?php endif; ?></tr>
</tbody>
<tbody class="infos"><tr><th><?= UPKEEP ?></th><td colspan="<?= $colspan ?>">
<div class="sup"><?= $technology->getUpkeep($e,$tribe) ?><img class="r4" src="img/x.gif"> <?= PER_HR ?></div>
<div class="sback"><a href="a2b.php?r=<?= $e['id'] ?>"><?= SEND_BACK ?></a></div>
</td></tr></tbody>
</table>
<?php endforeach; ?>
<?php endif; ?>
<!-- TROOPS IN OASIS -->
<?php if ($enforceoasis): ?>
<h4><?= TROOPS_IN_OASIS ?></h4>
<?php foreach ($enforceoasis as $e):
$colspan=10+$e['hero']; $owner=$database->getVillageField($e['from'],'owner'); $tribe=$database->getUserField($owner,'tribe',0); $start=($tribe-1)*10+1;
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead><tr>
<td class="role"><a href="karte.php?d=<?= $e['vref'] ?>&c=<?= $generator->getMapCheck($e['vref']) ?>"><?= $database->getVillageField($e['conqured'],'name') ?></a></td>
<td colspan="<?= $colspan ?>">
<a href="spieler.php?uid=<?= $owner ?>"><?= $database->getUserField($owner,'username',0) ?> <?= TROOPS ?></a> <?= FROM ?> <a href="karte.php?d=<?= $e['from'] ?>&c=<?= $generator->getMapCheck($e['from']) ?>"><?= $database->getVillageField($e['from'],'name') ?></a>
</td>
</tr></thead>
<tbody class="units">
<tr><th>&nbsp;</th><?php for($i=$start;$i<$start+10;$i++): ?><td><img src="img/x.gif" class="unit u<?= $i ?>"></td><?php endfor; ?><?php if($e['hero']): ?><td><img src="img/x.gif" class="unit uhero"></td><?php endif; ?></tr>
<tr><th><?= TROOPS ?></th><?php for($i=$start;$i<$start+10;$i++): ?><td class="<?= $e['u'.$i]==0?'none':'' ?>"><?= $e['u'.$i] ?></td><?php endfor; ?><?php if($e['hero']): ?><td><?= $e['hero'] ?></td><?php endif; ?></tr>
</tbody>
<tbody class="infos"><tr><th><?= UPKEEP ?></th><td colspan="<?= $colspan ?>">
<div class="sup"><?= $technology->getUpkeep($e,$tribe) ?><img class="r4" src="img/x.gif"> <?= PER_HR ?></div>
<div class="sback"><a href="a2b.php?r=<?= $e['id'] ?>"><?= SEND_BACK ?></a></div>
</td></tr></tbody>
</table>
<?php endforeach; ?>
<?php endif; ?>
<!-- PRISONERS (held by me) -->
<?php $p3 = $database->getPrisoners3($village->wid); if($p3): ?>
<h4><?= PRISONERS ?></h4>
<?php foreach($p3 as $p):
$colspan=10+$p['t11']; $tribe=$database->getUserField($database->getVillageField($p['from'],'owner'),'tribe',0); $start=($tribe-1)*10+1;
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead><tr>
<td class="role"><a href="karte.php?d=<?= $p['wref'] ?>&c=<?= $generator->getMapCheck($p['wref']) ?>"><?= $database->getVillageField($p['wref'],'name') ?></a></td>
<td colspan="<?= $colspan ?>"><a href="karte.php?d=<?= $p['wref'] ?>"><?= PRISONERSIN ?> <?= $database->getVillageField($p['wref'],'name') ?></a></td>
</tr></thead>
<tbody class="units">
<tr><th>&nbsp;</th><?php for($i=$start;$i<$start+10;$i++): ?><td><img src="img/x.gif" class="unit u<?= $i ?>"></td><?php endfor; ?><?php if($p['t11']): ?><td><img src="img/x.gif" class="unit uhero"></td><?php endif; ?></tr>
<tr><th><?= TROOPS ?></th><?php for($i=1;$i<=10;$i++): ?><td class="<?= $p['t'.$i]==0?'none':'' ?>"><?= $p['t'.$i] ?></td><?php endfor; ?><?php if($p['t11']): ?><td><?= $p['t11'] ?></td><?php endif; ?></tr>
</tbody>
<tbody class="infos"><tr><th><?= UPKEEP ?></th><td colspan="<?= $colspan+1 ?>">
<div class="sup"><?= $technology->getUpkeep($p,$tribe,0,1) ?><img class="r4" src="img/x.gif"> <?= PER_HR ?></div>
<div class="sback"><a href="a2b.php?delprisoners=<?= $p['id'] ?>"><?= KILL ?></a></div>
</td></tr></tbody>
</table>
<?php endforeach; ?>
<?php endif; ?>
<!-- PRISONERS (my troops captured) -->
<?php $p = $database->getPrisoners($village->wid); if($p): ?>
<h4><?= PRISONERS ?></h4>
<?php foreach($p as $pr):
$colspan=10+$pr['t11']; $tribe=$database->getUserField($database->getVillageField($pr['from'],'owner'),'tribe',0); $start=($tribe-1)*10+1;
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead><tr>
<td class="role"><a href="karte.php?d=<?= $pr['from'] ?>&c=<?= $generator->getMapCheck($pr['from']) ?>"><?= $database->getVillageField($pr['from'],'name') ?></a></td>
<td colspan="<?= $colspan ?>"><a href="karte.php?d=<?= $pr['from'] ?>"><?= PRISONERSFROM ?> <?= $database->getVillageField($pr['from'],'name') ?></a></td>
</tr></thead>
<tbody class="units">
<tr><th>&nbsp;</th><?php for($i=$start;$i<$start+10;$i++): ?><td><img src="img/x.gif" class="unit u<?= $i ?>"></td><?php endfor; ?><?php if($pr['t11']): ?><td><img src="img/x.gif" class="unit uhero"></td><?php endif; ?></tr>
<tr><th><?= TROOPS ?></th><?php for($i=1;$i<=10;$i++): ?><td class="<?= $pr['t'.$i]==0?'none':'' ?>"><?= $pr['t'.$i] ?></td><?php endfor; ?><?php if($pr['t11']): ?><td><?= $pr['t11'] ?></td><?php endif; ?></tr>
</tbody>
<tbody class="infos"><tr><td colspan="<?= $colspan+1 ?>">
<div class="sup"><img class="r6" src="img/x.gif"></div>
<div class="sback"><a href="a2b.php?delprisoners=<?= $pr['id'] ?>"><?= SEND_BACK ?></a></div>
</td></tr></tbody>
</table>
<?php endforeach; ?>
<?php endif; ?>
<?php
$out = $database->getMovement(3,$village->wid,0);
$set = $database->getMovement(5,$village->wid,0);
$cnt = count($set);
foreach($out as $u) if($u['vref']==$village->wid) $cnt++;
?>
<?php if($cnt>=1): ?>
<h4><?= TROOPS_ON_THEIR_WAY ?></h4>
<?php include '16_walking.tpl'; ?>
<?php endif; ?>
<?php else: ?>
<b><?= RALLYPOINT_COMMENCE ?></b><br>
<?php endif; ?>
<?php include 'upgrade.tpl'; ?>
</div>