public function show()
 {
     global $USER, $PLANET, $resource, $pricelist, $reslist, $LNG;
     $targetGalaxy = HTTP::_GP('galaxy', (int) $PLANET['galaxy']);
     $targetSystem = HTTP::_GP('system', (int) $PLANET['system']);
     $targetPlanet = HTTP::_GP('planet', (int) $PLANET['planet']);
     $targetType = HTTP::_GP('type', (int) $PLANET['planet_type']);
     $mission = HTTP::_GP('target_mission', 0);
     $Fleet = array();
     $FleetRoom = 0;
     $allyInfo = $GLOBALS['DATABASE']->query("SELECT FleetCapa FROM `uni1_alliance` WHERE id = " . $USER['ally_id'] . ";");
     $allyInfo = $GLOBALS['DATABASE']->fetch_array($allyInfo);
     $listorder = array(210, 212, 202, 203, 204, 205, 229, 209, 206, 207, 208, 217, 215, 213, 211, 220, 224, 219, 223, 225, 226, 214, 216, 230, 227, 228, 222, 218, 221);
     foreach ($listorder as $id => $ShipID) {
         $amount = max(0, round(HTTP::_GP('ship' . $ShipID, 0.0, 0.0)));
         if ($amount < 1 || $ShipID == 212) {
             continue;
         }
         $Fleet[$ShipID] = $amount;
         $FleetRoom += $pricelist[$ShipID]['capacity'] * $amount;
         $FleetRoom += $FleetRoom / 100 * getbonusOneBis(1207, $USER['academy_1207']) + $FleetRoom / 100 * $allyInfo['FleetCapa'];
     }
     foreach ($Fleet as $Ship => $Count) {
         if ($Count > $PLANET[$resource[$Ship]]) {
             $this->printMessage($LNG['fl_not_all_ship_avalible']);
         }
     }
     $FleetRoom *= 1 + $USER['factor']['ShipStorage'];
     if (empty($Fleet)) {
         FleetFunctions::GotoFleetPage();
     }
     $FleetData = array('fleetroom' => floattostring($FleetRoom), 'gamespeed' => FleetFunctions::GetGameSpeedFactor(), 'fleetspeedfactor' => max(0, 1 + $USER['factor']['FlyTime']), 'planet' => array('galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'planet_type' => $PLANET['planet_type']), 'maxspeed' => FleetFunctions::GetFleetMaxSpeed($Fleet, $USER), 'ships' => FleetFunctions::GetFleetShipInfo($Fleet, $USER), 'fleetMinDuration' => MIN_FLEET_TIME);
     $token = getRandomString();
     $_SESSION['fleet'][$token] = array('time' => TIMESTAMP, 'fleet' => $Fleet, 'fleetRoom' => $FleetRoom);
     $shortcutList = $this->GetUserShotcut();
     $colonyList = $this->GetColonyList();
     $ACSList = $this->GetAvalibleACS();
     if (!empty($shortcutList)) {
         $shortcutAmount = max(array_keys($shortcutList));
     } else {
         $shortcutAmount = 0;
     }
     $this->tplObj->loadscript('flotten.js');
     $this->tplObj->execscript('updateVars();FleetTime();window.setInterval("FleetTime()", 1000);');
     $this->tplObj->assign_vars(array('token' => $token, 'mission' => $mission, 'shortcutList' => $shortcutList, 'shortcutMax' => $shortcutAmount, 'colonyList' => $colonyList, 'ACSList' => $ACSList, 'galaxy' => $targetGalaxy, 'system' => $targetSystem, 'planet' => $targetPlanet, 'type' => $targetType, 'speedSelect' => FleetFunctions::$allowedSpeed, 'typeSelect' => array(1 => $LNG['type_planet'][1], 2 => $LNG['type_planet'][2], 3 => $LNG['type_planet'][3], 4 => $LNG['type_planet'][4]), 'fleetdata' => $FleetData));
     $this->display('page.fleetStep1.default.tpl');
 }
 public function show()
 {
     global $USER, $PLANET, $pricelist, $reslist, $LNG;
     $targetGalaxy = HTTP::_GP('galaxy', (int) $PLANET['galaxy']);
     $targetSystem = HTTP::_GP('system', (int) $PLANET['system']);
     $targetPlanet = HTTP::_GP('planet', (int) $PLANET['planet']);
     $targetType = HTTP::_GP('type', (int) $PLANET['planet_type']);
     $mission = HTTP::_GP('target_mission', 0);
     $Fleet = array();
     $FleetRoom = 0;
     foreach ($reslist['fleet'] as $id => $ShipID) {
         $amount = max(0, round(HTTP::_GP('ship' . $ShipID, 0.0, 0.0)));
         if ($amount < 1 || $ShipID == 212) {
             continue;
         }
         $Fleet[$ShipID] = $amount;
         $FleetRoom += $pricelist[$ShipID]['capacity'] * $amount;
     }
     $FleetRoom *= 1 + $USER['factor']['ShipStorage'];
     if (empty($Fleet)) {
         FleetFunctions::GotoFleetPage();
     }
     $FleetData = array('fleetroom' => floatToString($FleetRoom), 'gamespeed' => FleetFunctions::GetGameSpeedFactor(), 'fleetspeedfactor' => max(0, 1 + $USER['factor']['FlyTime']), 'planet' => array('galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'planet_type' => $PLANET['planet_type']), 'maxspeed' => FleetFunctions::GetFleetMaxSpeed($Fleet, $USER), 'ships' => FleetFunctions::GetFleetShipInfo($Fleet, $USER), 'fleetMinDuration' => MIN_FLEET_TIME);
     $token = getRandomString();
     $_SESSION['fleet'][$token] = array('time' => TIMESTAMP, 'fleet' => $Fleet, 'fleetRoom' => $FleetRoom);
     $shortcutList = $this->GetUserShotcut();
     $colonyList = $this->GetColonyList();
     $ACSList = $this->GetAvalibleACS();
     if (!empty($shortcutList)) {
         $shortcutAmount = max(array_keys($shortcutList));
     } else {
         $shortcutAmount = 0;
     }
     $this->tplObj->loadscript('flotten.js');
     $this->tplObj->execscript('updateVars();FleetTime();window.setInterval("FleetTime()", 1000);');
     $this->assign(array('token' => $token, 'mission' => $mission, 'shortcutList' => $shortcutList, 'shortcutMax' => $shortcutAmount, 'colonyList' => $colonyList, 'ACSList' => $ACSList, 'galaxy' => $targetGalaxy, 'system' => $targetSystem, 'planet' => $targetPlanet, 'type' => $targetType, 'speedSelect' => FleetFunctions::$allowedSpeed, 'typeSelect' => array(1 => $LNG['type_planet'][1], 2 => $LNG['type_planet'][2], 3 => $LNG['type_planet'][3]), 'fleetdata' => $FleetData));
     $this->display('page.fleetStep1.default.tpl');
 }
示例#3
0
 public static function ShowFleet1Page()
 {
     global $USER, $PLANET, $resource, $pricelist, $reslist, $db, $LNG, $ExtraDM;
     $TargetGalaxy = request_var('galaxy', $PLANET['galaxy']);
     $TargetSystem = request_var('system', $PLANET['system']);
     $TargetPlanet = request_var('planet', $PLANET['planet']);
     $TargetPlanettype = request_var('planet_type', $PLANET['planet_type']);
     $PlanetRess = new ResourceUpdate();
     $PlanetRess->CalcResource();
     $PlanetRess->SavePlanetToDB();
     $template = new template();
     $template->loadscript('notifybox.js');
     $template->loadscript('flotten.js');
     $template->page_header();
     $template->page_topnav();
     $template->page_leftmenu();
     $template->page_planetmenu();
     $template->page_footer();
     $template->getplanets();
     foreach ($reslist['fleet'] as $id => $ShipID) {
         $amount = min(request_var('ship' . $ShipID, '0') + 0, $PLANET[$resource[$ShipID]] + 0);
         if ($amount <= 0 || $ShipID == 212 || !is_numeric($amount)) {
             continue;
         }
         $Fleet[$ShipID] = $amount;
         $FleetRoom += $pricelist[$ShipID]['capacity'] * $amount;
     }
     if (!is_array($Fleet)) {
         parent::GotoFleetPage();
     }
     $template->execscript('updateVars();FleetTime();window.setInterval("FleetTime()", 1000);');
     $FleetData = array('fleetroom' => floattostring($FleetRoom), 'gamespeed' => parent::GetGameSpeedFactor(), 'fleetspeedfactor' => (TIMESTAMP - $USER[$resource[706]] <= 0 ? 1 - $ExtraDM[706]['add'] : 1) - GENERAL * $USER['rpg_general'], 'planet' => array('galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'planet_type' => $PLANET['planet_type']), 'maxspeed' => parent::GetFleetMaxSpeed($Fleet, $USER), 'ships' => parent::GetFleetShipInfo($Fleet, $USER));
     $template->assign_vars(array('mission' => request_var('target_mission', 0), 'Shoutcutlist' => parent::GetUserShotcut($USER), 'Colonylist' => parent::GetColonyList($template->UserPlanets), 'AKSList' => parent::IsAKS($USER['id']), 'AvailableSpeeds' => parent::GetAvailableSpeeds(), 'fleetarray' => parent::SetFleetArray($Fleet), 'galaxy_post' => $TargetGalaxy, 'system_post' => $TargetSystem, 'planet_post' => $TargetPlanet, 'fleetdata' => json_encode($FleetData), 'options_selector' => array(1 => $LNG['fl_planet'], 2 => $LNG['fl_debris'], 3 => $LNG['fl_moon']), 'options' => $TargetPlanettype, 'fl_send_fleet' => $LNG['fl_send_fleet'], 'fl_destiny' => $LNG['fl_destiny'], 'fl_fleet_speed' => $LNG['fl_fleet_speed'], 'fl_distance' => $LNG['fl_distance'], 'fl_flying_time' => $LNG['fl_flying_time'], 'fl_fuel_consumption' => $LNG['fl_fuel_consumption'], 'fl_max_speed' => $LNG['fl_max_speed'], 'fl_cargo_capacity' => $LNG['fl_cargo_capacity'], 'fl_shortcut' => $LNG['fl_shortcut'], 'fl_shortcut_add_edit' => $LNG['fl_shortcut_add_edit'], 'fl_no_shortcuts' => $LNG['fl_no_shortcuts'], 'fl_planet_shortcut' => $LNG['fl_planet_shortcut'], 'fl_debris_shortcut' => $LNG['fl_debris_shortcut'], 'fl_moon_shortcut' => $LNG['fl_moon_shortcut'], 'fl_my_planets' => $LNG['fl_my_planets'], 'fl_acs_title' => $LNG['fl_acs_title'], 'fl_continue' => $LNG['fl_continue'], 'fl_no_colony' => $LNG['fl_no_colony'], 'fl_flying_arrival' => $LNG['fl_flying_arrival'], 'fl_flying_return' => $LNG['fl_flying_return']));
     $template->show('fleet1_table.tpl');
 }
 public function show()
 {
     global $USER, $PLANET, $resource, $pricelist, $reslist, $LNG;
     $PlanetCount = $GLOBALS['DATABASE']->getFirstCell("SELECT COUNT(*) FROM " . PLANETS . " WHERE id != " . $PLANET['id'] . " AND id_owner = " . $USER['id'] . " AND destruyed = 0;");
     $targetGalaxy = HTTP::_GP('galaxy', '');
     $targetSystem = HTTP::_GP('system', '');
     $targetPlanet = HTTP::_GP('planet', '');
     $targetType = HTTP::_GP('type', (int) $PLANET['planet_type']);
     $mission = HTTP::_GP('target_mission', 0);
     $missionText = '';
     $missionDesc = '';
     if ($mission != 0) {
         $missionText = $LNG['type_missionbis'][$mission];
     }
     if ($mission != 0) {
         $missionDesc = $LNG['type_missionDesc'][$mission];
     }
     $Fleet = array();
     $FleetRoom = 0;
     foreach ($reslist['fleet'] as $id => $ShipID) {
         $amount = max(0, round(HTTP::_GP('ship' . $ShipID, 0.0, 0.0)));
         if ($amount < 1 || $ShipID == 212) {
             continue;
         }
         $Fleet[$ShipID] = $amount;
         $FleetRoom += $pricelist[$ShipID]['capacity'] * $amount;
     }
     $FleetRoom *= 1 + $USER['factor']['ShipStorage'];
     if (empty($Fleet)) {
         FleetFunctions::GotoFleetPage();
     }
     $FleetData = array('fleetroom' => floattostring($FleetRoom), 'gamespeed' => FleetFunctions::GetGameSpeedFactor(), 'fleetspeedfactor' => max(0, 1 + $USER['factor']['FlyTime']), 'planet' => array('galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'planet_type' => $PLANET['planet_type']), 'maxspeed' => FleetFunctions::GetFleetMaxSpeed($Fleet, $USER), 'ships' => FleetFunctions::GetFleetShipInfo($Fleet, $USER), 'fleetMinDuration' => MIN_FLEET_TIME);
     $token = getRandomString();
     $_SESSION['fleet'][$token] = array('time' => TIMESTAMP, 'fleet' => $Fleet, 'fleetRoom' => $FleetRoom);
     $shortcutList = $this->GetUserShotcut();
     $colonyList = $this->GetColonyList();
     $ACSList = $this->GetAvalibleACS();
     if (!empty($shortcutList)) {
         $shortcutAmount = max(array_keys($shortcutList));
     } else {
         $shortcutAmount = 0;
     }
     $PopulationOnPlanet = array();
     $avaible_pop = array(301, 302, 303, 304, 305, 306, 307);
     foreach ($avaible_pop as $populationID) {
         $PopulationOnPlanet[] = array('id' => $populationID, 'count' => $PLANET[$resource[$populationID]]);
     }
     $this->tplObj->loadscript('flotten.js');
     $this->tplObj->execscript('updateVars();calculateTransportCapacity();FleetTime();window.setInterval("FleetTime()", 1000);');
     $this->tplObj->assign_vars(array('token' => $token, 'missionText' => $missionText, 'missionDesc' => $missionDesc, 'mission' => $mission, 'shortcutList' => $shortcutList, 'shortcutMax' => $shortcutAmount, 'colonyList' => $colonyList, 'PopulationOnPlanet' => $PopulationOnPlanet, 'ACSList' => $ACSList, 'galaxy' => $targetGalaxy, 'system' => $targetSystem, 'planet' => $targetPlanet, 'PlanetCount' => $PlanetCount, 'type' => $targetType, 'speedSelect' => FleetFunctions::$allowedSpeed, 'typeSelect' => array(1 => $LNG['type_planet'][1], 2 => $LNG['type_planet'][2]), 'fleetdata' => $FleetData));
     $this->display('page.fleetStep1.default.tpl');
 }