diff --git a/Admin/Templates/config.tpl b/Admin/Templates/config.tpl index ba83787c..1a6e139d 100644 --- a/Admin/Templates/config.tpl +++ b/Admin/Templates/config.tpl @@ -71,6 +71,7 @@ $editIcon = ' ? ? ? + ? ?x ? ? hour/s diff --git a/Admin/Templates/editServerSet.tpl b/Admin/Templates/editServerSet.tpl index 4b198681..e9996d2b 100644 --- a/Admin/Templates/editServerSet.tpl +++ b/Admin/Templates/editServerSet.tpl @@ -202,6 +202,10 @@ function refresh(tz) { ? + + ? + + ? x diff --git a/GameEngine/Admin/Mods/editServerSet.php b/GameEngine/Admin/Mods/editServerSet.php index 1ba36184..fa03b6e3 100755 --- a/GameEngine/Admin/Mods/editServerSet.php +++ b/GameEngine/Admin/Mods/editServerSet.php @@ -182,6 +182,11 @@ $text = admin_config_template_contents(array( tz_config_set($text, '%NATARS_SPAWN_TIME%', $_POST['natars_spawn_time'] ?? ''); tz_config_set($text, '%NATARS_WW_SPAWN_TIME%', $_POST['natars_ww_spawn_time'] ?? ''); tz_config_set($text, '%NATARS_WW_BUILDING_PLAN_SPAWN_TIME%', $_POST['natars_ww_building_plan_spawn_time'] ?? ''); + + // Intarzierea dupa care Natarii isi incep Minunea (zile de la planuri). + $natarsWwDelay = isset($_POST['natars_ww_start_delay']) ? (int) $_POST['natars_ww_start_delay'] : 10; + if ($natarsWwDelay < 0 || $natarsWwDelay > 3650) { $natarsWwDelay = 10; } + tz_config_set($text, '%NATARS_WW_START_DELAY%', $natarsWwDelay); tz_config_set($text, '%NATURE_REGTIME%', $_POST['nature_regtime'] ?? ''); tz_config_set($text, '%OASIS_WOOD_MULTIPLIER%', $_POST['oasis_wood_multiplier'] ?? ''); tz_config_set($text, '%OASIS_CLAY_MULTIPLIER%', $_POST['oasis_clay_multiplier'] ?? ''); diff --git a/GameEngine/Artifacts.php b/GameEngine/Artifacts.php index cd61739a..7dc2f2c8 100644 --- a/GameEngine/Artifacts.php +++ b/GameEngine/Artifacts.php @@ -151,6 +151,37 @@ class Artifacts //All Cropland of the 6th level "f2" => 6, "f8" => 6, "f9" => 6, "f12" => 6, "f13" => 6, "f15" => 6], + /** + * @var array Cladirile capitalei Natarilor + * + * Capitala e satul Minunii Lumii al Natarilor: are Minunea de la bun inceput + * (nivel 0, se construieste ulterior - vezi AutomationNatarsWW), plus + * infrastructura care ii permite sa o ridice. + * + * Sloturile f19-f38 sunt cele 20 de locuri de cladiri; f39 e punctul de + * adunare, f40 zidul, f99 Minunea. Un slot merge la Primarie, restul de 19 + * sunt umplute cu Depozite Mari si Hambare Mari la nivel 20, fiindca + * fiecare nivel de Minune cere sute de mii de resurse. + * + * NOTA: in Travian T4, cele 13 sate de Minune NU au zid sau resedinta, ca + * sa poata fi cucerite fara berbeci. Capitala Natarilor e insa a lor si nu + * se cucereste, deci zidul are sens aici. + */ + + NATARS_CAPITAL_BUILDINGS = [ + //Minunea Lumii (nivel 0, se construieste ulterior) + "f99t" => 40, "f99" => 0, + //Primarie 20, punct de adunare 20, zid 20 (Natarii folosesc zidul de oras) + "f19t" => 24, "f19" => 20, "f39t" => 16, "f39" => 1, "f40t" => 31, "f40" => 20, + //Restul sloturilor: 10 Depozite Mari si 9 Hambare Mari, toate la nivel 20 + "f20t" => 38, "f20" => 20, "f22t" => 38, "f22" => 20, "f24t" => 38, "f24" => 20, + "f26t" => 38, "f26" => 20, "f28t" => 38, "f28" => 20, "f30t" => 38, "f30" => 20, + "f32t" => 38, "f32" => 20, "f34t" => 38, "f34" => 20, "f36t" => 38, "f36" => 20, + "f38t" => 38, "f38" => 20, + "f21t" => 39, "f21" => 20, "f23t" => 39, "f23" => 20, "f25t" => 39, "f25" => 20, + "f27t" => 39, "f27" => 20, "f29t" => 39, "f29" => 20, "f31t" => 39, "f31" => 20, + "f33t" => 39, "f33" => 20, "f35t" => 39, "f35" => 20, "f37t" => 39, "f37" => 20], + /** * @var int The base amount of Natars' spying units, used when Natars account is created */ @@ -226,7 +257,21 @@ class Artifacts $wid = $database->getFreeVillage($possibleWids); //Generate the Natars' capital - $wid = $database->generateVillages([['wid' => $wid, 'mode' => 2, 'type' => 3, 'kid' => 0, 'capital' => 1, 'pop' => 834, 'name' => null, 'natar' => 0]], self::NATARS_UID, TRIBE5); + // + // Capitala primeste de la bun inceput Minunea Lumii si infrastructura + // din NATARS_CAPITAL_BUILDINGS. Lista se transmite in acelasi format ca + // la satele de Minune: [0] = numele coloanelor, [1][] = valorile. + $capitalBuildings = []; + $capitalBuildings[0] = array_keys(self::NATARS_CAPITAL_BUILDINGS); + $capitalBuildings[1][] = array_values(self::NATARS_CAPITAL_BUILDINGS); + + $wid = $database->generateVillages( + [['wid' => $wid, 'mode' => 2, 'type' => 3, 'kid' => 0, 'capital' => 1, 'pop' => 834, 'name' => null, 'natar' => 0]], + self::NATARS_UID, + TRIBE5, + null, + $capitalBuildings + ); //Scouts all players $this->scoutAllPlayers($wid); diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 691aa6a0..1d85b4e0 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -72,6 +72,7 @@ include_once __DIR__ . '/Automation/AutomationTraining.php'; include_once __DIR__ . '/Automation/AutomationHero.php'; include_once __DIR__ . '/Automation/AutomationStarvation.php'; include_once __DIR__ . '/Automation/AutomationNatarsWW.php'; +include_once __DIR__ . '/Automation/AutomationNatarsWWBuild.php'; include_once __DIR__ . '/Automation/AutomationMedals.php'; include_once __DIR__ . '/Automation/AutomationCleanup.php'; include_once __DIR__ . '/Automation/AutomationPlayerStatistics.php'; @@ -88,6 +89,7 @@ class Automation { use AutomationHero; use AutomationStarvation; use AutomationNatarsWW; + use AutomationNatarsWWBuild; use AutomationMedals; @@ -138,7 +140,8 @@ class Automation { "heroAdventureComplete", // P3: curatenie periodica (are interval propriu, nu ruleaza la fiecare tick) "cleanupOldData", - "recordPlayerStatistics"]; + "recordPlayerStatistics", + "buildNatarsWonder"]; foreach($methodsArrays as $method){ $file = fopen($autoprefix."GameEngine/Prevention/".$method.".txt", "w"); diff --git a/GameEngine/Automation/AutomationNatarsWWBuild.php b/GameEngine/Automation/AutomationNatarsWWBuild.php new file mode 100644 index 00000000..ac00ba7a --- /dev/null +++ b/GameEngine/Automation/AutomationNatarsWWBuild.php @@ -0,0 +1,105 @@ +areArtifactsSpawned(true)) { + return false; + } + + $planTime = strtotime(START_DATE) + + ((defined('NATARS_WW_BUILDING_PLAN_SPAWN_TIME') ? (int) NATARS_WW_BUILDING_PLAN_SPAWN_TIME : 0) * 86400); + + $speed = (defined('SPEED') && SPEED > 0) ? (float) SPEED : 1.0; + $startAt = $planTime + (int) round($delay * 86400 / $speed); + + if (time() < $startAt) { + return false; + } + + $natarUid = defined('NATARS_UID') ? (int) NATARS_UID : 2; + + // capitala Natarilor: satul lor care are slotul de Minune + $res = mysqli_query($database->dblink, + "SELECT v.wref, f.f99 AS level + FROM " . TB_PREFIX . "vdata v + JOIN " . TB_PREFIX . "fdata f ON f.vref = v.wref + WHERE v.owner = " . $natarUid . " AND v.capital = 1 AND f.f99t = 40 + LIMIT 1"); + + $row = $res ? mysqli_fetch_assoc($res) : null; + + if (!$row) { + return false; + } + + $wref = (int) $row['wref']; + $level = (int) $row['level']; + + if ($level >= 100) { + return false; // gata, nu mai are ce urca + } + + // Un nivel deja in lucru? Coada de constructii tine randul in bdata. + $busy = mysqli_query($database->dblink, + "SELECT COUNT(*) AS total FROM " . TB_PREFIX . "bdata WHERE wid = " . $wref); + $busyRow = $busy ? mysqli_fetch_assoc($busy) : null; + + if ($busyRow && (int) $busyRow['total'] > 0) { + return false; // asteptam sa se termine nivelul curent + } + + $next = $level + 1; + + if (!isset($bid40[$next]['time'])) { + return false; + } + + // Timpul REAL din datele de joc, scalat cu viteza serverului - la fel ca + // pentru orice alta constructie. Natarii nu sar peste el. + $buildTime = (int) max(1, round($bid40[$next]['time'] / $speed)); + + // Folosim metoda jocului, nu SQL propriu: ea actualizeaza si tipul + // cladirii in fdata si respecta formatul cozii. + $ok = $database->addBuilding($wref, 99, 40, 0, time() + $buildTime, 0, $next); + + if (!$ok) { + error_log('[TravianZ] Natars WW: constructia nu a pornit: ' + . mysqli_error($database->dblink)); + + return false; + } + + return true; + } +} diff --git a/GameEngine/Lang/en.php b/GameEngine/Lang/en.php index 408f2363..740bc559 100755 --- a/GameEngine/Lang/en.php +++ b/GameEngine/Lang/en.php @@ -4291,3 +4291,10 @@ tz_def('TZ_RPT_ALL_RESULTS', 'All results'); tz_def('TZ_RPT_F_WON_NOLOSS', 'Won without losses'); tz_def('TZ_RPT_F_WON_LOSS', 'Won with losses'); tz_def('TZ_RPT_F_LOST', 'Lost'); + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// MINUNEA LUMII A NATARILOR +////////////////////////////////////////////////////////////////////////////////////////////////////// +tz_def('TZ_WW_NATARS', 'Natars'); +tz_def('CONF_SERV_NATARS_WW_START_DELAY', 'Natars\' World Wonder start'); +tz_def('CONF_SERV_NATARS_WW_START_DELAY_TOOLTIP', 'How many days after the construction plans appear the Natars start building their own World Wonder. Scaled by server speed. 0 disables it.'); diff --git a/GameEngine/Lang/fr.php b/GameEngine/Lang/fr.php index 0c1d0813..ee1aa2ec 100644 --- a/GameEngine/Lang/fr.php +++ b/GameEngine/Lang/fr.php @@ -4234,3 +4234,10 @@ tz_def('TZ_RPT_ALL_RESULTS', 'Tous les résultats'); tz_def('TZ_RPT_F_WON_NOLOSS', 'Gagné sans pertes'); tz_def('TZ_RPT_F_WON_LOSS', 'Gagné avec pertes'); tz_def('TZ_RPT_F_LOST', 'Perdu'); + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// MINUNEA LUMII A NATARILOR +////////////////////////////////////////////////////////////////////////////////////////////////////// +tz_def('TZ_WW_NATARS', 'Natars'); +tz_def('CONF_SERV_NATARS_WW_START_DELAY', 'Debut de la Merveille des Natars'); +tz_def('CONF_SERV_NATARS_WW_START_DELAY_TOOLTIP', 'Combien de jours apres l\'apparition des plans de construction les Natars commencent leur propre Merveille du Monde. Ajuste selon la vitesse du serveur. 0 desactive.'); diff --git a/GameEngine/Lang/ro.php b/GameEngine/Lang/ro.php index 8270e9ed..c291c9d2 100644 --- a/GameEngine/Lang/ro.php +++ b/GameEngine/Lang/ro.php @@ -4031,3 +4031,10 @@ tz_def('TZ_RPT_ALL_RESULTS', 'Toate rezultatele'); tz_def('TZ_RPT_F_WON_NOLOSS', 'Castigat fara pierderi'); tz_def('TZ_RPT_F_WON_LOSS', 'Castigat cu pierderi'); tz_def('TZ_RPT_F_LOST', 'Pierdut'); + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// MINUNEA LUMII A NATARILOR +////////////////////////////////////////////////////////////////////////////////////////////////////// +tz_def('TZ_WW_NATARS', 'Natari'); +tz_def('CONF_SERV_NATARS_WW_START_DELAY', 'Pornirea Minunii Natarilor'); +tz_def('CONF_SERV_NATARS_WW_START_DELAY_TOOLTIP', 'Dupa cate zile de la aparitia planurilor incep Natarii propria Minune a Lumii. Se scaleaza cu viteza serverului. 0 dezactiveaza.'); diff --git a/Templates/Ranking/ww.tpl b/Templates/Ranking/ww.tpl index c6140301..1c9ef615 100644 --- a/Templates/Ranking/ww.tpl +++ b/Templates/Ranking/ww.tpl @@ -56,6 +56,13 @@ if (WW == true) { $result = mysqli_query($database->dblink, $sql); ?> + @@ -82,14 +89,23 @@ if ($result && mysqli_num_rows($result) > 0) { $count++; $check = $generator->getMapCheck($row['wref']); + + // Minunea Natarilor se evidentiaza: nu e a unui jucator, iar cand ajunge + // la nivelul 100 serverul se incheie - merita sa sara in ochi. + $isNatarWW = (defined('NATARS_UID') && (int) $row['id'] === (int) NATARS_UID); ?> - + > diff --git a/install/data/constant_format.tpl b/install/data/constant_format.tpl index 7ee8f971..6c9e599e 100644 --- a/install/data/constant_format.tpl +++ b/install/data/constant_format.tpl @@ -275,7 +275,15 @@ define("NATARS_UNITS",%NATARS_UNITS%); // ***** Natars Spawn Time define("NATARS_SPAWN_TIME",%NATARS_SPAWN_TIME%); define("NATARS_WW_SPAWN_TIME",%NATARS_WW_SPAWN_TIME%); -define("NATARS_WW_BUILDING_PLAN_SPAWN_TIME",%NATARS_WW_BUILDING_PLAN_SPAWN_TIME%); +define("NATARS_WW_BUILDING_PLAN_SPAWN_TIME",%NATARS_WW_BUILDING_PLAN_SPAWN_TIME%); + +// ***** Natars' World Wonder +// Dupa cate ZILE de la aparitia planurilor de constructie incep Natarii sa-si +// ridice propria Minune a Lumii. In Travian, cand ajung la nivelul 100 se +// incheie serverul; la nivelul 75 isi recheama toate trupele ca s-o apere. +// +// 0 = Natarii nu construiesc deloc. +define("NATARS_WW_START_DELAY", %NATARS_WW_START_DELAY%); // ***** Nature troops regeneration time define("NATURE_REGTIME",%NATURE_REGTIME%); diff --git a/install/process.php b/install/process.php index d77be357..9b73cd01 100644 --- a/install/process.php +++ b/install/process.php @@ -241,6 +241,11 @@ class Process { $findReplace["%NATARS_SPAWN_TIME%"] = $_POST['natars_spawn_time']; $findReplace["%NATARS_WW_SPAWN_TIME%"] = $_POST['natars_ww_spawn_time']; $findReplace["%NATARS_WW_BUILDING_PLAN_SPAWN_TIME%"] = $_POST['natars_ww_building_plan_spawn_time']; + + // Dupa cate zile de la aparitia planurilor incep Natarii Minunea lor. + $natarsWwDelay = isset($_POST['natars_ww_start_delay']) ? (int) $_POST['natars_ww_start_delay'] : 10; + if ($natarsWwDelay < 0 || $natarsWwDelay > 3650) { $natarsWwDelay = 10; } + $findReplace["%NATARS_WW_START_DELAY%"] = $natarsWwDelay; $findReplace["%NATURE_REGTIME%"] = $_POST['nature_regtime']; $findReplace["%OASIS_WOOD_MULTIPLIER%"] = $_POST['oasis_wood_multiplier']; $findReplace["%OASIS_CLAY_MULTIPLIER%"] = $_POST['oasis_clay_multiplier']; diff --git a/install/templates/config.tpl b/install/templates/config.tpl index 33dc160b..f547e47c 100644 --- a/install/templates/config.tpl +++ b/install/templates/config.tpl @@ -141,6 +141,7 @@ $dbPrefix = $_SESSION['install_random_prefix'];
+
. + + +