Example #1
0
$scan_system = sys_get_param_int('system');
$scan_planet = sys_get_param_int('planet');
$scan_planet_type = 1;
// sys_get_param_int('planettype');
$id = sys_get_param_id('id');
$source_galaxy = $planetrow['galaxy'];
$source_system = $planetrow['system'];
$source_planet = $planetrow['planet'];
$sensorRange = GetPhalanxRange($sensorLevel);
$system_distance = abs($source_system - $scan_system);
if ($system_distance > $sensorRange || $scan_galaxy != $source_galaxy) {
    message($lang['phalanx_rangeerror'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
}
$cost = $sensorLevel * 1000;
if ($planetrow['deuterium'] < $cost) {
    message($lang['phalanx_nodeuterium'], "phalanx", '', 3);
}
$planet_scanned = db_planet_by_gspt($scan_galaxy, $scan_system, $scan_planet, $scan_planet_type);
if (!$planet_scanned['id']) {
    message($lang['phalanx_planet_not_exists'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
}
if ($planet_scanned['destruyed']) {
    message($lang['phalanx_planet_destroyed'], $lang['tech'][STRUC_MOON_PHALANX], '', 3);
}
db_planet_set_by_id($user['current_planet'], "deuterium = deuterium - {$cost}");
$template = gettemplate('planet_fleet_list', true);
$fleet_list = flt_get_fleets($planet_scanned, true);
$fleets = flt_parse_fleets_to_events($fleet_list, $planet_scanned);
//int_get_missile_to_planet("SELECT * FROM `{{iraks}}` WHERE fleet_end_galaxy = {$scan_galaxy} AND fleet_end_system = {$scan_system} AND fleet_end_planet = {$scan_planet};");
tpl_assign_fleet($template, $fleets);
display($template, $lang['tech'][STRUC_MOON_PHALANX], false, '', false, false);
Example #2
0
     $planet_fill = floor($planetrow['field_current'] / eco_planet_fields_max($planetrow) * 100);
     $planet_fill = $planet_fill > 100 ? 100 : $planet_fill;
     $can_teleport = uni_planet_teleport_check($user, $planetrow);
     $template->assign_vars(array('DARK_MATTER' => $user['dark_matter'], 'PLANET_FILL' => floor($planetrow['field_current'] / eco_planet_fields_max($planetrow) * 100), 'PLANET_FILL_BAR' => $planet_fill, 'SECTOR_CAN_BUY' => $sector_cost <= $user_dark_matter, 'SECTOR_COST' => $sector_cost, 'SECTOR_COST_TEXT' => pretty_number($sector_cost), 'planet_field_current' => $planetrow['field_current'], 'planet_field_max' => eco_planet_fields_max($planetrow), 'CAN_TELEPORT' => $can_teleport['result'] == ERR_NONE, 'CAN_NOT_TELEPORT_MSG' => $can_teleport['message'], 'TELEPORT_COST_TEXT' => pretty_number($config->planet_teleport_cost, true, $user['dark_matter']), 'CAN_CAPITAL' => $user['dark_matter'] >= $config->planet_capital_cost, 'CAPITAL_COST_TEXT' => pretty_number($config->planet_capital_cost, true, $user['dark_matter']), 'PLANET_DENSITY_INDEX' => $planet_density_index, 'PLANET_CORE_TEXT' => $lang['uni_planet_density_types'][$planet_density_index], 'IS_CAPITAL' => $planetrow['id'] == $user['id_planet'], 'PAGE_HINT' => $lang['ov_manage_page_hint']));
     $template->assign_block_vars('result', $result);
     display($template, $lang['rename_and_abandon_planet']);
     break;
 default:
     sn_sys_sector_buy();
     $template = gettemplate('planet_overview', true);
     rpg_level_up($user, RPG_STRUCTURE);
     rpg_level_up($user, RPG_RAID);
     rpg_level_up($user, RPG_TECH);
     rpg_level_up($user, RPG_EXPLORE);
     $fleet_id = 1;
     $fleet_list = flt_get_fleets($user['id']);
     $fleets = flt_parse_fleets_to_events($fleet_list);
     //    int_get_missile_to_planet("SELECT * FROM `{{iraks}}` WHERE `fleet_owner` = '{$user['id']}'");
     $planet_count = 0;
     sn_db_transaction_start();
     $planets_query = db_planet_list_sorted($user, false, '*');
     foreach ($planets_query as $an_id => $UserPlanet) {
         $UserPlanet = sys_o_get_updated($user, $UserPlanet['id'], SN_TIME_NOW, false, true);
         $list_planet_que = $UserPlanet['que'];
         $UserPlanet = $UserPlanet['planet'];
         $template_planet = tpl_parse_planet($UserPlanet);
         $planet_fleet_id = 0;
         $fleet_list = $template_planet['fleet_list'];
         if ($fleet_list['own']['count']) {
             $planet_fleet_id = "p{$UserPlanet['id']}";
             $fleets_to_planet[$UserPlanet['id']] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id);
Example #3
0
function flt_get_fleets_to_planet($planet, $fleet_db_list = 0)
{
    if (!($planet && $planet['id']) && !$fleet_db_list) {
        return $planet;
    }
    global $user;
    if ($fleet_db_list === 0) {
        $fleet_db_list = flt_get_fleets($planet);
    }
    foreach ($fleet_db_list as $fleet) {
        if ($fleet['fleet_owner'] == $user['id']) {
            if ($fleet['fleet_mission'] == MT_MISSILE) {
                continue;
            }
            $fleet_ownage = 'own';
        } else {
            switch ($fleet['fleet_mission']) {
                case MT_ATTACK:
                case MT_AKS:
                case MT_DESTROY:
                case MT_MISSILE:
                    $fleet_ownage = 'enemy';
                    break;
                default:
                    $fleet_ownage = 'neutral';
                    break;
            }
        }
        $fleet_list[$fleet_ownage]['fleets'][$fleet['fleet_id']] = $fleet;
        if ($fleet['fleet_mess'] == 1 || $fleet['fleet_mess'] == 0 && $fleet['fleet_mission'] == MT_RELOCATE || $fleet['fleet_target_owner'] != $user['id']) {
            //      $fleet_sn = flt_expand($fleet);
            $fleet_sn = sys_unit_str2arr($fleet['fleet_array']);
            foreach ($fleet_sn as $ship_id => $ship_amount) {
                if (in_array($ship_id, sn_get_groups('fleet'))) {
                    $fleet_list[$fleet_ownage]['total'][$ship_id] += $ship_amount;
                }
            }
        }
        $fleet_list[$fleet_ownage]['count']++;
        $fleet_list[$fleet_ownage]['amount'] += $fleet['fleet_amount'];
        $fleet_list[$fleet_ownage]['total'][RES_METAL] += $fleet['fleet_resource_metal'];
        $fleet_list[$fleet_ownage]['total'][RES_CRYSTAL] += $fleet['fleet_resource_crystal'];
        $fleet_list[$fleet_ownage]['total'][RES_DEUTERIUM] += $fleet['fleet_resource_deuterium'];
    }
    return $fleet_list;
}