コード例 #1
0
ファイル: imperium.php プロジェクト: Gritch69/XG-Project
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $resource = parent::$objects->get_objects();
     $reslist = parent::$objects->get_objects_list();
     $planetsrow = parent::$db->query("SELECT `planet_id`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_name`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_galaxy`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_image`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_field_current`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_field_max`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal_perhour`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal_perhour`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium_perhour`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_energy_used`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_energy_max`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_metal_mine`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_crystal_mine`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_deuterium_sintetizer`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_solar_plant`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_fusion_reactor`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_robot_factory`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_nano_factory`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_hangar`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_metal_store`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_crystal_store`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_deuterium_tank`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_laboratory`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_terraformer`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_ally_deposit`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_missile_silo`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_mondbasis`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_phalanx`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_jump_gate`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_rocket_launcher`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_light_laser`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_heavy_laser`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_gauss_cannon`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_ion_cannon`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_plasma_turret`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_small_shield_dome`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_large_shield_dome`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_anti-ballistic_missile`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_interplanetary_missile`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_small_cargo_ship`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_big_cargo_ship`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_light_fighter`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_heavy_fighter`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_cruiser`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_battleship`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_colony_ship`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_recycler`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_espionage_probe`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_bomber`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_solar_satellite`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_destroyer`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_deathstar`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_battlecruiser`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS p\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . BUILDINGS . " AS b ON b.building_planet_id = p.`planet_id`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . DEFENSES . " AS d ON d.defense_planet_id = p.`planet_id`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . SHIPS . " AS s ON s.ship_planet_id = p.`planet_id`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_user_id` = '" . (int) $this->_current_user['user_id'] . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `planet_destroyed` = 0;");
     $parse = $this->_lang;
     $planet = array();
     $r = array();
     $EmpireRowTPL = parent::$page->get_template('empire/empire_row');
     $f = array('file_images', 'file_names', 'file_coordinates', 'file_fields', 'file_metal', 'file_crystal', 'file_deuterium', 'file_energy');
     $m = array('build', 'tech', 'fleet', 'defense');
     $n = array('building_row', 'technology_row', 'fleet_row', 'defense_row');
     while ($p = parent::$db->fetch_array($planetsrow)) {
         $planet[] = $p;
     }
     $parse['mount'] = count($planet) + 1;
     foreach ($planet as $p) {
         $datat = array('<a href="game.php?page=overview&cp=' . $p['planet_id'] . '&amp;re=0"><img src="' . DPATH . 'planets/small/s_' . $p['planet_image'] . '.jpg" border="0" height="80" width="80"></a>', $p['planet_name'], "[<a href=\"game.php?page=galaxy&mode=3&galaxy={$p['planet_galaxy']}&system={$p['planet_system']}\">{$p['planet_galaxy']}:{$p['planet_system']}:{$p['planet_planet']}</a>]", $p['planet_field_current'] . '/' . $p['planet_field_max'], '<a href="game.php?page=resources&cp=' . $p['planet_id'] . '&amp;re=0&amp;planettype=' . $p['planet_type'] . '">' . Format_Lib::pretty_number($p['planet_metal']) . '</a> / ' . Format_Lib::pretty_number($p['planet_metal_perhour'] + Functions_Lib::read_config('metal_basic_income')), '<a href="game.php?page=resources&cp=' . $p['planet_id'] . '&amp;re=0&amp;planettype=' . $p['planet_type'] . '">' . Format_Lib::pretty_number($p['planet_crystal']) . '</a> / ' . Format_Lib::pretty_number($p['planet_crystal_perhour'] + Functions_Lib::read_config('crystal_basic_income')), '<a href="game.php?page=resources&cp=' . $p['planet_id'] . '&amp;re=0&amp;planettype=' . $p['planet_type'] . '">' . Format_Lib::pretty_number($p['planet_deuterium']) . '</a> / ' . Format_Lib::pretty_number($p['planet_deuterium_perhour'] + Functions_Lib::read_config('deuterium_basic_income')), Format_Lib::pretty_number($p['planet_energy_max'] - $p['planet_energy_used']) . ' / ' . Format_Lib::pretty_number($p['planet_energy_max']));
         for ($k = 0; $k < 8; $k++) {
             $parse[$f[$k]] = isset($parse[$f[$k]]) ? $parse[$f[$k]] : '';
             $data['text'] = $datat[$k];
             $parse[$f[$k]] .= parent::$page->parse_template($EmpireRowTPL, $data);
         }
         foreach ($resource as $i => $res) {
             $r[$i] = isset($r[$i]) ? $r[$i] : '';
             $data['text'] = !isset($p[$resource[$i]]) && !isset($this->_current_user[$resource[$i]]) ? '0' : (in_array($i, $reslist['build']) ? "<a href=\"game.php?page=" . Developments_Lib::set_building_page($i) . "&cp={$p['planet_id']}&amp;re=0&amp;planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>" : (in_array($i, $reslist['tech']) ? "<a href=\"game.php?page=research&cp={$p['planet_id']}&amp;re=0&amp;planettype={$p['planet_type']}\">{$this->_current_user[$resource[$i]]}</a>" : (in_array($i, $reslist['fleet']) ? "<a href=\"game.php?page=shipyard&cp={$p['planet_id']}&amp;re=0&amp;planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>" : (in_array($i, $reslist['defense']) ? "<a href=\"game.php?page=defense&cp={$p['planet_id']}&amp;re=0&amp;planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>" : '0'))));
             $r[$i] .= parent::$page->parse_template($EmpireRowTPL, $data);
         }
     }
     for ($j = 0; $j < 4; $j++) {
         foreach ($reslist[$m[$j]] as $a => $i) {
             $parse[$n[$j]] = isset($parse[$n[$j]]) ? $parse[$n[$j]] : '';
             $data['text'] = $this->_lang['tech'][$i];
             $parse[$n[$j]] .= "<tr>" . parent::$page->parse_template($EmpireRowTPL, $data) . $r[$i] . "</tr>";
         }
     }
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('empire/empire_table'), $parse), FALSE);
 }
コード例 #2
0
ファイル: infos.php プロジェクト: saiikup/XG-Proyect-v3.x.x
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     if (!array_key_exists($this->_element_id, $this->_resource)) {
         Functions_Lib::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) {
         $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) {
             Functions_Lib::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'] = Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['metal'] + $this->_pricelist[$this->_element_id]['crystal']);
         $parse['shield_pt'] = Format_Lib::pretty_number($this->_combat_caps[$this->_element_id]['shield']);
         $parse['attack_pt'] = Format_Lib::pretty_number($this->_combat_caps[$this->_element_id]['attack']);
         $parse['capacity_pt'] = Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['capacity']);
         $parse['base_speed'] = Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['speed']);
         $parse['base_conso'] = Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['consumption']);
         if ($this->_element_id == 202) {
             $parse['upd_speed'] = "<font color=\"yellow\">(" . Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['speed2']) . ")</font>";
             $parse['upd_conso'] = "<font color=\"yellow\">(" . Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['consumption2']) . ")</font>";
         } elseif ($this->_element_id == 211) {
             $parse['upd_speed'] = "<font color=\"yellow\">(" . Format_Lib::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'] = Format_Lib::pretty_number($this->_pricelist[$this->_element_id]['metal'] + $this->_pricelist[$this->_element_id]['crystal']);
         $parse['shield_pt'] = Format_Lib::pretty_number($this->_combat_caps[$this->_element_id]['shield']);
         $parse['attack_pt'] = Format_Lib::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);
         } 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'] = Functions_Lib::chrono_applet("Gate", "1", $RestString['value'], TRUE);
                 $parse['gate_wait_time'] = "<div id=\"bxx" . "Gate" . "1" . "\"></div>";
                 $parse['gate_script_go'] = Functions_Lib::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 = Developments_Lib::development_price($this->_current_user, $this->_current_planet, $this->_element_id, TRUE, TRUE);
             $DestroyTime = Developments_Lib::development_time($this->_current_user, $this->_current_planet, $this->_element_id) / 2;
             $parse['destroyurl'] = "game.php?page=" . Developments_Lib::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'] = Format_Lib::pretty_number($NeededRessources['metal']);
             $parse['crystal'] = Format_Lib::pretty_number($NeededRessources['crystal']);
             $parse['deuterium'] = Format_Lib::pretty_number($NeededRessources['deuterium']);
             $parse['destroytime'] = Format_Lib::pretty_time($DestroyTime);
             $page .= parent::$page->parse_template($DestroyTPL, $parse);
         }
     }
     parent::$page->display($page);
 }
コード例 #3
0
 /**
  * method current_building
  * param $call_program
  * param $element_id
  * return if is possible develop a new building, research, ship or defense.
  */
 public static function current_building($call_program, $element_id = 0)
 {
     $parse = parent::$lang;
     $parse['call_program'] = $call_program;
     $parse['current_page'] = $element_id != 0 ? Developments_Lib::set_building_page($element_id) : $call_program;
     return parent::$page->parse_template(parent::$page->get_template('buildings/buildings_buildlist_script'), $parse);
 }