Example #1
0
 /**
  * method flying_fleets_table
  * param $fleet_row
  * param $Status
  * param $Owner
  * param $Label
  * param $Record
  * param $current_user
  * return the fleet table for the overview and phalanx
  */
 public static function flying_fleets_table($fleet_row, $Status, $Owner, $Label, $Record, $current_user)
 {
     $FleetStyle = array(1 => 'attack', 2 => 'federation', 3 => 'transport', 4 => 'deploy', 5 => 'hold', 6 => 'espionage', 7 => 'colony', 8 => 'harvest', 9 => 'destroy', 10 => 'missile', 15 => 'transport');
     $FleetStatus = array(0 => 'flight', 1 => 'holding', 2 => 'return');
     $FleetPrefix = $Owner ? 'own' : '';
     $RowsTPL = parent::$page->get_template('overview/overview_fleet_event');
     $MissionType = $fleet_row['fleet_mission'];
     $FleetContent = self::fleet_ships_popup($fleet_row, parent::$lang['cff_flotte'], $FleetPrefix . $FleetStyle[$MissionType], $current_user);
     $FleetCapacity = self::fleet_resources_popup($fleet_row, parent::$lang['type_mission'][$MissionType], $FleetPrefix . $FleetStyle[$MissionType]);
     $planet_name = parent::$db->queryFetch("SELECT\t(SELECT `planet_name`\n                                                                                                                    FROM " . PLANETS . "\n                                                                                                                    WHERE `planet_galaxy` = '" . intval($fleet_row['fleet_start_galaxy']) . "' AND\n                                                                                                                                    `planet_system` = '" . intval($fleet_row['fleet_start_system']) . "' AND\n                                                                                                                                    `planet_planet` = '" . intval($fleet_row['fleet_start_planet']) . "' AND\n                                                                                                                                    `planet_type` = '" . intval($fleet_row['fleet_start_type']) . "') AS start_planet_name,\n                                                                                                            (SELECT `planet_name`\n                                                                                                                    FROM " . PLANETS . "\n                                                                                                                    WHERE `planet_galaxy` = '" . intval($fleet_row['fleet_end_galaxy']) . "' AND\n                                                                                                                                    `planet_system` = '" . intval($fleet_row['fleet_end_system']) . "' AND\n                                                                                                                                    `planet_planet` = '" . intval($fleet_row['fleet_end_planet']) . "' AND\n                                                                                                                                    `planet_type` = '" . intval($fleet_row['fleet_end_type']) . "') AS target_planet_name");
     $StartType = $fleet_row['fleet_start_type'];
     $TargetType = $fleet_row['fleet_end_type'];
     if ($Status != 2) {
         if ($StartType == 1) {
             $StartID = parent::$lang['cff_from_the_planet'];
         } elseif ($StartType == 3) {
             $StartID = parent::$lang['cff_from_the_moon'];
         }
         $StartID .= $planet_name['start_planet_name'] . " ";
         $StartID .= FleetsLib::start_link($fleet_row, $FleetPrefix . $FleetStyle[$MissionType]);
         if ($MissionType != 15) {
             switch ($TargetType) {
                 case 1:
                     $TargetID = parent::$lang['cff_the_planet'];
                     break;
                 case 2:
                     $TargetID = parent::$lang['cff_debris_field'];
                     break;
                 case 3:
                     $TargetID = parent::$lang['cff_to_the_moon'];
                     break;
             }
         } else {
             $TargetID = parent::$lang['cff_the_position'];
         }
         $TargetID .= $planet_name['target_planet_name'] . " ";
         $TargetID .= FleetsLib::target_link($fleet_row, $FleetPrefix . $FleetStyle[$MissionType]);
     } else {
         if ($StartType == 1) {
             $StartID = parent::$lang['cff_to_the_planet'];
         } elseif ($StartType == 3) {
             $StartID = parent::$lang['cff_the_moon'];
         }
         $StartID .= $planet_name['start_planet_name'] . " ";
         $StartID .= FleetsLib::start_link($fleet_row, $FleetPrefix . $FleetStyle[$MissionType]);
         if ($MissionType != 15) {
             switch ($TargetType) {
                 case 1:
                     $TargetID = parent::$lang['cff_from_planet'];
                     break;
                 case 2:
                     $TargetID = parent::$lang['cff_from_debris_field'];
                     break;
                 case 3:
                     $TargetID = parent::$lang['cff_from_the_moon'];
                     break;
             }
         } else {
             $TargetID = parent::$lang['cff_from_position'];
         }
         $TargetID .= $planet_name['target_planet_name'] . " ";
         $TargetID .= FleetsLib::target_link($fleet_row, $FleetPrefix . $FleetStyle[$MissionType]);
     }
     if ($MissionType == 10) {
         $EventString = parent::$lang['cff_missile_attack'] . " ( " . preg_replace("(503,)i", "", $fleet_row['fleet_array']) . " ) ";
         $Time = $fleet_row['fleet_start_time'];
         $Rest = $Time - time();
         $EventString .= $StartID;
         $EventString .= parent::$lang['cff_to'];
         $EventString .= $TargetID;
         $EventString .= ".";
     } else {
         if ($Owner == TRUE) {
             $EventString = parent::$lang['cff_one_of_your'];
             $EventString .= $FleetContent;
         } else {
             $EventString = parent::$lang['cff_a'];
             $EventString .= $FleetContent;
             $EventString .= parent::$lang['cff_of'];
             $EventString .= self::enemy_link($fleet_row);
         }
         switch ($Status) {
             case 0:
                 $Time = $fleet_row['fleet_start_time'];
                 $Rest = $Time - time();
                 $EventString .= parent::$lang['cff_goes'];
                 $EventString .= $StartID;
                 $EventString .= parent::$lang['cff_toward'];
                 $EventString .= $TargetID;
                 $EventString .= parent::$lang['cff_with_the_mission_of'];
                 break;
             case 1:
                 $Time = $fleet_row['fleet_end_stay'];
                 $Rest = $Time - time();
                 $EventString .= parent::$lang['cff_goes'];
                 $EventString .= $StartID;
                 $EventString .= parent::$lang['cff_to_explore'];
                 $EventString .= $TargetID;
                 $EventString .= parent::$lang['cff_with_the_mission_of'];
                 break;
             case 2:
                 $Time = $fleet_row['fleet_end_time'];
                 $Rest = $Time - time();
                 $EventString .= parent::$lang['cff_comming_back'];
                 $EventString .= $TargetID;
                 $EventString .= $StartID;
                 $EventString .= parent::$lang['cff_with_the_mission_of'];
                 break;
         }
         $EventString .= $FleetCapacity;
     }
     $bloc['fleet_status'] = $FleetStatus[$Status];
     $bloc['fleet_prefix'] = $FleetPrefix;
     $bloc['fleet_style'] = $FleetStyle[$MissionType];
     $bloc['fleet_javai'] = FunctionsLib::chrono_applet($Label, $Record, $Rest, TRUE);
     $bloc['fleet_order'] = $Label . $Record;
     $bloc['fleet_descr'] = $EventString;
     $bloc['fleet_javas'] = FunctionsLib::chrono_applet($Label, $Record, $Rest, FALSE);
     return parent::$page->parse_template($RowsTPL, $bloc);
 }
