mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-24 10:56:43 +08:00
Fixed some bugs
Automation.php: Fixed a bug that could happened if two attacks hit two different targets (one with some traps and the other with 0 traps) at the same second. Building.php: Fixed the possibility to build a residence and a palace with the waiting loop (the previous fix wasn't working and $tid was used as a $id and viceversa). Fixed the possibility to build in the id reserved to walls (id 40).
This commit is contained in:
@@ -3219,7 +3219,8 @@ class Automation {
|
|||||||
,$troopsdead9
|
,$troopsdead9
|
||||||
,$troopsdead10
|
,$troopsdead10
|
||||||
,$troopsdead11
|
,$troopsdead11
|
||||||
,$DefenderUnit);
|
,$DefenderUnit
|
||||||
|
,$info_trap);
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
|
|
||||||
|
|||||||
+7
-48
@@ -42,29 +42,6 @@ class Building {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function residenceOfPalaceBuildInProgress() {
|
|
||||||
global $database, $village;
|
|
||||||
|
|
||||||
$residenceOrPalaceInProgress = $database->getBuildingByType2($village->wid, '25, 26');
|
|
||||||
$residenceBuildInProgress = false;
|
|
||||||
$palaceBuildInProgress = false;
|
|
||||||
|
|
||||||
if (count($residenceOrPalaceInProgress)) {
|
|
||||||
foreach ($residenceOrPalaceInProgress as $record) {
|
|
||||||
if ($record == 25) {
|
|
||||||
$residenceBuildInProgress = true;
|
|
||||||
} else {
|
|
||||||
$palaceBuildInProgress = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
|
||||||
'residence' => $residenceBuildInProgress,
|
|
||||||
'palace' => $palaceBuildInProgress
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Checks whether to allow building Wonder of the World
|
* Checks whether to allow building Wonder of the World
|
||||||
* above current level. This includes checks for WW upgrade
|
* above current level. This includes checks for WW upgrade
|
||||||
@@ -144,19 +121,9 @@ class Building {
|
|||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
$levels = $database->getResourceLevel($village->wid);
|
$levels = $database->getResourceLevel($village->wid);
|
||||||
$progresses = $this->residenceOfPalaceBuildInProgress();
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!(
|
!(
|
||||||
// check if we're not trying to hack-build residence and palace together
|
|
||||||
(
|
|
||||||
!in_array($tid, [25, 26]) ||
|
|
||||||
(
|
|
||||||
($tid == 25 && $progresses['palace'] === false) ||
|
|
||||||
($tid == 26 && $progresses['residence'] === false)
|
|
||||||
)
|
|
||||||
) &&
|
|
||||||
|
|
||||||
// don't allow building WW to level 51 with a waiting loop
|
// don't allow building WW to level 51 with a waiting loop
|
||||||
(
|
(
|
||||||
$tid != 99 ||
|
$tid != 99 ||
|
||||||
@@ -183,6 +150,11 @@ class Building {
|
|||||||
(
|
(
|
||||||
$levels['f'.$tid.'t'] == $id ||
|
$levels['f'.$tid.'t'] == $id ||
|
||||||
$levels['f'.$tid.'t'] == 0
|
$levels['f'.$tid.'t'] == 0
|
||||||
|
) &&
|
||||||
|
// check that we're not trying to build in the walls id
|
||||||
|
(
|
||||||
|
($tid == 40 && in_array($id, [31, 32, 33])) ||
|
||||||
|
$tid != 40
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
if ( !isset($_GET['master']) && $this->checkResource( $id, $tid ) != 4 ) {
|
if ( !isset($_GET['master']) && $this->checkResource( $id, $tid ) != 4 ) {
|
||||||
@@ -590,18 +562,6 @@ 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()) &&
|
|
||||||
(
|
|
||||||
!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 ) {
|
||||||
@@ -640,7 +600,6 @@ class Building {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search through all user's villages if the castle is built or not
|
* Search through all user's villages if the castle is built or not
|
||||||
@@ -695,8 +654,8 @@ class Building {
|
|||||||
case 22: return $this->getTypeLevel(15) >= 3 && $this->getTypeLevel(19) >= 3 && !$isBuilt;
|
case 22: return $this->getTypeLevel(15) >= 3 && $this->getTypeLevel(19) >= 3 && !$isBuilt;
|
||||||
case 23: return !$isBuilt || $this->getTypeLevel($id) == 10;
|
case 23: return !$isBuilt || $this->getTypeLevel($id) == 10;
|
||||||
case 24: return $this->getTypeLevel(22) >= 10 && $this->getTypeLevel(15) >= 10 && !$isBuilt;
|
case 24: return $this->getTypeLevel(22) >= 10 && $this->getTypeLevel(15) >= 10 && !$isBuilt;
|
||||||
case 25: return $this->getTypeLevel(15) >= 5 && $this->getTypeLevel(26) == 0 && !$isBuilt;
|
case 25: return $this->getTypeLevel(15) >= 5 && !$isBuilt && !$this->getTypeField(26);
|
||||||
case 26: return $this->getTypeLevel(18) >= 1 && $this->getTypeLevel(15) >= 5 && $this->getTypeLevel(25) == 0 && !$isBuilt && !$this->isCastleBuilt();
|
case 26: return $this->getTypeLevel(18) >= 1 && $this->getTypeLevel(15) >= 5 && !$isBuilt && !$this->isCastleBuilt() && !$this->getTypeField(25);
|
||||||
case 27: return $this->getTypeLevel(15) >= 10 && !$isBuilt;
|
case 27: return $this->getTypeLevel(15) >= 10 && !$isBuilt;
|
||||||
case 28: return $this->getTypeLevel(17) == 20 && $this->getTypeLevel(20) >= 10 && !$isBuilt;
|
case 28: return $this->getTypeLevel(17) == 20 && $this->getTypeLevel(20) >= 10 && !$isBuilt;
|
||||||
case 29: return $this->getTypeLevel(19) == 20 && $village->capital == 0 && !$isBuilt;
|
case 29: return $this->getTypeLevel(19) == 20 && $village->capital == 0 && !$isBuilt;
|
||||||
|
|||||||
Reference in New Issue
Block a user