/** * 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)); }
/** * method build_page * param * return main method, loads everything */ private function build_page() { $parse = $this->_lang; $page = ''; $header_template = parent::$page->get_template('techtree/techtree_head'); $row_template = parent::$page->get_template('techtree/techtree_row'); foreach ($this->_lang['tech'] as $element => $element_name) { if ($element < 600) { $parse['tt_name'] = $element_name; if (!isset($this->_resource[$element])) { $parse['Requirements'] = $this->_lang['tt_requirements']; $page .= parent::$page->parse_template($header_template, $parse); } else { if (isset($this->_requeriments[$element])) { $list = ''; foreach ($this->_requeriments[$element] as $requirement => $level) { if (isset($this->_current_user[$this->_resource[$requirement]]) && $this->_current_user[$this->_resource[$requirement]] >= $level) { $list .= Format_Lib::color_green($this->set_level_format($level, $this->_lang['tech'][$requirement])); } elseif (isset($this->_current_planet[$this->_resource[$requirement]]) && $this->_current_planet[$this->_resource[$requirement]] >= $level) { $list .= Format_Lib::color_green($this->set_level_format($level, $this->_lang['tech'][$requirement])); } else { $list .= Format_Lib::color_red($this->set_level_format($level, $this->_lang['tech'][$requirement])); } $list .= '<br/>'; } $parse['required_list'] = $list; } else { $parse['required_list'] = ''; $parse['tt_detail'] = ''; } $parse['tt_info'] = $element; $page .= parent::$page->parse_template($row_template, $parse); } } } $parse['techtree_list'] = $page; return parent::$page->display(parent::$page->parse_template(parent::$page->get_template('techtree/techtree_body'), $parse)); }
/** * method resource_color * param1 $current_amount * param2 $max_amount * return color depending on the current storage capacity */ private function resource_color($current_amount, $max_amount) { if ($max_amount < $current_amount) { return Format_Lib::color_red(Format_Lib::pretty_number($max_amount / 1000) . 'k'); } else { return Format_Lib::color_green(Format_Lib::pretty_number($max_amount / 1000) . 'k'); } }
/** * 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; }
/** * method topnav_bar * param * return get the top navigation bar data and parses it */ private function game_navbar() { $parse = $this->_lang; $parse['dpath'] = DPATH; $parse['image'] = $this->_current_planet['planet_image']; $parse['planetlist'] = Functions_Lib::build_planet_list($this->_current_user); // VACATION MODE & DELETE MODE MESSAGES if ($this->_current_user['setting_vacations_status'] && $this->_current_user['setting_delete_account']) { $parse['show_umod_notice'] .= $this->_current_user['setting_delete_account'] ? '<table width="100%" style="border: 2px solid red; text-align:center;background:transparent;"><tr style="background:transparent;"><td style="background:transparent;">' . $this->_lang['tn_delete_mode'] . date(Functions_Lib::read_config('date_format_extended'), $this->_current_user['setting_delete_account'] + 60 * 60 * 24 * 7) . '</td></tr></table>' : ''; } else { if ($this->_current_user['setting_vacations_status'] < time()) { $parse['show_umod_notice'] = $this->_current_user['setting_vacations_status'] ? '<table width="100%" style="border: 2px solid #1DF0F0; text-align:center;background:transparent;"><tr style="background:transparent;"><td style="background:transparent;">' . $this->_lang['tn_vacation_mode'] . date(Functions_Lib::read_config('date_format_extended'), $this->_current_user['setting_vacations_until']) . '</td></tr></table><br>' : ''; } $parse['show_umod_notice'] .= $this->_current_user['setting_delete_account'] ? '<table width="100%" style="border: 2px solid red; text-align:center;background:transparent;"><tr style="background:transparent;"><td style="background:transparent;">' . $this->_lang['tn_delete_mode'] . date(Functions_Lib::read_config('date_format_extended'), $this->_current_user['setting_delete_account'] + 60 * 60 * 24 * 7) . '</td></tr></table>' : ''; } // RESOURCES FORMAT $metal = Format_Lib::pretty_number($this->_current_planet['planet_metal']); $crystal = Format_Lib::pretty_number($this->_current_planet['planet_crystal']); $deuterium = Format_Lib::pretty_number($this->_current_planet['planet_deuterium']); $darkmatter = Format_Lib::pretty_number($this->_current_user['premium_dark_matter']); $energy = Format_Lib::pretty_number($this->_current_planet['planet_energy_max'] + $this->_current_planet['planet_energy_used']) . "/" . Format_Lib::pretty_number($this->_current_planet['planet_energy_max']); // OFFICERS AVAILABILITY $commander = Officiers_Lib::is_officier_active($this->_current_user['premium_officier_commander']) ? '' : '_un'; $admiral = Officiers_Lib::is_officier_active($this->_current_user['premium_officier_admiral']) ? '' : '_un'; $engineer = Officiers_Lib::is_officier_active($this->_current_user['premium_officier_engineer']) ? '' : '_un'; $geologist = Officiers_Lib::is_officier_active($this->_current_user['premium_officier_geologist']) ? '' : '_un'; $technocrat = Officiers_Lib::is_officier_active($this->_current_user['premium_officier_technocrat']) ? '' : '_un'; // METAL if ($this->_current_planet['planet_metal'] >= $this->_current_planet['planet_metal_max']) { $metal = Format_Lib::color_red($metal); } // CRYSTAL if ($this->_current_planet['planet_crystal'] >= $this->_current_planet['planet_crystal_max']) { $crystal = Format_Lib::color_red($crystal); } // DEUTERIUM if ($this->_current_planet['planet_deuterium'] >= $this->_current_planet['planet_deuterium_max']) { $deuterium = Format_Lib::color_red($deuterium); } // ENERGY if ($this->_current_planet['planet_energy_max'] + $this->_current_planet['planet_energy_used'] < 0) { $energy = Format_Lib::color_red($energy); } $parse['metal'] = $metal; $parse['crystal'] = $crystal; $parse['deuterium'] = $deuterium; $parse['darkmatter'] = $darkmatter; $parse['energy'] = $energy; $parse['img_commander'] = $commander; $parse['img_admiral'] = $admiral; $parse['img_engineer'] = $engineer; $parse['img_geologist'] = $geologist; $parse['img_technocrat'] = $technocrat; return $this->parse_template($this->get_template('general/topnav'), $parse); }