Example #2
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     if (!array_key_exists($this->_element_id, $this->_resource)) {
         FunctionsLib::redirect('game.php?page=techtree');
     }
     $GateTPL = '';
     $DestroyTPL = '';
     $TableHeadTPL = '';
     $TableFooterTPL = '';
     $parse = $this->_lang;
     $parse['dpath'] = DPATH;
     $parse['name'] = $this->_lang['info'][$this->_element_id]['name'];
     $parse['image'] = $this->_element_id;
     $parse['description'] = $this->_lang['info'][$this->_element_id]['description'];
     if ($this->_element_id < 13 or $this->_element_id == 43 && $this->_current_planet[$this->_resource[43]] > 0) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_table');
     } elseif ($this->_element_id < 200) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_general');
     } elseif ($this->_element_id < 400) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_fleet');
     } elseif ($this->_element_id < 600) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_defense');
     } else {
         $PageTPL = parent::$page->get_template('infos/info_officiers_general');
     }
     //S�lo hay destroy en <200
     if ($this->_element_id < 200 && $this->_element_id != 33 && $this->_element_id != 41) {
         $DestroyTPL = parent::$page->get_template('infos/info_buildings_destroy');
     }
     if ($this->_element_id >= 1 && $this->_element_id <= 3) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_table');
         $TableHeadTPL = parent::$page->get_template('infos/info_production_header');
         $TableTPL = parent::$page->get_template('infos/info_production_body');
     } elseif ($this->_element_id == 4) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_table');
         $TableHeadTPL = parent::$page->get_template('infos/info_production_simple_header');
         $TableTPL = parent::$page->get_template('infos/info_production_simple_body');
     } elseif ($this->_element_id >= 22 && $this->_element_id <= 24) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_table');
         $DestroyTPL = parent::$page->get_template('infos/info_buildings_destroy');
         $TableHeadTPL = parent::$page->get_template('infos/info_storage_header');
         $TableTPL = parent::$page->get_template('infos/info_storage_table');
     } elseif ($this->_element_id == 12) {
         $TableHeadTPL = parent::$page->get_template('infos/info_energy_header');
         $TableTPL = parent::$page->get_template('infos/info_energy_body');
     } elseif ($this->_element_id == 42) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_table');
         $TableHeadTPL = parent::$page->get_template('infos/info_range_header');
         $TableTPL = parent::$page->get_template('infos/info_range_body');
     } elseif ($this->_element_id == 43) {
         $GateTPL = parent::$page->get_template('infos/info_gate_table');
         if ($_POST) {
             FunctionsLib::message($this->DoFleetJump(), "game.php?page=infos&gid=43", 2);
         }
     } elseif ($this->_element_id == 124) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_table');
         $DestroyTPL = parent::$page->get_template('infos/info_buildings_destroy');
         $TableHeadTPL = parent::$page->get_template('infos/info_astrophysics_header');
         $TableTPL = parent::$page->get_template('infos/info_astrophysics_table');
         $TableFooterTPL = parent::$page->get_template('infos/info_astrophysics_footer');
     } elseif ($this->_element_id >= 202 && $this->_element_id <= 250) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_fleet');
         $parse['element_typ'] = $this->_lang['tech'][200];
         $parse['rf_info_to'] = $this->ShowRapidFireTo();
         $parse['rf_info_fr'] = $this->ShowRapidFireFrom();
         $parse['hull_pt'] = FormatLib::pretty_number($this->_pricelist[$this->_element_id]['metal'] + $this->_pricelist[$this->_element_id]['crystal']);
         $parse['shield_pt'] = FormatLib::pretty_number($this->_combat_caps[$this->_element_id]['shield']);
         $parse['attack_pt'] = FormatLib::pretty_number($this->_combat_caps[$this->_element_id]['attack']);
         $parse['capacity_pt'] = FormatLib::pretty_number($this->_pricelist[$this->_element_id]['capacity']);
         $parse['base_speed'] = FormatLib::pretty_number($this->_pricelist[$this->_element_id]['speed']);
         $parse['base_conso'] = FormatLib::pretty_number($this->_pricelist[$this->_element_id]['consumption']);
         if ($this->_element_id == 202) {
             $parse['upd_speed'] = "<font color=\"yellow\">(" . FormatLib::pretty_number($this->_pricelist[$this->_element_id]['speed2']) . ")</font>";
             $parse['upd_conso'] = "<font color=\"yellow\">(" . FormatLib::pretty_number($this->_pricelist[$this->_element_id]['consumption2']) . ")</font>";
         } elseif ($this->_element_id == 211) {
             $parse['upd_speed'] = "<font color=\"yellow\">(" . FormatLib::pretty_number($this->_pricelist[$this->_element_id]['speed2']) . ")</font>";
         }
     } elseif ($this->_element_id >= 401 && $this->_element_id <= 550) {
         $PageTPL = parent::$page->get_template('infos/info_buildings_defense');
         $parse['element_typ'] = $this->_lang['tech'][400];
         if ($this->_element_id < 500) {
             $parse['rf_info_to'] = $this->ShowRapidFireTo();
             $parse['rf_info_fr'] = $this->ShowRapidFireFrom();
         }
         $parse['hull_pt'] = FormatLib::pretty_number($this->_pricelist[$this->_element_id]['metal'] + $this->_pricelist[$this->_element_id]['crystal']);
         $parse['shield_pt'] = FormatLib::pretty_number($this->_combat_caps[$this->_element_id]['shield']);
         $parse['attack_pt'] = FormatLib::pretty_number($this->_combat_caps[$this->_element_id]['attack']);
     }
     if ($TableHeadTPL != '') {
         $parse['table_head'] = parent::$page->parse_template($TableHeadTPL, $this->_lang);
         if ($this->_element_id >= 22 && $this->_element_id <= 24) {
             $parse['table_data'] = $this->storage_table($TableTPL);
         } elseif ($this->_element_id == 124) {
             $parse['table_data'] = $this->astrophysics_table($TableTPL);
         } elseif ($this->_element_id == 42) {
             $parse['table_data'] = $this->phalanxRange($TableTPL);
         } else {
             $parse['table_data'] = $this->ShowProductionTable($TableTPL);
         }
     }
     if ($TableFooterTPL != '') {
         $parse['table_footer'] = parent::$page->parse_template($TableFooterTPL, $this->_lang);
     }
     $page = parent::$page->parse_template($PageTPL, $parse);
     if ($GateTPL != '') {
         if ($this->_current_planet[$this->_resource[$this->_element_id]] > 0) {
             $RestString = $this->GetNextJumpWaitTime($this->_current_planet);
             $parse['gate_start_link'] = $this->planet_link($this->_current_planet);
             if ($RestString['value'] != 0) {
                 $parse['gate_time_script'] = FunctionsLib::chrono_applet("Gate", "1", $RestString['value'], TRUE);
                 $parse['gate_wait_time'] = "<div id=\"bxx" . "Gate" . "1" . "\"></div>";
                 $parse['gate_script_go'] = FunctionsLib::chrono_applet("Gate", "1", $RestString['value'], FALSE);
             } else {
                 $parse['gate_time_script'] = "";
                 $parse['gate_wait_time'] = "";
                 $parse['gate_script_go'] = "";
             }
             $parse['gate_dest_moons'] = $this->BuildJumpableMoonCombo($this->_current_user, $this->_current_planet);
             $parse['gate_fleet_rows'] = $this->BuildFleetListRows($this->_current_planet);
             $page .= parent::$page->parse_template($GateTPL, $parse);
         }
     }
     if ($DestroyTPL != '') {
         if (isset($this->_current_planet[$this->_resource[$this->_element_id]]) && $this->_current_planet[$this->_resource[$this->_element_id]] > 0) {
             $NeededRessources = DevelopmentsLib::development_price($this->_current_user, $this->_current_planet, $this->_element_id, TRUE, TRUE);
             $DestroyTime = DevelopmentsLib::development_time($this->_current_user, $this->_current_planet, $this->_element_id) / 2;
             $parse['destroyurl'] = "game.php?page=" . DevelopmentsLib::set_building_page($this->_element_id) . "&cmd=destroy&building=" . $this->_element_id;
             $parse['levelvalue'] = $this->_current_planet[$this->_resource[$this->_element_id]];
             $parse['nfo_metal'] = $this->_lang['Metal'];
             $parse['nfo_crysta'] = $this->_lang['Crystal'];
             $parse['nfo_deuter'] = $this->_lang['Deuterium'];
             $parse['metal'] = FormatLib::pretty_number($NeededRessources['metal']);
             $parse['crystal'] = FormatLib::pretty_number($NeededRessources['crystal']);
             $parse['deuterium'] = FormatLib::pretty_number($NeededRessources['deuterium']);
             $parse['destroytime'] = FormatLib::pretty_time($DestroyTime);
             $page .= parent::$page->parse_template($DestroyTPL, $parse);
         }
     }
     parent::$page->display($page);
 }