Add something cool for barraks, stable and workshop

Add something cool for barraks, stable and workshop
This commit is contained in:
novgorodschi catalin
2026-08-12 09:43:41 +03:00
parent 7c6425578e
commit 633aa05090
12 changed files with 415 additions and 21 deletions
+2 -2
View File
@@ -342,8 +342,8 @@ $heroAdventureConfig = array(
'silver' => array(0, 40),
'hp_loss' => array(0, 8),
'resources' => array(0, 400),
'equip_chance' => 3, // % chance: 1 random piece of gear
'item_chance' => 5, // % chance: consumables (rolled only if no gear dropped)
'equip_chance' => 20, // % chance: 1 random piece of gear
'item_chance' => 40, // % chance: consumables (rolled only if no gear dropped)
'consumable' => array(200, 201, 208), // Ointment, Scroll, Cage
),
1 => array( // HARD
+8
View File
@@ -4394,3 +4394,11 @@ tz_def('SITTER_P_GOLD', 'spend Gold');
tz_def('SITTER_P_DENIED', 'Your sitter permissions do not allow this action.');
tz_def('SITTER_P_HINT', 'Permissions for the new sitter:');
tz_def('SITTER_P_NOT_SITTING', 'You are not a sitter on any account.');
//////////////////////////////////////////////////////////////////////////////////////////////////////
// REDUCERI TIMP INSTRUIRE (cazarma / grajd)
//////////////////////////////////////////////////////////////////////////////////////////////////////
tz_def('TRAIN_BONUS_ARTIFACT', 'Artifact bonus');
tz_def('TRAIN_BONUS_HERO', 'Hero bonus');
tz_def('TRAIN_BONUS_ALLIANCE', 'Alliance bonus');
tz_def('TRAIN_BONUS_FINAL', 'Training time');
+9 -1
View File
@@ -4336,4 +4336,12 @@ tz_def('SITTER_P_RES', 'envoyer des ressources à dautres joueurs');
tz_def('SITTER_P_GOLD', 'dépenser de lor');
tz_def('SITTER_P_DENIED', 'Vos permissions de sitter ne vous permettent pas deffectuer cette action.');
tz_def('SITTER_P_HINT', 'Permissions du nouveau sitter :');
tz_def('SITTER_P_NOT_SITTING', 'Vous n\'etes sitter sur aucun compte.');
tz_def('SITTER_P_NOT_SITTING', 'Vous n\'etes sitter sur aucun compte.');
//////////////////////////////////////////////////////////////////////////////////////////////////////
// RÉDUCTIONS DU TEMPS D'ENTRAÎNEMENT (caserne / écurie)
//////////////////////////////////////////////////////////////////////////////////////////////////////
tz_def('TRAIN_BONUS_ARTIFACT', 'Bonus artefact');
tz_def('TRAIN_BONUS_HERO', 'Bonus héros');
tz_def('TRAIN_BONUS_ALLIANCE', 'Bonus alliance');
tz_def('TRAIN_BONUS_FINAL', 'Temps dentraînement');
+9 -1
View File
@@ -4131,4 +4131,12 @@ tz_def('SITTER_P_RES', 'trimite resurse altor jucatori');
tz_def('SITTER_P_GOLD', 'cheltuie aur');
tz_def('SITTER_P_DENIED', 'Permisiunile tale de sitter nu iti permit aceasta actiune.');
tz_def('SITTER_P_HINT', 'Permisiuni pentru noul sitter:');
tz_def('SITTER_P_NOT_SITTING', 'Nu esti sitter pe niciun cont.');
tz_def('SITTER_P_NOT_SITTING', 'Nu esti sitter pe niciun cont.');
//////////////////////////////////////////////////////////////////////////////////////////////////////
// REDUCERI TIMP INSTRUIRE (cazarma / grajd)
//////////////////////////////////////////////////////////////////////////////////////////////////////
tz_def('TRAIN_BONUS_ARTIFACT', 'Bonus artefact');
tz_def('TRAIN_BONUS_HERO', 'Bonus erou');
tz_def('TRAIN_BONUS_ALLIANCE', 'Bonus alianta');
tz_def('TRAIN_BONUS_FINAL', 'Timp instruire');
+200
View File
@@ -655,6 +655,13 @@ class Technology {
// in cazarma/grajd normale si in cele mari (Great Barracks/Great Stable),
// fiindca ramura e aleasa dupa TIPUL unitatii, nu dupa cladire.
// Nu se aplica la atelier, unitati speciale sau capcane - la fel ca in T4.
// FIX: artefactele de instruire (kind 5) erau aplicate DOAR la afisare,
// in sabloane - trainUnit() nu le folosea deloc. Un jucator cu artefact
// vedea jumatate din timp, dar trupele se antrenau in timpul intreg.
// Se aplica pe timpul dat de cladire, inaintea bonusurilor de erou si
// alianta, exact in ordinea in care sabloanele afisau pana acum.
$each = $this->applyArtifactTrainingBonus($each);
$each = $this->applyHeroTrainingBonus($each, $unit, $footies, $calvary);
// Bonusul de alianta "Recruitment": instruire mai rapida in toate
@@ -665,6 +672,199 @@ class Technology {
return $each;
}
/**
* Defalcarea reducerilor de timp pentru afisare in cazarma / grajd.
*
* Primeste timpul de baza pe care sablonul l-a calculat deja (formula
* cladirii + artefacte) si intoarce cum arata el dupa fiecare bonus:
*
* 'hero_percent' - % dat de coiful eroului (0 daca nu are)
* 'after_hero' - timpul dupa bonusul eroului
* 'hero_saved' - secunde economisite de erou
* 'alliance_percent' - % dat de bonusul de alianta Recruitment
* 'after_alliance' - timpul final
* 'alliance_saved' - secunde economisite de alianta
* 'total_saved' - economia totala
* 'has_bonus' - true daca exista cel putin o reducere
*
* Refoloseste EXACT aceleasi doua metode private pe care le apeleaza si
* getTrainingTime(), in aceeasi ordine (erou, apoi alianta). Asa afisajul
* nu poate ajunge sa spuna altceva decat calculeaza motorul: daca cineva
* schimba candva formula, se schimba in amandoua locurile deodata.
*/
public function getTrainingBonusInfo($unit, $baseTime) {
$footies = [1, 2, 3, 11, 12, 13, 14, 21, 22, 31, 32, 33, 34, 41, 42, 43, 44, 51, 52, 61, 62, 63, 71, 72, 73, 74, 81, 82, 83, 84];
$calvary = [4, 5, 6, 15, 16, 23, 24, 25, 26, 35, 36, 45, 46, 53, 54, 55, 56, 64, 65, 66, 75, 76, 85, 86];
$baseTime = (int) $baseTime;
$info = array(
'base' => $baseTime,
'artifact_percent' => 0,
'after_artifact' => $baseTime,
'artifact_saved' => 0,
'hero_percent' => 0,
'after_hero' => $baseTime,
'hero_saved' => 0,
'alliance_percent' => 0,
'after_alliance' => $baseTime,
'alliance_saved' => 0,
'total_saved' => 0,
'has_bonus' => false,
);
if ($baseTime <= 0) {
return $info;
}
/**
* IMPORTANT: procentele se iau din SURSA bonusului, nu din secundele
* economisite.
*
* Pe serverele rapide (100x) timpii ajung la 1-4 secunde, iar o
* reducere de 8% din 2 secunde inseamna 0,15s - care dispare la
* rotunjirea la secunda intreaga. Calculat din secunde, bonusul de
* alianta parea inexistent, desi el se aplica. Procentul nominal e
* mereu corect, iar secundele economisite raman doar informative.
*/
// --- artefacte ---
$info['artifact_percent'] = $this->artifactTrainingPercent();
$afterArtifact = $this->applyArtifactTrainingBonus($baseTime);
$info['after_artifact'] = $afterArtifact;
$info['artifact_saved'] = $baseTime - $afterArtifact;
// --- coiful eroului ---
$info['hero_percent'] = $this->heroTrainingPercent($unit, $footies, $calvary);
$afterHero = $this->applyHeroTrainingBonus($afterArtifact, $unit, $footies, $calvary);
$info['after_hero'] = $afterHero;
$info['hero_saved'] = $afterArtifact - $afterHero;
// --- bonusul de alianta ---
$info['alliance_percent'] = $this->allianceTrainingPercent();
$afterAlliance = $this->applyAllianceRecruitmentBonus($afterHero);
$info['after_alliance'] = $afterAlliance;
$info['alliance_saved'] = $afterHero - $afterAlliance;
$info['total_saved'] = $baseTime - $afterAlliance;
$info['has_bonus'] = ($info['artifact_percent'] > 0
|| $info['hero_percent'] > 0
|| $info['alliance_percent'] > 0);
return $info;
}
/**
* Procentul de reducere dat de artefacte, dedus din chiar functia care il
* aplica: o valoare mare trece prin ea, iar raportul da procentul. Asa nu
* duplicam logica multiplicatorilor si a "artefactului nebunului".
*/
private function artifactTrainingPercent() {
$probe = 1000000;
$out = $this->applyArtifactTrainingBonus($probe);
if ($out >= $probe) {
return 0;
}
return (int) round(($probe - $out) * 100 / $probe);
}
/** Procentul dat de coiful echipat al eroului (0 daca nu are). */
private function heroTrainingPercent($unit, array $footies, array $calvary) {
global $village, $database;
if (!class_exists('HeroBattleBonus') || !HeroBattleBonus::enabled()) {
return 0;
}
$uid = (isset($village->wid) && $database)
? (int) $database->getVillageField($village->wid, 'owner')
: 0;
if ($uid <= 0) {
return 0;
}
$bonuses = HeroBattleBonus::bonuses($uid);
if (!$bonuses) {
return 0;
}
if (in_array($unit, $footies)) {
$percent = (int) $bonuses[HB_TRAIN_INF];
} elseif (in_array($unit, $calvary)) {
$percent = (int) $bonuses[HB_TRAIN_CAV];
} else {
return 0;
}
if ($percent < 0) $percent = 0;
if ($percent > 90) $percent = 90;
return $percent;
}
/**
* Procentul efectiv al bonusului de alianta "Recruitment".
*
* Bonusul e multiplicativ (timpul se imparte la 1+x), deci un bonus
* anuntat ca +8% inseamna 1 - 1/1.08 = 7% timp mai putin. Afisam procentul
* real de reducere, nu pe cel din panoul aliantei.
*/
private function allianceTrainingPercent() {
global $village, $database;
if (!class_exists('AllianceBonus') || !AllianceBonus::enabled()) {
return 0;
}
$owner = (isset($village->wid) && $database)
? (int) $database->getVillageField($village->wid, 'owner')
: 0;
if ($owner <= 0) {
return 0;
}
$mult = AllianceBonus::multiplier($owner, AllianceBonus::RECRUITMENT);
if ($mult <= 1.0) {
return 0;
}
return (int) round((1 - (1 / $mult)) * 100);
}
/**
* Aplica influenta artefactelor de instruire (kind 5) asupra timpului.
*
* Proprietarul si satul se iau la fel ca la celelalte doua bonusuri, ca sa
* fie corect si cand codul ruleaza in alt context (cron, sitter, admin).
*/
private function applyArtifactTrainingBonus($each) {
global $village, $database;
if (!$database || !isset($village->wid)) {
return $each;
}
$uid = (int) $database->getVillageField($village->wid, 'owner');
if ($uid <= 0) {
return $each;
}
$out = (int) $database->getArtifactsValueInfluence($uid, $village->wid, 5, $each);
return $out > 0 ? $out : 1;
}
/**
* Aplica bonusul de alianta "Recruitment" asupra timpului de instruire.
*
+13 -6
View File
@@ -35,12 +35,13 @@ foreach ($units as $i) {
$maxPlus = $technology->maxUnitPlus($i);
$available = (int)($village->unitarray['u'.$i] ?? 0);
$dur = $database->getArtifactsValueInfluence(
$session->uid,
$village->wid,
5,
round($unitData['time'] * ($bid19[$village->resarray['f'.$id]]['attri'] / 100) / SPEED)
);
/**
* Timpul de BAZA, doar din formula cladirii. Artefactele nu se mai aplica
* aici: sunt tratate ca reducere, alaturi de erou si alianta, in
* train_bonus.tpl - si, din acest commit, si in motor (Technology.php),
* unde inainte lipseau cu totul.
*/
$dur = (int) round($unitData['time'] * ($bid19[$village->resarray['f'.$id]]['attri'] / 100) / SPEED);
$timeFormatted = $generator->getTimeFormat($dur);
$total_required = (int)($unitData['wood'] + $unitData['clay'] + $unitData['iron'] + $unitData['crop']);
@@ -64,6 +65,12 @@ foreach ($units as $i) {
|<a href="build.php?gid=17&t=3&r1=<?php echo (int)$unitData['wood']*$maxPlus;?>&r2=<?php echo (int)$unitData['clay']*$maxPlus;?>&r3=<?php echo (int)$unitData['iron']*$maxPlus;?>&r4=<?php echo (int)$unitData['crop']*$maxPlus;?>" title="<?php echo NPC_TRADE; ?>"><img class="npc" src="img/x.gif" alt="<?php echo NPC_TRADE; ?>" title="<?php echo NPC_TRADE; ?>" /></a>
<?php endif;?>
</div>
<?php
// reducerile de timp (coif erou + bonus alianta), sub timpul normal
$tbUnit = $i; $tbTime = $dur;
include("train_bonus.tpl");
?>
</td>
<td class="val"><input type="text" class="text" name="t<?php echo $i;?>" value="0" maxlength="10"></td>
<td class="max"><a href="#" onClick="document.snd.t<?php echo $i;?>.value=<?php echo $maxTrain;?>; return false;">(<?php echo $maxTrain;?>)</a></td>
+8 -1
View File
@@ -42,7 +42,8 @@ for ($i = $start; $i <= $end; $i++) {
$baseTime = $unitData['time'] * ($bid20[$village->resarray['f'.$id]]['attri'] / 100);
if ($horseTrough >= 1) $baseTime *= (1 / $bid41[$horseTrough]['attri']);
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round($baseTime / SPEED));
// timpul de baza, fara artefacte: acestea apar ca reducere in train_bonus.tpl
$dur = (int) round($baseTime / SPEED);
$timeFormatted = $generator->getTimeFormat($dur);
$total_required = (int)($unitData['wood'] + $unitData['clay'] + $unitData['iron'] + $unitData['crop']);
@@ -67,6 +68,12 @@ for ($i = $start; $i <= $end; $i++) {
|<a href="build.php?gid=17&t=3&r1=<?php echo (int)$unitData['wood']*$maxPlus;?>&r2=<?php echo (int)$unitData['clay']*$maxPlus;?>&r3=<?php echo (int)$unitData['iron']*$maxPlus;?>&r4=<?php echo (int)$unitData['crop']*$maxPlus;?>" title="<?php echo NPC_TRADE; ?>"><img class="npc" src="img/x.gif" alt="<?php echo NPC_TRADE; ?>" /></a>
<?php endif;?>
</div>
<?php
// reducerile de timp (coif erou + bonus alianta), sub timpul normal
$tbUnit = $i; $tbTime = $dur;
include("train_bonus.tpl");
?>
</td>
<td class="val"><input type="text" class="text" name="t<?php echo $i;?>" value="0" maxlength="10"></td>
<td class="max"><a href="#" onClick="document.snd.t<?php echo $i;?>.value=<?php echo $maxTrain;?>; return false;">(<?php echo $maxTrain;?>)</a></td>
+14 -1
View File
@@ -59,7 +59,8 @@ $trainlist = $technology->getTrainingList(3);
$maxTrain = $technology->maxUnit($i);
$maxPlus = $technology->maxUnitPlus($i);
$available = (int)($village->unitarray['u'.$i]?? 0);
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round($unitData['time'] * ($bid21[$level]['attri']/100) / SPEED));
// timpul de baza, fara artefacte: acestea apar ca reducere in train_bonus.tpl
$dur = (int) round($unitData['time'] * ($bid21[$level]['attri']/100) / SPEED);
$timeFormatted = $generator->getTimeFormat($dur);
$total_required = (int)($unitData['wood']+$unitData['clay']+$unitData['iron']+$unitData['crop']);
$showNpc = $session->userinfo['gold']>=3 && $building->getTypeLevel(17)>=1 && $village->atotal >= $total_required;
@@ -83,6 +84,18 @@ $trainlist = $technology->getTrainingList(3);
|<a href="build.php?gid=17&t=3&r1=<?php echo (int)$unitData['wood']*$maxPlus;?>&r2=<?php echo (int)$unitData['clay']*$maxPlus;?>&r3=<?php echo (int)$unitData['iron']*$maxPlus;?>&r4=<?php echo (int)$unitData['crop']*$maxPlus;?>" title="<?php echo NPC_TRADE; ?>"><img class="npc" src="img/x.gif" alt="<?php echo NPC_TRADE; ?>"/></a>
<?php endif;?>
</div>
<?php
/**
* Reducerile de timp. La atelier NU exista bonus de
* erou (coifurile acopera doar infanteria si
* cavaleria), deci raman artefactele si bonusul de
* alianta "Recruitment" - iar train_bonus.tpl sare
* singur peste liniile cu procent 0.
*/
$tbUnit = $i; $tbTime = $dur;
include("train_bonus.tpl");
?>
</td>
<td class="val"><input type="text" class="text" name="t<?php echo $i;?>" value="0" maxlength="10"></td>
<td class="max"><a href="#" onClick="document.snd.t<?php echo $i;?>.value=<?php echo $maxTrain;?>; return false;">(<?php echo $maxTrain;?>)</a></td>
+8 -1
View File
@@ -43,7 +43,8 @@ for ($i = $start; $i <= $end; $i++):
$available = (int)$village->unitarray['u'.$i];
$max = $technology->maxUnit($i, true);
$maxPlus = $technology->maxUnitPlus($i);
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round($unit['time'] * ($bid29[$level]['attri'] / 100) / SPEED));
// timpul de baza, fara artefacte: acestea apar ca reducere in train_bonus.tpl
$time = (int) round($unit['time'] * ($bid29[$level]['attri'] / 100) / SPEED);
$totalRequired = (int)($unit['wood'] + $unit['clay'] + $unit['iron'] + $unit['crop']);
$showNpc = $session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $totalRequired;
?>
@@ -65,6 +66,12 @@ for ($i = $start; $i <= $end; $i++):
|<a href="build.php?gid=17&t=3&r1=<?php echo $costWood/3*$maxPlus;?>&r2=<?php echo $costClay/3*$maxPlus;?>&r3=<?php echo $costIron/3*$maxPlus;?>&r4=<?php echo $costCrop/3*$maxPlus;?>" title="<?php echo NPC_TRADE; ?>"><img class="npc" src="img/x.gif" alt="<?php echo NPC_TRADE; ?>" /></a>
<?php endif;?>
</div>
<?php
// reducerile de timp (coif erou + bonus alianta), sub timpul normal
$tbUnit = $i; $tbTime = $time;
include("train_bonus.tpl");
?>
</td>
<td class="val"><input type="text" class="text" name="t<?php echo $i;?>" value="0" maxlength="10"></td>
<td class="max"><a href="#" onClick="document.snd.t<?php echo $i;?>.value=<?php echo $max;?>; return false;">(<?php echo $max;?>)</a></td>
+8 -1
View File
@@ -49,7 +49,8 @@ for ($i = $start; $i <= $end; $i++):
$speedMod = $bid30[$level]['attri'] / 100;
if ($horseDrinking >= 1) $speedMod *= (1 / $bid41[$horseDrinking]['attri']);
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round($unit['time'] * $speedMod / SPEED));
// timpul de baza, fara artefacte: acestea apar ca reducere in train_bonus.tpl
$time = (int) round($unit['time'] * $speedMod / SPEED);
$totalRequired = (int)($unit['wood'] + $unit['clay'] + $unit['iron'] + $unit['crop']);
$showNpc = $session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $totalRequired;
@@ -72,6 +73,12 @@ for ($i = $start; $i <= $end; $i++):
|<a href="build.php?gid=17&t=3&r1=<?php echo $unit['wood']*$maxPlus;?>&r2=<?php echo $unit['clay']*$maxPlus;?>&r3=<?php echo $unit['iron']*$maxPlus;?>&r4=<?php echo $unit['crop']*$maxPlus;?>" title="<?php echo NPC_TRADE; ?>"><img class="npc" src="img/x.gif" alt="<?php echo NPC_TRADE; ?>" /></a>
<?php endif;?>
</div>
<?php
// reducerile de timp (coif erou + bonus alianta), sub timpul normal
$tbUnit = $i; $tbTime = $time;
include("train_bonus.tpl");
?>
</td>
<td class="val"><input type="text" class="text" name="t<?php echo $i;?>" value="0" maxlength="10"></td>
<td class="max"><a href="#" onClick="document.snd.t<?php echo $i;?>.value=<?php echo $max;?>; return false;">(<?php echo $max;?>)</a></td>
+130
View File
@@ -0,0 +1,130 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename : TRAINING TIME BONUS LINES ##
## Type : SHARED BUILDING PARTIAL ##
## --------------------------------------------------------------------------- ##
## Created by : Shadow ##
## --------------------------------------------------------------------------- ##
## Contact : cata7007@gmail.com ##
## Project : TravianZ ##
## GitHub : https://github.com/Shadowss/TravianZ ##
## --------------------------------------------------------------------------- ##
## License : TravianZ Project ##
## Copyright : TravianZ (c) 2010-2026. All rights reserved. ##
## --------------------------------------------------------------------------- ##
## ##
## Afiseaza, sub timpul normal de instruire, reducerile active: ##
## - coiful eroului (HB_TRAIN_INF / HB_TRAIN_CAV) ##
## - bonusul de alianta "Recruitment" ##
## si timpul final rezultat. ##
## ##
## Se include din 19_train.tpl, 20_train.tpl, 29_train.tpl si 30_train.tpl. ##
## Variabile asteptate de la sablonul care il include: ##
## $tbUnit - id-ul unitatii ##
## $tbTime - timpul de baza, in secunde (dupa cladire + artefacte) ##
## ##
## Nu afiseaza nimic daca nu exista nicio reducere, deci pe serverele fara ##
## erou T4 sau fara bonusuri de alianta lista arata exact ca inainte. ##
## ##
#################################################################################
global $technology, $generator;
if (!isset($tbUnit, $tbTime) || !is_object($technology)
|| !method_exists($technology, 'getTrainingBonusInfo')) {
return;
}
$tbInfo = $technology->getTrainingBonusInfo($tbUnit, $tbTime);
if (empty($tbInfo['has_bonus'])) {
return;
}
/**
* CSS-ul se emite o singura data pe pagina, la primul rand care are bonus.
* Asa nu trebuie atinse 19.tpl / 20.tpl / 29.tpl / 30.tpl doar pentru stil,
* si nu se repeta de 10 ori cand sunt 10 unitati in lista.
*/
if (empty($GLOBALS['tbCssDone'])) {
$GLOBALS['tbCssDone'] = true;
?>
<style type="text/css">
/* reducerile de timp la instruire (cazarma, grajd si variantele mari) */
.trainBonus {
margin-top: 3px;
padding-top: 3px;
border-top: 1px dotted #d9d6cf;
font-size: 10px;
line-height: 15px;
color: #96928a; /* palid: informatie secundara, nu concureaza cu timpul normal */
}
.trainBonus .tbLine { display: inline-block; margin-right: 10px; white-space: nowrap; }
.trainBonus .tbTag {
display: inline-block;
margin-right: 3px;
padding: 0 4px;
border-radius: 2px;
color: #ffffff;
font-size: 9px;
line-height: 13px;
}
.trainBonus .tbArte { background: #7d5ba6; } /* mov, ca artefactele */
.trainBonus .tbHero { background: #b8862f; } /* auriu, ca echipamentul eroului */
.trainBonus .tbAlly { background: #5d7391; } /* albastru, ca bonusurile de alianta */
.trainBonus .tbSaved { color: #b3afa7; }
.trainBonus .tbFinal { color: #4a7a24; } /* verde: rezultatul care conteaza */
.trainBonus .tbFinal b { color: #3f6b1c; }
.trainBonus .tbFinal .clock { vertical-align: -2px; margin-right: 2px; }
</style>
<?php
}
$tbLblArtifact = defined('TRAIN_BONUS_ARTIFACT') ? TRAIN_BONUS_ARTIFACT : 'Artifact bonus';
$tbLblHero = defined('TRAIN_BONUS_HERO') ? TRAIN_BONUS_HERO : 'Hero bonus';
$tbLblAlliance = defined('TRAIN_BONUS_ALLIANCE') ? TRAIN_BONUS_ALLIANCE : 'Alliance bonus';
$tbLblFinal = defined('TRAIN_BONUS_FINAL') ? TRAIN_BONUS_FINAL : 'Training time';
?>
<div class="trainBonus">
<?php if ($tbInfo['artifact_percent'] > 0) { ?>
<span class="tbLine">
<span class="tbTag tbArte"><?php echo $tbLblArtifact; ?></span>
&minus;<?php echo (int) $tbInfo['artifact_percent']; ?>%
<?php if ($tbInfo['artifact_saved'] > 0) { ?>
<span class="tbSaved">(&minus;<?php echo $generator->getTimeFormat($tbInfo['artifact_saved']); ?>)</span>
<?php } ?>
</span>
<?php } ?>
<?php if ($tbInfo['hero_percent'] > 0) { ?>
<span class="tbLine">
<span class="tbTag tbHero"><?php echo $tbLblHero; ?></span>
&minus;<?php echo (int) $tbInfo['hero_percent']; ?>%
<?php if ($tbInfo['hero_saved'] > 0) { ?>
<span class="tbSaved">(&minus;<?php echo $generator->getTimeFormat($tbInfo['hero_saved']); ?>)</span>
<?php } ?>
</span>
<?php } ?>
<?php if ($tbInfo['alliance_percent'] > 0) { ?>
<span class="tbLine">
<span class="tbTag tbAlly"><?php echo $tbLblAlliance; ?></span>
&minus;<?php echo (int) $tbInfo['alliance_percent']; ?>%
<?php if ($tbInfo['alliance_saved'] > 0) { ?>
<span class="tbSaved">(&minus;<?php echo $generator->getTimeFormat($tbInfo['alliance_saved']); ?>)</span>
<?php } ?>
</span>
<?php } ?>
<span class="tbLine tbFinal">
<img class="clock" src="img/x.gif" alt="" title="<?php echo $tbLblFinal; ?>" />
<b><?php echo $generator->getTimeFormat($tbInfo['after_alliance']); ?></b>
</span>
</div>
+6 -7
View File
@@ -18,16 +18,15 @@
## Copyright : TravianZ (c) 2010-2026. All rights reserved. ##
## --------------------------------------------------------------------------- ##
## ##
## Componenta Hero din bara de sus (zona incercuita cu rosu in ##
## RELOCARE_GOLD_LOCATIE_EROU.png). Se include din Templates/header.tpl, ##
## Componenta Hero din bara de sus. Se include din Templates/header.tpl, ##
## in interiorul lui #mtop. ##
## ##
## Structura (vezi VEDERE_GENERALA.png): ##
## - stanga sus : casa = "Hero at home" + numele satului -> 37.tpl ##
## Structura: ##
## - stanga sus : casa = "Hero at home" + numele satului -> 37.tpl ##
## (craniu, cand eroul e mort -> tot 37.tpl) ##
## - centru : portretul eroului + inelul Health(rosu)/Experience(albastru)
## - dreapta sus : numarul de aventuri -> 37_adventures.tpl ##
## - dreapta jos : argintul -> 37_auction.tpl ##
## - centru : portretul eroului + inelul Health(rosu)/Experience(albastru)#
## - dreapta sus : numarul de aventuri -> 37_adventures.tpl ##
## - dreapta jos : argintul -> 37_auction.tpl ##
## ##
## Toate valorile sunt reale (nimic hardcodat). Inelul e SVG desenat din ##
## procentele efective, NU o imagine statica. ##