mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-09 12:51:01 +00:00
Add Egipteans Detailed For Oasis Waterworks
Add Egipteans Detailed For Oasis Waterworks
This commit is contained in:
@@ -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; ?> —
|
||||
<?php echo CURRENT_BONUS; ?> <b>+<?php echo (int)round($bid45[$wwLevel]['attri'] * 100); ?>%</b>
|
||||
<?php echo WATERWORKS_HINT; ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
@@ -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% → <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");?>
|
||||
|
||||
Reference in New Issue
Block a user