getOasis($village->wid); 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']); 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) { if (!isset($oasisTypeBonuses[$type])) { return ''; } $html = ''; foreach ($oasisTypeBonuses[$type] as $bonus) { [$resource, $percent] = $bonus; $icon = $oasisResourceIcons[$resource]; $html .= '' . $icon['alt'] . '+' . $percent . '%'; } return $html; }; ?> getCoor($oasis['wref']); ?>
<?php echo DELETE; ?>
(
|
)
%