/** * method build_page * param * return main method, loads everything */ private function build_page() { $parse = $this->_lang; $modules_array = ''; $modules_count = count(explode(';', Functions_Lib::read_config('modules'))); $row_template = parent::$page->get_template('adm/modules_row_view'); $module_rows = ''; $parse['alert'] = ''; // SAVE PAGE if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['save']) { for ($i = 0; $i <= $modules_count - 2; $i++) { $modules_array .= (isset($_POST["status{$i}"]) ? 1 : 0) . ';'; } Functions_Lib::update_config('modules', $modules_array); $parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['se_all_ok_message']); } // SHOW PAGE $modules_array = explode(';', Functions_Lib::read_config('modules')); foreach ($modules_array as $module => $status) { if ($status != NULL) { $parse['module'] = $module; $parse['module_name'] = $this->_lang['module'][$module]; $parse['module_value'] = $status == 1 ? 'checked' : ''; $parse['color'] = $status == 1 ? 'text-success' : 'text-error'; $module_rows .= parent::$page->parse_template($row_template, $parse); } } $parse['module_rows'] = $module_rows; parent::$page->display(parent::$page->parse_template(parent::$page->get_template("adm/modules_view"), $parse)); }
/** * method build_page * param * return main method, loads everything */ private function build_page() { $parse = $this->_lang; $parse['alert'] = ''; $error = ''; if (isset($_POST['save'])) { if (isset($_POST['premium_url']) && !empty($_POST['premium_url'])) { Functions_Lib::update_config('premium_url', Functions_Lib::prep_url($_POST['premium_url'])); } else { $error .= $this->_lang['pr_error_url']; } if (isset($_POST['trader_darkmatter']) && $_POST['trader_darkmatter'] > 0) { Functions_Lib::update_config('trader_darkmatter', $_POST['trader_darkmatter']); } else { $error .= $this->_lang['pr_error_trader']; } if ($error != '') { $parse['alert'] = Administration_Lib::save_message('warning', $error); } else { $parse['alert'] = Administration_Lib::save_message('ok', $this->_lang['pr_all_ok_message']); } } $parse['premium_url'] = Functions_Lib::read_config('premium_url'); $parse['trader_darkmatter'] = Functions_Lib::read_config('trader_darkmatter'); parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/premium_view'), $parse)); }
/** * method build_page * param * return main method, loads everything */ private function build_page() { $parse = $this->_lang; if ($_POST) { $login = parent::$db->query_fetch("SELECT `user_id`, `user_name`, `user_password`, `user_banned`\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `user_name` = '" . parent::$db->escape_value($_POST['login']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `user_password` = '" . sha1($_POST['pass']) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1"); if ($login['user_banned'] <= time()) { $this->remove_ban($login['user_name']); } if ($login) { // User login if (parent::$users->user_login($login['user_id'], $login['user_name'], $login['user_password'])) { // Update current planet parent::$db->query("UPDATE " . USERS . " SET\n\t\t\t\t\t\t\t\t\t\t\t`user_current_planet` = `user_home_planet_id`\n\t\t\t\t\t\t\t\t\t\t\tWHERE `user_id` ='" . $login['user_id'] . "'"); // Redirect to game Functions_Lib::redirect('game.php?page=overview'); } } // If login fails Functions_Lib::redirect('index.php'); } else { $parse['year'] = date('Y'); $parse['version'] = VERSION; $parse['servername'] = Functions_Lib::read_config('game_name'); $parse['game_logo'] = Functions_Lib::read_config('game_logo'); $parse['forum_url'] = Functions_Lib::read_config('forum_url'); $parse['js_path'] = JS_PATH . 'home/'; $parse['css_path'] = CSS_PATH . 'home/'; $parse['img_path'] = IMG_PATH . 'home/'; $parse['base_path'] = BASE_PATH; parent::$page->display(parent::$page->parse_template(parent::$page->get_template('home/index_body'), $parse), FALSE, '', FALSE); } }
/** * method production_amount * param1 $production * param2 $boost * return production amount */ public static function production_amount($production, $boost, $is_energy = false) { if ($is_energy) { return floor($production * $boost); } else { return floor($production * Functions_Lib::read_config('resource_multiplier') * $boost); } }
/** * method build_page * param * return the statistics page */ private function build_page() { $parse = $this->_lang; $parse['dpath'] = DPATH; $bloc = $this->_lang; $mode = isset($_GET['mode']) ? $_GET['mode'] : ''; $time = isset($_GET['time']) ? $_GET['time'] : ''; if ($mode == 2 && ($time == 'month' or $time == 'week')) { $Selected = $_GET['offi']; $time = 'darkmatter_' . $time; $set_time = $time == 'darkmatter_month' ? 3600 * 24 * 30 * 3 : 3600 * 24 * 7; if (in_array($Selected, $this->_reslist['officier'])) { $Result = $this->is_officier_accesible($Selected, $time); $Price = $this->get_officier_price($Selected, $time); if ($Result !== FALSE) { $this->_current_user['premium_dark_matter'] -= $Price; // IF THE OFFICIER IS ACTIVE if (Officiers_Lib::is_officier_active($this->_current_user[$this->_resource[$Selected]])) { $this->_current_user[$this->_resource[$Selected]] += $set_time; // ADD TIME } else { $this->_current_user[$this->_resource[$Selected]] = time() + $set_time; // SET TIME } parent::$db->query("UPDATE " . PREMIUM . " SET\n\t\t\t\t\t\t\t\t\t\t\t`premium_dark_matter` = '" . $this->_current_user['premium_dark_matter'] . "',\n\t\t\t\t\t\t\t\t\t\t\t`" . $this->_resource[$Selected] . "` = '" . $this->_current_user[$this->_resource[$Selected]] . "'\n\t\t\t\t\t\t\t\t\t\t\tWHERE `premium_user_id` = '" . $this->_current_user['user_id'] . "';"); } } Functions_Lib::redirect('game.php?page=officier'); } else { $OfficierRowTPL = parent::$page->get_template('officier/officier_row'); $parse['disp_off_tbl'] = ''; $parse['premium_pay_url'] = Functions_Lib::read_config('premium_url') != '' ? Functions_Lib::read_config('premium_url') : 'game.php?page=officier'; foreach ($this->_lang['tech'] as $Element => $ElementName) { if ($Element >= 601 && $Element <= 605) { $bloc['dpath'] = DPATH; $bloc['off_id'] = $Element; $bloc['off_status'] = Officiers_Lib::is_officier_active($this->_current_user[$this->_resource[$Element]]) ? '<font color=lime>' . $this->_lang['of_active'] . ' ' . date(Functions_Lib::read_config('date_format'), $this->_current_user[$this->_resource[$Element]]) . '</font>' : '<font color=red>' . $this->_lang['of_inactive'] . '</font>'; $bloc['off_name'] = $ElementName; $bloc['off_desc'] = $this->_lang['res']['descriptions'][$Element]; $bloc['off_desc_short'] = $this->_lang['info'][$Element]['description']; $bloc['month_price'] = Format_Lib::pretty_number($this->get_officier_price($Element, 'darkmatter_month')); $bloc['week_price'] = Format_Lib::pretty_number($this->get_officier_price($Element, 'darkmatter_week')); $bloc['img_big'] = $this->get_officier_image($Element, 'img_big'); $bloc['img_small'] = $this->get_officier_image($Element, 'img_small'); $bloc['off_link_month'] = "game.php?page=officier&mode=2&offi=" . $Element . "&time=month"; $bloc['off_link_week'] = "game.php?page=officier&mode=2&offi=" . $Element . "&time=week"; $parse['disp_off_tbl'] .= parent::$page->parse_template($OfficierRowTPL, $bloc); } } } parent::$page->display(parent::$page->parse_template(parent::$page->get_template('officier/officier_table'), $parse)); }
/** * __construct() */ public function __construct() { parent::__construct(); // check if session is active parent::$users->check_session(); // Check module access Functions_Lib::module_message(Functions_Lib::is_module_accesible(self::MODULE_ID)); $this->_lang = parent::$lang; $this->_resource = parent::$objects->get_objects(); $this->_tr_dark_matter = Functions_Lib::read_config('trader_darkmatter'); $this->_current_user = parent::$users->get_user_data(); $this->_current_planet = parent::$users->get_planet_data(); $this->build_page(); }
/** * __construct() */ public function __construct() { parent::__construct(); // check if session is active parent::$users->check_session(); $this->_lang = parent::$lang; $this->_current_user = parent::$users->get_user_data(); // Check if the user is allowed to access if (Administration_Lib::have_access($this->_current_user['user_authlevel']) && Administration_Lib::authorization($this->_current_user['user_authlevel'], 'config_game') == 1) { $this->_game_config = Functions_Lib::read_config('', TRUE); $this->build_page(); } else { die(Functions_Lib::message($this->_lang['ge_no_permissions'])); } }
/** * method flying_fleets_table * param * return the fleets table */ private function flying_fleets_table() { $table = ''; $i = 0; while ($fleet = parent::$db->fetch_array($this->_flying_fleets)) { $block['num'] = ++$i; $block['mission'] = $this->resources_pop_up($this->_lang['ff_type_mission'][$fleet['fleet_mission']] . ' ' . (Fleets_Lib::is_fleet_returning($fleet) ? $this->_lang['ff_r'] : $this->_lang['ff_a']), $fleet); $block['amount'] = $this->ships_pop_up($this->_lang['ff_ships'], $fleet); $block['beginning'] = Format_Lib::pretty_coords($fleet['fleet_start_galaxy'], $fleet['fleet_start_system'], $fleet['fleet_start_planet']); $block['departure'] = date(Functions_Lib::read_config('date_format_extended'), $fleet['fleet_creation']); $block['objective'] = Format_Lib::pretty_coords($fleet['fleet_end_galaxy'], $fleet['fleet_end_system'], $fleet['fleet_end_planet']); $block['arrival'] = date(Functions_Lib::read_config('date_format_extended'), $fleet['fleet_start_time']); $block['return'] = date(Functions_Lib::read_config('date_format_extended'), $fleet['fleet_end_time']); $table .= parent::$page->parse_template(parent::$page->get_template('adm/fleet_rows_view'), $block); } return $table; }
/** * method calculate_points * param $element * param $level * return the points for the current element and level */ public static function calculate_points($element, $level, $type = '') { switch ($type) { case 'tech': $current_level = $level; break; case '': default: $current_level = $level - 1 < 0 ? 0 : $level - 1; break; } $element = parent::$objects->get_price($element); $resources_total = $element['metal'] + $element['crystal'] + $element['deuterium']; $level_mult = pow($element['factor'], $current_level); $points = $resources_total * $level_mult / Functions_Lib::read_config('stat_settings'); return $points; }
/** * method do_search * param * return do the search */ private function do_search() { // build the query, run the query and return the result $search_result = parent::$db->query($this->build_search_query()); $template = parent::$page->get_template('adm/messages_row_view'); $results = ''; if ($search_result !== FALSE) { // loop thru the results while ($search_data = parent::$db->fetch_array($search_result)) { $search_data['mg_show_hide'] = $this->_lang['mg_show_hide']; $search_data['message_time'] = date(Functions_Lib::read_config('date_format_extended'), $search_data['message_time']); $search_data['message_text'] = stripslashes(nl2br($search_data['message_text'])); $results .= parent::$page->parse_template($template, $search_data); } // return search results with table format of course return $results; } $this->_alert = Administration_Lib::save_message('warning', $this->_lang['mg_no_results']); }
/** * method build_page * param * return main method, loads everything */ private function build_page() { $parse = $this->_lang; $update = Functions_Lib::read_config('stat_last_update'); $backup = Functions_Lib::read_config('last_backup'); $cleanup = Functions_Lib::read_config('last_cleanup'); $modules = explode(';', Functions_Lib::read_config('modules')); $count_modules = 0; // COUNT MODULES foreach ($modules as $module) { if ($module == 1) { $count_modules++; } } // LOAD STATISTICS $inactive_time = time() - 60 * 60 * 24 * 7; $users_count = parent::$db->query_fetch("SELECT (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSELECT COUNT(user_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . USERS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) AS users_count,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ( SELECT COUNT(user_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tFROM " . USERS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tWHERE user_onlinetime < {$inactive_time} AND user_onlinetime <> 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) AS inactive_count,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ( SELECT COUNT(setting_user_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tFROM " . SETTINGS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tWHERE setting_vacations_status <> 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) AS on_vacation,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ( SELECT COUNT(setting_user_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tFROM " . SETTINGS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tWHERE setting_delete_account <> 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) AS to_delete,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ( SELECT COUNT(user_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tFROM " . USERS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tWHERE user_banned <> 0\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) AS banned_users,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ( SELECT COUNT(fleet_id)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t \t\tFROM " . FLEETS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ) AS fleets_count"); // LOAD STATISTICS $db_tables = parent::$db->query("SHOW TABLE STATUS"); $db_size = 0; while ($row = parent::$db->fetch_array($db_tables)) { $db_size += $row['Data_length'] + $row['Index_length']; } // PARSE STATISTICS $parse['info_points'] = date(Functions_Lib::read_config('date_format_extended'), $update) . ' | ' . Format_Lib::pretty_time(time() - $update); $parse['info_backup'] = date(Functions_Lib::read_config('date_format_extended'), $backup) . ' | ' . Format_Lib::pretty_time(time() - $backup); $parse['info_cleanup'] = date(Functions_Lib::read_config('date_format_extended'), $cleanup) . ' | ' . Format_Lib::pretty_time(time() - $cleanup); $parse['info_modules'] = $count_modules . '/' . (count($modules) - 1); $parse['info_total_users'] = $users_count['users_count']; $parse['info_inactive_users'] = $users_count['inactive_count']; $parse['info_vacation_users'] = $users_count['on_vacation']; $parse['info_delete_mode_users'] = $users_count['to_delete']; $parse['info_banned_users'] = $users_count['banned_users']; $parse['info_flying_fleets'] = $users_count['fleets_count']; $parse['info_database_size'] = round($db_size / 1024, 1) . ' kb'; $parse['info_database_server'] = 'MySQL ' . parent::$db->server_info(); parent::$page->display(parent::$page->parse_template(parent::$page->get_template("adm/information_view"), $parse)); }
/** * method build_page * param * return main method, loads everything */ private function build_page() { $game_stat = Functions_Lib::read_config('stat'); $game_stat_level = Functions_Lib::read_config('stat_level'); $game_stat_settings = Functions_Lib::read_config('stat_settings'); $game_stat_update_time = Functions_Lib::read_config('stat_update_time'); $this->_lang['alert'] = ''; if (isset($_POST['save']) && $_POST['save'] == $this->_lang['cs_save_changes']) { if (isset($_POST['stat']) && $_POST['stat'] != $game_stat) { Functions_Lib::update_config('stat', $_POST['stat']); $game_stat = $_POST['stat']; $ASD3 = $_POST['stat']; } if (isset($_POST['stat_level']) && is_numeric($_POST['stat_level']) && $_POST['stat_level'] != $game_stat_level) { Functions_Lib::update_config('stat_level', $_POST['stat_level']); $game_stat_level = $_POST['stat_level']; $ASD1 = $_POST['stat_level']; } if (isset($_POST['stat_settings']) && is_numeric($_POST['stat_settings']) && $_POST['stat_settings'] != $game_stat_settings) { Functions_Lib::update_config('stat_settings', $_POST['stat_settings']); $game_stat_settings = $_POST['stat_settings']; } if (isset($_POST['stat_update_time']) && is_numeric($_POST['stat_update_time']) && $_POST['stat_update_time'] != $game_stat_update_time) { Functions_Lib::update_config('stat_update_time', $_POST['stat_update_time']); $game_stat_update_time = $_POST['stat_update_time']; } $this->_lang['alert'] = Administration_Lib::save_message('ok', $this->_lang['cs_all_ok_message']); } $selected = "selected=\"selected\""; $stat = $game_stat == 1 ? 'sel_sta1' : 'sel_sta0'; $this->_lang[$stat] = $selected; $this->_lang['stat_level'] = $game_stat_level; $this->_lang['stat_settings'] = $game_stat_settings; $this->_lang['stat_update_time'] = $game_stat_update_time; $this->_lang['yes'] = $this->_lang['cs_yes'][1]; $this->_lang['no'] = $this->_lang['cs_no'][0]; parent::$page->display(parent::$page->parse_template(parent::$page->get_template('adm/statistics_view'), $this->_lang)); }
/** * method build_page * param * return main method, loads everything */ private function build_page() { $resource = parent::$objects->get_objects(); $reslist = parent::$objects->get_objects_list(); $planetsrow = parent::$db->query("SELECT `planet_id`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_name`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_galaxy`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_image`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_field_current`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_field_max`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_metal_perhour`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_crystal_perhour`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_deuterium_perhour`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_energy_used`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_energy_max`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_metal_mine`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_crystal_mine`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_deuterium_sintetizer`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_solar_plant`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_fusion_reactor`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_robot_factory`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_nano_factory`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_hangar`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_metal_store`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_crystal_store`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_deuterium_tank`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_laboratory`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_terraformer`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_ally_deposit`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_missile_silo`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_mondbasis`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_phalanx`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tb.`building_jump_gate`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_rocket_launcher`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_light_laser`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_heavy_laser`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_gauss_cannon`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_ion_cannon`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_plasma_turret`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_small_shield_dome`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_large_shield_dome`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_anti-ballistic_missile`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\td.`defense_interplanetary_missile`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_small_cargo_ship`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_big_cargo_ship`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_light_fighter`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_heavy_fighter`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_cruiser`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_battleship`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_colony_ship`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_recycler`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_espionage_probe`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_bomber`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_solar_satellite`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_destroyer`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_deathstar`,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\ts.`ship_battlecruiser`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS p\r\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`\r\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`\r\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`\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_user_id` = '" . (int) $this->_current_user['user_id'] . "'\r\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->fetch_array($planetsrow)) { $planet[] = $p; } $parse['mount'] = count($planet) + 1; foreach ($planet as $p) { $datat = array('<a href="game.php?page=overview&cp=' . $p['planet_id'] . '&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'] . '&re=0&planettype=' . $p['planet_type'] . '">' . Format_Lib::pretty_number($p['planet_metal']) . '</a> / ' . Format_Lib::pretty_number($p['planet_metal_perhour'] + Functions_Lib::read_config('metal_basic_income')), '<a href="game.php?page=resources&cp=' . $p['planet_id'] . '&re=0&planettype=' . $p['planet_type'] . '">' . Format_Lib::pretty_number($p['planet_crystal']) . '</a> / ' . Format_Lib::pretty_number($p['planet_crystal_perhour'] + Functions_Lib::read_config('crystal_basic_income')), '<a href="game.php?page=resources&cp=' . $p['planet_id'] . '&re=0&planettype=' . $p['planet_type'] . '">' . Format_Lib::pretty_number($p['planet_deuterium']) . '</a> / ' . Format_Lib::pretty_number($p['planet_deuterium_perhour'] + Functions_Lib::read_config('deuterium_basic_income')), Format_Lib::pretty_number($p['planet_energy_max'] - $p['planet_energy_used']) . ' / ' . Format_Lib::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=" . Developments_Lib::set_building_page($i) . "&cp={$p['planet_id']}&re=0&planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>" : (in_array($i, $reslist['tech']) ? "<a href=\"game.php?page=research&cp={$p['planet_id']}&re=0&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']}&re=0&planettype={$p['planet_type']}\">{$p[$resource[$i]]}</a>" : (in_array($i, $reslist['defense']) ? "<a href=\"game.php?page=defense&cp={$p['planet_id']}&re=0&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); }
/** * method build_page * param * return main method, loads everything */ private function build_page() { $parse = $this->_lang; // ON POST if ($_SERVER['REQUEST_METHOD'] == 'POST') { // SAVE DATA if (isset($_POST['save']) && $_POST['save']) { Functions_Lib::update_config('auto_backup', isset($_POST['auto_backup']) && $_POST['auto_backup'] == 'on' ? 1 : 0); } // BACKUP DATABASE RIGHT NOW if (isset($_POST['backup']) && $_POST['backup']) { $result = parent::$db->backup_db(); if ($result != FALSE) { $parse['alert'] = Administration_Lib::save_message('ok', str_replace('%s', round($result / 1024, 2), $this->_lang['bku_backup_done'])); } } } // PARSE DATA $auto_backup_status = Functions_Lib::read_config('auto_backup'); $parse['color'] = $auto_backup_status == 1 ? 'text-success' : 'text-error'; $parse['checked'] = $auto_backup_status == 1 ? 'checked' : ''; parent::$page->display(parent::$page->parse_template(parent::$page->get_template("adm/backup_view"), $parse)); }
/** * method build_page * param * return main method, loads everything */ private function build_page() { $parse = $this->_lang; $query = parent::$db->query("SELECT *\n\t\t\t\t\t\t\t\t\t\t\tFROM " . BANNED . "\n\t\t\t\t\t\t\t\t\t\t\tORDER BY `banned_id`;"); $i = 0; $sub_template = parent::$page->get_template('banned/banned_row'); $body = ''; while ($u = parent::$db->fetch_array($query)) { $parse['player'] = $u[1]; $parse['reason'] = $u[2]; $parse['since'] = date(Functions_Lib::read_config('date_format_extended'), $u[4]); $parse['until'] = date(Functions_Lib::read_config('date_format_extended'), $u[5]); $parse['by'] = $u[6]; $i++; $body .= parent::$page->parse_template($sub_template, $parse); } if ($i == 0) { $parse['banned_msg'] = $this->_lang['bn_no_players_banned']; } else { $parse['banned_msg'] = $this->_lang['bn_exists'] . $i . $this->_lang['bn_players_banned']; } $parse['banned_players'] = $body; parent::$page->display(parent::$page->parse_template(parent::$page->get_template('banned/banned_body'), $parse)); }
/** * method attack * param $current_ships * param $target_ships * param $current_tech * param $target_tech * return process the attack */ private function attack($current_ships, $target_ships, $current_tech, $target_tech) { $round = array(); $attacker_n = array(); $enemy_n = array(); if (!is_null($current_ships)) { $current_debris_start['metal'] = 0; $current_debris_start['crystal'] = 0; foreach ($current_ships as $a => $b) { $current_debris_start['metal'] = $current_debris_start['metal'] + $current_ships[$a]['count'] * $this->_pricelist[$a]['metal']; $current_debris_start['crystal'] = $current_debris_start['crystal'] + $current_ships[$a]['count'] * $this->_pricelist[$a]['crystal']; } } $target_debris_start['metal'] = 0; $target_debris_start['crystal'] = 0; $target_start = $target_ships; if (!is_null($target_ships)) { foreach ($target_ships as $a => $b) { if ($a < 300) { $target_debris_start['metal'] = $target_debris_start['metal'] + $target_ships[$a]['count'] * $this->_pricelist[$a]['metal']; $target_debris_start['crystal'] = $target_debris_start['crystal'] + $target_ships[$a]['count'] * $this->_pricelist[$a]['crystal']; } else { $target_debris_start_defense['metal'] = $target_debris_start_defense['metal'] + $target_ships[$a]['count'] * $this->_pricelist[$a]['metal']; $target_debris_start_defense['crystal'] = $target_debris_start_defense['crystal'] + $target_ships[$a]['count'] * $this->_pricelist[$a]['crystal']; } } } for ($i = 1; $i <= 7; $i++) { $attacker_attack = 0; $enemy_attack = 0; $attacker_defense = 0; $enemy_defense = 0; $attacker_amount = 0; $enemy_amount = 0; $attacker_shield = 0; $enemy_shield = 0; if (!is_null($current_ships)) { foreach ($current_ships as $a => $b) { $current_ships[$a]['defense'] = $current_ships[$a]['count'] * ($this->_pricelist[$a]['metal'] + $this->_pricelist[$a]['crystal']) / 10 * (1 + 0.1 * $current_tech['research_shielding_technology']); $rand = mt_rand(80, 120) / 100; $current_ships[$a]['shield'] = $current_ships[$a]['count'] * $this->_combat_caps[$a]['shield'] * (1 + 0.1 * $current_tech['research_armour_technology']) * $rand; $atak_statku = $this->_combat_caps[$a]['attack']; $technologie = 1 + 0.1 * $current_tech['research_weapons_technology']; $rand = mt_rand(80, 120) / 100; $ilosc = $current_ships[$a]['count']; $current_ships[$a]['attack'] = $number * $atak_statku * $technologie * $rand; $attacker_attack = $attacker_attack + $current_ships[$a]['attack']; $attacker_defense = $attacker_defense + $current_ships[$a]['defense']; $attacker_amount = $attacker_amount + $current_ships[$a]['count']; } } else { $attacker_amount = 0; break; } if (!is_null($target_ships)) { foreach ($target_ships as $a => $b) { $target_ships[$a]['defense'] = $target_ships[$a]['count'] * ($this->_pricelist[$a]['metal'] + $this->_pricelist[$a]['crystal']) / 10 * (1 + 0.1 * $target_tech['research_shielding_technology']); $rand = mt_rand(80, 120) / 100; $target_ships[$a]['shield'] = $target_ships[$a]['count'] * $this->_combat_caps[$a]['shield'] * (1 + 0.1 * $target_tech['research_armour_technology']) * $rand; $atak_statku = $this->_combat_caps[$a]['attack']; $technologie = 1 + 0.1 * $target_tech['research_weapons_technology']; $rand = mt_rand(80, 120) / 100; $number = $target_ships[$a]['count']; $target_ships[$a]['attack'] = $number * $atak_statku * $technologie * $rand; $enemy_attack = $enemy_attack + $target_ships[$a]['attack']; $enemy_defense = $enemy_defense + $target_ships[$a]['defense']; $enemy_amount = $enemy_amount + $target_ships[$a]['count']; } } else { $enemy_amount = 0; $round[$i]['attacker'] = $current_ships; $round[$i]['enemy'] = $target_ships; $round[$i]['attacker']['attack'] = $attacker_attack; $round[$i]['enemy']['attack'] = $enemy_attack; $round[$i]['attacker']['count'] = $attacker_amount; $round[$i]['enemy']['count'] = $enemy_amount; break; } $round[$i]['attacker'] = $current_ships; $round[$i]['enemy'] = $target_ships; $round[$i]['attacker']['attack'] = $attacker_attack; $round[$i]['enemy']['attack'] = $enemy_attack; $round[$i]['attacker']['count'] = $attacker_amount; $round[$i]['enemy']['count'] = $enemy_amount; if ($attacker_amount == 0 or $enemy_amount == 0) { break; } foreach ($current_ships as $a => $b) { if ($attacker_amount > 0) { $wrog_moc = $current_ships[$a]['count'] * $enemy_attack / $attacker_amount; if ($current_ships[$a]['shield'] < $wrog_moc) { $max_zdjac = floor($current_ships[$a]['count'] * $enemy_amount / $attacker_amount); $wrog_moc = $wrog_moc - $current_ships[$a]['shield']; $attacker_shield = $attacker_shield + $current_ships[$a]['shield']; $ile_zdjac = floor($wrog_moc / (($this->_pricelist[$a]['metal'] + $this->_pricelist[$a]['crystal']) / 10)); if ($ile_zdjac > $max_zdjac) { $ile_zdjac = $max_zdjac; } $attacker_n[$a]['count'] = ceil($current_ships[$a]['count'] - $ile_zdjac); if ($attacker_n[$a]['count'] <= 0) { $attacker_n[$a]['count'] = 0; } } else { $attacker_n[$a]['count'] = $current_ships[$a]['count']; $attacker_shield = $attacker_shield + $wrog_moc; } } else { $attacker_n[$a]['count'] = $current_ships[$a]['count']; $attacker_shield = $attacker_shield + $wrog_moc; } } foreach ($target_ships as $a => $b) { if ($enemy_amount > 0) { $atakujacy_moc = $target_ships[$a]['count'] * $attacker_attack / $enemy_amount; if ($target_ships[$a]['shield'] < $atakujacy_moc) { $max_zdjac = floor($target_ships[$a]['count'] * $attacker_amount / $enemy_amount); $atakujacy_moc = $atakujacy_moc - $target_ships[$a]['shield']; $enemy_shield = $enemy_shield + $target_ships[$a]['shield']; $ile_zdjac = floor($atakujacy_moc / (($this->_pricelist[$a]['metal'] + $this->_pricelist[$a]['crystal']) / 10)); if ($ile_zdjac > $max_zdjac) { $ile_zdjac = $max_zdjac; } $enemy_n[$a]['count'] = ceil($target_ships[$a]['count'] - $ile_zdjac); if ($enemy_n[$a]['count'] <= 0) { $enemy_n[$a]['count'] = 0; } } else { $enemy_n[$a]['count'] = $target_ships[$a]['count']; $enemy_shield = $enemy_shield + $atakujacy_moc; } } else { $enemy_n[$a]['count'] = $target_ships[$a]['count']; $enemy_shield = $enemy_shield + $atakujacy_moc; } } foreach ($current_ships as $a => $b) { foreach ($this->_combat_caps[$a]['sd'] as $c => $d) { if (isset($target_ships[$c])) { $enemy_n[$c]['count'] = $enemy_n[$c]['count'] - floor($d * mt_rand(50, 100) / 100); if ($enemy_n[$c]['count'] <= 0) { $enemy_n[$c]['count'] = 0; } } } } foreach ($target_ships as $a => $b) { foreach ($this->_combat_caps[$a]['sd'] as $c => $d) { if (isset($current_ships[$c])) { $attacker_n[$c]['count'] = $attacker_n[$c]['count'] - floor($d * mt_rand(50, 100) / 100); if ($attacker_n[$c]['count'] <= 0) { $attacker_n[$c]['count'] = 0; } } } } $round[$i]['attacker']['shield'] = $attacker_shield; $round[$i]['enemy']['shield'] = $enemy_shield; $target_ships = $enemy_n; $current_ships = $attacker_n; } if ($attacker_amount == 0 or $enemy_amount == 0) { if ($attacker_amount == 0 && $enemy_amount == 0) { $wygrana = "r"; } else { if ($attacker_amount == 0) { $wygrana = "w"; } else { $wygrana = "a"; } } } else { $i = sizeof($round); $round[$i]['attacker'] = $current_ships; $round[$i]['enemy'] = $target_ships; $round[$i]['attacker']['attack'] = $attacker_attack; $round[$i]['enemy']['attack'] = $enemy_attack; $round[$i]['attacker']['count'] = $attacker_amount; $round[$i]['enemy']['count'] = $enemy_amount; $wygrana = "r"; } $current_debris_end['metal'] = 0; $current_debris_end['crystal'] = 0; if (!is_null($current_ships)) { foreach ($current_ships as $a => $b) { $current_debris_end['metal'] = $current_debris_end['metal'] + $current_ships[$a]['count'] * $this->_pricelist[$a]['metal']; $current_debris_end['crystal'] = $current_debris_end['crystal'] + $current_ships[$a]['count'] * $this->_pricelist[$a]['crystal']; } } $target_debris_end['metal'] = 0; $target_debris_end['crystal'] = 0; if (!is_null($target_ships)) { foreach ($target_ships as $a => $b) { if ($a < 300) { $target_debris_end['metal'] = $target_debris_end['metal'] + $target_ships[$a]['count'] * $this->_pricelist[$a]['metal']; $target_debris_end['crystal'] = $target_debris_end['crystal'] + $target_ships[$a]['count'] * $this->_pricelist[$a]['crystal']; } else { $target_debris_end_obrona['metal'] = $target_debris_end_obrona['metal'] + $target_ships[$a]['count'] * $this->_pricelist[$a]['metal']; $target_debris_end_obrona['crystal'] = $target_debris_end_obrona['crystal'] + $target_ships[$a]['count'] * $this->_pricelist[$a]['crystal']; } } } $ilosc_wrog = 0; $straty_obrona_wrog = 0; if (!is_null($target_ships)) { foreach ($target_ships as $a => $b) { if ($a > 300) { $straty_obrona_wrog = $straty_obrona_wrog + ($target_start[$a]['count'] - $target_ships[$a]['count']) * ($this->_pricelist[$a]['metal'] + $this->_pricelist[$a]['crystal']); $target_ships[$a]['count'] = $target_ships[$a]['count'] + ($target_start[$a]['count'] - $target_ships[$a]['count']) * mt_rand(60, 80) / 100; $ilosc_wrog = $ilosc_wrog + $target_ships[$a]['count']; } } } if ($ilosc_wrog > 0 && $attacker_amount == 0) { $wygrana = "w"; } $game_fleet_cdr = Functions_Lib::read_config('fleet_cdr'); $game_def_cdr = Functions_Lib::read_config('defs_cdr'); $debris['metal'] = ($current_debris_start['metal'] - $current_debris_end['metal'] + ($target_debris_start['metal'] - $target_debris_end['metal'])) * ($game_fleet_cdr / 100); $debris['crystal'] = ($current_debris_start['crystal'] - $current_debris_end['crystal'] + ($target_debris_start['crystal'] - $target_debris_end['crystal'])) * ($game_fleet_cdr / 100); $debris['metal'] += ($current_debris_start['metal'] - $current_debris_end['metal'] + ($target_debris_start['metal'] - $target_debris_end['metal'])) * ($game_def_cdr / 100); $debris['crystal'] += ($current_debris_start['crystal'] - $current_debris_end['crystal'] + ($target_debris_start['crystal'] - $target_debris_end['crystal'])) * ($game_def_cdr / 100); $debris['attacker'] = $current_debris_start['metal'] - $current_debris_end['metal'] + ($current_debris_start['crystal'] - $current_debris_end['crystal']); $debris['enemy'] = $target_debris_start['metal'] - $target_debris_end['metal'] + ($target_debris_start['crystal'] - $target_debris_end['crystal']) + $straty_obrona_wrog; return array("attacker" => $current_ships, "enemy" => $target_ships, "win" => $wygrana, "data_for_rw" => $round, "debris" => $debris); }
/** * method set_user_data * param * return (void) */ private function set_user_data() { $user_row = array(); $this->_user_data = parent::$db->query("SELECT u.*,\n\t \t\t\t\t\t\t\t\t\t\t\tpre.*,\n\t \t\t\t\t\t\t\t\t\t\t\tse.*,\n\t \t\t\t\t\t\t\t\t\t\t\tusul.user_statistic_total_rank,\n\t \t\t\t\t\t\t\t\t\t\t\tusul.user_statistic_total_points,\n\t \t\t\t\t\t\t\t\t\t\t\tr.*,\n\t \t\t\t\t\t\t\t\t\t\t\ta.alliance_name,\n\t \t\t\t\t\t\t\t\t\t\t\t(SELECT COUNT(`message_id`) AS `new_message` FROM `" . MESSAGES . "` WHERE `message_receiver` = u.`user_id` AND `message_read` = 0) AS `new_message`\n\t \t\t\t\t\t\t\t\t\tFROM " . USERS . " AS u\n\t \t\t\t\t\t\t\t\t\tINNER JOIN " . SETTINGS . " AS se ON se.setting_user_id = u.user_id\n\t \t\t\tINNER JOIN " . USERS_STATISTICS . " AS usul ON usul.user_statistic_user_id = u.user_id\n\t \t\t\tINNER JOIN " . PREMIUM . " AS pre ON pre.premium_user_id = u.user_id\n\t \t\t\tINNER JOIN " . RESEARCH . " AS r ON r.research_user_id = u.user_id\n\t \t\t\tLEFT JOIN " . ALLIANCE . " AS a ON a.alliance_id = u.user_ally_id\n\t \t\t\t\t\t\t\t\t\tWHERE (u.user_name = '" . parent::$db->escape_value($_SESSION['user_name']) . "')\n\t \t\t\t\t\t\t\t\t\tLIMIT 1;"); if (parent::$db->num_rows($this->_user_data) != 1) { Functions_Lib::message($this->_lang['ccs_multiple_users'], XGP_ROOT, 3, FALSE, FALSE); } $user_row = parent::$db->fetch_array($this->_user_data); if ($user_row['user_id'] != $_SESSION['user_id']) { Functions_Lib::message($this->_lang['ccs_other_user'], XGP_ROOT, 3, FALSE, FALSE); } if (sha1($user_row['user_password'] . "-" . SECRETWORD) != $_SESSION['user_password']) { Functions_Lib::message($this->_lang['css_different_password'], XGP_ROOT, 5, FALSE, FALSE); } if ($user_row['user_banned'] > 0) { $parse = $this->_lang; $parse['banned_until'] = date(Functions_Lib::read_config('date_format_extended'), $user_row['user_banned']); die(parent::$page->parse_template(parent::$page->get_template('home/banned_message'), $parse)); } parent::$db->query("UPDATE " . USERS . " SET\n \t\t\t\t\t`user_onlinetime` = '" . time() . "',\n \t\t\t\t\t`user_current_page` = '" . parent::$db->escape_value($_SERVER['REQUEST_URI']) . "',\n \t\t\t\t\t`user_lastip` = '" . parent::$db->escape_value($_SERVER['REMOTE_ADDR']) . "',\n \t\t\t\t\t`user_agent` = '" . parent::$db->escape_value($_SERVER['HTTP_USER_AGENT']) . "'\n \t\t\t\t\tWHERE `user_id` = '" . parent::$db->escape_value($_SESSION['user_id']) . "'\n \t\t\t\t\tLIMIT 1;"); // pass the data $this->_user_data = $user_row; // unset the old data unset($user_row); }
/** * method build_page * param * return main method, loads everything */ private function build_page() { $parse = $this->_lang; $game_metal_basic_income = Functions_Lib::read_config('metal_basic_income'); $game_crystal_basic_income = Functions_Lib::read_config('crystal_basic_income'); $game_deuterium_basic_income = Functions_Lib::read_config('deuterium_basic_income'); $game_energy_basic_income = Functions_Lib::read_config('energy_basic_income'); $game_resource_multiplier = Functions_Lib::read_config('resource_multiplier'); if ($this->_current_planet['planet_type'] == 3) { $game_metal_basic_income = 0; $game_crystal_basic_income = 0; $game_deuterium_basic_income = 0; } $this->_current_planet['planet_metal_max'] = Production_Lib::max_storable($this->_current_planet[$this->_resource[22]]); $this->_current_planet['planet_crystal_max'] = Production_Lib::max_storable($this->_current_planet[$this->_resource[23]]); $this->_current_planet['planet_deuterium_max'] = Production_Lib::max_storable($this->_current_planet[$this->_resource[24]]); $parse['production_level'] = 100; $post_porcent = Production_Lib::max_production($this->_current_planet['planet_energy_max'], $this->_current_planet['planet_energy_used']); $parse['resource_row'] = ''; $this->_current_planet['planet_metal_perhour'] = 0; $this->_current_planet['planet_crystal_perhour'] = 0; $this->_current_planet['planet_deuterium_perhour'] = 0; $this->_current_planet['planet_energy_max'] = 0; $this->_current_planet['planet_energy_used'] = 0; $BuildTemp = $this->_current_planet['planet_temp_max']; $ResourcesRowTPL = parent::$page->get_template('resources/resources_row'); foreach ($this->_reslist['prod'] as $ProdID) { if ($this->_current_planet[$this->_resource[$ProdID]] > 0 && isset($this->_prod_grid[$ProdID])) { $BuildLevelFactor = $this->_current_planet['planet_' . $this->_resource[$ProdID] . '_porcent']; $BuildLevel = $this->_current_planet[$this->_resource[$ProdID]]; $BuildEnergy = $this->_current_user['research_energy_technology']; // BOOST $geologe_boost = 1 + 1 * (Officiers_Lib::is_officier_active($this->_current_user['premium_officier_geologist']) ? GEOLOGUE : 0); $engineer_boost = 1 + 1 * (Officiers_Lib::is_officier_active($this->_current_user['premium_officier_engineer']) ? ENGINEER_ENERGY : 0); // PRODUCTION FORMULAS $metal_prod = eval($this->_prod_grid[$ProdID]['formule']['metal']); $crystal_prod = eval($this->_prod_grid[$ProdID]['formule']['crystal']); $deuterium_prod = eval($this->_prod_grid[$ProdID]['formule']['deuterium']); $energy_prod = eval($this->_prod_grid[$ProdID]['formule']['energy']); // PRODUCTION $metal = Production_Lib::production_amount($metal_prod, $geologe_boost); $crystal = Production_Lib::production_amount($crystal_prod, $geologe_boost); $deuterium = Production_Lib::production_amount($deuterium_prod, $geologe_boost); if ($ProdID >= 4) { $energy = Production_Lib::production_amount($energy_prod, $engineer_boost, TRUE); } else { $energy = Production_Lib::production_amount($energy_prod, 1, TRUE); } if ($energy > 0) { $this->_current_planet['planet_energy_max'] += $energy; } else { $this->_current_planet['planet_energy_used'] += $energy; } $this->_current_planet['planet_metal_perhour'] += $metal; $this->_current_planet['planet_crystal_perhour'] += $crystal; $this->_current_planet['planet_deuterium_perhour'] += $deuterium; $metal = Production_Lib::current_production($metal, $post_porcent); $crystal = Production_Lib::current_production($crystal, $post_porcent); $deuterium = Production_Lib::current_production($deuterium, $post_porcent); $energy = Production_Lib::current_production($energy, $post_porcent); $Field = 'planet_' . $this->_resource[$ProdID] . '_porcent'; $CurrRow = array(); $CurrRow['name'] = $this->_resource[$ProdID]; $CurrRow['porcent'] = $this->_current_planet[$Field]; $CurrRow['option'] = $this->build_options($CurrRow['porcent']); $CurrRow['type'] = $this->_lang['tech'][$ProdID]; $CurrRow['level'] = $ProdID > 200 ? $this->_lang['rs_amount'] : $this->_lang['rs_lvl']; $CurrRow['level_type'] = $this->_current_planet[$this->_resource[$ProdID]]; $CurrRow['metal_type'] = Format_Lib::pretty_number($metal); $CurrRow['crystal_type'] = Format_Lib::pretty_number($crystal); $CurrRow['deuterium_type'] = Format_Lib::pretty_number($deuterium); $CurrRow['energy_type'] = Format_Lib::pretty_number($energy); $CurrRow['metal_type'] = Format_Lib::color_number($CurrRow['metal_type']); $CurrRow['crystal_type'] = Format_Lib::color_number($CurrRow['crystal_type']); $CurrRow['deuterium_type'] = Format_Lib::color_number($CurrRow['deuterium_type']); $CurrRow['energy_type'] = Format_Lib::color_number($CurrRow['energy_type']); $parse['resource_row'] .= parent::$page->parse_template($ResourcesRowTPL, $CurrRow); } } $parse['Production_of_resources_in_the_planet'] = str_replace('%s', $this->_current_planet['planet_name'], $this->_lang['rs_production_on_planet']); $parse['production_level'] = $this->prod_level($this->_current_planet['planet_energy_used'], $this->_current_planet['planet_energy_max']); $parse['metal_basic_income'] = $game_metal_basic_income; $parse['crystal_basic_income'] = $game_crystal_basic_income; $parse['deuterium_basic_income'] = $game_deuterium_basic_income; $parse['energy_basic_income'] = $game_energy_basic_income; $parse['planet_metal_max'] = $this->resource_color($this->_current_planet['planet_metal'], $this->_current_planet['planet_metal_max']); $parse['planet_crystal_max'] = $this->resource_color($this->_current_planet['planet_crystal'], $this->_current_planet['planet_crystal_max']); $parse['planet_deuterium_max'] = $this->resource_color($this->_current_planet['planet_deuterium'], $this->_current_planet['planet_deuterium_max']); $parse['metal_total'] = Format_Lib::color_number(Format_Lib::pretty_number(floor($this->_current_planet['planet_metal_perhour'] * 0.01 * $parse['production_level'] + $parse['metal_basic_income']))); $parse['crystal_total'] = Format_Lib::color_number(Format_Lib::pretty_number(floor($this->_current_planet['planet_crystal_perhour'] * 0.01 * $parse['production_level'] + $parse['crystal_basic_income']))); $parse['deuterium_total'] = Format_Lib::color_number(Format_Lib::pretty_number(floor($this->_current_planet['planet_deuterium_perhour'] * 0.01 * $parse['production_level'] + $parse['deuterium_basic_income']))); $parse['energy_total'] = Format_Lib::color_number(Format_Lib::pretty_number(floor($this->_current_planet['planet_energy_max'] + $parse['energy_basic_income'] + $this->_current_planet['planet_energy_used']))); $parse['daily_metal'] = $this->calculate_daily($this->_current_planet['planet_metal_perhour'], $parse['production_level'], $parse['metal_basic_income']); $parse['weekly_metal'] = $this->calculate_weekly($this->_current_planet['planet_metal_perhour'], $parse['production_level'], $parse['metal_basic_income']); $parse['daily_crystal'] = $this->calculate_daily($this->_current_planet['planet_crystal_perhour'], $parse['production_level'], $parse['crystal_basic_income']); $parse['weekly_crystal'] = $this->calculate_weekly($this->_current_planet['planet_crystal_perhour'], $parse['production_level'], $parse['crystal_basic_income']); $parse['daily_deuterium'] = $this->calculate_daily($this->_current_planet['planet_deuterium_perhour'], $parse['production_level'], $parse['deuterium_basic_income']); $parse['weekly_deuterium'] = $this->calculate_weekly($this->_current_planet['planet_deuterium_perhour'], $parse['production_level'], $parse['deuterium_basic_income']); $parse['daily_metal'] = Format_Lib::color_number(Format_Lib::pretty_number($parse['daily_metal'])); $parse['weekly_metal'] = Format_Lib::color_number(Format_Lib::pretty_number($parse['weekly_metal'])); $parse['daily_crystal'] = Format_Lib::color_number(Format_Lib::pretty_number($parse['daily_crystal'])); $parse['weekly_crystal'] = Format_Lib::color_number(Format_Lib::pretty_number($parse['weekly_crystal'])); $parse['daily_deuterium'] = Format_Lib::color_number(Format_Lib::pretty_number($parse['daily_deuterium'])); $parse['weekly_deuterium'] = Format_Lib::color_number(Format_Lib::pretty_number($parse['weekly_deuterium'])); $ValidList['percent'] = array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100); $SubQry = ''; if ($_POST && !parent::$users->is_on_vacations($this->_current_user)) { foreach ($_POST as $Field => $Value) { $FieldName = 'planet_' . $Field . '_porcent'; if (isset($this->_current_planet[$FieldName])) { if (!in_array($Value, $ValidList['percent'])) { Functions_Lib::redirect('game.php?page=resourceSettings'); } $Value = $Value / 10; $this->_current_planet[$FieldName] = $Value; $SubQry .= ", `" . $FieldName . "` = '" . $Value . "'"; } } parent::$db->query("UPDATE " . PLANETS . " SET\r\n\t\t\t\t\t\t\t\t\t`planet_id` = '" . $this->_current_planet['planet_id'] . "'\r\n\t\t\t\t\t\t\t\t\t{$SubQry}\r\n\t\t\t\t\t\t\t\t\tWHERE `planet_id` = '" . $this->_current_planet['planet_id'] . "';"); Functions_Lib::redirect('game.php?page=resourceSettings'); } parent::$page->display(parent::$page->parse_template(parent::$page->get_template('resources/resources'), $parse)); }
/** * method get_research_info * param * return the research page for the current user */ private function get_data_members() { $parse = $this->_lang; $parse['al_alliance_members'] = str_replace('%s', $this->_alliance_query['alliance_name'], $this->_lang['al_alliance_members']); $all_members = $this->get_members(); $alliance_ranks = unserialize($this->_alliance_query['alliance_ranks']); $template = parent::$page->get_template('adm/alliances_members_row_view'); $members = ''; if (!empty($all_members)) { while ($member = parent::$db->fetch_assoc($all_members)) { $member['alliance_request'] = $member['alliance_request'] ? $this->_lang['al_request_yes'] : $this->_lang['al_request_no']; $member['ally_request_text'] = $member['ally_request_text'] ? $this->_lang['ally_request_text'] : '-'; $member['alliance_register_time'] = date(Functions_Lib::read_config('date_format_extended'), $member['alliance_register_time']); if ($member['user_id'] == $member['alliance_owner']) { $member['ally_rank'] = $member['alliance_owner_range']; } else { if (isset($member['ally_rank'])) { $member['ally_rank'] = $alliance_ranks[$member['ally_rank']]['name']; } else { $member['ally_rank'] = $this->_lang['al_rank_not_defined']; } } $members .= parent::$page->parse_template($template, $member); } } $parse['members_table'] = empty($members) ? '<tr><td colspan="6" class="align_center text-error">' . $this->_lang['al_no_ranks'] . '</td></tr>' : $members; $parse['alert_info'] = $this->_alert_type != '' ? Administration_Lib::save_message($this->_alert_type, $this->_alert_info) : ''; return parent::$page->parse_template(parent::$page->get_template("adm/alliances_members_view"), $parse); }
/** * 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; }
/** * method acs_attack * param $attackers * param $defenders * return the attack result */ private function acs_attack(&$attackers, &$defenders) { $totalResourcePoints = array('attacker' => 0, 'defender' => 0); $resourcePointsAttacker = array('metal' => 0, 'crystal' => 0); foreach ($attackers as $fleetID => $attacker) { foreach ($attacker['detail'] as $element => $amount) { $resourcePointsAttacker['metal'] += $this->_pricelist[$element]['metal'] * $amount; $resourcePointsAttacker['crystal'] += $this->_pricelist[$element]['crystal'] * $amount; $totalResourcePoints['attacker'] += $this->_pricelist[$element]['metal'] * $amount; $totalResourcePoints['attacker'] += $this->_pricelist[$element]['crystal'] * $amount; } } $resourcePointsDefender = array('metal' => 0, 'crystal' => 0); foreach ($defenders as $fleetID => $defender) { foreach ($defender['def'] as $element => $amount) { //Line20 if ($element < 300) { $resourcePointsDefender['metal'] += $this->_pricelist[$element]['metal'] * $amount; $resourcePointsDefender['crystal'] += $this->_pricelist[$element]['crystal'] * $amount; $totalResourcePoints['defender'] += $this->_pricelist[$element]['metal'] * $amount; $totalResourcePoints['defender'] += $this->_pricelist[$element]['crystal'] * $amount; } else { if (!isset($originalDef[$element])) { $originalDef[$element] = 0; } $originalDef[$element] += $amount; $totalResourcePoints['defender'] += $this->_pricelist[$element]['metal'] * $amount; $totalResourcePoints['defender'] += $this->_pricelist[$element]['crystal'] * $amount; } } } $max_rounds = 6; for ($round = 0, $rounds = array(); $round < $max_rounds; $round++) { $attackDamage = array('total' => 0); $attackShield = array('total' => 0); $attackAmount = array('total' => 0); $defenseDamage = array('total' => 0); $defenseShield = array('total' => 0); $defenseAmount = array('total' => 0); $attArray = array(); $defArray = array(); foreach ($attackers as $fleetID => $attacker) { $attackDamage[$fleetID] = 0; $attackShield[$fleetID] = 0; $attackAmount[$fleetID] = 0; foreach ($attacker['detail'] as $element => $amount) { $attTech = 1 + 0.1 * $attacker['user']['research_weapons_technology']; // WEAPONS $defTech = 1 + 0.1 * $attacker['user']['research_shielding_technology']; // SHIELD $shieldTech = 1 + 0.1 * $attacker['user']['research_armour_technology']; // ARMOUR $attackers[$fleetID]['techs'] = array($shieldTech, $defTech, $attTech); $thisAtt = $amount * $this->_combat_caps[$element]['attack'] * $attTech * (mt_rand(80, 120) / 100); //attaque $thisDef = $amount * $this->_combat_caps[$element]['shield'] * $defTech; //bouclier $thisShield = $amount * ($this->_pricelist[$element]['metal'] + $this->_pricelist[$element]['crystal']) / 10 * $shieldTech; //coque $attArray[$fleetID][$element] = array('def' => $thisDef, 'shield' => $thisShield, 'att' => $thisAtt); $attackDamage[$fleetID] += $thisAtt; $attackDamage['total'] += $thisAtt; $attackShield[$fleetID] += $thisDef; $attackShield['total'] += $thisDef; $attackAmount[$fleetID] += $amount; $attackAmount['total'] += $amount; } } foreach ($defenders as $fleetID => $defender) { $defenseDamage[$fleetID] = 0; $defenseShield[$fleetID] = 0; $defenseAmount[$fleetID] = 0; foreach ($defender['def'] as $element => $amount) { $attTech = 1 + 0.1 * $defender['user']['research_weapons_technology']; //attaquue $defTech = 1 + 0.1 * $defender['user']['research_shielding_technology']; //bouclier $shieldTech = 1 + 0.1 * $defender['user']['research_armour_technology']; //coque $defenders[$fleetID]['techs'] = array($shieldTech, $defTech, $attTech); $thisAtt = $amount * $this->_combat_caps[$element]['attack'] * $attTech * (mt_rand(80, 120) / 100); //attaque $thisDef = $amount * $this->_combat_caps[$element]['shield'] * $defTech; //bouclier $thisShield = $amount * ($this->_pricelist[$element]['metal'] + $this->_pricelist[$element]['crystal']) / 10 * $shieldTech; //coque if ($element == 407 || $element == 408) { $thisAtt = 0; } $defArray[$fleetID][$element] = array('def' => $thisDef, 'shield' => $thisShield, 'att' => $thisAtt); $defenseDamage[$fleetID] += $thisAtt; $defenseDamage['total'] += $thisAtt; $defenseShield[$fleetID] += $thisDef; $defenseShield['total'] += $thisDef; $defenseAmount[$fleetID] += $amount; $defenseAmount['total'] += $amount; } } $rounds[$round] = array('attackers' => $attackers, 'defenders' => $defenders, 'attack' => $attackDamage, 'defense' => $defenseDamage, 'attackA' => $attackAmount, 'defenseA' => $defenseAmount, 'infoA' => $attArray, 'infoD' => $defArray); if ($defenseAmount['total'] <= 0 || $attackAmount['total'] <= 0) { break; } // Calculate hit percentages (ACS only but ok) $attackPct = array(); foreach ($attackAmount as $fleetID => $amount) { if (!is_numeric($fleetID)) { continue; } $attackPct[$fleetID] = $amount / $attackAmount['total']; } $defensePct = array(); foreach ($defenseAmount as $fleetID => $amount) { if (!is_numeric($fleetID)) { continue; } $defensePct[$fleetID] = $amount / $defenseAmount['total']; } // CALCUL DES PERTES !!! $attacker_n = array(); $attacker_shield = 0; foreach ($attackers as $fleetID => $attacker) { $attacker_n[$fleetID] = array(); foreach ($attacker['detail'] as $element => $amount) { $defender_moc = $amount * ($defenseDamage['total'] * $attackPct[$fleetID]) / $attackAmount[$fleetID]; if ($amount > 0) { if ($attArray[$fleetID][$element]['def'] / $amount < $defender_moc) { $max_removePoints = floor($amount * $defenseAmount['total'] / $attackAmount[$fleetID] * $attackPct[$fleetID]); $defender_moc -= $attArray[$fleetID][$element]['def']; $attacker_shield += $attArray[$fleetID][$element]['def']; $ile_removePoints = floor($defender_moc / (($this->_pricelist[$element]['metal'] + $this->_pricelist[$element]['crystal']) / 10)); if ($max_removePoints < 0) { $max_removePoints = 0; } if ($ile_removePoints < 0) { $ile_removePoints = 0; } if ($ile_removePoints > $max_removePoints) { $ile_removePoints = $max_removePoints; } $attacker_n[$fleetID][$element] = ceil($amount - $ile_removePoints); if ($attacker_n[$fleetID][$element] <= 0) { $attacker_n[$fleetID][$element] = 0; } } else { $attacker_n[$fleetID][$element] = round($amount); $attacker_shield += $defender_moc; } } else { $attacker_n[$fleetID][$element] = round($amount); $attacker_shield += $defender_moc; } } } $defender_n = array(); $defender_shield = 0; foreach ($defenders as $fleetID => $defender) { $defender_n[$fleetID] = array(); foreach ($defender['def'] as $element => $amount) { $attacker_moc = $amount * ($attackDamage['total'] * $defensePct[$fleetID]) / $defenseAmount[$fleetID]; if ($amount > 0) { if ($defArray[$fleetID][$element]['def'] / $amount < $attacker_moc) { $max_removePoints = floor($amount * $attackAmount['total'] / $defenseAmount[$fleetID] * $defensePct[$fleetID]); $attacker_moc -= $defArray[$fleetID][$element]['def']; $defender_shield += $defArray[$fleetID][$element]['def']; $ile_removePoints = floor($attacker_moc / (($this->_pricelist[$element]['metal'] + $this->_pricelist[$element]['crystal']) / 10)); if ($max_removePoints < 0) { $max_removePoints = 0; } if ($ile_removePoints < 0) { $ile_removePoints = 0; } if ($ile_removePoints > $max_removePoints) { $ile_removePoints = $max_removePoints; } $defender_n[$fleetID][$element] = ceil($amount - $ile_removePoints); if ($defender_n[$fleetID][$element] <= 0) { $defender_n[$fleetID][$element] = 0; } } else { $defender_n[$fleetID][$element] = round($amount); $defender_shield += $attacker_moc; } } else { $defender_n[$fleetID][$element] = round($amount); $defender_shield += $attacker_moc; } } } // "Rapidfire" foreach ($attackers as $fleetID => $attacker) { foreach ($defenders as $fleetID2 => $defender) { foreach ($attacker['detail'] as $element => $amount) { if ($amount > 0) { foreach ($this->_combat_caps[$element]['sd'] as $c => $d) { if (isset($defender['def'][$c])) { if ($d > 0) { $e = $d / $defender['techs'][0] / ($defender['techs'][1] * $attacker['techs'][2]); $defender_n[$fleetID2][$c] -= ceil($amount * $e * (mt_rand(50, 120) / 100) / 2 * $defensePct[$fleetID2] * ($amount / $attackAmount[$fleetID])); if ($defender_n[$fleetID2][$c] <= 0) { $defender_n[$fleetID2][$c] = 0; } } } } } } foreach ($defender['def'] as $element => $amount) { if ($amount > 0) { foreach ($this->_combat_caps[$element]['sd'] as $c => $d) { if (isset($attacker['detail'][$c])) { if ($d > 0) { $e = $d / $defender['techs'][0] / ($defender['techs'][1] * $attacker['techs'][2]); $attacker_n[$fleetID][$c] -= ceil($amount * $e * (mt_rand(50, 120) / 100) / 2 * $attackPct[$fleetID] * ($amount / $defenseAmount[$fleetID2])); if ($attacker_n[$fleetID][$c] <= 0) { $attacker_n[$fleetID][$c] = 0; } } } } } } } } $rounds[$round]['attackShield'] = $attacker_shield; $rounds[$round]['defShield'] = $defender_shield; foreach ($attackers as $fleetID => $attacker) { $attackers[$fleetID]['detail'] = array_map('round', $attacker_n[$fleetID]); } foreach ($defenders as $fleetID => $defender) { $defenders[$fleetID]['def'] = array_map('round', $defender_n[$fleetID]); } } if ($attackAmount['total'] <= 0) { $won = "r"; // defender } elseif ($defenseAmount['total'] <= 0) { $won = "a"; // attacker } else { $won = "w"; // draw $rounds[count($rounds)] = array('attackers' => $attackers, 'defenders' => $defenders, 'attack' => $attackDamage, 'defense' => $defenseDamage, 'attackA' => $attackAmount, 'defenseA' => $defenseAmount); } // CDR foreach ($attackers as $fleetID => $attacker) { // flotte attaquant en CDR foreach ($attacker['detail'] as $element => $amount) { $totalResourcePoints['attacker'] -= $this->_pricelist[$element]['metal'] * $amount; $totalResourcePoints['attacker'] -= $this->_pricelist[$element]['crystal'] * $amount; $resourcePointsAttacker['metal'] -= $this->_pricelist[$element]['metal'] * $amount; $resourcePointsAttacker['crystal'] -= $this->_pricelist[$element]['crystal'] * $amount; } } $resourcePointsDefenderDefs = array('metal' => 0, 'crystal' => 0); foreach ($defenders as $fleetID => $defender) { foreach ($defender['def'] as $element => $amount) { if ($element < 300) { // flotte defenseur en CDR $resourcePointsDefender['metal'] -= $this->_pricelist[$element]['metal'] * $amount; $resourcePointsDefender['crystal'] -= $this->_pricelist[$element]['crystal'] * $amount; $totalResourcePoints['defender'] -= $this->_pricelist[$element]['metal'] * $amount; $totalResourcePoints['defender'] -= $this->_pricelist[$element]['crystal'] * $amount; } else { // defs defenseur en CDR + reconstruction $totalResourcePoints['defender'] -= $this->_pricelist[$element]['metal'] * $amount; $totalResourcePoints['defender'] -= $this->_pricelist[$element]['crystal'] * $amount; if (Officiers_Lib::is_officier_active($defender['user']['premium_officier_technocrat'])) { $lost = floor(($originalDef[$element] - $amount) / ENGINEER_DEFENSE); } else { $lost = $originalDef[$element] - $amount; } $giveback = round($lost * (mt_rand(70 * 0.8, 70 * 1.2) / 100)); $defenders[$fleetID]['def'][$element] += $giveback; $resourcePointsDefenderDefs['metal'] += $this->_pricelist[$element]['metal'] * ($lost - $giveback); $resourcePointsDefenderDefs['crystal'] += $this->_pricelist[$element]['crystal'] * ($lost - $giveback); } } } $game_fleet_cdr = Functions_Lib::read_config('fleet_cdr'); $game_defs_cdr = Functions_Lib::read_config('defs_cdr'); $totalLost = array('att' => $totalResourcePoints['attacker'], 'def' => $totalResourcePoints['defender']); $debAttMet = $resourcePointsAttacker['metal'] * ($game_fleet_cdr / 100); $debAttCry = $resourcePointsAttacker['crystal'] * ($game_fleet_cdr / 100); $debDefMet = $resourcePointsDefender['metal'] * ($game_fleet_cdr / 100) + $resourcePointsDefenderDefs['metal'] * ($game_defs_cdr / 100); $debDefCry = $resourcePointsDefender['crystal'] * ($game_fleet_cdr / 100) + $resourcePointsDefenderDefs['crystal'] * ($game_defs_cdr / 100); return array('won' => $won, 'debree' => array('att' => array($debAttMet, $debAttCry), 'def' => array($debDefMet, $debDefCry)), 'rw' => $rounds, 'lost' => $totalLost); }
/** * method write_errors() * param $Text * $log_file * return write the errors into the log file */ private function write_errors($text, $log_file) { $file = XGP_ROOT . LOGS_PATH . $log_file . ".php"; if (!file_exists($file) && is_writable($file)) { @fopen($file, "w+"); @fclose(fopen($file, "w+")); } $fp = @fopen($file, "a"); $date = $text; $date .= date(Functions_Lib::read_config('date_format_extended'), time()) . "||\n"; @fwrite($fp, $date); @fclose($fp); }
/** * method show_queue * param $Sprice * return (array) the queue to build data */ private function show_queue(&$Sprice = FALSE) { $lang = $this->_lang; $CurrentQueue = $this->_current_planet['planet_b_building_id']; $QueueID = 0; $to_destroy = 0; $BuildMode = ''; if ($CurrentQueue != 0) { $QueueArray = explode(";", $CurrentQueue); $ActualCount = count($QueueArray); } else { $QueueArray = '0'; $ActualCount = 0; } $ListIDRow = ''; if ($ActualCount != 0) { $PlanetID = $this->_current_planet['planet_id']; for ($QueueID = 0; $QueueID < $ActualCount; $QueueID++) { $BuildArray = explode(",", $QueueArray[$QueueID]); $BuildEndTime = floor($BuildArray[3]); $CurrentTime = floor(time()); if ($BuildMode == 'destroy') { $to_destroy++; } if ($BuildEndTime >= $CurrentTime) { $ListID = $QueueID + 1; $building = $BuildArray[0]; $BuildLevel = $BuildArray[1]; $BuildMode = $BuildArray[4]; $BuildTime = $BuildEndTime - time(); $ElementTitle = $this->_lang['tech'][$building]; if (isset($Sprice[$building]) && $Sprice !== FALSE && $BuildLevel > $Sprice[$building]) { $Sprice[$building] = $BuildLevel; } if ($ListID > 0) { $ListIDRow .= "<tr>"; if ($BuildMode == 'build') { $ListIDRow .= "\t<td class=\"l\" colspan=\"2\">" . $ListID . ".: " . $ElementTitle . " " . $BuildLevel . "</td>"; } else { $ListIDRow .= "\t<td class=\"l\" colspan=\"2\">" . $ListID . ".: " . $ElementTitle . " " . $BuildLevel . " " . $this->_lang['bd_dismantle'] . "</td>"; } $ListIDRow .= "\t<td class=\"k\">"; if ($ListID == 1) { $ListIDRow .= "\t\t<div id=\"blc\" class=\"z\">" . $BuildTime . "<br>"; $ListIDRow .= "\t\t<a href=\"game.php?page=" . $this->_current_page . "&listid=" . $ListID . "&cmd=cancel&planet=" . $PlanetID . "\">" . $this->_lang['bd_interrupt'] . "</a></div>"; $ListIDRow .= "\t\t<script language=\"JavaScript\">"; $ListIDRow .= "\t\t\tpp = \"" . $BuildTime . "\";\n"; $ListIDRow .= "\t\t\tpk = \"" . $ListID . "\";\n"; $ListIDRow .= "\t\t\tpm = \"cancel\";\n"; $ListIDRow .= "\t\t\tpl = \"" . $PlanetID . "\";\n"; $ListIDRow .= "\t\t\tt();\n"; $ListIDRow .= "\t\t</script>"; $ListIDRow .= "\t\t<strong color=\"lime\"><br><font color=\"lime\">" . date(Functions_Lib::read_config('date_format_extended'), $BuildEndTime) . "</font></strong>"; } else { $ListIDRow .= "\t\t<font color=\"red\">"; $ListIDRow .= "\t\t<a href=\"game.php?page=" . $this->_current_page . "&listid=" . $ListID . "&cmd=remove&planet=" . $PlanetID . "\">" . $this->_lang['bd_cancel'] . "</a></font>"; } $ListIDRow .= "\t</td>"; $ListIDRow .= "</tr>"; } } } } $RetValue['to_destoy'] = $to_destroy; $RetValue['lenght'] = $ActualCount; $RetValue['buildlist'] = $ListIDRow; return $RetValue; }
/** * __construct() */ public function __construct() { $this->_protection = Functions_Lib::read_config('noobprotection'); $this->_protectiontime = Functions_Lib::read_config('noobprotectiontime'); $this->_protectionmulti = Functions_Lib::read_config('noobprotectionmulti'); }
define('DPATH', DEFAULT_SKINPATH); // For debugging if (Functions_Lib::read_config('debug') == 1) { // Show all errors ini_set('display_errors', 1); error_reporting(E_ALL); } else { // Only for Betas, it's going to be changed ini_set('display_errors', 1); error_reporting(E_ALL); } $debug = Functions_Lib::load_library('Debug_Lib'); $db = new Database(); $installed = Functions_Lib::read_config('game_installed'); $game_version = Functions_Lib::read_config('version'); $game_lang = Functions_Lib::read_config('lang'); $current_page = isset($_GET['page']) ? $_GET['page'] : ''; // check if is installed if ($installed == 0 && !defined('IN_INSTALL')) { Functions_Lib::redirect(XGP_ROOT . 'install/'); } // define game version if ($installed != 0) { define('VERSION', $game_version == '' ? '' : 'v' . $game_version); } // define game language define('DEFAULT_LANG', $game_lang == '' ? 'spanish' : $game_lang); if (!defined('IN_INSTALL')) { require_once XGP_ROOT . 'application/core/Sessions.php'; require_once XGP_ROOT . 'application/core/Hooks.php'; require_once XGP_ROOT . 'application/libraries/Statistics_Lib.php';
/** * method create_planet * param $Galaxy * param $System * param $Position * param $PlanetOwnerID * param $PlanetName * param $HomeWorld * return creates a planet into the data base. */ public function create_planet($galaxy, $system, $position, $planet_owner_id, $planet_name = '', $home_world = FALSE) { $planet_exist = parent::$db->query_fetch("SELECT `planet_id`\r\n\t\t\t\t\t\t \t\t\t\t\t\t\t\tFROM " . PLANETS . "\r\n\t\t\t\t\t\t \t\t\t\t\t\t\t\tWHERE `planet_galaxy` = '" . $galaxy . "' AND\r\n\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t`planet_system` = '" . $system . "' AND\r\n\t\t\t\t\t\t \t\t\t\t\t\t\t\t\t\t`planet_planet` = '" . $position . "';"); if (!$planet_exist) { $planet = $this->return_size($position, $home_world); $planet['planet_diameter'] = ($planet['planet_field_max'] ^ 14 / 1.5) * 75; $planet['metal'] = BUILD_METAL; $planet['crystal'] = BUILD_CRISTAL; $planet['deuterium'] = BUILD_DEUTERIUM; $planet['planet_metal_perhour'] = Functions_Lib::read_config('metal_basic_income'); $planet['planet_crystal_perhour'] = Functions_Lib::read_config('crystal_basic_income'); $planet['planet_deuterium_perhour'] = Functions_Lib::read_config('deuterium_basic_income'); $planet['galaxy'] = $galaxy; $planet['system'] = $system; $planet['planet'] = $position; if ($position == 1 || $position == 2 || $position == 3) { $PlanetType = array('trocken'); $PlanetClass = array('planet'); $PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10'); $planet['planet_temp_min'] = mt_rand(0, 100); $planet['planet_temp_max'] = $planet['planet_temp_min'] + 40; } elseif ($position == 4 || $position == 5 || $position == 6) { $PlanetType = array('dschjungel'); $PlanetClass = array('planet'); $PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10'); $planet['planet_temp_min'] = mt_rand(-25, 75); $planet['planet_temp_max'] = $planet['planet_temp_min'] + 40; } elseif ($position == 7 || $position == 8 || $position == 9) { $PlanetType = array('normaltemp'); $PlanetClass = array('planet'); $PlanetDesign = array('01', '02', '03', '04', '05', '06', '07'); $planet['planet_temp_min'] = mt_rand(-50, 50); $planet['planet_temp_max'] = $planet['planet_temp_min'] + 40; } elseif ($position == 10 || $position == 11 || $position == 12) { $PlanetType = array('wasser'); $PlanetClass = array('planet'); $PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09'); $planet['planet_temp_min'] = mt_rand(-75, 25); $planet['planet_temp_max'] = $planet['planet_temp_min'] + 40; } elseif ($position == 13 || $position == 14 || $position == 15) { $PlanetType = array('eis'); $PlanetClass = array('planet'); $PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10'); $planet['planet_temp_min'] = mt_rand(-100, 10); $planet['planet_temp_max'] = $planet['planet_temp_min'] + 40; } else { $PlanetType = array('dschjungel', 'gas', 'normaltemp', 'trocken', 'wasser', 'wuesten', 'eis'); $PlanetClass = array('planet'); $PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '00'); $planet['planet_temp_min'] = mt_rand(-120, 10); $planet['planet_temp_max'] = $planet['planet_temp_min'] + 40; } $planet['image'] = $PlanetType[mt_rand(0, count($PlanetType) - 1)]; $planet['image'] .= $PlanetClass[mt_rand(0, count($PlanetClass) - 1)]; $planet['image'] .= $PlanetDesign[mt_rand(0, count($PlanetDesign) - 1)]; $planet['planet_type'] = 1; $planet['planet_user_id'] = $planet_owner_id; $planet['planet_last_update'] = time(); $planet['planet_name'] = $planet_name == '' ? $this->_lang['ge_colony'] : $planet_name; parent::$db->query("INSERT INTO " . PLANETS . " SET\r\n\t\t\t\t\t\t\t\t\t" . ($home_world == FALSE ? "`planet_name` = '{$planet['planet_name']}'," : $this->_lang['ge_home_planet']) . "\r\n\t\t\t\t\t\t\t\t\t`planet_user_id` = '" . $planet['planet_user_id'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_galaxy` = '" . $planet['galaxy'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_system` = '" . $planet['system'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_planet` = '" . $planet['planet'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_last_update` = '" . $planet['planet_last_update'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_type` = '" . $planet['planet_type'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_image` = '" . $planet['image'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_diameter` = '" . $planet['planet_diameter'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_field_max` = '" . $planet['planet_field_max'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_temp_min` = '" . $planet['planet_temp_min'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_temp_max` = '" . $planet['planet_temp_max'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_metal` = '" . $planet['metal'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_metal_perhour` = '" . $planet['planet_metal_perhour'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_crystal` = '" . $planet['crystal'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_crystal_perhour` = '" . $planet['planet_crystal_perhour'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_deuterium` = '" . $planet['deuterium'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_deuterium_perhour` = '" . $planet['planet_deuterium_perhour'] . "';"); $last_id = parent::$db->insert_id(); parent::$db->query("INSERT INTO " . BUILDINGS . " SET\r\n\t\t\t\t\t\t\t\t\t`building_planet_id` = '" . $last_id . "';"); parent::$db->query("INSERT INTO " . DEFENSES . " SET\r\n\t\t\t\t\t\t\t\t\t`defense_planet_id` = '" . $last_id . "';"); parent::$db->query("INSERT INTO " . SHIPS . " SET\r\n\t\t\t\t\t\t\t\t\t`ship_planet_id` = '" . $last_id . "';"); $RetValue = TRUE; } else { $RetValue = FALSE; } return $RetValue; }
/** * method time_zone_picker * param * return return the select options */ private function time_zone_picker() { $utc = new DateTimeZone('UTC'); $dt = new DateTime('now', $utc); $time_zones = ''; $current_time_zone = Functions_Lib::read_config('date_time_zone'); // Get the data foreach (DateTimeZone::listIdentifiers() as $tz) { $current_tz = new DateTimeZone($tz); $offset = $current_tz->getOffset($dt); $transition = $current_tz->getTransitions($dt->getTimestamp(), $dt->getTimestamp()); foreach ($transition as $element => $data) { $time_zones_data[$data['offset']][] = $tz; } } // Sort by key ksort($time_zones_data); // Build the combo foreach ($time_zones_data as $offset => $tz) { $time_zones .= '<optgroup label="GMT' . $this->format_offset($offset) . '">'; foreach ($tz as $key => $zone) { $time_zones .= '<option value="' . $zone . '" ' . ($current_time_zone == $zone ? ' selected' : '') . ' >' . $zone . '</option>'; } $time_zones .= '</optgroup>'; } // Return data return $time_zones; }
/** * method check_server * param $current_lang * return (void) */ public static function check_server($current_user) { if (self::read_config('game_enable') == 0 && $current_user['user_authlevel'] == 3) { self::message(stripslashes(Functions_Lib::read_config('close_reason')), '', '', FALSE, FALSE); die; } }
/** * method check_updates * param * return check for updates and returns true or false */ private function check_updates() { if (function_exists('file_get_contents')) { $last_v = @file_get_contents('http://xgproyect.xgproyect.net/current.php'); $system_v = Functions_Lib::read_config('version'); return version_compare($system_v, $last_v, '<'); } }
public static function update_resource(&$current_user, &$current_planet, $UpdateTime, $Simul = FALSE) { $resource = parent::$objects->get_objects(); $ProdGrid = parent::$objects->get_production(); $reslist = parent::$objects->get_objects_list(); $game_resource_multiplier = Functions_Lib::read_config('resource_multiplier'); $game_metal_basic_income = Functions_Lib::read_config('metal_basic_income'); $game_crystal_basic_income = Functions_Lib::read_config('crystal_basic_income'); $game_deuterium_basic_income = Functions_Lib::read_config('deuterium_basic_income'); $CurrentPlanet['planet_metal_max'] = Production_Lib::max_storable($current_planet[$resource[22]]); $current_planet['planet_crystal_max'] = Production_Lib::max_storable($current_planet[$resource[23]]); $current_planet['planet_deuterium_max'] = Production_Lib::max_storable($current_planet[$resource[24]]); $MaxMetalStorage = $current_planet['planet_metal_max']; $MaxCristalStorage = $current_planet['planet_crystal_max']; $MaxDeuteriumStorage = $current_planet['planet_deuterium_max']; $Caps = array(); $BuildTemp = $current_planet['planet_temp_max']; $sub_query = ''; $parse['production_level'] = 100; $post_porcent = Production_Lib::max_production($current_planet['planet_energy_max'], $current_planet['planet_energy_used']); $Caps['planet_metal_perhour'] = 0; $Caps['planet_crystal_perhour'] = 0; $Caps['planet_deuterium_perhour'] = 0; $Caps['planet_energy_max'] = 0; $Caps['planet_energy_used'] = 0; foreach ($ProdGrid as $ProdID => $formula) { $BuildLevelFactor = $current_planet['planet_' . $resource[$ProdID] . '_porcent']; $BuildLevel = $current_planet[$resource[$ProdID]]; $BuildEnergy = $current_user['research_energy_technology']; // BOOST $geologe_boost = 1 + 1 * (Officiers_Lib::is_officier_active($current_user['premium_officier_geologist']) ? GEOLOGUE : 0); $engineer_boost = 1 + 1 * (Officiers_Lib::is_officier_active($current_user['premium_officier_engineer']) ? ENGINEER_ENERGY : 0); // PRODUCTION FORMULAS $metal_prod = eval($ProdGrid[$ProdID]['formule']['metal']); $crystal_prod = eval($ProdGrid[$ProdID]['formule']['crystal']); $deuterium_prod = eval($ProdGrid[$ProdID]['formule']['deuterium']); $energy_prod = eval($ProdGrid[$ProdID]['formule']['energy']); // PRODUCTION $Caps['planet_metal_perhour'] += Production_Lib::current_production(Production_Lib::production_amount($metal_prod, $geologe_boost), $post_porcent); $Caps['planet_crystal_perhour'] += Production_Lib::current_production(Production_Lib::production_amount($crystal_prod, $geologe_boost), $post_porcent); $Caps['planet_deuterium_perhour'] += Production_Lib::current_production(Production_Lib::production_amount($deuterium_prod, $geologe_boost), $post_porcent); if ($ProdID >= 4) { if ($ProdID == 12 && $current_planet['planet_deuterium'] == 0) { continue; } $Caps['planet_energy_max'] += Production_Lib::production_amount($energy_prod, $engineer_boost, TRUE); } else { $Caps['planet_energy_used'] += Production_Lib::production_amount($energy_prod, 1, TRUE); } } if ($current_planet['planet_type'] == 3) { $game_metal_basic_income = 0; $game_crystal_basic_income = 0; $game_deuterium_basic_income = 0; $current_planet['planet_metal_perhour'] = 0; $current_planet['planet_crystal_perhour'] = 0; $current_planet['planet_deuterium_perhour'] = 0; $current_planet['planet_energy_used'] = 0; $current_planet['planet_energy_max'] = 0; } else { $current_planet['planet_metal_perhour'] = $Caps['planet_metal_perhour']; $current_planet['planet_crystal_perhour'] = $Caps['planet_crystal_perhour']; $current_planet['planet_deuterium_perhour'] = $Caps['planet_deuterium_perhour']; $current_planet['planet_energy_used'] = $Caps['planet_energy_used']; $current_planet['planet_energy_max'] = $Caps['planet_energy_max']; } $ProductionTime = $UpdateTime - $current_planet['planet_last_update']; $current_planet['planet_last_update'] = $UpdateTime; if ($current_planet['planet_energy_max'] == 0) { $current_planet['planet_metal_perhour'] = $game_metal_basic_income; $current_planet['planet_crystal_perhour'] = $game_crystal_basic_income; $current_planet['planet_deuterium_perhour'] = $game_deuterium_basic_income; $production_level = 100; } elseif ($current_planet['planet_energy_max'] >= $current_planet['planet_energy_used']) { $production_level = 100; } else { $production_level = floor($current_planet['planet_energy_max'] / $current_planet['planet_energy_used'] * 100); } if ($production_level > 100) { $production_level = 100; } elseif ($production_level < 0) { $production_level = 0; } if ($current_planet['planet_metal'] <= $MaxMetalStorage) { $MetalProduction = $ProductionTime * ($current_planet['planet_metal_perhour'] / 3600) * (0.01 * $production_level); $MetalBaseProduc = $ProductionTime * ($game_metal_basic_income / 3600); $MetalTheorical = $current_planet['planet_metal'] + $MetalProduction + $MetalBaseProduc; if ($MetalTheorical <= $MaxMetalStorage) { $current_planet['planet_metal'] = $MetalTheorical; } else { $current_planet['planet_metal'] = $MaxMetalStorage; } } if ($current_planet['planet_crystal'] <= $MaxCristalStorage) { $CristalProduction = $ProductionTime * ($current_planet['planet_crystal_perhour'] / 3600) * (0.01 * $production_level); $CristalBaseProduc = $ProductionTime * ($game_crystal_basic_income / 3600); $CristalTheorical = $current_planet['planet_crystal'] + $CristalProduction + $CristalBaseProduc; if ($CristalTheorical <= $MaxCristalStorage) { $current_planet['planet_crystal'] = $CristalTheorical; } else { $current_planet['planet_crystal'] = $MaxCristalStorage; } } if ($current_planet['planet_deuterium'] <= $MaxDeuteriumStorage) { $DeuteriumProduction = $ProductionTime * ($current_planet['planet_deuterium_perhour'] / 3600) * (0.01 * $production_level); $DeuteriumBaseProduc = $ProductionTime * ($game_deuterium_basic_income / 3600); $DeuteriumTheorical = $current_planet['planet_deuterium'] + $DeuteriumProduction + $DeuteriumBaseProduc; if ($DeuteriumTheorical <= $MaxDeuteriumStorage) { $current_planet['planet_deuterium'] = $DeuteriumTheorical; } else { $current_planet['planet_deuterium'] = $MaxDeuteriumStorage; } } if ($current_planet['planet_metal'] < 0) { $current_planet['planet_metal'] = 0; } if ($current_planet['planet_crystal'] < 0) { $current_planet['planet_crystal'] = 0; } if ($current_planet['planet_deuterium'] < 0) { $current_planet['planet_deuterium'] = 0; } if ($Simul == FALSE) { // SHIPS AND DEFENSES UPDATE $builded = self::building_queue($current_user, $current_planet, $ProductionTime); $ship_points = 0; $defense_points = 0; if ($builded != '') { foreach ($builded as $element => $count) { if ($element != '') { // POINTS switch ($element) { case $element >= 202 && $element <= 215: $ship_points += Statistics_Lib::calculate_points($element, $count) * $count; break; case $element >= 401 && $element <= 503: $defense_points += Statistics_Lib::calculate_points($element, $count) * $count; break; default: break; } $sub_query .= "`" . $resource[$element] . "` = '" . $current_planet[$resource[$element]] . "', "; } } } // RESEARCH UPDATE if ($current_planet['planet_b_tech'] <= time() && $current_planet['planet_b_tech_id'] != 0) { $current_user['research_points'] = Statistics_Lib::calculate_points($current_planet['planet_b_tech_id'], $current_user[$resource[$current_planet['planet_b_tech_id']]], 'tech'); $current_user[$resource[$current_planet['planet_b_tech_id']]]++; $tech_query = "`planet_b_tech` = '0',"; $tech_query .= "`planet_b_tech_id` = '0',"; $tech_query .= "`" . $resource[$current_planet['planet_b_tech_id']] . "` = '" . $current_user[$resource[$current_planet['planet_b_tech_id']]] . "',"; $tech_query .= "`user_statistic_technology_points` = `user_statistic_technology_points` + '" . $current_user['research_points'] . "',"; $tech_query .= "`research_current_research` = '0',"; } else { $tech_query = ""; } parent::$db->query("UPDATE " . PLANETS . " AS p\r\n\t\t\t\t\t\t\t\t\tINNER JOIN " . USERS_STATISTICS . " AS us ON us.user_statistic_user_id = p.planet_user_id\r\n\t\t\t\t\t\t\t\t\tINNER JOIN " . DEFENSES . " AS d ON d.defense_planet_id = p.`planet_id`\r\n\t\t\t\t\t\t\t\t\tINNER JOIN " . SHIPS . " AS s ON s.ship_planet_id = p.`planet_id`\r\n\t\t\t\t\t\t\t\t\tINNER JOIN " . RESEARCH . " AS r ON r.research_user_id = p.planet_user_id SET\r\n\t\t\t\t\t\t\t\t\t`planet_metal` = '" . $current_planet['planet_metal'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_crystal` = '" . $current_planet['planet_crystal'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_deuterium` = '" . $current_planet['planet_deuterium'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_last_update` = '" . $current_planet['planet_last_update'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_b_hangar_id` = '" . $current_planet['planet_b_hangar_id'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_metal_perhour` = '" . $current_planet['planet_metal_perhour'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_crystal_perhour` = '" . $current_planet['planet_crystal_perhour'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_deuterium_perhour` = '" . $current_planet['planet_deuterium_perhour'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_energy_used` = '" . $current_planet['planet_energy_used'] . "',\r\n\t\t\t\t\t\t\t\t\t`planet_energy_max` = '" . $current_planet['planet_energy_max'] . "',\r\n\t\t\t\t\t\t\t\t\t`user_statistic_ships_points` = `user_statistic_ships_points` + '" . $ship_points . "',\r\n\t\t\t\t\t\t\t\t\t`user_statistic_defenses_points` = `user_statistic_defenses_points` + '" . $defense_points . "',\r\n\t\t\t\t\t\t\t\t\t{$sub_query}\r\n\t\t\t\t\t\t\t\t\t{$tech_query}\r\n\t\t\t\t\t\t\t\t\t`planet_b_hangar` = '" . $current_planet['planet_b_hangar'] . "'\r\n\t\t\t\t\t\t\t\t\tWHERE `planet_id` = '" . $current_planet['planet_id'] . "';"); } }