Fixed an artefact bug

+Fixed a bug that prevented the conquer of an artefact between two
villages of the same owner
This commit is contained in:
iopietro
2018-04-08 21:49:13 +02:00
parent 49a0c1377f
commit a8b474bc01
+13 -12
View File
@@ -7191,22 +7191,23 @@ References: User ID/Message ID, Mode
$size1 = $size2 = $size3 = 0; $size1 = $size2 = $size3 = 0;
$artifact = $this->getOwnArtefactInfo( $from ); $artifact = $this->getOwnArtefactInfo( $from );
if ( ! empty( $artifact ) ) { if (!empty($artifact)) {
$form->addError( "error", "Treasury is full. Your hero could not claim the artefact" ); $form->addError( "error", "Treasury is full. Your hero could not claim the artefact" );
return false; return false;
} }
$uid = $session->uid;
$q = " $uid = $this->getVillageField($from, "owner");
SELECT Count(size) AS totals, $vuid = $this->getVillageField($vref, "owner");
SUM(IF(size = '1',1,0)) small,
SUM(IF(size = '2',1,0)) great, $q = "SELECT Count(size) AS totals,
SUM(IF(size = '3',1,0)) `unique` SUM(IF(size = '1',1,0)) small,
FROM " . TB_PREFIX . "artefacts WHERE owner = " . (int) $uid; SUM(IF(size = '2',1,0)) great,
$result = mysqli_query( $this->dblink, $q ); SUM(IF(size = '3',1,0)) `unique`
FROM " . TB_PREFIX . "artefacts WHERE owner = " . (int) $uid;
$result = mysqli_query( $this->dblink, $q );
$artifact = $this->mysqli_fetch_all( $result )[0]; $artifact = $this->mysqli_fetch_all( $result )[0];
if ( $artifact['totals'] < 3 || $type == 11 ) { if ( $artifact['totals'] < 3 || $type == 11 || $uid == $vuid) {
$DefenderFields = $this->getResourceLevel( $vref ); $DefenderFields = $this->getResourceLevel( $vref );
$defcanclaim = true; $defcanclaim = true;
@@ -7242,7 +7243,7 @@ References: User ID/Message ID, Mode
} }
} }
if ( ( $artifact['great'] > 0 || $artifact['unique'] > 0 ) && $size > 1 ) { if (($artifact['great'] > 0 || $artifact['unique'] > 0) && $size > 1 && $uid != $vuid) {
$form->addError( "error", "Max num. of great/unique artefacts. Your hero could not claim the artefact" ); $form->addError( "error", "Max num. of great/unique artefacts. Your hero could not claim the artefact" );
return false; return false;
} }