Пример #1
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 ? DevelopmentsLib::set_building_page($element_id) : $call_program;
     return parent::$page->parse_template(parent::$page->get_template('buildings/buildings_buildlist_script'), $parse);
 }
Пример #2
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $resource = parent::$objects->getObjects();
     $reslist = parent::$objects->getObjectsList();
     $planetsrow = parent::$db->query("SELECT `planet_id`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_name`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_galaxy`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_image`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_field_current`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_field_max`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal_perhour`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal_perhour`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium_perhour`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_energy_used`,\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_energy_max`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_metal_mine`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_crystal_mine`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_deuterium_sintetizer`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_solar_plant`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_fusion_reactor`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_robot_factory`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_nano_factory`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_hangar`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_metal_store`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_crystal_store`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_deuterium_tank`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_laboratory`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_terraformer`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_ally_deposit`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_missile_silo`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_mondbasis`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_phalanx`,\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_jump_gate`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_rocket_launcher`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_light_laser`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_heavy_laser`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_gauss_cannon`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_ion_cannon`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_plasma_turret`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_small_shield_dome`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_large_shield_dome`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_anti-ballistic_missile`,\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_interplanetary_missile`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_small_cargo_ship`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_big_cargo_ship`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_light_fighter`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_heavy_fighter`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_cruiser`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_battleship`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_colony_ship`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_recycler`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_espionage_probe`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_bomber`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_solar_satellite`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_destroyer`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_deathstar`,\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_battlecruiser`\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS p\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`\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`\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`\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_user_id` = '" . (int) $this->_current_user['user_id'] . "'\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->fetchArray($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'] . '">' . FormatLib::pretty_number($p['planet_metal']) . '</a> / ' . FormatLib::pretty_number($p['planet_metal_perhour'] + FunctionsLib::read_config('metal_basic_income')), '<a href="game.php?page=resources&cp=' . $p['planet_id'] . '&amp;re=0&amp;planettype=' . $p['planet_type'] . '">' . FormatLib::pretty_number($p['planet_crystal']) . '</a> / ' . FormatLib::pretty_number($p['planet_crystal_perhour'] + FunctionsLib::read_config('crystal_basic_income')), '<a href="game.php?page=resources&cp=' . $p['planet_id'] . '&amp;re=0&amp;planettype=' . $p['planet_type'] . '">' . FormatLib::pretty_number($p['planet_deuterium']) . '</a> / ' . FormatLib::pretty_number($p['planet_deuterium_perhour'] + FunctionsLib::read_config('deuterium_basic_income')), FormatLib::pretty_number($p['planet_energy_max'] - $p['planet_energy_used']) . ' / ' . FormatLib::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=" . DevelopmentsLib::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);
 }
Пример #3
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);
 }