Add Egipteans Detailed For Oasis Waterworks

Add Egipteans Detailed For Oasis Waterworks
This commit is contained in:
novgorodschi catalin
2026-07-15 11:20:41 +03:00
parent 7fdad592e5
commit 1925f45001
4 changed files with 76 additions and 3 deletions
+3
View File
@@ -1299,6 +1299,9 @@ tz_def('STONEMASON_DESC', 'The Stonemason is an expert it cutting stone. The hig
tz_def('BREWERY', 'Brewery');
tz_def('CURRENT_BONUS', 'Current bonus:');
tz_def('WATERWORKS_HINT', '(Boost by Waterworks)');
tz_def('WATERWORKS_AFFECTED', 'annexed oases benefit from this bonus.');
tz_def('OASIS_EFFECTIVE_BONUS', 'Effective oasis bonus:');
tz_def('BONUS_LEVEL', 'Bonus at level');
tz_def('BREWERY_DESC', 'Tasty mead is brewed here.Drinks make your soldiers braver and stronger when attacking others (1% per Brewery level). Unfortunately, the persuasive power of leaders is reduced by 50% and catapults can only make random hits. Can only be built in the capital, but affects all your villages. The mead-festivals always last 72 hours.<br>Tribe-specific: Teutons only');
tz_def('MEAD_FESTIVAL', 'Mead-Festival');
+35 -2
View File
@@ -21,6 +21,21 @@
$oasisarray = $database->getOasis($village->wid);
// Waterworks (gid 45, Egipteni): creste bonusul oazelor cu +5% relativ / nivel.
// Determin nivelul din satul curent si factorul efectiv (25% de baza).
global $bid45;
$wwLevel = 0;
$wwFactor = 0.25;
for ($wwi = 19; $wwi <= 40; $wwi++) {
if (isset($village->resarray['f'.$wwi.'t']) && (int)$village->resarray['f'.$wwi.'t'] == 45) {
$wwLevel = max($wwLevel, (int)$village->resarray['f'.$wwi]);
}
}
if ($wwLevel > 0 && isset($bid45[$wwLevel]['attri'])) {
$wwFactor = 0.25 * (1 + $bid45[$wwLevel]['attri']);
}
$wwMultiplier = $wwFactor / 0.25; // 1.0 fara Waterworks, 1.5 la nivel maxim
if (isset($_GET['gid']) && $_GET['gid'] == 37 && isset($_GET['del']) && $database->getOasisField($_GET['del'], 'owner') == $session->uid) {
$units->returnTroops($village->wid, 1);
$database->removeOases($_GET['del']);
@@ -57,7 +72,7 @@
// Replace the original switch with 12 identical cases as the structure.
// Unknown types => empty string, just like the lack of a 'default' in the original switch.
$renderOasisBonus = function ($type) use ($oasisResourceIcons, $oasisTypeBonuses) {
$renderOasisBonus = function ($type) use ($oasisResourceIcons, $oasisTypeBonuses, $wwMultiplier, $wwLevel) {
if (!isset($oasisTypeBonuses[$type])) {
return '';
}
@@ -66,7 +81,15 @@
foreach ($oasisTypeBonuses[$type] as $bonus) {
[$resource, $percent] = $bonus;
$icon = $oasisResourceIcons[$resource];
$html .= '<img class="' . $icon['class'] . '" src="img/x.gif" alt="' . $icon['alt'] . '" title="' . $icon['title'] . '" />+' . $percent . '%';
// procentul efectiv (bonusul fizic al oazei x multiplicatorul Waterworks)
$effective = $percent * $wwMultiplier;
// afisez cifra rotunda daca e intreaga, altfel o zecimala (25 -> 25, 37.5 -> 37.5)
$effStr = ($effective == floor($effective)) ? (string)(int)$effective : rtrim(rtrim(number_format($effective, 1, '.', ''), '0'), '.');
$html .= '<img class="' . $icon['class'] . '" src="img/x.gif" alt="' . $icon['alt'] . '" title="' . $icon['title'] . '" />+' . $effStr . '%';
// cand Waterworks e activ, arat si bonusul de baza barat pentru context
if ($wwLevel > 0 && $effective != $percent) {
$html .= ' <span class="ww_base">(' . $percent . '%)</span>';
}
}
return $html;
@@ -112,3 +135,13 @@ if (!empty($oasisarray)) {
<?php } ?>
</tbody>
</table>
<?php if ($wwLevel > 0): ?>
<p class="ww_summary">
<img class="building g45" src="img/x.gif" alt="<?php echo WATERWORKS; ?>" title="<?php echo WATERWORKS; ?>" />
<?php echo WATERWORKS; ?> <?php echo LEVEL; ?> <?php echo $wwLevel; ?> &mdash;
<?php echo CURRENT_BONUS; ?> <b>+<?php echo (int)round($bid45[$wwLevel]['attri'] * 100); ?>%</b>
<?php echo WATERWORKS_HINT; ?>
</p>
<?php endif; ?>
+19
View File
@@ -25,6 +25,14 @@ include("next.tpl");
$level = (int)$village->resarray['f'.$id];
$current = $level > 0 ? (int)round($bid45[$level]['attri'] * 100) : 0;
// numarul de oaze anexate de acest sat (pentru a arata impactul concret)
$wwOasisCount = 0;
$wwOasisList = $database->getOasis($village->wid);
if (!empty($wwOasisList)) $wwOasisCount = count($wwOasisList);
// procentul efectiv al unei oaze standard (25% de baza)
$wwEffective = $level > 0 ? 25 * (1 + $bid45[$level]['attri']) : 25;
$wwEffStr = ($wwEffective == floor($wwEffective)) ? (string)(int)$wwEffective : rtrim(rtrim(number_format($wwEffective, 1, '.', ''), '0'), '.');
?>
<div id="build" class="gid45">
<a href="#" onClick="return Popup(45,4);" class="build_logo">
@@ -48,6 +56,17 @@ $current = $level > 0 ? (int)round($bid45[$level]['attri'] * 100) : 0;
<td><b><?php echo $nextBonus;?></b> <?php echo PERCENT;?></td>
</tr>
<?php endif;?>
<?php if ($level > 0): ?>
<tr>
<th><?php echo OASIS_EFFECTIVE_BONUS;?></th>
<td>25% &rarr; <b><?php echo $wwEffStr;?>%</b></td>
</tr>
<?php if ($wwOasisCount > 0): ?>
<tr>
<th><?php echo OASES;?></th>
<td><b><?php echo $wwOasisCount;?></b> <?php echo WATERWORKS_AFFECTED;?></td>
</tr>
<?php endif; endif; ?>
</table>
<?php include("upgrade.tpl");?>
+19 -1
View File
@@ -9517,7 +9517,25 @@ input.accept{width:12px;height:12px;background-image:url(../../img/a/acc.gif);}
text-align:center;
margin-top:15px;
}
/* Waterworks (Egipteni): bonusul efectiv al oazelor in 37_land */
#oases td.res span.ww_base {
color: #999;
font-size: 10px;
text-decoration: line-through;
}
p.ww_summary {
margin: 6px 0 0 0;
padding: 5px 8px;
background: #f3f6ec;
border: 1px solid #d9e2c4;
border-radius: 3px;
font-size: 11px;
color: #4a5a2a;
}
p.ww_summary img.building {
vertical-align: middle;
margin-right: 4px;
}
.error{
color:red;
margin-top:10px;