Exploring You are exploring the map, and nothing has happened. Continue exploring using the direction buttons or the Travel To menus. HTML; } function move() { global $controlrow; // Early exit if fighting if (user()->currentaction == 'Fighting') redirect('/fight'); // Validate direction $form = validate($_POST, ['direction' => ['in:north,west,east,south']]); if (!$form['valid']) { $errors = ul_from_validate_errors($form['errors']); return is_htmx() ? $errors : display($errors, 'Move Error'); } // Current game state $game_size = $controlrow['gamesize']; $latitude = user()->latitude; $longitude = user()->longitude; $direction = $form['data']['direction']; // Calculate new coordinates with boundary checks switch ($direction) { case 'north': $latitude = min($latitude + 1, $game_size); break; case 'south': $latitude = max($latitude - 1, -$game_size); break; case 'east': $longitude = min($longitude + 1, $game_size); break; case 'west': $longitude = max($longitude - 1, -$game_size); break; } // Check for town $town = get_town_by_xy($longitude, $latitude); if ($town !== false) { return \Towns\travelto($town['id'], false); } // Determine action (1 in 5 chance of fighting) if (rand(1, 5) === 1) { user()->currentaction = 'Fighting'; user()->currentfight = 1; } else { user()->currentaction = 'Exploring'; } user()->latitude = $latitude; user()->longitude = $longitude; user()->save(); return index(); }