mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
Fixed a bug in Palace/Residence
+Fixed a bug (or fixed a fix?) that didn't permit to train chief and settlers in the same village +Fixed a bug that didn't count trapped chiefs and trapped settlers +Fixed a bug that did count chiefs and settlers of other players as used slots, if they were attacking/reinforcing you -Removed an unused portion of code
This commit is contained in:
+10
-25
@@ -6824,6 +6824,7 @@ References: User ID/Message ID, Mode
|
||||
$chiefs = $row['R2'];
|
||||
|
||||
$settlers += 3 * count($this->getMovement(5, $village->wid, 0));
|
||||
|
||||
$current_movement = $this->getMovement(3, $village->wid, 0);
|
||||
if(!empty($current_movement)) {
|
||||
foreach($current_movement as $build) {
|
||||
@@ -6831,20 +6832,7 @@ References: User ID/Message ID, Mode
|
||||
$chiefs += $build['t9'];
|
||||
}
|
||||
}
|
||||
$current_movement = $this->getMovement(3, $village->wid, 1);
|
||||
if(!empty($current_movement)) {
|
||||
foreach($current_movement as $build) {
|
||||
$settlers += $build['t10'];
|
||||
$chiefs += $build['t9'];
|
||||
}
|
||||
}
|
||||
$current_movement = $this->getMovement(4, $village->wid, 0);
|
||||
if(!empty($current_movement)) {
|
||||
foreach($current_movement as $build) {
|
||||
$settlers += $build['t10'];
|
||||
$chiefs += $build['t9'];
|
||||
}
|
||||
}
|
||||
|
||||
$current_movement = $this->getMovement(4, $village->wid, 1);
|
||||
if(!empty($current_movement)) {
|
||||
foreach($current_movement as $build) {
|
||||
@@ -6882,25 +6870,22 @@ References: User ID/Message ID, Mode
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: trapped settlers/chiefs calculation required
|
||||
$settlerslots = ($maxslots * 3) - $chiefs - $settlers;
|
||||
|
||||
// don't allow training of settlers if there is at least 1 chief in the village
|
||||
if ($chiefs > 0) {
|
||||
$settlerslots = 0;
|
||||
}
|
||||
$trappedTroops = $this->getPrisoners($village->wid, 1);
|
||||
if(!empty($trappedTroops)){
|
||||
foreach($trappedTroops as $trapped){
|
||||
$settlers += $trapped['t10'];
|
||||
$chiefs += $trapped['t9'];
|
||||
}
|
||||
}
|
||||
|
||||
$settlerslots = ($maxslots * 3) - ($chiefs * 3) - $settlers;
|
||||
$chiefslots = $maxslots - $chiefs - floor(($settlers + 2) / 3);
|
||||
|
||||
if(!$technology->getTech(($session->tribe - 1) * 10 + 9)) {
|
||||
$chiefslots = 0;
|
||||
}
|
||||
|
||||
// don't allow training of chieftains if there is at least 1 settler in the village
|
||||
if ($settlers > 0) {
|
||||
$chiefslots = 0;
|
||||
}
|
||||
|
||||
$slots = array("chiefs" => $chiefslots, "settlers" => $settlerslots);
|
||||
return $slots;
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=($session->tribe-1)*10+9;$i<=($session->tribe*10);$i++) {
|
||||
if ($slots['settlers']>0 && $i%10==0 || $slots['chiefs']>0 && $i%10==9 && $session->tribe != 4) {
|
||||
$maxunit = MIN($technology->maxUnit($i),($i%10==0?$slots['settlers']:$slots['chiefs']));
|
||||
for ($i = ($session->tribe - 1) * 10 + 9; $i <= ($session->tribe * 10); $i++) {
|
||||
if ($slots['settlers'] > 0 && $i % 10 == 0 || $slots['chiefs'] > 0 && $i % 10 == 9 && $session->tribe != 4) {
|
||||
$maxunit = MIN($technology->maxUnit($i), ($i % 10 == 0 ? $slots['settlers'] : $slots['chiefs']));
|
||||
|
||||
echo "<tr><td class=\"desc\">
|
||||
<div class=\"tit\">
|
||||
@@ -56,8 +56,8 @@ echo "<td class=\"val\"><input type=\"text\" class=\"text\" name=\"t".$i."\" val
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
} else {
|
||||
echo '<div class="c">'.RESIDENCE_TRAIN_DESC.'</div>';
|
||||
}
|
||||
}
|
||||
else echo '<div class="c">'.RESIDENCE_TRAIN_DESC.'</div>';
|
||||
|
||||
include ("25_progress.tpl");
|
||||
?>
|
||||
|
||||
@@ -1,20 +1,4 @@
|
||||
<?php
|
||||
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,5,3,0));
|
||||
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,5,1,1));
|
||||
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,5,2,0));
|
||||
if($artefact > 0){
|
||||
$artefact_bonus = 2;
|
||||
$artefact_bonus2 = 1;
|
||||
}else if($artefact1 > 0){
|
||||
$artefact_bonus = 2;
|
||||
$artefact_bonus2 = 1;
|
||||
}else if($artefact2 > 0){
|
||||
$artefact_bonus = 4;
|
||||
$artefact_bonus2 = 3;
|
||||
}else{
|
||||
$artefact_bonus = 1;
|
||||
$artefact_bonus2 = 1;
|
||||
}
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
@@ -27,7 +11,7 @@
|
||||
|
||||
$slots = $database->getAvailableExpansionTraining();
|
||||
|
||||
if ($slots['settlers']+$slots['chiefs']>0) { ?>
|
||||
if ($slots['settlers'] + $slots['chiefs'] > 0) { ?>
|
||||
|
||||
<form method="POST" name="snd" action="build.php">
|
||||
<input type="hidden" name="id" value="<?php echo $id; ?>" />
|
||||
@@ -43,9 +27,9 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=($session->tribe-1)*10+9;$i<=($session->tribe*10);$i++) {
|
||||
if ($slots['settlers']>0 && $i%10==0 || $slots['chiefs']>0 && $i%10==9 && $session->tribe != 4) {
|
||||
$maxunit = MIN($technology->maxUnit($i),($i%10==0?$slots['settlers']:$slots['chiefs']));
|
||||
for ($i = ($session->tribe - 1) * 10 + 9; $i <= $session->tribe * 10; $i++) {
|
||||
if ($slots['settlers'] > 0 && $i % 10 == 0 || $slots['chiefs'] > 0 && $i % 10 == 9 && $session->tribe != 4) {
|
||||
$maxunit = MIN($technology->maxUnit($i), ($i % 10 == 0 ? $slots['settlers'] : $slots['chiefs']));
|
||||
|
||||
echo "<tr><td class=\"desc\">
|
||||
<div class=\"tit\">
|
||||
@@ -73,8 +57,8 @@ echo "<td class=\"val\"><input type=\"text\" class=\"text\" name=\"t".$i."\" val
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
} else {
|
||||
echo '<div class="c">'.PALACE_TRAIN_DESC.'</div>';
|
||||
}
|
||||
}
|
||||
else echo '<div class="c">'.PALACE_TRAIN_DESC.'</div>';
|
||||
|
||||
include ("26_progress.tpl");
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user