Fixed an artefact bug

+Fixed a bug that prevented the destruction of a village, if it had 0
population with no artefacts inside
+Some clean-up
This commit is contained in:
iopietro
2018-04-08 22:55:33 +02:00
parent a8b474bc01
commit 72fd81b69b
2 changed files with 13 additions and 17 deletions
+11 -7
View File
@@ -157,7 +157,7 @@ class Automation {
//default: $build = "Nothing had"; break; //default: $build = "Nothing had"; break;
} }
if ($build=="" & !$mode) { //capital or only 1 village left.. not destroy if ($build=="" && !$mode) { //capital or only 1 village left.. not destroy
$build="Village can't be"; $build="Village can't be";
} }
@@ -2705,10 +2705,10 @@ class Automation {
if(($data['t11']-$dead11-$traped11)> 0){ //hero if(($data['t11']-$dead11-$traped11)> 0){ //hero
if ($heroxp == 0) { if ($heroxp == 0) {
$xp=""; $xp="";
$info_hero = $hero_pic.",Your hero had nothing to kill therefore gains no XP at all"; $info_hero = $hero_pic.",Your hero had nothing to kill therefore gains no XP at all.";
} else { } else {
$xp=" and gained ".$heroxp." XP from the battle"; $xp=" and gained ".$heroxp." XP from the battle.";
$info_hero = $hero_pic.",Your hero gained ".$heroxp." XP"; $info_hero = $hero_pic.",Your hero gained ".$heroxp." XP.";
} }
if ($isoasis != 0) { //oasis fix by ronix if ($isoasis != 0) { //oasis fix by ronix
@@ -2736,9 +2736,9 @@ class Automation {
} else { } else {
global $form; global $form;
if ($heroxp == 0) { if ($heroxp == 0) {
$xp=" no XP from the battle"; $xp=" no XP from the battle.";
} else { } else {
$xp=" gained ".$heroxp." XP from the battle"; $xp=" gained ".$heroxp." XP from the battle.";
} }
$artifact = reset($database->getOwnArtefactInfo($data['to'])); $artifact = reset($database->getOwnArtefactInfo($data['to']));
if (!empty($artifact)) { if (!empty($artifact)) {
@@ -2746,6 +2746,10 @@ class Automation {
if ($database->canClaimArtifact($data['from'],$artifact['vref'],$artifact['size'],$artifact['type'])) { if ($database->canClaimArtifact($data['from'],$artifact['vref'],$artifact['size'],$artifact['type'])) {
$database->claimArtefact($data['from'],$data['to'],$database->getVillageField($data['from'],"owner")); $database->claimArtefact($data['from'],$data['to'],$database->getVillageField($data['from'],"owner"));
$info_hero = $hero_pic.",Your hero is carrying home an artefact".$xp; $info_hero = $hero_pic.",Your hero is carrying home an artefact".$xp;
if($pop == 0){
$can_destroy = $village_destroyed = 1;
$info_hero .= ". The village has been destroyed.";
}
} else { } else {
$info_hero = $hero_pic.",".$form->getError("error").$xp; $info_hero = $hero_pic.",".$form->getError("error").$xp;
} }
@@ -2758,7 +2762,7 @@ class Automation {
if ($heroxp == 0) { if ($heroxp == 0) {
$xp=""; $xp="";
} else { } else {
$xp=" but gained ".$heroxp." XP from the battle"; $xp=" but gained ".$heroxp." XP from the battle.";
} }
if ($traped11>0) { if ($traped11>0) {
$info_hero = $hero_pic.",Your hero was trapped".$xp; $info_hero = $hero_pic.",Your hero was trapped".$xp;
+2 -10
View File
@@ -7230,16 +7230,8 @@ References: User ID/Message ID, Mode
for ( $i = 19; $i <= 38; $i ++ ) { for ( $i = 19; $i <= 38; $i ++ ) {
if ( $AttackerFields[ 'f' . $i . 't' ] == 27 ) { if ( $AttackerFields[ 'f' . $i . 't' ] == 27 ) {
$attTresuaryLevel = $AttackerFields[ 'f' . $i ]; $attTresuaryLevel = $AttackerFields[ 'f' . $i ];
if ( $attTresuaryLevel >= 10 ) { $villageartifact = $attTresuaryLevel >= 10;
$villageartifact = true; $accountartifact = $attTresuaryLevel >= 20;
} else {
$villageartifact = false;
}
if ( $attTresuaryLevel >= 20 ) {
$accountartifact = true;
} else {
$accountartifact = false;
}
} }
} }