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']) && (int)$_GET['gid'] === 37 && isset($_GET['del']) ) { $oasisWref = (int)$_GET['del']; /* * Verificam server-side ca: * * 1. oaza exista; * 2. apartine jucatorului; * 3. este cucerita de SATUL CURENT. * * Nu este suficient doar owner == session uid deoarece un jucator * poate avea mai multe sate si mai multe oaze. */ $oasisOwner = (int)$database->getOasisField( $oasisWref, 'owner' ); $oasisConquered = (int)$database->getOasisField( $oasisWref, 'conqured' ); if ( $oasisWref > 0 && $oasisOwner === (int)$session->uid && $oasisConquered === (int)$village->wid ) { /* * FOARTE IMPORTANT: * * Returnam doar trupele din OAZA SELECTATA. * * returnTroops($village->wid, 1) NU trebuie folosit aici, * deoarece acela proceseaza toate oazele satului. * * Functia are lock per oasis si re-citeste DB dupa lock. */ $units->returnOasisTroops($oasisWref); /* * Dupa ce reinforcement-urile au fost returnate, * oaza este eliberata. */ $database->removeOases($oasisWref); } header("Location: build.php?id=" . $id . "&land"); exit; } // Explicit lookup, instead of the original repetitive switch: // each oasis type => which resources get bonus and how much. // Identical behavior to the original (same alt/title on each icon, // including the existing asymmetry: for wood, alt uses TZ_WOOD but // title uses LUMBER - kept exactly as in the original source). $oasisResourceIcons = [ 'wood' => ['class' => 'r1', 'alt' => TZ_WOOD, 'title' => LUMBER], 'clay' => ['class' => 'r2', 'alt' => CLAY, 'title' => CLAY], 'iron' => ['class' => 'r3', 'alt' => IRON, 'title' => IRON], 'crop' => ['class' => 'r4', 'alt' => CROP, 'title' => CROP], ]; $oasisTypeBonuses = [ 1 => [['wood', 25]], 2 => [['wood', 25]], 3 => [['wood', 25], ['crop', 25]], 4 => [['clay', 25]], 5 => [['clay', 25]], 6 => [['clay', 25], ['crop', 25]], 7 => [['iron', 25]], 8 => [['iron', 25]], 9 => [['iron', 25], ['crop', 25]], 10 => [['crop', 25]], 11 => [['crop', 25]], 12 => [['crop', 50]], ]; // 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, $wwMultiplier, $wwLevel) { if (!isset($oasisTypeBonuses[$type])) { return ''; } $html = ''; foreach ($oasisTypeBonuses[$type] as $bonus) { [$resource, $percent] = $bonus; $icon = $oasisResourceIcons[$resource]; // 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 .= '' . $icon['alt'] . '+' . $effStr . '%'; // cand Waterworks e activ, arat si bonusul de baza barat pentru context if ($wwLevel > 0 && $effective != $percent) { $html .= ' (' . $percent . '%)'; } } return $html; }; ?> getCoor($oasis['wref']); ?>
<?php echo DELETE; ?>
(
|
)
%
0): ?>

<?php echo WATERWORKS; ?> +%