Ejemplo n.º 1
0
 /**
  * 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));
 }
Ejemplo n.º 2
0
 /**
  * method get_user_rank
  * param
  * return the current user rank
  */
 private function get_user_rank()
 {
     $stats_available = Functions_Lib::read_config('stat');
     $user_rank = '-';
     $total_rank = $this->_current_user['user_statistic_total_rank'] == '' ? $this->_current_planet['stats_users'] : $this->_current_user['user_statistic_total_rank'];
     if ($stats_available && $this->_current_user['user_authlevel'] <= Functions_Lib::read_config('stat_level') or !$stats_available && $this->_current_user['user_authlevel'] == 0) {
         $user_rank = Format_Lib::pretty_number($this->_current_user['user_statistic_total_points']) . " (" . $this->_lang['ov_place'] . ' ' . Functions_Lib::set_url('game.php?page=statistics&range=' . $total_rank, $total_rank, $total_rank) . ' ' . $this->_lang['ov_of'] . ' ' . $this->_current_planet['stats_users'] . ")";
     }
     return $user_rank;
 }
Ejemplo n.º 3
0
 /**
  * method phalanx_link
  * param $planet_type
  * return phalanx link
  */
 private function phalanx_link($planet_type)
 {
     $attributes = "onclick=fenster(&#039;game.php?page=phalanx&galaxy=" . $this->_galaxy . "&amp;system=" . $this->_system . "&amp;planet=" . $this->_planet . "&amp;planettype=" . $planet_type . "&#039;)";
     return str_replace('"', '', Functions_Lib::set_url('', '', $this->_lang['gl_phalanx'], $attributes));
 }
Ejemplo n.º 4
0
 /**
  * method do_command
  * param $have_fields
  * param $full_queue
  * param $building
  * param $queue
  * return (string) $action
  */
 private function set_action_button($have_fields, $full_queue, $building, $queue)
 {
     // all field occupied
     $action = Format_Lib::color_red($this->_lang['bd_no_more_fields']);
     // with fields
     if ($have_fields && !$full_queue) {
         if ($queue['lenght'] == 0) {
             if (Developments_Lib::is_development_payable($this->_current_user, $this->_current_planet, $building, TRUE, FALSE) && !parent::$users->is_on_vacations($this->_current_user)) {
                 $action = Functions_Lib::set_url('game.php?page=' . $this->_current_page . '&cmd=insert&building=' . $building, '', Format_Lib::color_green($this->_lang['bd_build']));
             } else {
                 $action = Format_Lib::color_red($this->_lang['bd_build']);
             }
         } else {
             $action = Functions_Lib::set_url('game.php?page=' . $this->_current_page . '&cmd=insert&building=' . $building, '', Format_Lib::color_green($this->_lang['bd_add_to_list']));
         }
     }
     if ($have_fields && $full_queue) {
         $action = Format_Lib::color_red($this->_lang['bd_build']);
     }
     if ($building == 31 && Developments_Lib::is_lab_working($this->_current_user) or ($building == 21 or $building == 14 or $building == 15) && Developments_Lib::is_shipyard_working($this->_current_planet)) {
         $action = Format_Lib::color_red($this->_lang['bd_working']);
     }
     return $action;
 }
Ejemplo n.º 5
0
 /**
  * method image_block
  * param $ally_id
  * param $alliance_request
  * return shows the request block, if any
  */
 private function request_block($ally_id, $alliance_request)
 {
     if (!$this->_current_user['user_ally_id'] && !$this->_current_user['user_ally_request'] && !$alliance_request) {
         $url = 'game.php?page=alliance&mode=apply&allyid=' . $ally_id;
         $url = Functions_Lib::set_url($url, $this->_lang['al_click_to_send_request'], $this->_lang['al_click_to_send_request']);
         return '<tr><th>' . $this->_lang['al_request'] . '</th><th>' . $url . '</th></tr>';
     }
     return '';
 }
Ejemplo n.º 6
0
 /**
  * buildReportLink
  *
  * @param string $color Color
  * @param string $rid   Report ID
  * @param int    $g     Galaxy
  * @param int    $s     System
  * @param int    $p     Planet
  *
  * @return string
  */
 private function buildReportLink($color, $rid, $g, $s, $p)
 {
     $style = 'style="color:' . $color . ';"';
     $js = "OnClick=\\'f(\"game.php?page=combatreport&report=" . $rid . "\", \"\");\\'";
     $content = $this->_lang['sys_mess_attack_report'] . ' ' . Format_Lib::pretty_coords($g, $s, $p);
     return Functions_Lib::set_url('', '', $content, $style . ' ' . $js);
 }