From b0208730c98a42902d0965e2f683f7f65a984d34 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 29 Oct 2017 13:51:15 +0100 Subject: [PATCH] fix: village with palace becomes capital --- GameEngine/Automation.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index d8b44000..98c7b524 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -642,7 +642,7 @@ class Automation { if(file_exists("GameEngine/Prevention/build.txt")) { unlink("GameEngine/Prevention/build.txt"); } - global $database,$bid18,$bid10,$bid11,$bid38,$bid39; + global $database,$bid18,$bid10,$bid11,$bid38,$bid39,$session; $time = time(); $array = array(); $q = "SELECT * FROM ".TB_PREFIX."bdata where timestamp < $time and master = 0"; @@ -686,6 +686,12 @@ class Automation { if($indi['type'] == 18){ $this->updateMax($database->getVillageField($indi['wid'],"owner")); } + + if($indi['type'] == 26 && $level=='1'){ + // change capital to this city if we finished up building a palace + $database->query("UPDATE ".TB_PREFIX."vdata SET capital = 0 WHERE owner = ".(int) $session->uid); + $database->query("UPDATE ".TB_PREFIX."vdata SET capital = 1 WHERE owner = ".(int) $session->uid." AND wref = ".(int) $indi['wid']); + } if($indi['type'] == 38) { $max=$database->getVillageField($indi['wid'],"maxstore");