mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-17 23:57:18 +00:00
+54
-2
@@ -42,6 +42,29 @@ class Building {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function residenceOfPalaceBuildInProgress($vid) {
|
||||||
|
global $database, $village;
|
||||||
|
|
||||||
|
$residenceOrPalaceInProgress = $database->getBuildingByType($village->wid, '25, 26');
|
||||||
|
$residenceBuildInProgress = false;
|
||||||
|
$palaceBuildInProgress = false;
|
||||||
|
|
||||||
|
if (count($residenceOrPalaceInProgress)) {
|
||||||
|
foreach ($residenceOrPalaceInProgress as $record) {
|
||||||
|
if ($record['type'] == 25) {
|
||||||
|
$residenceBuildInProgress = true;
|
||||||
|
} else {
|
||||||
|
$palaceBuildInProgress = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'residence' => $residenceBuildInProgress,
|
||||||
|
'palace' => $palaceBuildInProgress
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
public function canProcess($id,$tid) {
|
public function canProcess($id,$tid) {
|
||||||
//add fix by ronix
|
//add fix by ronix
|
||||||
global $session;
|
global $session;
|
||||||
@@ -82,8 +105,22 @@ class Building {
|
|||||||
header("Location: banned.php");
|
header("Location: banned.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check if we're not trying to hack-build residence and palace together
|
||||||
|
if (
|
||||||
|
($progresses = $this->residenceOfPalaceBuildInProgress($village->wid)) &&
|
||||||
|
(
|
||||||
|
!in_array($get['master'], [25, 26]) ||
|
||||||
|
(
|
||||||
|
($get['master'] == 25 && $progresses['palace'] === false) ||
|
||||||
|
($get['master'] == 26 && $progresses['residence'] === false)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) {
|
||||||
$level = $database->getResourceLevel( $village->wid );
|
$level = $database->getResourceLevel( $village->wid );
|
||||||
$database->addBuilding( $village->wid, $get['id'], $get['master'], 1, $get['time'], 1, $level[ 'f' . $get['id'] ] + 1 + count( $database->getBuildingByField( $village->wid, $get['id'] ) ) );
|
$database->addBuilding( $village->wid, $get['id'], $get['master'], 1, $get['time'], 1, $level[ 'f' . $get['id'] ] + 1 + count( $database->getBuildingByField( $village->wid, $get['id'] ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
if ( $get['id'] > 18 ) {
|
if ( $get['id'] > 18 ) {
|
||||||
header( "Location: dorf2.php" );
|
header( "Location: dorf2.php" );
|
||||||
exit;
|
exit;
|
||||||
@@ -434,10 +471,21 @@ class Building {
|
|||||||
global $database,$village,$session,$logging;
|
global $database,$village,$session,$logging;
|
||||||
|
|
||||||
if($this->allocated < $this->maxConcurrent) {
|
if($this->allocated < $this->maxConcurrent) {
|
||||||
|
// check if we're not trying to hack-build residence and palace together
|
||||||
|
if (
|
||||||
|
($progresses = $this->residenceOfPalaceBuildInProgress($village->wid)) &&
|
||||||
|
(
|
||||||
|
!in_array($tid, [25, 26]) ||
|
||||||
|
(
|
||||||
|
($tid == 25 && $progresses['palace'] === false) ||
|
||||||
|
($tid == 26 && $progresses['residence'] === false)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
|
||||||
if ( $tid == 16 ) {
|
if ( $tid == 16 ) {
|
||||||
$id = 39;
|
$id = 39;
|
||||||
}
|
} else if ( $tid == 31 || $tid == 32 || $tid == 33 ) {
|
||||||
else if($tid == 31 || $tid == 32 || $tid == 33) {
|
|
||||||
$id = 40;
|
$id = 40;
|
||||||
}
|
}
|
||||||
$uprequire = $this->resourceRequired( $id, $tid );
|
$uprequire = $this->resourceRequired( $id, $tid );
|
||||||
@@ -465,6 +513,10 @@ class Building {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
header( "Location: dorf2.php" );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4971,9 +4971,11 @@ References: User ID/Message ID, Mode
|
|||||||
|
|
||||||
// no need to cache this method
|
// no need to cache this method
|
||||||
function getBuildingByType($wid,$type) {
|
function getBuildingByType($wid,$type) {
|
||||||
list($wid,$type) = $this->escape_input((int) $wid,(int) $type);
|
$wid = (int) $wid;
|
||||||
|
|
||||||
$q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and type = $type and master = 0";
|
$type = (strpos($type, ',') === false ? (int) $type : $this->escape($type));
|
||||||
|
|
||||||
|
$q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and type IN($type) and master = 0";
|
||||||
$result = mysqli_query($this->dblink,$q);
|
$result = mysqli_query($this->dblink,$q);
|
||||||
return $this->mysqli_fetch_all($result);
|
return $this->mysqli_fetch_all($result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,6 +98,10 @@ $greatwarehouse1 = getTypeCount(38);
|
|||||||
$greatgranary1 = getTypeCount(39);
|
$greatgranary1 = getTypeCount(39);
|
||||||
$greatworkshop1 = getTypeCount(42);
|
$greatworkshop1 = getTypeCount(42);
|
||||||
|
|
||||||
|
$residenceOrPalaceInProgress = $building->residenceOfPalaceBuildInProgress($village->wid);
|
||||||
|
$residenceBuildInProgress = $residenceOrPalaceInProgress['residence'];
|
||||||
|
$palaceBuildInProgress = $residenceOrPalaceInProgress['palace'];
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div id="build" class="gid0"><h1<?php echo CONSTRUCT_NEW_BUILDING;?></h1>
|
<div id="build" class="gid0"><h1<?php echo CONSTRUCT_NEW_BUILDING;?></h1>
|
||||||
<?php
|
<?php
|
||||||
@@ -163,7 +167,7 @@ include("avaliable/grainmill.tpl");
|
|||||||
if($granary >= 1 && $warehouse >= 1 && $mainbuilding >= 3 && $market == 0 && $market1 == 0 && $id != 39 && $id != 40) {
|
if($granary >= 1 && $warehouse >= 1 && $mainbuilding >= 3 && $market == 0 && $market1 == 0 && $id != 39 && $id != 40) {
|
||||||
include("avaliable/marketplace.tpl");
|
include("avaliable/marketplace.tpl");
|
||||||
}
|
}
|
||||||
if($mainbuilding >= 5 && $residence == 0 && $residence1 == 0 && $id != 39 && $id != 40 && $palace == 0) {
|
if($mainbuilding >= 5 && $residence == 0 && $residence1 == 0 && $id != 39 && $id != 40 && $palace == 0 && !$palaceBuildInProgress) {
|
||||||
include("avaliable/residence.tpl");
|
include("avaliable/residence.tpl");
|
||||||
}
|
}
|
||||||
if($academy == 0 && $academy1 == 0 && $mainbuilding >= 3 && $barrack >= 3 && $id != 39 && $id != 40) {
|
if($academy == 0 && $academy1 == 0 && $mainbuilding >= 3 && $barrack >= 3 && $id != 39 && $id != 40) {
|
||||||
@@ -195,9 +199,8 @@ if ($test){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//if Castle no ready include palace.tpl
|
//if Castle no ready include palace.tpl
|
||||||
if (!$test){
|
if (!$test && !$residenceBuildInProgress){
|
||||||
include("avaliable/palace.tpl");
|
include("avaliable/palace.tpl");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user