Example #1
0
     $user_loc_message = sprintf($st[15], $GAME_VARS[ship_warp_cost]);
 } elseif ($GAME_VARS['ship_warp_cost'] < 0 && $user['turns'] < $warp_cost && $user['login_id'] > 1) {
     $user_loc_message = sprintf($st[16], $warp_cost);
     //player isn't alive, and thus cannot move around.
 } elseif (!$am_alive) {
     $user_loc_message = $st[17];
 } else {
     if ($toloc < 1) {
         $user_loc_message = $st[18];
     } elseif ($toloc == $user['location']) {
         $user_loc_message = $st[19];
     } elseif (search_links($star, $toloc) && $user['location'] > 0 && $user['location'] <= $game_info['num_stars']) {
         $user_loc_message = sprintf($st[20], $toloc);
     } else {
         explore_sys($user, $toloc);
         charge_turns($warp_cost);
         dbn("update {$db_name}_ships set location = '{$toloc}', mine_mode = '0' where ship_id = '{$user['ship_id']}'");
         $user_ship['mine_mode'] = 0;
         $user_ship['location'] = $toloc;
         #simpler & quicker version of ramscooping.
         #ramscooping using the mammoth ramjet
         $temp056 = mt_rand(1, 3);
         dbn("update {$db_name}_ships set fuel = fuel + '{$temp056}' where shipclass = 301 && ((ship_id = '{$user_ship['ship_id']}' && '{$temp056}' + '{$user_ship['empty_bays']}' > 0) || (fleet_id = '{$user_ship['fleet_id']}' && location = '{$user['location']}' && login_id = '{$user['login_id']}' && (cargo_bays - metal-fuel-elect-colon > {$temp056})))");
         if ($user_ship['shipclass'] == 301 && $temp056 + $user_ship['empty_bays'] > 0) {
             $user_ship['fuel'] += $temp056;
             $user_ship['empty_bays'] -= $temp056;
         }
         #ramscooping using the asteroid processor.
         $temp056 = mt_rand(1, 3);
         dbn("update {$db_name}_ships set metal = metal + '{$temp056}' where shipclass = 302 && ((ship_id = '{$user_ship['ship_id']}' && '{$temp056}' + '{$user_ship['empty_bays']}' > 0) || (fleet_id = '{$user_ship['fleet_id']}' && location = '{$user['location']}' && login_id = '{$user['login_id']}' && (cargo_bays - metal-fuel-elect-colon) > {$temp056}))");
         if ($user_ship['shipclass'] == 302 && $temp056 + $user_ship['empty_bays'] > 0) {
Example #2
0
    $amount = (int) $_POST['amount'];
    if (!avail_check(4001)) {
        $out .= $st[432];
    } elseif ($user['turns'] < 1) {
        $out .= $st[433];
    } elseif ($amount <= 0) {
        get_var('Take Colonists', $_SERVER['PHP_SELF'], "<a href='{$_SERVER['PHP_SELF']}?all_colon=1'>Fill Ship</a><p />Combien de colons voulez-vous acheter ?<br />Chaque colon coûte <b>{$GAME_VARS['cost_colonist']}</b> crédits.<p />", 'amount', $fill);
    } elseif ($fill < 1) {
        $out .= $st[1892] . "<p />";
    } 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>";
Example #3
0
function print_leftbar()
{
    global $user, $db_name, $game_info, $user_ship, $GAME_VARS, $p_user, $cw, $st;
    //create the major table for the WHOLE PAGE
    $str = "\n<table border='0' cellspacing='0' cellpadding='0' width='100%'>";
    //whole page fills 1 "row".
    $str .= "\n<tr width='100%'>";
    //create "cell" for left bar. width stipulates width of this bar.
    //uses class "leftbar" from the stylesheets to decide on it's width
    $str .= "\n<td class='leftbar' align='left' valign='top'>";
    /*************** Content *************/
    $str .= '<img src="images/logos/logo_petit.png" /><br />';
    //top box with game details in it
    $str .= make_table2(array(date("d M - H:i")), "l_col");
    $str .= q_row(popup_help("game_info.php?db_name={$db_name}", 600, 450, $game_info['name']), "l_col");
    if ($game_info['paused'] == 1) {
        $str .= q_row($cw['game_paused'], "l_col");
    } else {
        $str .= q_row("<b>{$game_info['days_left']}</b> " . $cw['days_left'], "l_col");
    }
    //active user count details
    $end_lnk = "";
    $cnt_link_str = "";
    if ($user['login_id'] == 1 || $user['login_id'] == OWNER_ID) {
        $cnt_link_str .= "<a href='admin.php?show_active=1'>";
        $end_lnk = "</a>";
    }
    db("select count(login_id) from {$db_name}_users where login_id > 1 && last_request > " . (time() - 300));
    $lr_result = dbr();
    $str .= q_row($cnt_link_str . "<b>{$lr_result['0']}</b> " . $cw['active_users'] . "{$end_lnk}</b>", "l_col");
    $str .= "</table><p />";
    //end top box with game details
    $str .= make_table2(array(stripslashes(print_name($user))), "l_col");
    $str .= q_row("<b>" . number_format($user['turns']) . "</b> " . strtolower($cw['turns']) . " sur <b>" . number_format($GAME_VARS['max_turns']) . "</b> max<br /><a href='buy.php' id='plusCycles'>Plus de cycles</a>", "l_col");
    //newbie safety, or admin link
    if ($user['login_id'] == 1 || $user['login_id'] == OWNER_ID) {
        //cheating and using this space for admin links
        $str .= "\n<td><a href='admin.php'>" . $cw['admin'] . "</a>";
        if ($user['login_id'] == OWNER_ID) {
            //server admin link
            $str .= "\n<br /><a href='developer.php'>" . $cw['server_admin'] . "</a>";
        }
        $str .= "</td>";
        /*} elseif($user['turns_run'] > $GAME_VARS['turns_safe']){
        		$str .= "\n<td><a href='buy.php' style='color:#FF0000;'>".$cw['Get more turns']."</a></td>";*/
    } elseif ($user['turns_run'] < $GAME_VARS['turns_safe']) {
        $s_turns = $GAME_VARS['turns_safe'] - $user['turns_run'];
        $str .= q_row("<b>{$s_turns}</b> <b class='b1'>" . $cw['safe_turns_left'] . "</b>", "l_col");
    } elseif ($user['turns_run'] <= $GAME_VARS['turns_safe']) {
        $str .= q_row("<b class='b1'>" . $cw['leaving_newbie_safety'] . "</b>", "l_col");
        charge_turns(1);
        send_message($user['login_id'], $st[7]);
    }
    if (!$p_user['bp_user_id']) {
        $plusCubits = "<br /><a href='buy_cubits.php' id='plusCycles'>Plus de cubits</a>";
    }
    $str .= q_row("<b>" . number_format($user['cash'], 0, ',', ' ') . "</b> " . strtolower($cw['credits']) . $plusCubits, "l_col");
    $str .= q_row("<b>" . number_format($user['tech']) . "</b> " . $cw['tech_units'], "l_col");
    $str .= "</table>";
    /*
    //if not in a ship, don't show these details
    if($user['ship_id'] == 1) {
    	$str .= make_table2(array($cw['ship_destroyed']), "l_col");
    } else {
    	$str .= make_table2(array(stripslashes($user_ship['ship_name'])), "l_col");
    	$str .= q_row(popup_help("help.php?popup=1&ship_info=".$user_ship['shipclass']."&db_name=$db_name", 300, 600, $user_ship['class_name']), "l_col");
    
    	$clan_fleet_str = "";
    	if($user['clan_id'] > 0 && $GAME_VARS['clan_fleet_attacking'] == 1){
    		$clan_fleet_str= " ".$cw['c_fleet'].": <b>$user_ship[clan_fleet_id]</b>";
    	}
    	$str .= q_row($cw['fleet'].": <b>$user_ship[fleet_id]</b><br />".$clan_fleet_str, "l_col");
    	$str .= q_row($cw['fighters'].": <b>".number_format($user_ship['fighters'])."</b> / <b>".number_format($user_ship['max_fighters'])."</b>", "l_col");
    	$str .= q_row($cw['shields'].": <b>".number_format($user_ship['shields'])."</b> / <b>".number_format($user_ship['max_shields'])."</b>", "l_col");
    	$str .= q_row($cw['armour'].": <b>".number_format($user_ship['armour'])."</b> / <b>".number_format($user_ship['max_armour'])."</b>", "l_col");
    
    	$str .= q_row($cw['cargo_bays'].":<br />".bay_storage($user_ship), "l_col");
    }
    
    $str .= "</table>";
    //end of ship detail listing
    */
    /*************************Forum Links***************************/
    /*
    	//prepare to get central forum information
    	$last_globals = $p_user['last_access_global_forum'];
    	$last_admin = 0;
    	if($user['login_id'] == 1){ //last access admin forum for admins
    		$last_admin = $game_info['last_access_admin_forum'];
    	} elseif($user['login_id'] == OWNER_ID) { //last access admin forum for server op
    		$last_admin = $p_user['icq'];
    	}
    	//get new messages from central forums (admin and globals).
    	db("select count(message_id) as new_messages, forum_id from se_central_messages where (timestamp > '$last_admin' && (('$user[login_id]' = 1 && (game_id != '$game_info[game_id]' || sender_id != 1)) || (sender_id != '$user[login_id]' && '$user[login_id]' = '".OWNER_ID."')) && forum_id = -99) || (timestamp > '$last_globals' && (sender_id = 1 || (sender_id != 1 && sender_id != '$user[login_id]')) && forum_id = -50) group by forum_id");
    	//initialise array that will contain how many of each message was found.
    	$msgs_array = array(-1 => 0, -5 => 0, -50 => 0, -99 => 0);
    	while($msg_tmp = dbr(1)){
    		$msgs_array[$msg_tmp['forum_id']] = $msg_tmp['new_messages'];
    	}
    	//get new messages for regular and clan forums
    	db("select count(message_id) as new_messages, login_id as forum_id from ${db_name}_messages where (timestamp > '$user[last_access_forum]' && login_id = -1 && sender_id != '$user[login_id]') || (timestamp > '$user[last_access_clan_forum]' && login_id = -5 && clan_id = '$user[clan_id]' && sender_id != '$user[login_id]') group by login_id");
    	while($msg_tmp = dbr(1)){
    		$msgs_array[$msg_tmp['forum_id']] = $msg_tmp['new_messages'];
    	}
    	//initiate comms. table
    	$str .= "<p />".make_table2(array($cw['communications']), "l_col");
    	//messages links. Need to work out if there are any messages for the player.
    	db("select count(message_id) from ${db_name}_messages where login_id = '$user[login_id]' and timestamp > ".$user['last_access_msg']);
    	$counted = dbr();
    	if($counted[0] == 0){
    		$str .= q_row("\n<a href='mpage.php'>".$cw['no_messages']."</a> - <a href='message.php'>".$cw['send']."</a>", "l_col");
    	}else{
    		$str .= q_row("\n<a href='mpage.php'><b>$counted[0]</b> ".$cw['messages']."</a> - <a href='message.php'>".$cw['send']."</a>", "l_col");
    	}
    */
    /*******************
     * Forum Link
     *******************/
    /*$forum_temp_str = "<a href='forum.php?target_id=-1'>".$cw['shout_box']."</a>";
    
    	if($msgs_array[-1] > 0){
    		$forum_temp_str .= " - {$msgs_array[-1]} <a href='forum.php?target_id=-1&last_time=$user[last_access_forum]'>".$cw['new']."</a>";
    	}
    	$str .= q_row($forum_temp_str, "l_col");*/
    /*******************
     * Global Forum Link
     *******************/
    /*$forum_temp_str = "<a href='/forum' target='_blank'>".$cw['forum']."</a>";
    
    	$str .= q_row($forum_temp_str, "l_col");
    
    	$forum_temp_str = "";*/
    /*******************
     * Clan Forum Link
     *******************/
    /*if($user['login_id'] == 1 || $user['login_id'] == OWNER_ID){
    		$forum_temp_str .= "<a href='forum.php?target_id=-5'>".$cw['clan_forums']."</a>";
    
    	} elseif($user['clan_id'] > 0) {
    		$forum_temp_str .= "<a href='forum.php?target_id=-5'><font color='$user[clan_sym_color]'>$user[clan_sym]</font> ".$cw['forum']."</a>";
    
    		if($msgs_array[-5] > 0){
    			 $forum_temp_str .= " - ({$msgs_array[-5]} <a href='forum.php?target_id=-5&last_time=$user[last_access_clan_forum]'>".$cw['new']."</a>)";
    		}
    		//security precaution
    		unset($_REQUEST['clan_id']);
    	}
    	//only print the clan forum link for people in a clan
    	(!empty($forum_temp_str)) ? $str .= q_row($forum_temp_str, "l_col") : 0;
    
    
    	$forum_temp_str = "";
    */
    /*******************
     * Admin Forum Link
     *******************/
    /*if($user['login_id'] == 1 || $user['login_id'] == OWNER_ID){
    		$forum_temp_str .= "<a href='forum.php?target_id=-99'>".$cw['admin_forums']."</a>";
    
    		if($msgs_array[-99] > 0){
    			 $forum_temp_str .= " - ({$msgs_array[-99]} <a href='forum.php?target_id=-99&last_time=$user[last_access_clan_forum]'>new</a>)";
    		}
    	}
    	//only print the clan forum link for people in a clan
    	(!empty($forum_temp_str)) ? $str .= q_row($forum_temp_str, "l_col") : 0;
    
    
    	$str .= "</table>";
    	//end forums table
    
    	$str .= "<p />".make_table2(array($cw['account_functions']), "l_col");
    
    	$str .= q_row("\n<a href='parrainage.php'>".$cw['parrainage']."</a>", "l_col");
    
    	$str .= q_row("\n<a href='options.php'>".$cw['preferences']."</a>", "l_col");
    	$str .= q_row("\n&nbsp", "v_col");
    
    	//admin lower sidebar
    	if($user['login_id'] == 1){
    		$str .= q_row("\n<a href='logout.php'>".$cw['logout']."</a>", "l_col");
    	} else { //player lower sidebar
    		$str .=  q_row("\n<a href='logout.php?logout_single_game=1' target='_top'>".$cw['game_list']."</a>", "l_col");
    		$str .=  q_row("\n<a href='logout.php?comp_logout=1' target='_top'>".$cw['complete_logout']."</a>", "l_col");
    	}
    	$str .= "</table>";*/
    /*************** End Content *************/
    if ($p_user['id_didac']) {
        db("select * from se_didacticiel where id=" . $p_user['id_didac']);
        $data = dbr();
        $str .= "<div id='didacticiel'>";
        $str .= "<div id='texte_didac'>";
        $str .= nl2br($data['texte']);
        $str .= "</div>";
        $str .= "<div id='liens_didac'>";
        $str .= "<a href='#null' id='prec_didac'>&lt;&lt; Préc.</a>&nbsp;&nbsp;";
        $str .= "<a href='#null' id='suiv_didac'>Suiv. &gt;&gt;</a>";
        $str .= "</div>";
        $str .= "<a href='#null' id='annuler_didac'>Fermer</a>";
        $str .= "</div>";
    }
    $str .= '<br />Pour nous soutenir votez sur facebook:<br /><iframe src="http://www.facebook.com/plugins/like.php?href=http%253A%252F%252Fwww.astravires.fr%252F&amp;layout=button_count&amp;show_faces=false&amp;width=150&amp;action=like&amp;font=arial&amp;colorscheme=dark&amp;height=40" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; margin: 5px; height:40px;" allowTransparency="true"></iframe>';
    $rand = mt_rand(1, 999999);
    /*
     * publicité désactivée
     * 
    	if (!$p_user['bp_user_id']) {
    		$str .= "<br />
    				<iframe id='a7eabf27' name='a7eabf27' src='http://pub.nilsine.fr/www/delivery/afr.php?zoneid=2&amp;cb=$rand' framespacing='0' frameborder='no' scrolling='no' width='120' height='600'><a href='http://pub.nilsine.fr/www/delivery/ck.php?n=a3e02ac4&amp;cb=$rand' target='_blank'><img src='http://pub.nilsine.fr/www/delivery/avw.php?zoneid=2&amp;cb=$rand&amp;n=a3e02ac4' border='0' alt='' /></a></iframe>
    				";
    	}
    */
    $str .= '</td>';
    echo $str;
}
Example #4
0
function load_unload_planet($selected_ships, $load_or_unload, $do_ship = 0)
{
    global $user, $user_ship, $db_name, $tech_mat, $text_mat, $planet, $sure, $type, $dump_all, $cw, $st;
    discern_type($type);
    $extra_where = "";
    $captaining = 0;
    if ($selected_ships == 1) {
        foreach ($do_ship as $ship_id) {
            $extra_where .= "ship_id = '{$ship_id}' || ";
            if ($ship_id == $user['ship_id']) {
                $captaining = 1;
            }
        }
        $extra_where = preg_replace("/\\|\\| \$/", "", $extra_where);
        $extra_where = "&& ({$extra_where})";
    }
    if ($load_or_unload == 2) {
        //unloading the ship
        //select all ships that are valid
        db("select sum({$tech_mat}) as goods, count(ship_id) as ship_count from {$db_name}_ships where login_id = '{$user['login_id']}' && location = '{$user['location']}' && {$tech_mat} > 0 " . $extra_where);
        $results = dbr(1);
        $turn_cost = ceil($results['ship_count'] * 0.75);
        $max_reached = "";
        if (!isset($results['goods'])) {
            //no goods on any ships
            return sprintf($st[1535], $text_mat);
        } elseif ($user['turns'] < $turn_cost && !isset($dump_all)) {
            //insufficient turns
            return sprintf($st[1536], $turn_cost);
            unset($results);
        } elseif ($results['goods'] + $planet['colon'] > $planet['max_population'] && $type == 1) {
            $max_reached = "<b class='b1'>" . $cw['warning'] . "</b>: " . $st[1537];
        } elseif (!isset($sure) && $selected_ships == 0 && !isset($dump_all)) {
            //confirmation
            get_var($st[1538] . " {$text_mat}", 'planet.php', sprintf($st[1539], $text_mat, $results[goods], $results[ship_count], $turn_cost) . $max_reached, 'sure', 'yes');
        } else {
            //finish unloading the planets.
            $t_cost_str = "";
            dbn("update {$db_name}_planets set {$tech_mat} = {$tech_mat} + '{$results['goods']}' where planet_id = '{$user['on_planet']}'");
            dbn("update {$db_name}_ships set {$tech_mat} = 0 where login_id = '{$user['login_id']}' && location = '{$user['location']}' && {$tech_mat} > 0 " . $extra_where);
            if (!isset($dump_all)) {
                charge_turns($turn_cost);
                $t_cost_str = " pour un coût total de <b>{$turn_cost}</b> cycles.";
            }
            if ($captaining == 1 || $selected_ships == 0 && $user_ship[$tech_mat] > 0) {
                $user_ship[$tech_mat] = 0;
                empty_bays($user_ship);
            }
            $planet[$tech_mat] += $results['goods'];
            return "<b>{$results['goods']}</b> " . sprintf($st[1540], $text_mat, $results[ship_count]) . $t_cost_str;
        }
    } else {
        //loading the ship
        $taken = 0;
        //goods taken from planet so far.
        $ship_counter = 0;
        if ($planet[$tech_mat] < 1) {
            //can't take stuff if there isn't any to take
            return sprintf($st[1541], $text_mat);
        } elseif ($type == 0) {
            //fighters
            db2("select ship_id,(max_fighters - fighters) as free,ship_name, {$tech_mat} from {$db_name}_ships where login_id = '{$user['login_id']}' && location = '{$user['location']}' && (max_fighters - fighters) > 0 {$extra_where} order by free desc");
        } elseif ($type != 0) {
            db2("select ship_id, (cargo_bays - metal - fuel - elect - colon) as free, ship_name, {$tech_mat} from {$db_name}_ships where login_id = '{$user['login_id']}' && location = '{$user['location']}' && (cargo_bays - metal - fuel - elect - colon) > 0 {$extra_where} order by free desc");
        }
        $ships = dbr2(1);
        $first_mess = "";
        $sec_mess = "";
        $turns_txt = "";
        $out = "";
        if ($type == 0 && $planet['allocated_to_fleet'] > 0) {
            //warning about fighter allocation
            $first_mess = $cw['warning'] . ".<br /> " . $st[1542];
            $sec_mess = $cw['warning'] . ":<br />" . $st[1543];
        }
        if (!isset($ships['ship_id']) && $selected_ships == 0) {
            //check to see if there are any ships
            return $st[1544] . " <b class='b1'>{$text_mat}</b>.";
        } elseif (!isset($ships['ship_id']) && $selected_ships == 1) {
            //check to see if there are any ships
            return $st[1545] . " <b class='b1'>{$text_mat}</b>.";
        } else {
            while ($ships) {
                $ship_counter++;
                //planet can load ship w/ spare fighters.
                if ($ships['free'] < $planet[$tech_mat] - $taken) {
                    if (isset($sure) || $selected_ships == 1) {
                        //only run during the real thing.
                        dbn("update {$db_name}_ships set {$tech_mat} = {$tech_mat} + '{$ships['free']}' where ship_id = '{$ships['ship_id']}'");
                        $out .= "<br /><b class='b1'>{$ships['ship_name']}</b> : " . sprintf($st[1546], $ships[free], $text_mat);
                        if ($ships['ship_id'] == $user_ship['ship_id'] && $type == 0) {
                            #update user ship
                            $user_ship['fighters'] = $user_ship['max_fighters'];
                        } elseif ($ships['ship_id'] == $user_ship['ship_id'] && $type > 0) {
                            #update user ship
                            $user_ship[$tech_mat] += $ships['free'];
                            $user_ship['empty_bays'] -= $ships['free'];
                        }
                    }
                    $taken += $ships['free'];
                    //ensure user has enough turns, or stop the loop where the user is.
                    if ($user['turns'] <= ceil($ship_counter * 0.75)) {
                        $turns_txt = $st[1547];
                        $out .= $st[1548];
                        unset($ships);
                        break;
                    }
                    //planet will run out of fighters.
                } elseif ($ships['free'] >= $planet[$tech_mat] - $taken) {
                    $t868 = $ships[$tech_mat] + ($planet[$tech_mat] - $taken);
                    if (isset($sure) || $selected_ships == 1) {
                        #only run during the real thing.
                        dbn("update {$db_name}_ships set {$tech_mat} = '{$t868}' where ship_id = '{$ships['ship_id']}'");
                        $out .= "<br /><b class='b1'>{$ships['ship_name']}</b>s " . $st[1549] . " <b>{$t868}</b> <b class='b1'>{$text_mat}</b>";
                        if ($ships['ship_id'] == $user_ship['ship_id'] && $type == 0) {
                            #update user ship
                            $user_ship['fighters'] = $t868;
                        } elseif ($ships['ship_id'] == $user_ship['ship_id'] && $type > 0) {
                            #update user ship
                            $user_ship[$tech_mat] = $t868;
                            empty_bays($user_ship);
                        }
                    }
                    $taken += $t868 - $ships[$tech_mat];
                    unset($ships);
                    break;
                }
                $ships = dbr2(1);
            }
            #end loop of ships
            $turn_cost = ceil($ship_counter * 0.75);
            if (!isset($sure) && $selected_ships == 0) {
                get_var($st[1550], 'planet.php', $turns_txt . sprintf($st[1551], $ship_counter, $taken, $text_mat, $turn_cost) . "<p />" . $first_mess, 'sure', 'yes');
            } else {
                dbn("update {$db_name}_planets set {$tech_mat} = {$tech_mat} - '{$taken}' where planet_id = '{$user['on_planet']}'");
                $planet[$tech_mat] -= $taken;
                if ($planet['allocated_to_fleet'] > 0 && $type == 0) {
                    dbn("update {$db_name}_planets set allocated_to_fleet = 0 where planet_id = '{$user['on_planet']}'");
                }
                charge_turns($turn_cost);
                if ($type == 1) {
                    #colonists
                    $planet['alloc_fight'] = 0;
                    $planet['alloc_elect'] = 0;
                    dbn("update {$db_name}_planets set alloc_fight = 0, alloc_elect=0 where planet_id = '{$user['on_planet']}'");
                    $out .= $st[1552];
                }
                return "<b>{$ship_counter}</b>" . sprintf($st[1553], $taken, $text_mat) . " <b class='b1'>{$planet['planet_name']}</b>:<br />" . $out . "<p />" . $st[1554] . " <b>{$turn_cost}</b>.<p />" . $sec_mess;
            }
        }
    }
}
Example #5
0
} elseif ($user['turns'] < 5) {
    $error_str = $st[94];
} elseif (empty($planet_name)) {
    get_var($st[95], 'planet_build.php', $st[96], 'planet_name', '');
} elseif (strlen($planet_name) < 3) {
    $rs = "<p /><a href='javascript:history.back()'>" . $cw['try_again'] . "</a>";
    print_page($cw['invalide_name'], $st[97]);
} else {
    $planet_name = correct_name($planet_name);
    if (!$planet_name || $planet_name == " " || $planet_name == "") {
        $rs = "<p /><a href='javascript:history.back()'>" . $cw['try_again'] . "</a>";
        print_page($cw['invalide_name'], $st[98]);
    }
    // remove gen device, but not from admin.
    if ($user['login_id'] > 1) {
        dbn("update {$db_name}_users set genesis = genesis - 1 where login_id = {$user['login_id']}");
    }
    charge_turns(5);
    if ($user['clan_id']) {
        $clan_id = $user['clan_id'];
    } else {
        $clan_id = -1;
    }
    // build the new planet
    dbn("insert into {$db_name}_planets (planet_name,location,login_id,login_name,clan_id,planet_img, max_population) values ('{$planet_name}', '{$user['location']}', '{$user['login_id']}', '{$user['login_name']}', '{$clan_id}', '{$planet_img}', '{$max_pop}')");
    $last_planet = mysql_insert_id();
    dbn("update {$db_name}_stars set planetary_slots = planetary_slots - 1 where star_id = {$star['star_id']}");
    post_news(sprintf($st[99], $user[login_name], $planet_name), $cw['planet']);
    $error_str .= sprintf($st[100], $last_planet);
}
print_page($cw['planet_built'], $error_str);
Example #6
0
                }
            }
            //ships are now free to do as they will
            if (!empty($disengage_sql)) {
                $disengage_sql = preg_replace("/\\|\\| \$/", "", $disengage_sql);
                dbn("update {$db_name}_ships set ship_engaged = 0 where " . $disengage_sql);
            }
            //planets are now free to do as they will as well
            if (!empty($disengage_planets_sql)) {
                $disengage_planets_sql = preg_replace("/\\|\\| \$/", "", $disengage_planets_sql);
                dbn("update {$db_name}_planets set planet_engaged = 0 where " . $disengage_planets_sql);
            }
            charge_turns($total_attack_turn_cost);
        } else {
            //even simulations take turns to run!
            charge_turns($simulate_attack_turn_cost);
        }
        /***************************
        * Now leaving the attack system code.
        ****************************/
    }
    //end of fleet attacking 'if' - inner
}
//end of fleet attacking 'if' - outer
//print the page and be done with it.
print_page("Fleet Attacking", $tech_str);
exit;
/*****************************************************************
*								Functions
******************************************************************/
//friends - function to set value of an array to 1 (friend) in rediness to send to the attack processor