From a584c6815364f9b95f357745085b2a924719b982 Mon Sep 17 00:00:00 2001 From: novgorodschi catalin Date: Tue, 4 Aug 2026 09:40:41 +0300 Subject: [PATCH] Fix Huns Loiality Regeneration & WW cannot be change to capital Fix Huns Loiality Regeneration & WW cannot be change to capital --- .../Automation/AutomationVillageUpkeep.php | 26 +++++++++++++++---- GameEngine/Lang/en.php | 5 ++++ GameEngine/Lang/fr.php | 5 ++++ GameEngine/Lang/ro.php | 7 ++++- Templates/Build/26.tpl | 20 +++++++++++++- Templates/Build/44.tpl | 23 +++++++++++++++- 6 files changed, 78 insertions(+), 8 deletions(-) diff --git a/GameEngine/Automation/AutomationVillageUpkeep.php b/GameEngine/Automation/AutomationVillageUpkeep.php index 0938d51a..39b8aec2 100644 --- a/GameEngine/Automation/AutomationVillageUpkeep.php +++ b/GameEngine/Automation/AutomationVillageUpkeep.php @@ -87,12 +87,28 @@ trait AutomationVillageUpkeep { $array = $database->getProfileVillages(0, 6); if(!empty($array)) { foreach($array as $loyalty) { - if (($t25_level = $this->getTypeLevel(25, $loyalty['wref'])) >= 1) { - $value = $t25_level; - }elseif(($t26_level = $this->getTypeLevel(26, $loyalty['wref'])) >= 1){ - $value = $t26_level; + /** + * Cladirile care regenereaza loialitatea. + * + * BUG REPARAT: se verificau doar Resedinta (25) si Palatul (26). + * Hunii nu au niciuna din ele - au Centrul de Comanda (44), care + * le tine locul. Satele lor nu-si mai regenerau loialitatea + * niciodata, deci ramaneau vesnic vulnerabile la cucerire. + * + * Restul jocului trateaza deja gid 44 ca resedinta - vezi + * AutomationBattleResolution, unde se calculeaza sloturile de + * expansiune - doar aici lipsea. + */ + $value = 0; + + foreach (array(25, 26, 44) as $loyaltyBuilding) { + $lvl = $this->getTypeLevel($loyaltyBuilding, $loyalty['wref']); + + if ($lvl >= 1) { + $value = $lvl; + break; + } } - else $value = 0; if($value > 0){ $newloyalty = min(100, $loyalty['loyalty'] + $value * (time() - $loyalty['lastupdate2']) / 3600); diff --git a/GameEngine/Lang/en.php b/GameEngine/Lang/en.php index 49c243be..b67c20ec 100755 --- a/GameEngine/Lang/en.php +++ b/GameEngine/Lang/en.php @@ -4350,3 +4350,8 @@ tz_def('HERO_COL_ACTION', 'Action'); ////////////////////////////////////////////////////////////////////////////////////////////////////// tz_def('ADM_WW_IMAGE', 'Per-tribe World Wonder'); tz_def('ADM_WW_IMAGE_TIP', 'Each tribe sees its own World Wonder artwork, both on the village map and on the construction page. Tribes without artwork on disk keep the original image regardless of this setting.'); + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// MINUNEA LUMII - satul nu poate fi capitala +////////////////////////////////////////////////////////////////////////////////////////////////////// +tz_def('TZ_WW_NO_CAPITAL', 'The World Wonder village cannot become your capital.'); diff --git a/GameEngine/Lang/fr.php b/GameEngine/Lang/fr.php index 3d71a780..75635cb0 100644 --- a/GameEngine/Lang/fr.php +++ b/GameEngine/Lang/fr.php @@ -4293,3 +4293,8 @@ tz_def('HERO_COL_ACTION', 'Action'); ////////////////////////////////////////////////////////////////////////////////////////////////////// tz_def('ADM_WW_IMAGE', 'Merveille par tribu'); tz_def('ADM_WW_IMAGE_TIP', 'Chaque tribu voit sa propre Merveille du Monde, sur la carte du village et sur la page de construction. Les tribus sans images gardent l\'image d\'origine, quel que soit ce reglage.'); + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// MINUNEA LUMII - satul nu poate fi capitala +////////////////////////////////////////////////////////////////////////////////////////////////////// +tz_def('TZ_WW_NO_CAPITAL', 'Le village de la Merveille du Monde ne peut pas devenir votre capitale.'); diff --git a/GameEngine/Lang/ro.php b/GameEngine/Lang/ro.php index d54e07f9..7a8cd220 100644 --- a/GameEngine/Lang/ro.php +++ b/GameEngine/Lang/ro.php @@ -2178,7 +2178,7 @@ tz_def('TZ_IN_THE_VILLAGE_YOU_CAN_BUILD_BUILD', 'În sat poți construi clădiri tz_def('TZ_IRON_25_5_GOLD', 'Fier +25% (5 aur)'); tz_def('TZ_ISO_YY_MM_DD_24H', 'ISO (aa/ll/zz 24h)'); tz_def('TZ_ITALIAN', 'Italiană'); -tz_def('TZ_SPANISH', 'Spaniola'); +tz_def('TZ_SPANISH', 'Spaniolă'); tz_def('TZ_I_ACTIVATED_PLUS_BUT_PRODUCTION_DI', 'Am activat Plus, dar producția nu a crescut.'); tz_def('TZ_JOIN_AN_ALLIANCE', 'Alătură-te unei alianțe'); tz_def('TZ_JOIN_AN_ALLIANCE_OR_FOUND_ONE_ON_Y', 'Alătură-te unei alianțe sau întemeiază una proprie.'); @@ -4090,3 +4090,8 @@ tz_def('HERO_COL_ACTION', 'Actiune'); ////////////////////////////////////////////////////////////////////////////////////////////////////// tz_def('ADM_WW_IMAGE', 'Minune pe trib'); tz_def('ADM_WW_IMAGE_TIP', 'Fiecare trib isi vede propria Minune a Lumii, atat pe harta satului cat si in pagina de constructie. Triburile fara imagini pe disc raman pe imaginea originala, indiferent de setare.'); + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// MINUNEA LUMII - satul nu poate fi capitala +////////////////////////////////////////////////////////////////////////////////////////////////////// +tz_def('TZ_WW_NO_CAPITAL', 'Satul Minunii Lumii nu poate deveni capitala.'); diff --git a/Templates/Build/26.tpl b/Templates/Build/26.tpl index 2a3f88a5..7acd128e 100644 --- a/Templates/Build/26.tpl +++ b/Templates/Build/26.tpl @@ -24,7 +24,19 @@ if(time() - (!empty($_SESSION['time_p']) ? $_SESSION['time_p'] : 0) > 5){ $_SESSION['error_p'] = ''; } // --- CHANGE CAPITAL LOGIC --- -if($_POST && $_GET['action'] == 'change_capital' && !$village->capital){ +/** + * Satul Minunii Lumii NU poate deveni capitala. + * + * Capitala are reguli proprii - campurile de resurse urca peste 10, primeste + * Atelierul Pietrarului, iar cladirile capital-only se sterg la mutare. Un sat + * de Minune cucerit de la Natari nu suporta asta. + * + * Blocam si actiunea, nu doar butonul: altfel cererea putea fi trimisa direct. + */ +$isWonderVillage = isset($village->resarray['f99t']) + && (int) $village->resarray['f99t'] == 40; + +if($_POST && $_GET['action'] == 'change_capital' && !$village->capital && !$isWonderVillage){ $pass = $_POST['pass']; $query = mysqli_query($database->dblink, 'SELECT password FROM `'.TB_PREFIX.'users` WHERE `id` = '.(int)$session->uid); $data = mysqli_fetch_assoc($query); @@ -99,6 +111,12 @@ if($village->capital == 1) { ?>

+

+» '.CHANGE_CAPITAL.'

'; diff --git a/Templates/Build/44.tpl b/Templates/Build/44.tpl index c270b231..8d6f51c9 100644 --- a/Templates/Build/44.tpl +++ b/Templates/Build/44.tpl @@ -26,7 +26,22 @@ if(time() - (!empty($_SESSION['time_p']) ? $_SESSION['time_p'] : 0) > 5){ $_SESSION['error_p'] = ''; } // --- CHANGE CAPITAL LOGIC (Command Center = echivalentul Palatului la Huni) --- -if($_POST && isset($_GET['action']) && $_GET['action'] == 'change_capital' && !$village->capital){ + /** + * Satul Minunii Lumii NU poate deveni capitala. + * + * Capitala are reguli proprii - campurile de resurse urca peste 10, primeste + * Atelierul Pietrarului, iar cladirile capital-only se sterg la mutare. Un + * sat de Minune cucerit de la Natari nu suporta asta: si-ar pierde cladiri + * si ar intra intr-o stare imposibila. + * + * In Travian, satul Minunii nu e niciodata capitala. Ascundem butonul si, + * mai important, blocam si actiunea - altfel cineva ar putea trimite cererea + * direct, fara sa treaca prin buton. + */ + $isWonderVillage = isset($village->resarray['f99t']) + && (int) $village->resarray['f99t'] == 40; + +if($_POST && isset($_GET['action']) && $_GET['action'] == 'change_capital' && !$village->capital && !$isWonderVillage){ $pass = $_POST['pass']; $query = mysqli_query($database->dblink, 'SELECT password FROM `'.TB_PREFIX.'users` WHERE `id` = '.(int)$session->uid); $data = mysqli_fetch_assoc($query); @@ -107,6 +122,12 @@ $level = (int)$village->resarray['f'.$id]; // --- CAPITALA: afisare stare / schimbare (identic cu Palatul) --- if($village->capital == 1) { echo '

'.CAPITAL.'

'; + } elseif ($isWonderVillage) { + // satul Minunii nu poate fi capitala + echo '

' + . (defined('TZ_WW_NO_CAPITAL') ? TZ_WW_NO_CAPITAL + : 'The World Wonder village cannot become your capital.') + . '

'; } else { if(empty($_GET['confirm'])) { print '

» '.CHANGE_CAPITAL.'

';