if ($star['event_random'] > 0 && $user['login_id'] != 1) { require_once "{$directories['includes']}/random_event_funcs.php"; random_event_checker($star, $user, $autowarp); } } //emergency returning to earth if (isset($_REQUEST['emergency_return'])) { if (!config_check("er", $user_ship)) { $user_loc_message .= $st[21]; } elseif ($user['location'] == 1) { $user_loc_message .= $st[22]; } elseif (!isset($_POST['sure'])) { //not confirmed yet. get_var($cw['emergency_return'], $_SERVER['PHP_SELF'], $st[23], 'sure', 'yes'); } else { explore_sys($user, 1); //on the off chance it hasn't been destroyed. $user_ship['config'] = str_replace("er", "", $user_ship['config']); dbn("update {$db_name}_ships set location = '1', mine_mode = '0', config='{$user_ship['config']}', upgrade_slots = upgrade_slots + 1 where ship_id = '{$user['ship_id']}'"); $user_ship['mine_mode'] = 0; $user_ship['location'] = 1; $user['location'] = 1; get_star(); } } archive_links(); #random event stuff: if ($star['event_random'] > 0) { if ($star['event_random'] == 2) { $random_str = "<font color=#00aaaa><center><p />" . $st[24] . " <a href='help.php?topic=Random_Events' target='_blank'>(" . $cw['help'] . ")</a>"; $random_str .= "<p />" . $st[25] . "</center><p /></font>";
function create_escape_pod($target) { global $db_name, $GAME_VARS, $cw, $st; $rand_star = random_system_num(); //make a random system number up. $ship_stats = load_ship_types(2); //load ship data for EP (class = 2) dbn("insert into {$db_name}_ships (ship_name, login_id, shipclass, class_name, class_name_abbr, fighters, max_fighters, max_shields, armour, max_armour, cargo_bays, mine_rate_metal, mine_rate_fuel, move_turn_cost, location, config,clan_id) values ('Escape Pod', '{$target['login_id']}', '2', '{$ship_stats['name']}', '{$ship_stats['class_abbr']}', '{$ship_stats['fighters']}', '{$ship_stats['max_fighters']}', '{$ship_stats['max_shields']}', '{$ship_stats['max_armour']}', '{$ship_stats['max_armour']}', '{$ship_stats['cargo_bays']}', '{$ship_stats['mine_rate_metal']}', '{$ship_stats['mine_rate_fuel']}', '{$ship_stats['move_turn_cost']}', '{$rand_star}', '{$ship_stats['config']}', '{$target['clan_id']}')"); $ship_id = mysql_insert_id(); //get users explored state. if (!isset($target['explored_sys']) && $GAME_VARS['uv_explored'] == 0) { db2("select explored_sys from {$db_name}_users where login_id = '{$target['login_id']}'"); $temp_exp_1 = dbr2(1); $target['explored_sys'] = $temp_exp_1['explored_sys']; unset($temp_exp_1); explore_sys($target, $rand_star); scramble_explored($target); } dbn("update {$db_name}_users set ship_id ='{$ship_id}' where login_id = '{$target['login_id']}'"); $target['location'] = $rand_star; $target['ship_id'] = $ship_id; return $target; }