diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 79246fa7..9d73ef96 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -124,9 +124,6 @@ class Automation { if(!file_exists("GameEngine/Prevention/updatehero.txt") or time()-filemtime("GameEngine/Prevention/updatehero.txt")>50) { $this->updateHero(); } - if(!file_exists("GameEngine/Prevention/research.txt") or time()-filemtime("GameEngine/Prevention/research.txt")>10) { - $this->researchComplete(); - } if(!file_exists("GameEngine/Prevention/cleardeleting.txt") or time()-filemtime("GameEngine/Prevention/cleardeleting.txt")>10) { $this->clearDeleting(); } @@ -134,17 +131,28 @@ class Automation { { $this->buildComplete(); } + $this->MasterBuilder(); + if (! file_exists("GameEngine/Prevention/demolition.txt") or time() - filemtime("GameEngine/Prevention/demolition.txt") > 10) + { + $this->demolitionComplete(); + } $this->updateStore(); if(!file_exists("GameEngine/Prevention/market.txt") or time()-filemtime("GameEngine/Prevention/market.txt")>10) { $this->marketComplete(); + } + if(!file_exists("GameEngine/Prevention/research.txt") or time()-filemtime("GameEngine/Prevention/research.txt")>10) { + $this->researchComplete(); } if(!file_exists("GameEngine/Prevention/training.txt") or time()-filemtime("GameEngine/Prevention/training.txt")>10) { $this->trainingComplete(); } + if(!file_exists("GameEngine/Prevention/celebration.txt") or time()-filemtime("GameEngine/Prevention/celebration.txt")>10) { + $this->celebrationComplete(); + } if(!file_exists("GameEngine/Prevention/sendunits.txt") or time()-filemtime("GameEngine/Prevention/sendunits.txt")>10) { $this->sendunitsComplete(); } - if(!file_exists("GameEngine/Prevention/loyalty.txt") or time()-filemtime("GameEngine/Prevention/loyalty.txt")>50) { + if(!file_exists("GameEngine/Prevention/loyalty.txt") or time()-filemtime("GameEngine/Prevention/loyalty.txt")>50) { $this->loyaltyRegeneration(); } if(!file_exists("GameEngine/Prevention/sendreinfunits.txt") or time()-filemtime("GameEngine/Prevention/sendreinfunits.txt")>10) { @@ -156,15 +164,7 @@ class Automation { if(!file_exists("GameEngine/Prevention/settlers.txt") or time()-filemtime("GameEngine/Prevention/settlers.txt")>10) { $this->sendSettlersComplete(); } - if(!file_exists("GameEngine/Prevention/celebration.txt") or time()-filemtime("GameEngine/Prevention/celebration.txt")>10) { - $this->celebrationComplete(); - } - if (! file_exists("GameEngine/Prevention/demolition.txt") or time() - filemtime("GameEngine/Prevention/demolition.txt") > 10) - { - $this->demolitionComplete(); - } $this->updateStore(); - $this->MasterBuilder(); } function activeCropDead(){ @@ -278,7 +278,7 @@ if (array_sum($unitarr)>0){ } } -private function loyaltyRegeneration() { + private function loyaltyRegeneration() { global $database; $array = array(); $q = "SELECT * FROM ".TB_PREFIX."vdata WHERE loyalty<>100"; @@ -501,7 +501,7 @@ private function loyaltyRegeneration() { $array = $database->query_return($q); foreach($array as $indi) { - if($indi['lastupdate'] <= $time){ + if($indi['lastupdate'] <= $time && $indi['lastupdate'] > 0){ $cp = $database->getVSumField($indi['id'], 'cp') * (time()-$indi['lastupdate'])/86400; $newupdate = time(); diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 59d93478..4a292023 100644 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -630,6 +630,7 @@ class Building { global $database,$session,$logging,$village,$bid18,$bid10,$bid11,$technology,$_SESSION; if($session->access!=BANNED){ if($session->gold >= 2){ + foreach($this->buildArray as $jobs) { if($jobs['wid']==$village->wid){ $wwvillage = $database->getResourceLevel($jobs['wid']); @@ -637,8 +638,7 @@ class Building { $level = $database->getFieldLevel($jobs['wid'],$jobs['field']); $level = ($level == -1) ? 0 : $level; if($jobs['type'] != 25 AND $jobs['type'] != 26 AND $jobs['type'] != 40) { - $gold=$database->getUserField($_SESSION['username'],'gold','username'); - $gold-=2; + $finish = 1; $database->updateUserField($_SESSION['username'],'gold',$gold,0); $resource = $this->resourceRequired($jobs['field'],$jobs['type']); $q = "UPDATE ".TB_PREFIX."fdata set f".$jobs['field']." = f".$jobs['field']." + 1, f".$jobs['field']."t = ".$jobs['type']." where vref = ".$jobs['wid']; @@ -685,6 +685,10 @@ class Building { } if(($jobs['field'] >= 19 && ($session->tribe == 1 || ALLOW_ALL_TRIBE)) || (!ALLOW_ALL_TRIBE && $session->tribe != 1)) { $innertimestamp = $jobs['timestamp']; } } + if($finish == 1){ + $gold=$database->getUserField($_SESSION['username'],'gold','username'); + $gold-=2; + } } } } diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index 9c8aa799..b97bcdb7 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -21,7 +21,7 @@ function register($username, $password, $email, $tribe, $locate, $act) { $time = time(); $timep = (time() + PROTECTION); - $q = "INSERT INTO " . TB_PREFIX . "users (username,password,access,email,timestamp,tribe,location,act,protect,regtime) VALUES ('$username', '$password', " . USER . ", '$email', $time, $tribe, $locate, '$act', $timep, $time)"; + $q = "INSERT INTO " . TB_PREFIX . "users (username,password,access,email,timestamp,tribe,location,act,protect,lastupdate,regtime) VALUES ('$username', '$password', " . USER . ", '$email', $time, $tribe, $locate, '$act', $timep, $time, $time)"; if(mysql_query($q, $this->connection)) { return mysql_insert_id($this->connection); } else { diff --git a/GameEngine/Profile.php b/GameEngine/Profile.php index 0fa03ace..96da08b2 100644 --- a/GameEngine/Profile.php +++ b/GameEngine/Profile.php @@ -81,7 +81,7 @@ class Profile { $database->submitProfile($database->RemoveXSS($post['uid']),$database->RemoveXSS($post['mw']),$database->RemoveXSS($post['ort']),$database->RemoveXSS($birthday),$database->RemoveXSS($post['be2']),$database->RemoveXSS($post['be1'])); $varray = $database->getProfileVillages($post['uid']); for($i=0;$i<=count($varray)-1;$i++) { - $database->setVillageName($database->RemoveXSS($varray[$i]['wref']),$database->RemoveXSS($post['dname'.$i])); + $database->setVillageName($database->RemoveXSS($varray[$i]['wref']),$post['dname'.$i]); } header("Location: ?uid=".$post['uid']); }else{ diff --git a/Templates/Build/37_train.tpl b/Templates/Build/37_train.tpl index f294f4d7..ad917768 100644 --- a/Templates/Build/37_train.tpl +++ b/Templates/Build/37_train.tpl @@ -21,8 +21,8 @@ if($session->tribe == 1) { $output.="
- \"Legionnaire\" - Legionnaire + \"".U1."\" + ".U1."
\"Wood\"".$u1['wood']."| @@ -54,8 +54,8 @@ if($session->tribe == 1) { $output.="
- \"Praetorian\" - Praetorian + \"".U2."\" + ".U2."
\"Wood\"".$u2['wood']."| @@ -87,8 +87,8 @@ if($session->tribe == 1) { $output.="
- \"Imperian\" - Imperian + \"".U3."\" + ".U3."
\"Wood\"".$u3['wood']."| @@ -120,8 +120,8 @@ if($session->tribe == 1) { $output.= "
- \"Equites - Equites Imperatoris + \"".U5."\" + ".U5."
\"Wood\"".$u5['wood']."| @@ -151,8 +151,8 @@ if($session->tribe == 1) { $output.="
- \"Equites - Equites Caesaris + \"".U6."\" + ".U6."
\"Wood\"".$u6['wood']."| @@ -185,8 +185,8 @@ if($session->tribe == 2) { $output.="
- \"Clubswinger\" - Clubswinger + \"".U11."\" + ".U11."
\"Wood\"".$u11['wood']."| @@ -216,8 +216,8 @@ $output.=" $output.="
- \"Clubswinger\" - Clubswinger + \"".U12."\" + ".U12."
\"Wood\"".$u12['wood']."| @@ -248,8 +248,8 @@ $output.=" $output.="
- \"Clubswinger\" - Clubswinger + \"".U13."\" + ".U13."
\"Wood\"".$u13['wood']."| @@ -279,8 +279,8 @@ $output.=" $output.="
- \"Clubswinger\" - Clubswinger + \"".U15."\" + ".U15."
\"Wood\"".$u15['wood']."| @@ -311,8 +311,8 @@ $output.=" $output.="
- \"Clubswinger\" - Clubswinger + \"".U16."\" + ".U16."
\"Wood\"".$u16['wood']."| @@ -345,8 +345,8 @@ if($session->tribe == 3) { $output.="
- \"Phalanx\" - Phalanx + \"".U21."\" + ".U21."
\"Wood\"".$u21['wood']."| @@ -376,8 +376,8 @@ $output.=" $output.="
- \"Clubswinger\" - Clubswinger + \"".U22."\" + ".U22."
\"Wood\"".$u22['wood']."| @@ -408,8 +408,8 @@ $output.=" $output.="
- \"Clubswinger\" - Clubswinger + \"".U24."\" + ".U24."
\"Wood\"".$u24['wood']."| @@ -439,8 +439,8 @@ $output.=" $output.="
- \"Clubswinger\" - Clubswinger + \"".U25."\" + ".U25."
\"Wood\"".$u25['wood']."| @@ -471,8 +471,8 @@ $output.=" $output.="
- \"Clubswinger\" - Clubswinger + \"".U26."\" + ".U26."
\"Wood\"".$u26['wood']."| diff --git a/install/templates/config.tpl b/install/templates/config.tpl index 852e87b7..6726269d 100644 --- a/install/templates/config.tpl +++ b/install/templates/config.tpl @@ -36,12 +36,12 @@ echo "
Error creating constant.php Beginners protection length: Plus account length: