示例#1
0
 public static function ShowFleetPage()
 {
     global $USER, $PLANET, $reslist, $resource, $db, $LNG, $ExtraDM;
     $PlanetRess = new ResourceUpdate();
     $PlanetRess->CalcResource();
     $PlanetRess->SavePlanetToDB();
     $parse = $LNG;
     $FleetID = request_var('fleetid', 0);
     $GetAction = request_var('action', "");
     $template = new template();
     $template->loadscript('flotten.js');
     if (!empty($FleetID)) {
         switch ($GetAction) {
             case "sendfleetback":
                 parent::SendFleetBack($USER, $FleetID);
                 break;
             case "getakspage":
                 $template->assign_vars(parent::GetAKSPage($USER, $PLANET, $FleetID));
                 break;
         }
     }
     $MaxExpedition = $USER[$resource[124]];
     if ($MaxExpedition >= 1) {
         $ExpeditionEnCours = parent::GetCurrentFleets($USER['id'], 15);
         $EnvoiMaxExpedition = floor(sqrt($MaxExpedition));
     } else {
         $ExpeditionEnCours = 0;
         $EnvoiMaxExpedition = 0;
     }
     $MaxFlottes = parent::GetMaxFleetSlots($USER);
     $galaxy = request_var('galaxy', $PLANET['galaxy']);
     $system = request_var('system', $PLANET['system']);
     $planet = request_var('planet', $PLANET['planet']);
     $planettype = request_var('planettype', $PLANET['planet_type']);
     $target_mission = request_var('target_mission', 0);
     $CurrentFleets = $db->query("SELECT * FROM " . FLEETS . " WHERE `fleet_owner` = '" . $USER['id'] . "' AND `fleet_mission` <> 10 ORDER BY `fleet_end_time` ASC;");
     $CountCurrentFleets = $db->num_rows($CurrentFleets);
     while ($CurrentFleetsRow = $db->fetch_array($CurrentFleets)) {
         $fleet = explode(";", $CurrentFleetsRow['fleet_array']);
         foreach ($fleet as $ShipID => $ShipCount) {
             if (empty($ShipCount)) {
                 continue;
             }
             $a = explode(",", $ShipCount);
             $FleetList[$CurrentFleetsRow['fleet_id']][$LNG['tech'][$a[0]]] = pretty_number($a[1]);
         }
         $FlyingFleetList[] = array('id' => $CurrentFleetsRow['fleet_id'], 'mission' => $CurrentFleetsRow['fleet_mission'], 'missionname' => $LNG['type_mission'][$CurrentFleetsRow['fleet_mission']], 'way' => $CurrentFleetsRow['fleet_mess'], 'start_galaxy' => $CurrentFleetsRow['fleet_start_galaxy'], 'start_system' => $CurrentFleetsRow['fleet_start_system'], 'start_planet' => $CurrentFleetsRow['fleet_start_planet'], 'start_time' => date(TDFORMAT, $CurrentFleetsRow['fleet_start_time']), 'end_galaxy' => $CurrentFleetsRow['fleet_end_galaxy'], 'end_system' => $CurrentFleetsRow['fleet_end_system'], 'end_planet' => $CurrentFleetsRow['fleet_end_planet'], 'end_time' => date(TDFORMAT, $CurrentFleetsRow['fleet_end_time']), 'amount' => pretty_number($CurrentFleetsRow['fleet_amount']), 'backin' => pretty_time(floor($CurrentFleetsRow['fleet_end_time'] - TIMESTAMP)), 'FleetList' => $FleetList[$CurrentFleetsRow['fleet_id']]);
     }
     $db->free_result($CurrentFleets);
     foreach ($reslist['fleet'] as $FleetID) {
         if ($PLANET[$resource[$FleetID]] > 0) {
             $FleetsOnPlanet[] = array('id' => $FleetID, 'name' => $LNG['tech'][$FleetID], 'speed' => parent::GetFleetMaxSpeed($FleetID, $USER), 'count' => pretty_number($PLANET[$resource[$FleetID]]));
         }
     }
     $template->assign_vars(array('FleetsOnPlanet' => $FleetsOnPlanet, 'FlyingFleetList' => $FlyingFleetList, 'fl_number' => $LNG['fl_number'], 'fl_mission' => $LNG['fl_mission'], 'fl_ammount' => $LNG['fl_ammount'], 'fl_beginning' => $LNG['fl_beginning'], 'fl_departure' => $LNG['fl_departure'], 'fl_destiny' => $LNG['fl_destiny'], 'fl_objective' => $LNG['fl_objective'], 'fl_arrival' => $LNG['fl_arrival'], 'fl_order' => $LNG['fl_order'], 'fl_new_mission_title' => $LNG['fl_new_mission_title'], 'fl_ship_type' => $LNG['fl_ship_type'], 'fl_ship_available' => $LNG['fl_ship_available'], 'fl_fleets' => $LNG['fl_fleets'], 'fl_expeditions' => $LNG['fl_expeditions'], 'fl_speed_title' => $LNG['fl_speed_title'], 'fl_max' => $LNG['fl_max'], 'fl_no_more_slots' => $LNG['fl_no_more_slots'], 'fl_continue' => $LNG['fl_continue'], 'fl_no_ships' => $LNG['fl_no_ships'], 'fl_select_all_ships' => $LNG['fl_select_all_ships'], 'fl_remove_all_ships' => $LNG['fl_remove_all_ships'], 'fl_acs' => $LNG['fl_acs'], 'fl_send_back' => $LNG['fl_send_back'], 'fl_returning' => $LNG['fl_returning'], 'fl_r' => $LNG['fl_r'], 'fl_onway' => $LNG['fl_onway'], 'fl_a' => $LNG['fl_a'], 'fl_info_detail' => $LNG['fl_info_detail'], 'fl_bonus' => $LNG['fl_bonus'], 'fl_bonus_attack' => $LNG['fl_bonus_attack'], 'fl_bonus_defensive' => $LNG['fl_bonus_defensive'], 'fl_bonus_shield' => $LNG['fl_bonus_shield'], 'bonus_comp' => $LNG['tech'][115], 'bonus_impul' => $LNG['tech'][117], 'bonus_hyper' => $LNG['tech'][118], 'galaxy' => $galaxy, 'system' => $system, 'planet' => $planet, 'planettype' => $planettype, 'target_mission' => $target_mission, 'envoimaxexpedition' => $EnvoiMaxExpedition, 'expeditionencours' => $ExpeditionEnCours, 'flyingfleets' => $CountCurrentFleets, 'maxfleets' => $MaxFlottes, 'target_mission' => $target_mission, 'currentexpeditions' => $ExpeditionEnCours, 'maxexpeditions' => $EnvoiMaxExpedition, 'slots_available' => $MaxFlottes <= $MaxFlyingFleets - $MaxFlyingRaks ? false : true, 'AKSPage' => $AKSPage, 'bonus_attack' => $USER[$resource[109]] * 10 + (TIMESTAMP - $USER[$resource[700]] <= 0 ? 100 * $ExtraDM[700]['add'] : 0) * 5, 'bonus_defensive' => $USER[$resource[110]] * 10 + (TIMESTAMP - $USER[$resource[701]] <= 0 ? 100 * $ExtraDM[701]['add'] : 0) * 5, 'bonus_shield' => $USER[$resource[111]] * 10 + (TIMESTAMP - $USER[$resource[700]] <= 0 ? 100 * $ExtraDM[700]['add'] : 0) * 5, 'bonus_combustion' => $USER[$resource[115]] * 10 + (TIMESTAMP - $USER[$resource[706]] <= 0 ? 100 * $ExtraDM[706]['add'] : 0), 'bonus_impulse' => $USER[$resource[117]] * 20 + (TIMESTAMP - $USER[$resource[706]] <= 0 ? 100 * $ExtraDM[706]['add'] : 0), 'bonus_hyperspace' => $USER[$resource[118]] * 30 + (TIMESTAMP - $USER[$resource[706]] <= 0 ? 100 * $ExtraDM[706]['add'] : 0)));
     $template->show('fleet_table.tpl');
 }