General fixes

+A method in Building.php is now static
+Fixed timers in the market
+Fixed a bug that did take in account a wrong tournament square when
calculating the returning time of the troops
This commit is contained in:
iopietro
2018-05-10 20:50:29 +02:00
parent de74f4a0cb
commit 950fc61f8a
10 changed files with 67 additions and 94 deletions
+2 -2
View File
@@ -64,10 +64,10 @@ $to = $database->getOMInfo($units[$y]['to']);}
<tr>
<th><?php echo CATAPULT_TARGET;?></th>
<td style="text-align: center" colspan="5">
<?php echo $units[$y]['ctar1'] == 0 ? "Random" : $building->procResType($units[$y]['ctar1']); ?>
<?php echo $units[$y]['ctar1'] == 0 ? "Random" : Building::procResType($units[$y]['ctar1']); ?>
</td>
<td style="text-align: center" colspan="<?php if($units[$y]['t11'] == 0) {echo"5";}else{echo"6";}?>">
<?php echo $units[$y]['ctar2'] == 99 ? "Random" : ($units[$y]['ctar2'] == 0 ? "-" : $building->procResType($units[$y]['ctar2'])); ?>
<?php echo $units[$y]['ctar2'] == 99 ? "Random" : ($units[$y]['ctar2'] == 0 ? "-" : Building::procResType($units[$y]['ctar2'])); ?>
</td>
</tr>
</tbody>
+3 -7
View File
@@ -238,7 +238,6 @@ if(isset($_POST['ft'])=='check'){
<?php } ?>
<p><?php echo MERCHANT_CARRY;?> <b><?php echo $market->maxcarry; ?></b> <?php echo UNITS_OF_RESOURCE;?> </p>
<?php
$timer = 1;
if(count($market->recieving) > 0) {
echo "<h4>".MERCHANT_COMING.":</h4>";
foreach($market->recieving as $recieve) {
@@ -247,7 +246,7 @@ echo "<h4>".MERCHANT_COMING.":</h4>";
echo "<thead><tr><td><a href=\"spieler.php?uid=$villageowner\">".$database->getUserField($villageowner,"username",0)."</a></td>";
echo "<td><a href=\"karte.php?d=".$recieve['from']."&c=".$generator->getMapCheck($recieve['from'])."\">".TRANSPORT_FROM." ".$database->getVillageField($recieve['from'],"name")."</a></td>";
echo "</tr></thead><tbody><tr><th>".ARRIVAL_IN."</th><td>";
echo "<div class=\"in\"><span id=timer$timer>".$generator->getTimeFormat($recieve['endtime']-time())."</span> h</div>";
echo "<div class=\"in\"><span id=timer".++$session->timer.">".$generator->getTimeFormat($recieve['endtime']-time())."</span> h</div>";
$datetime = $generator->procMtime($recieve['endtime']);
echo "<div class=\"at\">";
if($datetime[0] != "today") {
@@ -257,7 +256,6 @@ echo "<h4>".MERCHANT_COMING.":</h4>";
echo "</td></tr></tbody> <tr class=\"res\"> <th>".RESOURCES."</th> <td colspan=\"2\"><span class=\"f10\">";
echo "<img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"".LUMBER."\" />".$recieve['wood']." | <img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".$recieve['clay']." | <img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".$recieve['iron']." | <img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".$recieve['crop']."</td></tr></tbody>";
echo "</table>";
$timer +=1;
}
}
if(count($market->sending) > 0) {
@@ -269,7 +267,7 @@ if(count($market->sending) > 0) {
echo "<thead><tr> <td><a href=\"spieler.php?uid=$villageowner\">$ownername</a></td>";
echo "<td><a href=\"karte.php?d=".$send['to']."&c=".$generator->getMapCheck($send['to'])."\">".TRANSPORT_TO." ".$database->getVillageField($send['to'],"name")."</a></td>";
echo "</tr></thead> <tbody><tr> <th>".ARRIVAL_IN."</th> <td>";
echo "<div class=\"in\"><span id=timer".$timer.">".$generator->getTimeFormat($send['endtime']-time())."</span> h</div>";
echo "<div class=\"in\"><span id=timer".++$session->timer.">".$generator->getTimeFormat($send['endtime']-time())."</span> h</div>";
$datetime = $generator->procMtime($send['endtime']);
echo "<div class=\"at\">";
if($datetime[0] != "today") {
@@ -279,7 +277,6 @@ if(count($market->sending) > 0) {
echo "</td> </tr> <tr class=\"res\"> <th>".RESOURCES."</th><td>";
echo "<img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"".LUMBER."\" />".$send['wood']." | <img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".$send['clay']." | <img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".$send['iron']." | <img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".$send['crop']."</td></tr></tbody>";
echo "</table>";
$timer += 1;
}
}
if(count($market->return) > 0) {
@@ -291,7 +288,7 @@ if(count($market->return) > 0) {
echo "<thead><tr> <td><a href=\"spieler.php?uid=$villageowner\">$ownername</a></td>";
echo "<td><a href=\"karte.php?d=".$return['from']."&c=".$generator->getMapCheck($return['from'])."\">".RETURNFROM." ".$database->getVillageField($return['from'],"name")."</a></td>";
echo "</tr></thead> <tbody><tr> <th>".ARRIVAL_IN."</th> <td>";
echo "<div class=\"in\"><span id=timer".$timer.">".$generator->getTimeFormat($return['endtime']-time())."</span> h</div>";
echo "<div class=\"in\"><span id=timer".++$session->timer.">".$generator->getTimeFormat($return['endtime']-time())."</span> h</div>";
$datetime = $generator->procMtime($return['endtime']);
echo "<div class=\"at\">";
if($datetime[0] != "today") {
@@ -300,7 +297,6 @@ if(count($market->return) > 0) {
echo "".AT." ".$datetime[1]."</div>";
echo "</td> </tr>";
echo "</tbody></table>";
$timer += 1;
}
}
include("upgrade.tpl");
+2 -2
View File
@@ -35,7 +35,7 @@ $building->loadBuilding();
if($jobs['master'] == 0){
echo "<tr><td class=\"ico\"><a href=\"?d=".$jobs['id']."&a=0&c=$session->checker\">";
echo "<img src=\"img/x.gif\" class=\"del\" title=\"cancel\" alt=\"cancel\" /></a></td><td>";
echo $building->procResType($jobs['type'])." (Level ".$jobs['level'].")";
echo Building::procResType($jobs['type'])." (Level ".$jobs['level'].")";
if($jobs['loopcon'] == 0) { $BuildingList[] = $jobs['field']; }
if($jobs['loopcon'] == 1) {
echo " (waiting loop)";
@@ -47,7 +47,7 @@ $building->loadBuilding();
}else{
echo "<tr><td class=\"ico\"><a href=\"?d=".$jobs['id']."&a=0&c=$session->checker\">";
echo "<img src=\"img/x.gif\" class=\"del\" title=\"cancel\" alt=\"cancel\" /></a></td><td>";
echo $building->procResType($jobs['type'])."<span class=\"none\"> (Level ".$jobs['level'].")</span>";
echo Building::procResType($jobs['type'])."<span class=\"none\"> (Level ".$jobs['level'].")</span>";
}
}
?>
+7 -7
View File
@@ -12,10 +12,10 @@
<map name="map1" id="map1">
<?php
if($building->walling()) {
$wtitle = $building->procResType($building->walling())." Level ".$village->resarray['f40'];
$wtitle = Building::procResType($building->walling())." Level ".$village->resarray['f40'];
}
else {
$wtitle = ($village->resarray['f40'] == 0)? "Outer building site" : $building->procResType($village->resarray['f40t'],0)." Level ".$village->resarray['f40'];
$wtitle = ($village->resarray['f40'] == 0)? "Outer building site" : Building::procResType($village->resarray['f40t'],0)." Level ".$village->resarray['f40'];
}
?>
<area href="build.php?id=40" title="<?php echo $wtitle; ?>" coords="325,225,180" shape="circle" alt="" />
@@ -29,14 +29,14 @@ for($t=19;$t<=39;$t++) {
if ($village->natar==1 && ( $t== 25 || $t == 26 || $t == 29 || $t == 30 || $t == 33 )) {
if ($t==33) {
if($village->resarray['f99'] != 0) {
$title = $building->procResType(40). " Level ".$village->resarray['f99'];
}else $title = $building->procResType(40);
$title = Building::procResType(40). " Level ".$village->resarray['f99'];
}else $title = Building::procResType(40);
echo "<area href=\"build.php?id=99\" title=\"$title\" coords=\"190,170,80\" shape=\"circle\"/>";
}
} else {
if($village->resarray['f'.$t.'t'] != 0) {
$title = $building->procResType($village->resarray['f'.$t.'t']). " Level ".$village->resarray['f'.$t];
$title = Building::procResType($village->resarray['f'.$t.'t']). " Level ".$village->resarray['f'.$t];
}else{
$title = "Building site";
if(($t == 39) && ($village->resarray['f'.$t] == 0)) {
@@ -72,13 +72,13 @@ for ($i=1;$i<=20;$i++) {
$text = "Building site";
$img = "iso";
if($village->resarray['f'.($i+18).'t'] != 0) {
$text = $building->procResType($village->resarray['f'.($i+18).'t'])." Level ".$village->resarray['f'.($i+18)];
$text = Building::procResType($village->resarray['f'.($i+18).'t'])." Level ".$village->resarray['f'.($i+18)];
$img = "g".$village->resarray['f'.($i+18).'t'];
}
foreach($building->buildArray as $job) {
if($job['field'] == ($i+18)) {
$img = 'g'.$job['type'].'b';
$text = $building->procResType($job['type'])." Level ".$village->resarray['f'.$job['field']];
$text = Building::procResType($job['type'])." Level ".$village->resarray['f'.$job['field']];
}
}
echo "<img src=\"img/x.gif\" class=\"building d$i $img\" alt=\"$text\" />";
+2 -4
View File
@@ -19,9 +19,7 @@
$totalmerchants = $building->getTypeLevel(17,$vid);
$availmerchants = $totalmerchants - $database->totalMerchantUsed($vid);
$incoming_attacks = $database->getMovement(3,$vid,1);
$bui = '';
$tro = '';
$att = '';
$bui = $tro = $att = '';
if (count($incoming_attacks) > 0) {
$inc_atts = count($incoming_attacks);
@@ -35,7 +33,7 @@
}
}
foreach($jobs as $b){
$bui .= '<a href="build.php?newdid='.$vid.'&id='.$b['field'].'"><img class="bau" src="img/x.gif" title="'.$building->procResType($b['type']).'" alt="'.$building->procResType($b['type']).'"></a>';
$bui .= '<a href="build.php?newdid='.$vid.'&id='.$b['field'].'"><img class="bau" src="img/x.gif" title="'.Building::procResType($b['type']).'" alt="'.Building::procResType($b['type']).'"></a>';
}
foreach($unitsArray as $key => $c){
if($key == 99) $key = 51;
+1 -1
View File
@@ -27,7 +27,7 @@ if (count($jobs)) {
}
for ($i=1; $i<=18; $i++) {
echo " <area href=\"build.php?id=$i\" coords=\"$coorarray[$i]\" shape=\"circle\" title=\"".$building->procResType($arrayVillage['f'.$i.'t'])." Level ".$arrayVillage['f'.$i].(isset($activeFields[$i]) ? ' (upgrade in progress)' : '')."\"/>\r\n";
echo " <area href=\"build.php?id=$i\" coords=\"$coorarray[$i]\" shape=\"circle\" title=\"".Building::procResType($arrayVillage['f'.$i.'t'])." Level ".$arrayVillage['f'.$i].(isset($activeFields[$i]) ? ' (upgrade in progress)' : '')."\"/>\r\n";
}
?>
<area href="dorf2.php" coords="144,131,36" shape="circle" title="Village centre" alt="" />