mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-24 20:17:13 +00:00
fix: Great Workshop shown as error in Admin (editing Village)
This commit is contained in:
@@ -206,6 +206,7 @@ class funct {
|
|||||||
case 39: $build = "Great Granary"; break;
|
case 39: $build = "Great Granary"; break;
|
||||||
case 40: $build = "Wonder of the World"; break;
|
case 40: $build = "Wonder of the World"; break;
|
||||||
case 41: $build = "Horse Drinking Trough"; break;
|
case 41: $build = "Horse Drinking Trough"; break;
|
||||||
|
case 42: $build = "Great Workshop"; break;
|
||||||
default: $build = "Error"; break;
|
default: $build = "Error"; break;
|
||||||
}
|
}
|
||||||
return $build;
|
return $build;
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ class funct {
|
|||||||
case 39: $build = "Great Granary"; break;
|
case 39: $build = "Great Granary"; break;
|
||||||
case 40: $build = "Wonder of the World"; break;
|
case 40: $build = "Wonder of the World"; break;
|
||||||
case 41: $build = "Horse Drinking Trough"; break;
|
case 41: $build = "Horse Drinking Trough"; break;
|
||||||
|
case 42: $build = "Great Workshop"; break;
|
||||||
default: $build = "Error"; break;
|
default: $build = "Error"; break;
|
||||||
}
|
}
|
||||||
return $build;
|
return $build;
|
||||||
|
|||||||
+21
-2
@@ -663,32 +663,48 @@ class Building {
|
|||||||
|
|
||||||
public function getTypeLevel($tid,$vid=0) {
|
public function getTypeLevel($tid,$vid=0) {
|
||||||
global $village,$database;
|
global $village,$database;
|
||||||
|
|
||||||
$keyholder = array();
|
$keyholder = array();
|
||||||
|
|
||||||
if($vid == 0) {
|
if($vid == 0) {
|
||||||
$resourcearray = $village->resarray;
|
$resourcearray = $village->resarray;
|
||||||
} else {
|
} else {
|
||||||
$resourcearray = $database->getResourceLevel($vid);
|
$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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$element = count($keyholder);
|
$element = count($keyholder);
|
||||||
|
|
||||||
|
// if we count more than 1 instance of the building (mostly resource fields)
|
||||||
if($element >= 2) {
|
if($element >= 2) {
|
||||||
|
// resource field
|
||||||
if($tid <= 4) {
|
if($tid <= 4) {
|
||||||
$temparray = array();
|
$temparray = array();
|
||||||
|
|
||||||
for($i=0;$i<=$element-1;$i++) {
|
for($i=0;$i<=$element-1;$i++) {
|
||||||
|
// 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
|
||||||
|
$maValue = max($temparray);
|
||||||
foreach ($temparray as $key => $val) {
|
foreach ($temparray as $key => $val) {
|
||||||
if ($val == max($temparray))
|
if ($val == $maValue) {
|
||||||
$target = $key;
|
$target = $key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// village building
|
||||||
else {
|
else {
|
||||||
$target = 0;
|
$target = 0;
|
||||||
|
|
||||||
|
// 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;
|
||||||
@@ -696,12 +712,15 @@ class Building {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if we count only a single building
|
||||||
else if($element == 1) {
|
else if($element == 1) {
|
||||||
$target = 0;
|
$target = 0;
|
||||||
}
|
}
|
||||||
|
// no building matching search criteria
|
||||||
else {
|
else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($keyholder[$target] != "") {
|
if($keyholder[$target] != "") {
|
||||||
return $resourcearray['f'.$keyholder[$target]];
|
return $resourcearray['f'.$keyholder[$target]];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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...)
|
- add combat Simulator link to options for a village/oasis (Centre map, Raid, Send Troops...)
|
||||||
- don't show Support & Taskmaster in stats
|
- don't show Support & Taskmaster in stats
|
||||||
- add Support login possibility into Admin (ask for password during installation, create Support messages section)
|
- 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
|
- add registered date into user details in Admin
|
||||||
- npc shop button is missing from settlers training (palace)
|
- npc shop button is missing from settlers training (palace)
|
||||||
- should random attacks from Natars when building Wonder of the World be unit-less?
|
- 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
|
||||||
Reference in New Issue
Block a user