fix: Great Workshop shown as error in Admin (editing Village)

This commit is contained in:
Martin Ambrus
2017-10-21 22:38:01 +02:00
parent d0a3aaa044
commit 77a1d9879d
4 changed files with 26 additions and 4 deletions
+1
View File
@@ -206,6 +206,7 @@ class funct {
case 39: $build = "Great Granary"; break;
case 40: $build = "Wonder of the World"; break;
case 41: $build = "Horse Drinking Trough"; break;
case 42: $build = "Great Workshop"; break;
default: $build = "Error"; break;
}
return $build;
+1
View File
@@ -202,6 +202,7 @@ class funct {
case 39: $build = "Great Granary"; break;
case 40: $build = "Wonder of the World"; break;
case 41: $build = "Horse Drinking Trough"; break;
case 42: $build = "Great Workshop"; break;
default: $build = "Error"; break;
}
return $build;
+21 -2
View File
@@ -663,32 +663,48 @@ class Building {
public function getTypeLevel($tid,$vid=0) {
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 we count more than 1 instance of the building (mostly resource fields)
if($element >= 2) {
// resource field
if($tid <= 4) {
$temparray = array();
for($i=0;$i<=$element-1;$i++) {
// collect current field level
array_push($temparray,$resourcearray['f'.$keyholder[$i]]);
}
// find out the maximum field level for this village
$maValue = max($temparray);
foreach ($temparray as $key => $val) {
if ($val == max($temparray))
$target = $key;
if ($val == $maValue) {
$target = $key;
}
}
}
// village building
else {
$target = 0;
// find the highest level built for this building type
for($i=1;$i<=$element-1;$i++) {
if($resourcearray['f'.$keyholder[$i]] > $resourcearray['f'.$keyholder[$target]]) {
$target = $i;
@@ -696,12 +712,15 @@ class Building {
}
}
}
// if we count only a single building
else if($element == 1) {
$target = 0;
}
// no building matching search criteria
else {
return 0;
}
if($keyholder[$target] != "") {
return $resourcearray['f'.$keyholder[$target]];
}
+3 -2
View File
@@ -1,4 +1,3 @@
- add PayPal listener to verify gold transactions imediatelly
- add combat Simulator link to options for a village/oasis (Centre map, Raid, Send Troops...)
- don't show Support & Taskmaster in stats
- add Support login possibility into Admin (ask for password during installation, create Support messages section)
@@ -23,4 +22,6 @@
- add registered date into user details in Admin
- npc shop button is missing from settlers training (palace)
- should random attacks from Natars when building Wonder of the World be unit-less?
- send forum replies in a forum where a user is active also to that user's mailbox
- send forum replies in a forum where a user is active also to that user's mailbox
- make an option for admin to be raidable (in profile?)
- add PayPal listener to verify gold transactions imediatelly