コード例 #1
0
ファイル: research.php プロジェクト: Gritch69/XG-Project
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $tech_row_template = parent::$page->get_template('buildings/buildings_research_row');
     $tech_script_template = parent::$page->get_template('buildings/buildings_research_script');
     $technology_list = '';
     // time to do something
     $this->do_command();
     // build the page
     foreach ($this->_lang['tech'] as $tech => $tech_name) {
         if ($tech > 105 && $tech <= 199) {
             if (Developments_Lib::is_development_allowed($this->_current_user, $this->_current_planet, $tech)) {
                 $RowParse['dpath'] = DPATH;
                 $RowParse['tech_id'] = $tech;
                 $building_level = $this->_current_user[$this->_resource[$tech]];
                 $RowParse['tech_level'] = Developments_Lib::set_level_format($building_level, $tech, $this->_current_user);
                 $RowParse['tech_name'] = $tech_name;
                 $RowParse['tech_descr'] = $this->_lang['res']['descriptions'][$tech];
                 $RowParse['tech_price'] = Developments_Lib::formated_development_price($this->_current_user, $this->_current_planet, $tech);
                 $SearchTime = Developments_Lib::development_time($this->_current_user, $this->_current_planet, $tech, FALSE, $this->_lab_level);
                 $RowParse['search_time'] = Developments_Lib::formated_development_time($SearchTime);
                 if (!$this->_is_working['is_working']) {
                     if (Developments_Lib::is_development_payable($this->_current_user, $this->_current_planet, $tech) && !parent::$users->is_on_vacations($this->_current_user)) {
                         if (!$this->is_laboratory_in_queue()) {
                             $action_link = Format_Lib::color_red($this->_lang['bd_research']);
                         } else {
                             $action_link = Functions_Lib::set_url('game.php?page=research&cmd=search&tech=' . $tech, '', Format_Lib::color_green($this->_lang['bd_research']));
                         }
                     } else {
                         $action_link = Format_Lib::color_red($this->_lang['bd_research']);
                     }
                 } else {
                     if ($this->_is_working['working_on']['planet_b_tech_id'] == $tech) {
                         $bloc = $this->_lang;
                         if ($this->_is_working['working_on']['id'] != $this->_current_planet['planet_id']) {
                             $bloc['tech_time'] = $this->_is_working['working_on']['planet_b_tech'] - time();
                             $bloc['tech_name'] = $this->_lang['bd_from'] . $this->_is_working['working_on']['planet_name'] . '<br /> ' . Format_Lib::pretty_coords($this->_is_working['working_on']['planet_galaxy'], $this->_is_working['working_on']['planet_system'], $this->_is_working['working_on']['planet_planet']);
                             $bloc['tech_home'] = $this->_is_working['working_on']['id'];
                             $bloc['tech_id'] = $this->_is_working['working_on']['planet_b_tech_id'];
                         } else {
                             $bloc['tech_time'] = $this->_current_planet['planet_b_tech'] - time();
                             $bloc['tech_name'] = '';
                             $bloc['tech_home'] = $this->_current_planet['planet_id'];
                             $bloc['tech_id'] = $this->_current_planet['planet_b_tech_id'];
                         }
                         $action_link = parent::$page->parse_template($tech_script_template, $bloc);
                     } else {
                         $action_link = "<center>-</center>";
                     }
                 }
                 $RowParse['tech_link'] = $action_link;
                 $technology_list .= parent::$page->parse_template($tech_row_template, $RowParse);
             }
         }
     }
     $parse['noresearch'] = !$this->is_laboratory_in_queue() ? $this->_lang['bd_building_lab'] : '';
     $parse['technolist'] = $technology_list;
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('buildings/buildings_research'), $parse));
 }
コード例 #2
0
ファイル: buildings.php プロジェクト: Gritch69/XG-Project
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $resource = $this->_objects->get_objects();
     $parse = $this->_lang;
     $parse['dpath'] = DPATH;
     $page = '';
     $max_fields = Developments_Lib::max_fields($this->_current_planet);
     // time to do something
     $this->do_command();
     Developments_Lib::set_first_element($this->_current_planet, $this->_current_user);
     $Sprice = array();
     $queue = $this->show_queue($Sprice);
     $this->start_building();
     $full_queue = $queue['lenght'] < MAX_BUILDING_QUEUE_SIZE ? FALSE : TRUE;
     foreach ($this->_lang['tech'] as $building => $building_name) {
         if (in_array($building, $this->_allowed[$this->_current_planet['planet_type']])) {
             $queue['to_destroy'] = isset($queue['to_destroy']) ? $queue['to_destroy'] : 0;
             if ($this->_current_planet['planet_field_current'] < $max_fields - $queue['to_destroy']) {
                 $have_fields = TRUE;
             } else {
                 $have_fields = FALSE;
             }
             if (Developments_Lib::is_development_allowed($this->_current_user, $this->_current_planet, $building)) {
                 $building_level = $this->_current_planet[$resource[$building]];
                 $building_time = Developments_Lib::development_time($this->_current_user, $this->_current_planet, $building, $building_level);
                 $parse['i'] = $building;
                 $parse['nivel'] = Developments_Lib::set_level_format($building_level);
                 $parse['n'] = $building_name;
                 $parse['descriptions'] = $this->_lang['res']['descriptions'][$building];
                 $parse['price'] = Developments_Lib::formated_development_price($this->_current_user, $this->_current_planet, $building, TRUE, $building_level);
                 $parse['time'] = Developments_Lib::formated_development_time($building_time);
                 $parse['click'] = $this->set_action_button($have_fields, $full_queue, $building, $queue);
                 $page .= parent::$page->parse_template(parent::$page->get_template('buildings/buildings_builds_row'), $parse);
             }
         }
     }
     if ($queue['lenght'] > 0) {
         $parse['BuildListScript'] = Developments_Lib::current_building($this->_current_page);
         $parse['BuildList'] = $queue['buildlist'];
     } else {
         $parse['BuildListScript'] = '';
         $parse['BuildList'] = '';
     }
     $parse['BuildingsList'] = $page;
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('buildings/buildings_builds'), $parse));
 }