Example #1
0
        explore_sys($user, $temp_ship['location']);
        dbn("update {$db_name}_users set ship_id = '{$command}' where login_id = '{$user['login_id']}'");
        $user['ship_id'] = $command;
        $user['location'] = $temp_ship['location'];
        get_star();
        get_user_ship($command);
    }
}
//subspace jump
if (!empty($subspace)) {
    db("select count(ship_id) from {$db_name}_ships where fleet_id = '{$user_ship['fleet_id']}' && location = '{$user_ship['location']}' && ship_id != '{$user['ship_id']}' && login_id = '{$user['login_id']}'");
    $num_towed1 = dbr();
    $num_towed = $num_towed1[0];
    db("select count(star_id) from {$db_name}_stars");
    $num_ss = dbr();
    $turn = round(get_star_dist($user['location'], $subspace) / 2 + 1);
    $exp_sys_arr = explode(",", $user['explored_sys']);
    if (!config_check("sj", $user_ship)) {
        $user_loc_message .= $st[8];
    } elseif ($subspace == $user['location']) {
        $user_loc_message .= $st[9];
    } elseif ($user['turns'] < $turn) {
        $user_loc_message .= sprintf($st[10], $turn);
    } elseif ($num_towed > 10 && !config_check("ws", $user_ship)) {
        $user_loc_message .= sprintf($st[11], $num_towed);
    } elseif ($subspace > $num_ss[0] || $subspace <= 0) {
        $user_loc_message .= sprintf($st[12], $num_ss[0]);
    } elseif ($GAME_VARS['uv_explored'] == 0 && $user['explored_sys'] != -1 && $user['login_id'] != 1 && array_search($subspace, $exp_sys_arr) === false) {
        $user_loc_message .= $st[13];
    } else {
        explore_sys($user, $subspace);
Example #2
0
         if (!isset($sure)) {
             #ensure the user wants to carry out the autoshift.
             get_var($st[1615], 'planet.php', $st[1618] . "\r\n\t\t\t\t\t<br /><b>{$ship_count}</b> " . $cw['ship_s'] . ".\r\n\t\t\t\t\t<br /><b>{$colonist}</b> " . $st[1619] . "\r\n\t\t\t\t\t<p />" . $st[1620] . "<b class='b1'>{$planet['planet_name']}</b>(#<b>{$planet['location']}</b>).\r\n\t\t\t\t\t<p />" . sprintf($st[1621], $turn, $c_c), 'sure', '');
         } else {
             #update the game cos the user does want to do the autoshifting.
             dbn("update {$db_name}_planets set colon = colon + '{$colonist}' where planet_id = '{$planet_id}'");
             charge_turns($turn);
             take_cash($c_c);
             $output_str .= sprintf($st[1622], $colonists) . "<p />{$max_reached}<p />";
         }
     }
 } else {
     #user is getting the materials from a system other than Sol. Thus different maths and stuff needs to be done as there is a finite number of materials, but no cash cost.
     db("select location,login_id,planet_name,{$tech_mat},planet_id,alloc_fight,alloc_elect from {$db_name}_planets where planet_id = '{$dest_system}'");
     $from_sys = dbr(1);
     $turn = round(get_star_dist($user['location'], $from_sys['location']) / 1.8 + 1) * 2;
     #work out turn cost
     #echo $turns_can_use = floor(($user['turns']- $turn) * 1.35);
     if ($user['turns'] < $turn) {
         #ensure user has enough turns to get there
         $output_str .= sprintf($st[1623], $turn, $from_sys[planet_name], $from_sys[location]);
     } elseif (!isset($from_sys)) {
         $output_str .= $st[1624] . "<p />";
     } elseif ($from_sys['login_id'] != $user['login_id']) {
         $output_str .= $st[1625] . "<p />";
     } elseif ($type == 1 && $from_sys['colon'] - ($from_sys['alloc_elect'] + $from_sys['alloc_fight']) < 1) {
         $output_str .= $st[1626] . "<p />";
     } elseif ($type > 1 && $from_sys[$tech_mat] <= 0) {
         $output_str .= sprintf($st[1627], $text_mat);
     } else {
         #main autoshifting bit for taking materials from target planet