From 6d02a8ff0352268001ed9b29eb39f4c30e24f1a6 Mon Sep 17 00:00:00 2001 From: novgorodschi catalin Date: Tue, 28 Jul 2026 13:32:10 +0300 Subject: [PATCH] Fix Alliance Level Require Bonus Fix Alliance Level Require Bonus --- GameEngine/Alliance.php | 14 +++++++---- GameEngine/AllianceBonus.php | 46 ++++++++++++++++++++++++++++++++++ GameEngine/Lang/en.php | 7 ++++++ GameEngine/Lang/fr.php | 7 ++++++ GameEngine/Lang/ro.php | 7 ++++++ GameEngine/Technology.php | 28 +++++++++++---------- README.md | 21 ++++++++++++++++ Templates/Alliance/bonuses.tpl | 25 +++++++++++++++++- 8 files changed, 136 insertions(+), 19 deletions(-) diff --git a/GameEngine/Alliance.php b/GameEngine/Alliance.php index 7b1bfb8b..25feddbd 100755 --- a/GameEngine/Alliance.php +++ b/GameEngine/Alliance.php @@ -416,11 +416,15 @@ class Alliance { } $database->updateUserField($session->uid, "alliance", $aid, 1); - // Bonusurile de alianta devin disponibile treptat pentru - // membrii noi, deci retinem cand a intrat. Fara asta, - // cineva ar putea sari dintr-o alianta in alta doar ca sa - // culeaga bonusuri de nivel mare. - $database->updateUserField($session->uid, "alliance_joined", time(), 1); + + // FONDATORUL nu e "membru nou": alianta nu exista inaintea lui, deci nu + // are de unde sa "sara" ca sa culeaga bonusuri deja deblocate. Lasam + // alliance_joined pe 0, adica acces complet. + // + // Intarzierea de disponibilitate exista ca sa nu poti trece dintr-o + // alianta in alta doar ca sa profiti de nivelurile ei mari - lucru + // imposibil intr-o alianta pe care tocmai ai infiintat-o. + $database->updateUserField($session->uid, "alliance_joined", 0, 1); $database->procAllyPop($aid); $database->createAlliPermissions($session->uid, $aid, 'Alliance founder', '1', '1', '1', '1', '1', '1', '1', '1'); diff --git a/GameEngine/AllianceBonus.php b/GameEngine/AllianceBonus.php index 4f46cdcb..b054ef88 100644 --- a/GameEngine/AllianceBonus.php +++ b/GameEngine/AllianceBonus.php @@ -304,6 +304,52 @@ class AllianceBonus return max(0, min($level, $allowed)); } + /** + * Cat mai are de asteptat un jucator pana i se deschide nivelul urmator. + * + * Intoarce numarul de secunde, sau 0 daca deja beneficiaza de tot ce a + * deblocat alianta. Se foloseste in pagina de bonusuri: fara asta, un + * membru nou vede "nivel 2" dar simte efectul nivelului 1 si nu are cum + * sa-si dea seama de ce. + */ + public function waitingFor($uid, $btype) + { + if (!self::enabled()) { + return 0; + } + + $uid = (int) $uid; + $res = mysqli_query($this->db, + "SELECT alliance, alliance_joined FROM " . TB_PREFIX . "users WHERE id = " . $uid . " LIMIT 1"); + $row = $res ? mysqli_fetch_assoc($res) : null; + + if (!$row || (int) $row['alliance'] <= 0) { + return 0; + } + + $levels = $this->getLevels((int) $row['alliance']); + $unlocked = isset($levels[(int) $btype]) ? (int) $levels[(int) $btype] : 0; + $effective = $this->effectiveLevel($uid, $btype); + + if ($effective >= $unlocked) { + return 0; // beneficiaza deja de tot + } + + $joined = (int) $row['alliance_joined']; + + if ($joined <= 1) { + return 0; + } + + $speed = (defined('SPEED') && SPEED > 0) ? (float) SPEED : 1.0; + $step = max(60, (int) (86400 / $speed)); + + // nivelul (effective + 1) devine disponibil dupa effective * step + $ready = $joined + ($effective * $step); + + return max(0, $ready - time()); + } + /* ------------------------------------------------------------------ */ /* Donatii */ /* ------------------------------------------------------------------ */ diff --git a/GameEngine/Lang/en.php b/GameEngine/Lang/en.php index 8dbe927f..4796d813 100755 --- a/GameEngine/Lang/en.php +++ b/GameEngine/Lang/en.php @@ -4276,3 +4276,10 @@ tz_def('ADM_PLUS_STATISTICS_INTERVAL', 'Statistics snapshot interval (hours)'); tz_def('ADM_PLUS_STATISTICS_INTERVAL_TIP', 'How often a snapshot is taken. On a fast server a day is a lot of play, so a few hours gives a readable curve.'); tz_def('ADM_PLUS_STATISTICS_KEEP', 'Statistics history kept (days)'); tz_def('ADM_PLUS_STATISTICS_KEEP_TIP', '0 keeps everything, so players see the full history of their account since recording began.'); + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// BONUSURI DE ALIANTA - disponibilitate pentru membrii noi +////////////////////////////////////////////////////////////////////////////////////////////////////// +tz_def('ALLYBONUS_YOURLEVEL', 'Your level'); +tz_def('ALLYBONUS_UNLOCKS_IN', 'next unlocks in'); +tz_def('ALLYBONUS_NEWMEMBER', 'New members gain access to higher levels gradually: level 2 after 24 hours in the alliance, level 3 after 48 hours, and so on.'); diff --git a/GameEngine/Lang/fr.php b/GameEngine/Lang/fr.php index c10d5099..eddaf2dc 100644 --- a/GameEngine/Lang/fr.php +++ b/GameEngine/Lang/fr.php @@ -4219,3 +4219,10 @@ tz_def('ADM_PLUS_STATISTICS_INTERVAL', 'Intervalle des relevés (heures)'); tz_def('ADM_PLUS_STATISTICS_INTERVAL_TIP', 'Fréquence des relevés. Sur un serveur rapide, une journée représente beaucoup de jeu ; quelques heures donnent une courbe lisible.'); tz_def('ADM_PLUS_STATISTICS_KEEP', 'Historique conservé (jours)'); tz_def('ADM_PLUS_STATISTICS_KEEP_TIP', '0 conserve tout, afin que les joueurs voient l\'historique complet de leur compte depuis le début de l\'enregistrement.'); + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// BONUSURI DE ALIANTA - disponibilitate pentru membrii noi +////////////////////////////////////////////////////////////////////////////////////////////////////// +tz_def('ALLYBONUS_YOURLEVEL', 'Votre niveau'); +tz_def('ALLYBONUS_UNLOCKS_IN', 'prochain dans'); +tz_def('ALLYBONUS_NEWMEMBER', 'Les nouveaux membres accèdent progressivement aux niveaux supérieurs : niveau 2 après 24 heures dans l\'alliance, niveau 3 après 48 heures, etc.'); diff --git a/GameEngine/Lang/ro.php b/GameEngine/Lang/ro.php index 6fad3af6..9adf12a0 100644 --- a/GameEngine/Lang/ro.php +++ b/GameEngine/Lang/ro.php @@ -4016,3 +4016,10 @@ tz_def('ADM_PLUS_STATISTICS_INTERVAL', 'Intervalul intre masuratori (ore)'); tz_def('ADM_PLUS_STATISTICS_INTERVAL_TIP', 'Cat de des se ia o masuratoare. Pe un server rapid o zi inseamna mult joc, asa ca cateva ore dau o curba lizibila.'); tz_def('ADM_PLUS_STATISTICS_KEEP', 'Istoric pastrat (zile)'); tz_def('ADM_PLUS_STATISTICS_KEEP_TIP', '0 pastreaza tot, ca jucatorii sa vada istoricul complet al contului de la inceputul inregistrarii.'); + +////////////////////////////////////////////////////////////////////////////////////////////////////// +// BONUSURI DE ALIANTA - disponibilitate pentru membrii noi +////////////////////////////////////////////////////////////////////////////////////////////////////// +tz_def('ALLYBONUS_YOURLEVEL', 'Nivelul tau'); +tz_def('ALLYBONUS_UNLOCKS_IN', 'urmatorul in'); +tz_def('ALLYBONUS_NEWMEMBER', 'Membrii noi capata acces treptat la nivelurile mari: nivelul 2 dupa 24 de ore in alianta, nivelul 3 dupa 48 de ore si asa mai departe.'); diff --git a/GameEngine/Technology.php b/GameEngine/Technology.php index 660434cb..3cadc95c 100755 --- a/GameEngine/Technology.php +++ b/GameEngine/Technology.php @@ -655,19 +655,12 @@ class Technology { } /** - * Reduce timpul de instruire cu procentul dat de coiful echipat al eroului. - * - * Proprietarul e luat din satul in care se face instruirea (nu din sesiune), - * ca sa fie corect si cand codul ruleaza in alt context decat o pagina a - * jucatorului. HeroBattleBonus::bonuses() are deja gard de feature flag si - * cache per request, si intoarce null cand sistemul T4 e oprit. - */ - /** - * Aplica bonusul de alianta "Recruitment" asupra timpului de instruire. - * - * Proprietarul se ia din satul in care se instruieste, nu din sesiune, ca sa - * fie corect si cand codul ruleaza in alt context (cron, sitter). - */ + * Aplica bonusul de alianta "Recruitment" asupra timpului de instruire. + * + * Proprietarul se ia din satul in care se instruieste, nu din sesiune, ca sa + * fie corect si cand codul ruleaza in alt context (cron, sitter). + */ + private function applyAllianceRecruitmentBonus($each) { global $village, $database; @@ -693,6 +686,15 @@ class Technology { // bonusul de X% inseamna productie mai rapida, deci timp impartit return max(1, (int) round($each / $mult)); } + + /** + * Reduce timpul de instruire cu procentul dat de coiful echipat al eroului. + * + * Proprietarul e luat din satul in care se face instruirea (nu din sesiune), + * ca sa fie corect si cand codul ruleaza in alt context decat o pagina a + * jucatorului. HeroBattleBonus::bonuses() are deja gard de feature flag si + * cache per request, si intoarce null cand sistemul T4 e oprit. + */ private function applyHeroTrainingBonus($each, $unit, array $footies, array $calvary) { global $village, $database; diff --git a/README.md b/README.md index dc7f7b4b..9eb396e0 100644 --- a/README.md +++ b/README.md @@ -67,14 +67,31 @@ Travian 4-style hero system ported into the T3.6 engine, in phases: * Items backend (HeroItems.php) with equippable hero items and data layer. * Adventures backend (HeroAdventure.php) with adventure generation and rewards. * Auction house (HeroAuction.php) for player-to-player item trading. +* A new ability : resources production added. * Battle and speed integration (HeroBattleBonus.php + Battle.php hooks): item fighting strength, per-unit weapon bonuses, armor damage reduction, hunting horn and speed effects, artwork culture-point item. ⸻ +Alliance Bonus System + +Travian 4-style alliance system ported into the T3.6 engine, in phases: + +* Added Metalurgy Bonus - Speeds up troop training in every troop-producing building. Multiplies with hero helmets. +* Added Philosophy Bonus - Increases culture point production from buildings and hero helmets. Town hall celebrations are not affected. +* Added Metallurgy Bonus - Increases the offensive and defensive strength of your troops, on top of your smithy upgrades. +* Added Commerce Bonus - Increases how much each merchant can carry. Multiplies with the trade office. + +⸻ + Admin Panel * Complete frontend and backend redesign. +* Multi-Account Detection +* Push Protection Dashboard +* Registration Blocklist +* Quest Editor Page * New Admin Panel design. +* World Map Heatmap * New homepage with server statistics. * New Server Info page. * New Natars Management format. @@ -107,6 +124,10 @@ Admin Panel Gameplay Improvements * Vacation Mode added (requires 9 conditions). +* Added Graphical Statistics +* Added Server Milestones +* Activated gpack for each player +* NEW gpack travian_t4 style buildings * Alliance rank and privilege management added. * Main Building instant demolition with 10 gold. * Account Statement added in Travian Plus section (received/spent gold history). diff --git a/Templates/Alliance/bonuses.tpl b/Templates/Alliance/bonuses.tpl index 65f0a113..c5ec9fe9 100644 --- a/Templates/Alliance/bonuses.tpl +++ b/Templates/Alliance/bonuses.tpl @@ -113,6 +113,7 @@ $abGpack = defined('GP_LOCATE') ? GP_LOCATE : 'gpack/travian_default/'; /* descrierea sta in dreapta numelui si ocupa spatiul ramas */ .ab-desc{flex:1;color:#666;font-size:11px;line-height:1.35;padding-left:4px} .ab-eff{color:#1f7a1f;font-weight:bold} +.ab-wait{color:#a60;font-size:10px} .ab-bar{background:#fff;border:1px solid #c9c9c9;height:13px;overflow:hidden;margin:4px 0} .ab-bar i{display:block;height:100%;background:#7db72f} .ab-num{font-size:11px;color:#555} @@ -156,7 +157,24 @@ $abGpack = defined('GP_LOCATE') ? GP_LOCATE : 'gpack/travian_default/'; / -  +% + effectiveLevel($session->uid, $abT); + $abWait = $abEngine->waitingFor($session->uid, $abT); + ?> +  +% + +
+ : + + 0) { ?> + – + getTimeFormat($abWait); ?> + + +
+
+ +
+