mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-04 20:04:21 +00:00
General fixes
+Added WW building plans to the "Small artifacts" section of the treasury +Fixed a bug that permitted to maintain a building in queue when destroyed by catapults +Fixed a bug that didn't count the catapult destruction of a building in building queue
This commit is contained in:
+13
-13
@@ -812,9 +812,12 @@ class Automation {
|
||||
|
||||
$newLevel = $battle->CalculateNewBuildingLevel($battlepart['catapults']['moral'], $battlepart['catapults']['updown'], $tblevel, $battlepart['catapults']['realAttackers'], $data['t8']);
|
||||
|
||||
//If that building was present in the building queue, we have to modify his level or remove it
|
||||
$database->modifyBData($data['to'], $tbid, [$newLevel, $tblevel]);
|
||||
|
||||
// building/field destroyed
|
||||
if ($newLevel == 0)
|
||||
{
|
||||
{
|
||||
// prepare data to be updated
|
||||
$fieldsToSet = ["f".$tbid];
|
||||
$fieldValuesToSet = [0];
|
||||
@@ -834,20 +837,18 @@ class Automation {
|
||||
$buildarray = $GLOBALS["bid".$tbgid];
|
||||
|
||||
// (great) warehouse level was changed
|
||||
if ($tbgid==10 || $tbgid==38) {
|
||||
if ($tbgid == 10 || $tbgid == 38) {
|
||||
$database->setMaxStoreForVillage($data['to'], $buildarray[$newLevel]['attri']);
|
||||
}
|
||||
|
||||
// (great) granary level was changed
|
||||
if ($tbgid==11 || $tbgid==39) {
|
||||
if ($tbgid == 11 || $tbgid == 39) {
|
||||
$database->setMaxCropForVillage($data['to'], $buildarray[$newLevel]['attri']);
|
||||
}
|
||||
|
||||
// oasis cannot be destroyed
|
||||
$pop = $this->recountPop($data['to'], false);
|
||||
if ($isoasis == 0) {
|
||||
if($pop == 0 && $can_destroy == 1) $village_destroyed = 1;
|
||||
}
|
||||
if ($isoasis == 0 && $pop == 0 && $can_destroy == 1) $village_destroyed = 1;
|
||||
|
||||
if ($isSecondRow) {
|
||||
if ($tbid > 0) {
|
||||
@@ -856,7 +857,7 @@ class Automation {
|
||||
}
|
||||
|
||||
// embassy level was changed
|
||||
if ($tbgid==18){
|
||||
if ($tbgid == 18){
|
||||
$info_cat .= $database->checkEmbassiesAfterBattle($data['to'], $bdo['f'.$catapultTarget], false);
|
||||
}
|
||||
|
||||
@@ -865,15 +866,14 @@ class Automation {
|
||||
$info_cat = "".$catp_pic.", ".$this->procResType($tbgid, $can_destroy)." <b>destroyed</b>.";
|
||||
|
||||
// embassy level was changed
|
||||
if ($tbgid==18){
|
||||
if ($tbgid == 18){
|
||||
$info_cat .= $database->checkEmbassiesAfterBattle($data['to'], $bdo['f'.$catapultTarget], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
// building/field not damaged
|
||||
elseif ($newLevel == $tblevel)
|
||||
{
|
||||
if ($isSecondRow) {
|
||||
elseif($newLevel == $tblevel){
|
||||
if($isSecondRow) {
|
||||
if ($tbid > 0) {
|
||||
$info_cat .= "<tbody class=\"goods\"><tr><th>Information</th><td colspan=\"11\">
|
||||
<img class=\"unit u".$catp_pic."\" src=\"img/x.gif\" alt=\"Catapult\" title=\"Catapult\" /> ".$this->procResType($tbgid, $can_destroy)." was not damaged.</td></tr></tbody>";
|
||||
@@ -882,9 +882,9 @@ class Automation {
|
||||
$info_cat = "".$catp_pic.",".$this->procResType($tbgid, $can_destroy)." was not damaged.";
|
||||
}
|
||||
}
|
||||
else
|
||||
// building/field was damaged, let's calculate the actual damage
|
||||
{
|
||||
else
|
||||
{
|
||||
// update $bdo, so we don't have to reselect later
|
||||
$bdo['f'.$catapultTarget] = $newLevel;
|
||||
|
||||
|
||||
+22
-9
@@ -4941,7 +4941,7 @@ References: User ID/Message ID, Mode
|
||||
}
|
||||
|
||||
function checkEmbassiesAfterBattle($vid, $current_level, $use_cache = true) {
|
||||
$userData = $this->getUserArray($this->getVillageField($vid,"owner"), 1);
|
||||
$userData = $this->getUserArray($this->getVillageField($vid, "owner"), 1);
|
||||
|
||||
Automation::updateMax($this->getVillageField($vid,"owner"));
|
||||
$allianceStatus = $this->checkAllianceEmbassiesStatus([
|
||||
@@ -4951,16 +4951,29 @@ References: User ID/Message ID, Mode
|
||||
'lvl' => $current_level
|
||||
], false, $use_cache);
|
||||
|
||||
if ($allianceStatus === false) {
|
||||
return ' This player\'s alliance has been dispersed.';
|
||||
} else if ($allianceStatus === 0) {
|
||||
return ' Player was forced to leave their alliance.';
|
||||
} else {
|
||||
// all is good, no need to append additional alliance-related text
|
||||
return '';
|
||||
}
|
||||
if ($allianceStatus === false) return ' This player\'s alliance has been dispersed.';
|
||||
else if ($allianceStatus === 0) return ' Player was forced to leave their alliance.';
|
||||
else return ''; // all is good, no need to append additional alliance-related text
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify or delete a building being constructed/in queue
|
||||
*
|
||||
* @param int The village ID
|
||||
* @param int $field The field where the building is located
|
||||
* @param array $levels The new level of the building and the old one
|
||||
* @return bool Returns true if the query was successful, false otherwise
|
||||
*/
|
||||
|
||||
function modifyBData($wid, $field, $levels){
|
||||
list($wid, $field, $levels) = $this->escape_input((int) $wid, (int) $field, $levels);
|
||||
|
||||
if($levels[0] == 0) $q = "DELETE FROM " .TB_PREFIX. "bdata WHERE wid = $wid AND field = $field";
|
||||
else $q = "UPDATE " .TB_PREFIX. "bdata SET level = level - $levels[1] + $levels[0] WHERE wid = $wid AND field = $field";
|
||||
|
||||
return mysqli_query($this->dblink, $q);
|
||||
}
|
||||
|
||||
private function getBData($wid, $use_cache = true) {
|
||||
$wid = (int) $wid;
|
||||
|
||||
|
||||
+17
-32
@@ -33,10 +33,9 @@
|
||||
|
||||
$count = mysqli_fetch_array(mysqli_query($database->dblink,"SELECT Count(*) as Total FROM " . TB_PREFIX . "artefacts"), MYSQLI_ASSOC);
|
||||
$count = $count['Total'];
|
||||
if($count == 0) {
|
||||
echo '<td colspan="4" class="none">'.NO_ARTIFACTS.'</td>';
|
||||
} else {
|
||||
|
||||
if($count == 0) echo '<td colspan="4" class="none">'.NO_ARTIFACTS.'</td>';
|
||||
else
|
||||
{
|
||||
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 1");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
@@ -56,8 +55,6 @@
|
||||
|
||||
<?php
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 2");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
@@ -76,8 +73,6 @@
|
||||
|
||||
<?php
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 3");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
@@ -96,8 +91,6 @@
|
||||
|
||||
<?php
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 4");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
@@ -115,8 +108,6 @@
|
||||
|
||||
<?php
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 5");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
@@ -134,8 +125,6 @@
|
||||
|
||||
<?php
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 6");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
@@ -153,8 +142,6 @@
|
||||
|
||||
<?php
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 7");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
@@ -172,22 +159,6 @@
|
||||
|
||||
<?php
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 2 AND type = 8");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">Treasury <b>10</b>, Effect <b>Account</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
unset($artefact);
|
||||
unset($row);
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE size = 1 AND type = 8");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
@@ -199,6 +170,20 @@
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
<tr><td colspan="4"></td></tr>
|
||||
<?php
|
||||
$artefact = mysqli_query($database->dblink,"SELECT type, id, name, effect, vref, owner FROM `" . TB_PREFIX . "artefacts` WHERE type = 11");
|
||||
while($row = mysqli_fetch_array($artefact)) {
|
||||
echo '<tr>';
|
||||
echo '<td class="icon"><img class="artefact_icon_' . $row['type'] . '" src="img/x.gif" alt="" title=""></td>';
|
||||
echo '<td class="nam">';
|
||||
echo '<a href="build.php?id=' . $id . '&show='.$row['id'].'">' . $row['name'] . '</a> <span class="bon">' . $row['effect'] . '</span><div class="info">'.TREASURY.' <b>10</b>, '.EFFECT.' <b>'.VILLAGE.'</b></div>';
|
||||
echo '</td>';
|
||||
echo '<td class="pla"><a href="karte.php?d=' . $row['vref'] . '&c=' . $generator->getMapCheck($row['vref']) . '">' . $database->getUserField($row['owner'], "username", 0) . '</a></td>';
|
||||
echo '<td class="al"><a href="allianz.php?aid=' . $database->getUserField($row['owner'], "alliance", 0) . '">' . $database->getAllianceName($database->getUserField($row['owner'], "alliance", 0)) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user