Пример #1
0
 /**
  * __construct()
  */
 public function __construct()
 {
     $this->_lang = parent::$lang;
     if ($this->is_session_set()) {
         // Get user data and check it
         $this->set_user_data();
         // Check game close
         FunctionsLib::check_server($this->_user_data);
         // Set the changed planet
         $this->set_planet();
         // Get planet data and check it
         $this->set_planet_data();
         // Update resources, ships, defenses & technologies
         UpdateResourcesLib::updateResources($this->_user_data, $this->_planet_data, time());
         // Update buildings queue
         UpdateLib::updateBuildingsQueue($this->_planet_data, $this->_user_data);
     }
 }
Пример #2
0
 /**
  * method get_planets
  * param $user_planet
  * param $is_current_planet
  * return building in progress or free text
  */
 private function get_current_work($user_planet, $is_current_planet = TRUE)
 {
     // THE PLANET IS "FREE" BY DEFAULT
     $building_block = $this->_lang['ov_free'];
     if (!$is_current_planet) {
         // UPDATE THE PLANET INFORMATION FIRST, MAY BE SOMETHING HAS JUST FINISHED
         UpdateLib::updateBuildingsQueue($user_planet, $this->_current_user);
     }
     if ($user_planet['planet_b_building'] != 0) {
         if ($user_planet['planet_b_building'] != 0) {
             $queue = explode(';', $user_planet['planet_b_building_id']);
             // GET ALL
             $current_building = explode(',', $queue[0]);
             // GET ONLY THE FIRST ELEMENT
             $building = $current_building[0];
             // THE BUILDING
             $level = $current_building[1];
             // THE LEVEL
             $time_to_end = $current_building[3] - time();
             // THE TIME
             // THE BUILDING BLOCK
             if ($is_current_planet) {
                 $building_block = DevelopmentsLib::current_building("overview", $building);
                 $building_block .= $this->_lang['tech'][$building] . ' (' . $level . ')';
                 $building_block .= "<br /><div id=\"blc\" class=\"z\">" . FormatLib::pretty_time($time_to_end) . "</div>";
                 $building_block .= "\n<script language=\"JavaScript\">";
                 $building_block .= "\n\tpp = \"" . $time_to_end . "\";\n";
                 $building_block .= "\n\tpk = \"" . 1 . "\";\n";
                 $building_block .= "\n\tpm = \"cancel\";\n";
                 $building_block .= "\n\tpl = \"" . $this->_current_planet['planet_id'] . "\";\n";
                 $building_block .= "\n\tt();\n";
                 $building_block .= "\n</script>\n";
             } else {
                 $building_block = '' . $this->_lang['tech'][$building] . ' (' . $level . ')';
                 $building_block .= '<br><font color="#7f7f7f">(' . FormatLib::pretty_time($time_to_end) . ')</font>';
             }
         }
     }
     // BACK TO THE PLANET!
     return $building_block;
 }