Exemplo n.º 1
0
function make_standard_upgrade($upgrade_str, $config_addon, $cost, $developement_id, $tech_cost = 0)
{
    global $user, $user_ship, $db_name, $cw, $st;
    if ($user['cash'] < $cost) {
        return sprintf($st[197], $upgrade_str);
    } elseif ($user['tech'] < $tech_cost && $tech_cost > 0) {
        return $st[198];
    } elseif (!avail_check($developement_id)) {
        return sprintf($st[199], $upgrade_str);
    } elseif (config_check($config_addon, $user_ship)) {
        return sprintf($st[600], $upgrade_str);
    } elseif ($user_ship['upgrade_slots'] < 1) {
        return "";
    } else {
        take_cash($cost);
        take_tech($tech_cost);
        $user_ship['config'] .= "," . $config_addon;
        dbn("update {$db_name}_ships set config = '{$user_ship['config']} ', upgrade_slots = upgrade_slots - 1 where ship_id = '{$user['ship_id']}'");
        $user_ship['upgrade_slots']--;
        return "<b class='b1'>{$upgrade_str}</b>, " . sprintf($st[601], $user_ship[ship_name], $cost) . "<p />";
    }
}
Exemplo n.º 2
0
        dbn("update {$db_name}_users set genesis = genesis + 1 where login_id = '{$user['login_id']}'");
    }
} elseif ($buy == 8) {
    //Terra Imploder
    if ($user['cash'] < $terra_i_c) {
        $error_str .= $st[409];
    } elseif ($user['tech'] < $terra_i_t) {
        $error_str .= $st[410];
    } elseif (!avail_check(1000)) {
        $error_str .= $st[411];
    } elseif (!isset($sure)) {
        get_var($cw['purchase_terra_emploder'], $filename, $st[412], 'sure', '');
    } else {
        $error_str .= sprintf($st[413], $terra_i_c, $terra_i_t);
        take_cash($terra_i_c);
        take_tech($terra_i_t);
        $user['terra_imploder']++;
        dbn("update {$db_name}_users set terra_imploder = terra_imploder + 1 where login_id = '{$user['login_id']}'");
    }
} elseif ($buy == 9) {
    //Advanced Engine Upgrade
    if ($user_ship['move_turn_cost'] < 3) {
        $error_str .= $st[414];
    } elseif (config_check("e1", $user_ship)) {
        $error_str .= $st[415];
    } elseif (!isset($sure)) {
        get_var($cw['purchase_advanced_engine_upgrade'], $filename, $st[416] . "<b class='b1'>{$user_ship['ship_name']}</b>?", 'sure', '');
    } else {
        $error_str .= make_standard_upgrade($cw['advanced_engine_upgrade'], "e2", $advanced_engine_c, 5003, $advanced_engine_t);
        $user_ship['move_turn_cost'] = $user_ship['move_turn_cost'] - 2;
        dbn("update {$db_name}_ships set move_turn_cost = move_turn_cost - 2 where ship_id = '{$user['ship_id']}'");
Exemplo n.º 3
0
            dbn("update {$db_name}_planets set cash = {$set_cash} where planet_id = {$user['on_planet']}");
        }
    }
    if (isset($set_tech) && $GAME_VARS['uv_num_bmrkt'] > 0) {
        #tech units
        $set_tech = round($set_tech);
        settype($set_tech, "integer");
        if ($set_tech >= 0 && $set_tech != $planet['tech']) {
            if ($set_tech > $user['tech'] + $planet['tech']) {
                #ensure user doesn't go over the limit.
                $set_tech = $user['tech'] + $planet['tech'];
            }
            if ($set_tech > $planet['tech']) {
                #user putting money onto planet.
                $take_from_user = $set_tech - $planet['tech'];
                take_tech($take_from_user);
                $planet['tech'] = $set_tech;
                dbn("update {$db_name}_planets set tech = {$set_tech} where planet_id = {$user['on_planet']}");
            } else {
                #taking money from planet.
                $give_to_user = $planet['tech'] - $set_tech;
                give_tech($give_to_user);
                $planet['tech'] = $set_tech;
                dbn("update {$db_name}_planets set tech = {$set_tech} where planet_id = {$user['on_planet']}");
            }
        }
    }
}
if (isset($rename)) {
    if ($user['login_id'] != $planet['login_id']) {
        $text .= $st[1671];
Exemplo n.º 4
0
 } elseif ($num_ships['other_reached'] && !config_check("bs", $ship_stats)) {
     $error_str = sprintf($st[372], $num_ships[other_ships], $GAME_VARS[max_other_ships]);
 } elseif ($ship_type == 1 || $ship_type == 0) {
     $error_str = $st[373];
 } elseif (!avail_check($ship_type)) {
     $error_str .= $st[374];
 } elseif ($user['cash'] < $ship_stats['cost']) {
     $error_str = sprintf($st[375], $ship_stats[name]);
 } elseif ($user['tech'] < $ship_stats['tcost']) {
     $error_str = sprintf($st[376], $ship_stats[name]);
 } elseif (!isset($ship_name)) {
     $rs = "<p /><a href='bm_ships.php'>" . $cw['return_to_blacmarket_ships'] . "</a>";
     get_var($cw['name_your_new_ship'], 'bm_ships.php', sprintf($st[377], $num_ships[total_ships]) . "<b class='b1'>{$ship_stats['name']}</b>:(20 Char Max)", 'ship_name', '');
 } else {
     take_cash($ship_stats['cost']);
     take_tech($ship_stats['tcost']);
     // remove old escape pods
     dbn("delete from {$db_name}_ships where login_id = '{$user['login_id']}' && class_name REGEXP 'Escape'");
     $ship_name = correct_name($ship_name);
     if (empty($user_ship['fleet_id']) || $user_ship['fleet_id'] < 1) {
         $user_ship['fleet_id'] = 1;
     }
     // build the new ship
     $q_string = "insert into {$db_name}_ships (";
     $q_string = $q_string . "ship_name, login_id, location, clan_id, shipclass, class_name, class_name_abbr, fighters, max_fighters, max_shields, armour, max_armour, cargo_bays, mine_rate_metal, mine_rate_fuel, config, size, upgrade_slots, move_turn_cost, point_value, num_pc, num_ot, num_dt, num_ew, fleet_id";
     $q_string = $q_string . ") values(";
     $q_string = $q_string . "'{$ship_name}', '{$login_id}', {$user['location']}, '{$user['clan_id']}', '{$ship_stats['type_id']}', '{$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['config']}', '{$ship_stats['size']}', '{$ship_stats['upgrade_slots']}', '{$ship_stats['move_turn_cost']}', '{$ship_stats['point_value']}', '{$ship_stats['num_pc']}', '{$ship_stats['num_ot']}', '{$ship_stats['num_dt']}', '{$ship_stats['num_ew']}', '{$user_ship['fleet_id']}')";
     dbn($q_string);
     $new_ship_id = mysql_insert_id();
     #the game goes all screwy if a player get's hold of ship_id 1.
     if ($new_ship_id == 1) {