} elseif ($amount > $user_ship['empty_bays']) { $out .= "You can't carry that many colonists.<p />"; } elseif ($amount * $GAME_VARS['cost_colonist'] > $user['cash']) { $out .= "You can't afford that many colonists.<p />"; } else { take_cash($GAME_VARS['cost_colonist'] * $amount); charge_turns(1); dbn("update {$db_name}_ships set colon = colon + '{$amount}' where ship_id = '{$user['ship_id']}'"); $user_ship['colon'] += $amount; $user_ship['empty_bays'] -= $amount; } //the ship shop. listing ships } elseif (isset($_GET['ship_shop'])) { $out .= $st[1800] . '<br /><br />'; $array_ships = array("Cargo" => "", "Bataille" => "", "Transport" => "", "Modulaires" => "", "Autres" => ""); $ship_types = load_ship_types(0); foreach ($ship_types as $type_id => $ship_stats) { if ($type_id < 3 || $ship_stats['tcost'] != 0) { //skip the EP and SD, as well as BM ships. continue; } else { $buy_many_link = "<a href='ship_build.php?mass={$type_id}'>" . $cw['buy_many'] . "</a>"; if ($ship_stats['type'] == "Cargo") { $type = "Cargo"; } elseif ($ship_stats['type'] == "Bataille" || $ship_stats['type'] == 'Flagship') { $type = "Bataille"; } elseif ($ship_stats['type'] == "Modulaire") { $type = "Modulaires"; } elseif (eregi("Transport", $ship_stats['type'])) { $type = "Transport"; } else {
function give_first_ship($login_id, $clan_id, $s_name = "Un-Named") { global $GAME_VARS; //create user's first ship $ship_stats = load_ship_types($GAME_VARS['start_ship']); //ensure valid name $ship_stats['ship_name'] = correct_name($s_name); //create array with owner details in $ship_owner = array('login_id' => $login_id, 'clan_id' => 0); //make the ship return make_ship($ship_stats, $ship_owner); }
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; }
//string that is used for regular table for ships. is different for popups. $table_str = "<p />" . make_table(array("", ""), "WIDTH=75%"); if ($shipno < 0) { //list stats of all ships: //will load the selected ship details automatically. $ship_types = load_ship_types($shipno); $out_str .= "<h3><b>" . $cw['ship_listing'] . "</b></h3>" . $st[813]; if ($shipno == -1) { $out_str .= " " . $st[814] . "<p />"; } elseif ($shipno == -2) { $out_str .= " " . $st[815] . "<p />"; } $help_type = $cw['complete_ship_listing']; //list stats for a selected ship } else { $ship_types[] = load_ship_types($shipno); if ($popup) { //popup needs different table $table_str = "<br /><center><table width=250 height=250 cellspacing=0 cellpadding=3 border=1><tr><td colspan=2 align='center' bgcolor='#555555'>"; } $help_type = $cw['ship_details']; } //loop through all ships foreach ($ship_types as $ship_class => $ship_stats) { if ($ship_class == 1) { //skip ship type 1 continue 1; } //list selected ships only if ($ship_stats['tcost'] > 0 && $shipno == -2 || $ship_stats['tcost'] <= 0 && $shipno == -1 || $shipno > 1) { $ship_stats['cost'] = number_format($ship_stats['cost']);
<?php require_once "user.inc.php"; $filename = "equip_shop.php"; $status_bar_help = "?topic=Equipment"; if ($user['location'] != '1') { print_page($cw['error'], $st[1041]); } ship_status_checker(); $error_str = ""; if ($GAME_VARS['alternate_play_1'] == 1) { $ship_stats = load_ship_types($user_ship['shipclass']); $mining_switch_cost = round($ship_stats['cost'] / 10); } //fighter cost is now based upon the admin var. //$fighter_cost = 100; $fighter_cost = $GAME_VARS['fighter_cost_earth']; if ($fighter_cost <= 0) { $fighter_cost = 1; } $genesis_cost = $GAME_VARS['cost_genesis_device']; $bomb_cost = $GAME_VARS['bomb_cost']; $rs = "<p /><a href='equip_shop.php'>" . $cw['return_to_equipment_shop'] . "</a>"; settype($amount, 'int'); $amount = round($amount); if (isset($switch)) { //someone is switching mining types. if ($GAME_VARS['alternate_play_1'] != 1) { //check to see if alternate style of play is in effect. $error_str .= $st[1042]; } elseif ($user['cash'] < $mining_switch_cost) {
settype($num, "integer"); #initial checks to see if the ship is viable for duplication if ($user_ship['shipclass'] < 2) { $error_str .= $st[703]; } elseif ($user_ship['shipclass'] == 2) { $error_str .= $st[704]; } elseif ($num_ships['war_reached'] && config_check("bs", $user_ship)) { $error_str = sprintf($st[326], $num_ships[warships], $GAME_VARS[max_warships]); } elseif ($num_ships['other_reached'] && !config_check("bs", $user_ship)) { $error_str = sprintf($st[327], $num_ships[other_ships], $GAME_VARS[max_other_ships]); } elseif ($user_ship['num_pc'] > 0 || $user_ship['num_ew'] > 0 || config_check("e2", $user_ship) || config_check("bo", $user_ship)) { $error_str .= $st[707]; } elseif (config_check("oo", $ship_stats)) { $error_str .= $st[708]; } else { $blueprints = load_ship_types($user_ship['shipclass']); #more specific checks to see if anything has been done to the old ship if (!isset($blueprints)) { $error_str .= $st[709]; } elseif ($user['cash'] < $blueprints['cost']) { $error_str .= $st[710]; } elseif ($blueprints['tcost'] > 0) { $error_str .= $st[711]; } else { //detect if a variable has been changed function det_change($input_var) { global $changed_factor, $blueprints, $user_ship; if ($blueprints[$input_var] != $user_ship[$input_var]) { $changed_factor[$input_var] = $user_ship[$input_var] - $blueprints[$input_var]; }