diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 186af892..3c8ec073 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -3829,9 +3829,13 @@ class Automation { // Checked right after the new village row exists, so the // COUNT below already includes it. if (defined('NEW_FUNCTIONS_MILESTONES') && NEW_FUNCTIONS_MILESTONES) { - if ($database->countVillages($to['owner']) == 2) { + $villageCount = $database->countVillages($to['owner']); + if ($villageCount == 2) { $database->recordMilestoneIfFirst('second_village', $to['owner'], $data['to']); } + if ($villageCount == 5) { + $database->recordMilestoneIfFirst('five_villages', $to['owner'], $data['to']); + } } }else{ // here must come movement from returning settlers diff --git a/GameEngine/Lang/en.php b/GameEngine/Lang/en.php index 2df3cba9..f32d16b7 100755 --- a/GameEngine/Lang/en.php +++ b/GameEngine/Lang/en.php @@ -2325,6 +2325,8 @@ tz_def('TZ_MILESTONE_FIRST_WW', 'First to Conquer a Wonder of the World'); tz_def('TZ_MILESTONE_FIRST_WW_PLAN', 'First to Conquer a WW Building Plan'); tz_def('TZ_MILESTONE_FIRST_ALLIANCE', 'First Alliance Founded'); tz_def('TZ_MILESTONE_FIRST_PVP_CONQUEST', 'First Village Conquered from a Player'); +tz_def('TZ_MILESTONE_FIVE_VILLAGES', 'First to Found 5 Villages'); +tz_def('TZ_MILESTONE_FOUNDED_BY', 'Founded by'); // ===== i18n etape 2 (lot suivant) ===== tz_def('TZ_ACCOUNT_OR_INCREASE_YOUR_RESOURCE', '-Account or increase your resource production.To do so click'); diff --git a/GameEngine/Lang/fr.php b/GameEngine/Lang/fr.php index d7fbd0be..792b96d0 100644 --- a/GameEngine/Lang/fr.php +++ b/GameEngine/Lang/fr.php @@ -2615,4 +2615,6 @@ define('TZ_MILESTONE_FIRST_WW', 'Premier à conquérir une Merveille du Monde'); define('TZ_MILESTONE_FIRST_WW_PLAN', 'Premier à conquérir un Plan de Merveille'); define('TZ_MILESTONE_FIRST_ALLIANCE', 'Première alliance fondée'); define('TZ_MILESTONE_FIRST_PVP_CONQUEST', 'Premier village conquis sur un joueur'); +define('TZ_MILESTONE_FIVE_VILLAGES', 'Premier à fonder 5 villages'); +define('TZ_MILESTONE_FOUNDED_BY', 'Fondée par'); ?> diff --git a/GameEngine/Lang/ro.php b/GameEngine/Lang/ro.php index 6ed2334c..24c20e42 100644 --- a/GameEngine/Lang/ro.php +++ b/GameEngine/Lang/ro.php @@ -2602,4 +2602,6 @@ define('TZ_MILESTONE_FIRST_ARTIFACT', 'Primul care a capturat un artefact'); define('TZ_MILESTONE_FIRST_WW', 'Primul care a cucerit un Wonder of the World'); define('TZ_MILESTONE_FIRST_WW_PLAN', 'Primul care a cucerit un Plan WW'); define('TZ_MILESTONE_FIRST_ALLIANCE', 'Prima alianță fondată'); -define('TZ_MILESTONE_FIRST_PVP_CONQUEST', 'Primul sat cucerit de la un jucător'); \ No newline at end of file +define('TZ_MILESTONE_FIRST_PVP_CONQUEST', 'Primul sat cucerit de la un jucător'); +define('TZ_MILESTONE_FIVE_VILLAGES', 'Primul care a fondat 5 sate'); +define('TZ_MILESTONE_FOUNDED_BY', 'Fondată de'); diff --git a/Templates/Ranking/general.tpl b/Templates/Ranking/general.tpl index c98e83c7..fa067268 100644 --- a/Templates/Ranking/general.tpl +++ b/Templates/Ranking/general.tpl @@ -53,16 +53,18 @@ $milestoneIcons = [ 'plan' => '', 'alliance' => '', 'conquest' => '', + 'five_villages' => '', ]; $milestoneDefs = [ - 'second_village' => ['label' => TZ_MILESTONE_SECOND_VILLAGE, 'icon' => 'village', 'color' => '#c0783c'], - 'population_1000' => ['label' => TZ_MILESTONE_POPULATION_1000, 'icon' => 'population', 'color' => '#3c78c0'], - 'first_artifact' => ['label' => TZ_MILESTONE_FIRST_ARTIFACT, 'icon' => 'artifact', 'color' => '#8a4fc0'], - 'first_ww' => ['label' => TZ_MILESTONE_FIRST_WW, 'icon' => 'wonder', 'color' => '#c0a030'], - 'first_ww_plan' => ['label' => TZ_MILESTONE_FIRST_WW_PLAN, 'icon' => 'plan', 'color' => '#2f9e8f'], - 'first_alliance' => ['label' => TZ_MILESTONE_FIRST_ALLIANCE, 'icon' => 'alliance', 'color' => '#3fa14a'], - 'first_pvp_conquest' => ['label' => TZ_MILESTONE_FIRST_PVP_CONQUEST, 'icon' => 'conquest', 'color' => '#b6362f'], + 'second_village' => ['label' => TZ_MILESTONE_SECOND_VILLAGE, 'icon' => 'village', 'color' => '#c0783c'], + 'population_1000' => ['label' => TZ_MILESTONE_POPULATION_1000, 'icon' => 'population', 'color' => '#3c78c0'], + 'first_artifact' => ['label' => TZ_MILESTONE_FIRST_ARTIFACT, 'icon' => 'artifact', 'color' => '#8a4fc0'], + 'first_ww' => ['label' => TZ_MILESTONE_FIRST_WW, 'icon' => 'wonder', 'color' => '#c0a030'], + 'first_ww_plan' => ['label' => TZ_MILESTONE_FIRST_WW_PLAN, 'icon' => 'plan', 'color' => '#2f9e8f'], + 'first_alliance' => ['label' => TZ_MILESTONE_FIRST_ALLIANCE, 'icon' => 'alliance', 'color' => '#3fa14a'], + 'first_pvp_conquest' => ['label' => TZ_MILESTONE_FIRST_PVP_CONQUEST, 'icon' => 'conquest', 'color' => '#b6362f'], + 'five_villages' => ['label' => TZ_MILESTONE_FIVE_VILLAGES, 'icon' => 'five_villages', 'color' => '#7a6030'], ]; // ========================= @@ -224,19 +226,49 @@ return isset($units[$k])? (int)$units[$k] : 0; ? sprintf('background:radial-gradient(circle at 32%% 28%%, %s, %s 55%%, %s 100%%);border-color:rgba(255,255,255,0.35);', $light, $mdef['color'], $dark) : 'background:#d8d8d8;border-color:rgba(0,0,0,0.08);'; $title = htmlspecialchars($mdef['label'], ENT_QUOTES, 'UTF-8'); - $meta = $achieved - ? htmlspecialchars(($achieved['username'] ?: '-') . ' — ' . date('d.m.y G:i:s', (int)$achieved['achieved_time']), ENT_QUOTES, 'UTF-8') - : htmlspecialchars(TZ_MILESTONE_NOT_YET, ENT_QUOTES, 'UTF-8'); + + // Caption text under badge: + // - first_alliance shows the alliance name/tag (stored in `extra`) + // - all others show the player username + if ($achieved) { + if ($mkey === 'first_alliance') { + $caption = htmlspecialchars($achieved['extra'] ?: $achieved['username'] ?: '', ENT_QUOTES, 'UTF-8'); + } else { + $caption = htmlspecialchars($achieved['username'] ?: '', ENT_QUOTES, 'UTF-8'); + } + } else { + $caption = ''; + } + + // Tooltip meta line: + // - first_alliance: shows alliance name on first line, founder + date on second + // - all others: "Username — dd.mm.yy H:i:s" + if ($achieved) { + if ($mkey === 'first_alliance') { + $meta = htmlspecialchars( + ($achieved['extra'] ?: '-') . "\n" . + TZ_MILESTONE_FOUNDED_BY . ' ' . ($achieved['username'] ?: '-') . ' — ' . date('d.m.y G:i:s', (int)$achieved['achieved_time']), + ENT_QUOTES, 'UTF-8' + ); + } else { + $meta = htmlspecialchars( + ($achieved['username'] ?: '-') . ' — ' . date('d.m.y G:i:s', (int)$achieved['achieved_time']), + ENT_QUOTES, 'UTF-8' + ); + } + } else { + $meta = htmlspecialchars(TZ_MILESTONE_NOT_YET, ENT_QUOTES, 'UTF-8'); + } ?>
@@ -255,9 +287,11 @@ return isset($units[$k])? (int)$units[$k] : 0; .tzms-badge.tzms-locked svg{opacity:0.55;} .tzms-icon svg{width:28px;height:28px;} .tzms-caption{margin-top:5px;font-size:10px;color:#666;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:64px;margin-left:auto;margin-right:auto;} -.tzms-tooltip{display:none;position:absolute;z-index:9999;background:#1b1b1b;color:#fff;padding:8px 12px;border-radius:5px;font-size:12px;line-height:1.5;box-shadow:0 3px 10px rgba(0,0,0,0.4);max-width:260px;text-align:left;} +/* position:fixed — tooltip is always anchored to the viewport, immune to + any overflow:hidden or position:relative on parent containers */ +.tzms-tooltip{display:none;position:fixed;z-index:99999;background:#1b1b1b;color:#fff;padding:8px 12px;border-radius:5px;font-size:12px;line-height:1.55;box-shadow:0 3px 10px rgba(0,0,0,0.4);max-width:260px;text-align:left;pointer-events:none;white-space:pre-line;} .tzms-tip-title{font-weight:bold;color:#fff;} -.tzms-tip-meta{color:#b7b7b7;font-size:11px;margin-top:2px;} +.tzms-tip-meta{color:#b7b7b7;font-size:11px;margin-top:3px;white-space:pre-line;}