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
+5 -4
View File
@@ -120,13 +120,13 @@ class Automation {
} }
public function procResType($ref, $mode = 0) { public function procResType($ref, $mode = 0) {
global $building;
//Capital or only 1 village left = cannot be destroyed //Capital or only 1 village left = cannot be destroyed
return addslashes(empty($build = $building->procResType($ref)) && !$mode ? "Village can't be" : $build); return addslashes(empty($build = Building::procResType($ref)) && !$mode ? "Village can't be" : $build);
} }
function recountPop($vid, $use_cache = true){ function recountPop($vid, $use_cache = true){
global $database; global $database;
$vid = (int) $vid; $vid = (int) $vid;
$fdata = $database->getResourceLevel($vid, $use_cache); $fdata = $database->getResourceLevel($vid, $use_cache);
$popTot = 0; $popTot = 0;
@@ -148,6 +148,7 @@ class Automation {
function recountCP($vid){ function recountCP($vid){
global $database; global $database;
$vid = (int) $vid; $vid = (int) $vid;
$fdata = $database->getResourceLevel($vid); $fdata = $database->getResourceLevel($vid);
$popTot = 0; $popTot = 0;
@@ -3015,7 +3016,7 @@ class Automation {
} }
private function sendSettlersComplete() { private function sendSettlersComplete() {
global $database, $building, $autoprefix; global $database, $autoprefix;
if(file_exists($autoprefix."GameEngine/Prevention/settlers.txt")) { if(file_exists($autoprefix."GameEngine/Prevention/settlers.txt")) {
unlink($autoprefix."GameEngine/Prevention/settlers.txt"); unlink($autoprefix."GameEngine/Prevention/settlers.txt");
@@ -3761,7 +3762,7 @@ class Automation {
} }
private function demolitionComplete() { private function demolitionComplete() {
global $building, $database, $autoprefix; global $database, $autoprefix;
if(file_exists($autoprefix."GameEngine/Prevention/demolition.txt")) { if(file_exists($autoprefix."GameEngine/Prevention/demolition.txt")) {
unlink($autoprefix."GameEngine/Prevention/demolition.txt"); unlink($autoprefix."GameEngine/Prevention/demolition.txt");
+40 -63
View File
@@ -293,7 +293,7 @@ class Building {
return false; return false;
} }
public function procResType($ref) { public static function procResType($ref) {
switch($ref) { switch($ref) {
case 1: return "Woodcutter"; case 1: return "Woodcutter";
case 2: return "Clay Pit"; case 2: return "Clay Pit";
@@ -429,7 +429,7 @@ class Building {
if($database->addBuilding($village->wid, $id, $village->resarray['f'.$id.'t'], $loop, $time + ($loop == 1 ? ceil(60 / SPEED) : 0), 0, $level['f'.$id] + 1 + count($database->getBuildingByField($village->wid, $id)))) { if($database->addBuilding($village->wid, $id, $village->resarray['f'.$id.'t'], $loop, $time + ($loop == 1 ? ceil(60 / SPEED) : 0), 0, $level['f'.$id] + 1 + count($database->getBuildingByField($village->wid, $id)))) {
$database->modifyResource($village->wid, $uprequire['wood'], $uprequire['clay'], $uprequire['iron'], $uprequire['crop'], 0); $database->modifyResource($village->wid, $uprequire['wood'], $uprequire['clay'], $uprequire['iron'], $uprequire['crop'], 0);
$logging->addBuildLog($village->wid, $this->procResType($village->resarray['f'.$id.'t']), ($village->resarray['f'.$id] + ($loopsame > 0 ? 2 : 1)), 0); $logging->addBuildLog($village->wid, self::procResType($village->resarray['f'.$id.'t']), ($village->resarray['f'.$id] + ($loopsame > 0 ? 2 : 1)), 0);
$this->redirect($id); $this->redirect($id);
} }
} }
@@ -470,10 +470,10 @@ class Building {
} }
$level = $database->getResourceLevel($village->wid); $level = $database->getResourceLevel($village->wid);
if($database->addBuilding($village->wid,$id,$village->resarray['f'.$id.'t'],$loop,$time,0,0,$level['f'.$id] + 1 + count($database->getBuildingByField($village->wid,$id)))) { if($database->addBuilding($village->wid, $id, $village->resarray['f'.$id.'t'], $loop, $time, 0, 0, $level['f'.$id] + 1 + count($database->getBuildingByField($village->wid, $id)))){
$logging->addBuildLog($village->wid,$this->procResType($village->resarray['f'.$id.'t']),($village->resarray['f'.$id]-1),2); $logging->addBuildLog($village->wid, self::procResType($village->resarray['f'.$id.'t']), ($village->resarray['f'.$id] - 1), 2);
header("Location: dorf2.php"); header("Location: dorf2.php");
exit; exit();
} }
} }
} }
@@ -506,7 +506,7 @@ class Building {
if($this->meetRequirement($tid)) { if($this->meetRequirement($tid)) {
$level = $database->getResourceLevel($village->wid); $level = $database->getResourceLevel($village->wid);
if($database->addBuilding($village->wid, $id, $tid, $loop, $time, 0, $level['f' . $id] + 1 + count($database->getBuildingByField($village->wid, $id)))){ if($database->addBuilding($village->wid, $id, $tid, $loop, $time, 0, $level['f' . $id] + 1 + count($database->getBuildingByField($village->wid, $id)))){
$logging->addBuildLog($village->wid, $this->procResType($tid), ($village->resarray['f' . $id] + 1), 1); $logging->addBuildLog($village->wid, self::procResType($tid), ($village->resarray['f' . $id] + 1), 1);
$database->modifyResource($village->wid, $uprequire['wood'], $uprequire['clay'], $uprequire['iron'], $uprequire['crop'], 0); $database->modifyResource($village->wid, $uprequire['wood'], $uprequire['clay'], $uprequire['iron'], $uprequire['crop'], 0);
header("Location: dorf2.php"); header("Location: dorf2.php");
exit; exit;
@@ -668,47 +668,34 @@ class Building {
} }
} }
public function isMax($id,$field,$loop=0) { public function isMax($id, $field, $loop = 0) {
$name = "bid".$id; $name = "bid".$id;
global $$name,$village,$session; global $$name,$village,$session;
$dataarray = $$name; $dataarray = $$name;
// special case for Multihunter login which mathematically (because of the resarray length) // special case for Multihunter login which mathematically (because of the resarray length)
// allows for building resource fields above level 20 // allows for building resource fields above level 20
if ($session->tribe == 0) { if ($session->tribe == 0) return $village->resarray['f'.$field] == 20;
return $village->resarray['f'.$field] == 20;
}
if($id <= 4) { if($id <= 4) {
if($village->capital == 1) { if($village->capital == 1) return ($village->resarray['f'.$field] == (count($dataarray) - 1 - $loop));
return ($village->resarray['f'.$field] == (count($dataarray) - 1 - $loop)); else return ($village->resarray['f'.$field] == (count($dataarray) - 11 - $loop));
}
else {
return ($village->resarray['f'.$field] == (count($dataarray) - 11 - $loop));
}
}
else {
return ($village->resarray['f'.$field] == count($dataarray) - $loop);
} }
else return ($village->resarray['f'.$field] == count($dataarray) - $loop);
} }
public function getTypeLevel($tid,$vid=0) { public function getTypeLevel($tid, $vid = 0) {
global $village,$database,$session; global $village, $database, $session;
// Support would not have a village, so this is irrelevant // Support would not have a village, so this is irrelevant
if ($session->uid == 1) { if ($session->uid == 1) return 0;
return 0;
}
$keyholder = array(); $keyholder = [];
if($vid == 0) { if($vid == 0) $resourcearray = $village->resarray;
$resourcearray = $village->resarray; else $resourcearray = $database->getResourceLevel($vid);
} else {
$resourcearray = $database->getResourceLevel($vid);
}
foreach(array_keys($resourcearray,$tid) as $key) { foreach(array_keys($resourcearray, $tid) as $key) {
if(strpos($key,'t')) { if(strpos($key,'t')) {
$key = preg_replace("/[^0-9]/", '', $key); $key = preg_replace("/[^0-9]/", '', $key);
array_push($keyholder, $key); array_push($keyholder, $key);
@@ -718,51 +705,41 @@ class Building {
$element = count($keyholder); $element = count($keyholder);
// if we count more than 1 instance of the building (mostly resource fields) // if we count more than 1 instance of the building (mostly resource fields)
if($element >= 2) { if($element >= 2){
// resource field // resource field
if($tid <= 4) { if($tid <= 4){
$temparray = array(); $temparray = [];
for($i=0;$i<=$element-1;$i++) { for($i = 0; $i <= $element - 1; $i++){
// collect current field level // collect current field level
array_push($temparray,$resourcearray['f'.$keyholder[$i]]); array_push($temparray, $resourcearray['f'.$keyholder[$i]]);
} }
// find out the maximum field level for this village // find out the maximum field level for this village
$maValue = max($temparray); $maValue = max($temparray);
foreach ($temparray as $key => $val) { foreach($temparray as $key => $val){
if ($val == $maValue) { if($val == $maValue){
$target = $key; $target = $key;
} }
} }
} }else{ // village building
// village building
else {
$target = 0; $target = 0;
// find the highest level built for this building type // find the highest level built for this building type
for($i=1;$i<=$element-1;$i++) { for($i = 1; $i <= $element - 1; $i++){
if($resourcearray['f'.$keyholder[$i]] > $resourcearray['f'.$keyholder[$target]]) { if($resourcearray['f'.$keyholder[$i]] > $resourcearray['f'.$keyholder[$target]]){
$target = $i; $target = $i;
} }
} }
} }
} }
// if we count only a single building // if we count only a single building
else if($element == 1) { else if($element == 1) $target = 0;
$target = 0; else return 0; // no building matching search criteria
}
// no building matching search criteria if(!empty($keyholder[$target])) return $resourcearray['f'.$keyholder[$target]];
else { else return 0;
return 0;
}
if($keyholder[$target] != "") {
return $resourcearray['f'.$keyholder[$target]];
}
else {
return 0;
}
} }
+4 -3
View File
@@ -35,8 +35,9 @@ class MyGenerator {
return substr($encode,0,$length); return substr($encode,0,$length);
} }
public function procDistanceTime($coor, $thiscoor, $ref, $mode) { public function procDistanceTime($coor, $thiscoor, $ref, $mode, $vid = 0) {
global $bid28, $bid14, $building; global $bid28, $bid14, $building;
$xdistance = ABS($thiscoor['x'] - $coor['x']); $xdistance = ABS($thiscoor['x'] - $coor['x']);
if($xdistance > WORLD_MAX) { if($xdistance > WORLD_MAX) {
$xdistance = (2 * WORLD_MAX + 1) - $xdistance; $xdistance = (2 * WORLD_MAX + 1) - $xdistance;
@@ -54,8 +55,8 @@ class MyGenerator {
else $speed = 1; else $speed = 1;
}else{ }else{
$speed = $ref; $speed = $ref;
if($building->getTypeLevel(14) != 0 && $distance >= TS_THRESHOLD) { if(($tSquareLevel = $building->getTypeLevel(14, $vid)) > 0 && $distance >= TS_THRESHOLD) {
$speed *= ($bid14[$building->gettypeLevel(14)]['attri'] / 100) ; $speed *= ($bid14[$tSquareLevel]['attri'] / 100) ;
} }
} }
+1 -1
View File
@@ -733,7 +733,7 @@ class Units {
$fromCor = ['x' => $fromCoor['x'], 'y' => $fromCoor['y']]; $fromCor = ['x' => $fromCoor['x'], 'y' => $fromCoor['y']];
$toCor = ['x' => $toCoor['x'], 'y' => $toCoor['y']]; $toCor = ['x' => $toCoor['x'], 'y' => $toCoor['y']];
if(!$mode) return $generator->procDistanceTime($fromCor, $toCor, $unitArray[0], $mode); if(!$mode) return $generator->procDistanceTime($fromCor, $toCor, $unitArray[0], $mode, $from);
$start = ($tribe - 1) * 10 + 1; $start = ($tribe - 1) * 10 + 1;
$end = $tribe * 10; $end = $tribe * 10;
+2 -2
View File
@@ -64,10 +64,10 @@ $to = $database->getOMInfo($units[$y]['to']);}
<tr> <tr>
<th><?php echo CATAPULT_TARGET;?></th> <th><?php echo CATAPULT_TARGET;?></th>
<td style="text-align: center" colspan="5"> <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>
<td style="text-align: center" colspan="<?php if($units[$y]['t11'] == 0) {echo"5";}else{echo"6";}?>"> <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> </td>
</tr> </tr>
</tbody> </tbody>
+3 -7
View File
@@ -238,7 +238,6 @@ if(isset($_POST['ft'])=='check'){
<?php } ?> <?php } ?>
<p><?php echo MERCHANT_CARRY;?> <b><?php echo $market->maxcarry; ?></b> <?php echo UNITS_OF_RESOURCE;?> </p> <p><?php echo MERCHANT_CARRY;?> <b><?php echo $market->maxcarry; ?></b> <?php echo UNITS_OF_RESOURCE;?> </p>
<?php <?php
$timer = 1;
if(count($market->recieving) > 0) { if(count($market->recieving) > 0) {
echo "<h4>".MERCHANT_COMING.":</h4>"; echo "<h4>".MERCHANT_COMING.":</h4>";
foreach($market->recieving as $recieve) { 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 "<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 "<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 "</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']); $datetime = $generator->procMtime($recieve['endtime']);
echo "<div class=\"at\">"; echo "<div class=\"at\">";
if($datetime[0] != "today") { 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 "</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 "<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>"; echo "</table>";
$timer +=1;
} }
} }
if(count($market->sending) > 0) { 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 "<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 "<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 "</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']); $datetime = $generator->procMtime($send['endtime']);
echo "<div class=\"at\">"; echo "<div class=\"at\">";
if($datetime[0] != "today") { if($datetime[0] != "today") {
@@ -279,7 +277,6 @@ if(count($market->sending) > 0) {
echo "</td> </tr> <tr class=\"res\"> <th>".RESOURCES."</th><td>"; 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 "<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>"; echo "</table>";
$timer += 1;
} }
} }
if(count($market->return) > 0) { 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 "<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 "<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 "</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']); $datetime = $generator->procMtime($return['endtime']);
echo "<div class=\"at\">"; echo "<div class=\"at\">";
if($datetime[0] != "today") { if($datetime[0] != "today") {
@@ -300,7 +297,6 @@ if(count($market->return) > 0) {
echo "".AT." ".$datetime[1]."</div>"; echo "".AT." ".$datetime[1]."</div>";
echo "</td> </tr>"; echo "</td> </tr>";
echo "</tbody></table>"; echo "</tbody></table>";
$timer += 1;
} }
} }
include("upgrade.tpl"); include("upgrade.tpl");
+2 -2
View File
@@ -35,7 +35,7 @@ $building->loadBuilding();
if($jobs['master'] == 0){ if($jobs['master'] == 0){
echo "<tr><td class=\"ico\"><a href=\"?d=".$jobs['id']."&a=0&c=$session->checker\">"; 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 "<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'] == 0) { $BuildingList[] = $jobs['field']; }
if($jobs['loopcon'] == 1) { if($jobs['loopcon'] == 1) {
echo " (waiting loop)"; echo " (waiting loop)";
@@ -47,7 +47,7 @@ $building->loadBuilding();
}else{ }else{
echo "<tr><td class=\"ico\"><a href=\"?d=".$jobs['id']."&a=0&c=$session->checker\">"; 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 "<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"> <map name="map1" id="map1">
<?php <?php
if($building->walling()) { if($building->walling()) {
$wtitle = $building->procResType($building->walling())." Level ".$village->resarray['f40']; $wtitle = Building::procResType($building->walling())." Level ".$village->resarray['f40'];
} }
else { 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="" /> <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 ($village->natar==1 && ( $t== 25 || $t == 26 || $t == 29 || $t == 30 || $t == 33 )) {
if ($t==33) { if ($t==33) {
if($village->resarray['f99'] != 0) { if($village->resarray['f99'] != 0) {
$title = $building->procResType(40). " Level ".$village->resarray['f99']; $title = Building::procResType(40). " Level ".$village->resarray['f99'];
}else $title = $building->procResType(40); }else $title = Building::procResType(40);
echo "<area href=\"build.php?id=99\" title=\"$title\" coords=\"190,170,80\" shape=\"circle\"/>"; echo "<area href=\"build.php?id=99\" title=\"$title\" coords=\"190,170,80\" shape=\"circle\"/>";
} }
} else { } else {
if($village->resarray['f'.$t.'t'] != 0) { 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{ }else{
$title = "Building site"; $title = "Building site";
if(($t == 39) && ($village->resarray['f'.$t] == 0)) { if(($t == 39) && ($village->resarray['f'.$t] == 0)) {
@@ -72,13 +72,13 @@ for ($i=1;$i<=20;$i++) {
$text = "Building site"; $text = "Building site";
$img = "iso"; $img = "iso";
if($village->resarray['f'.($i+18).'t'] != 0) { 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']; $img = "g".$village->resarray['f'.($i+18).'t'];
} }
foreach($building->buildArray as $job) { foreach($building->buildArray as $job) {
if($job['field'] == ($i+18)) { if($job['field'] == ($i+18)) {
$img = 'g'.$job['type'].'b'; $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\" />"; 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); $totalmerchants = $building->getTypeLevel(17,$vid);
$availmerchants = $totalmerchants - $database->totalMerchantUsed($vid); $availmerchants = $totalmerchants - $database->totalMerchantUsed($vid);
$incoming_attacks = $database->getMovement(3,$vid,1); $incoming_attacks = $database->getMovement(3,$vid,1);
$bui = ''; $bui = $tro = $att = '';
$tro = '';
$att = '';
if (count($incoming_attacks) > 0) { if (count($incoming_attacks) > 0) {
$inc_atts = count($incoming_attacks); $inc_atts = count($incoming_attacks);
@@ -35,7 +33,7 @@
} }
} }
foreach($jobs as $b){ 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){ foreach($unitsArray as $key => $c){
if($key == 99) $key = 51; if($key == 99) $key = 51;
+1 -1
View File
@@ -27,7 +27,7 @@ if (count($jobs)) {
} }
for ($i=1; $i<=18; $i++) { 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="" /> <area href="dorf2.php" coords="144,131,36" shape="circle" title="Village centre" alt="" />