| @@ -337,6 +337,11 @@ | ||
| 337 | 337 | */ | 
| 338 | 338 | // OK v4 | 
| 339 | 339 | // TODO - вынести в отдельный класс | 
| 340 | +/** | |
| 341 | + * @param string $db_id_field_name | |
| 342 | + * @param string $db_table_name | |
| 343 | + * @param string $db_value_field_name | |
| 344 | + */ | |
| 340 | 345 |  function db_get_set_unique_id_value($current_value_unsafe, $db_id_field_name, $db_table_name, $db_value_field_name) { | 
| 341 | 346 | $current_value_safe = db_escape($current_value_unsafe); | 
| 342 | 347 |    $value_id = doquery("SELECT `{$db_id_field_name}` AS id_field FROM {{{$db_table_name}}} WHERE `{$db_value_field_name}` = '{$current_value_safe}' LIMIT 1 FOR UPDATE", true); | 
| @@ -7,8 +7,7 @@ discard block | ||
| 7 | 7 |  require_once('db_queries_fleet.php'); | 
| 8 | 8 | |
| 9 | 9 | |
| 10 | -function db_planet_list_admin_list($table_parent_columns, $planet_active, $active_time, $planet_type) | |
| 11 | -{ | |
| 10 | +function db_planet_list_admin_list($table_parent_columns, $planet_active, $active_time, $planet_type) { | |
| 12 | 11 | return doquery( | 
| 13 | 12 | "SELECT p.*, u.username" . ($table_parent_columns ? ', p1.name AS parent_name' : '') . | 
| 14 | 13 |      " FROM {{planets}} AS p | 
| @@ -17,8 +16,7 @@ discard block | ||
| 17 | 16 |      " WHERE " . ($planet_active ? "p.last_update >= {$active_time}" : "p.planet_type = {$planet_type}")); | 
| 18 | 17 | } | 
| 19 | 18 | |
| 20 | -function db_planet_list_search($searchtext) | |
| 21 | -{ | |
| 19 | +function db_planet_list_search($searchtext) { | |
| 22 | 20 | return doquery( | 
| 23 | 21 | "SELECT | 
| 24 | 22 | p.galaxy, p.system, p.planet, p.planet_type, p.name as planet_name, | 
| @@ -38,8 +36,7 @@ discard block | ||
| 38 | 36 | |
| 39 | 37 | |
| 40 | 38 | |
| 41 | -function db_user_list_search($searchtext) | |
| 42 | -{ | |
| 39 | +function db_user_list_search($searchtext) { | |
| 43 | 40 | return doquery( | 
| 44 | 41 | "SELECT | 
| 45 | 42 | pn.player_name, u.id as uid, u.username, u.ally_id, u.id_planet, u.total_points, u.total_rank, | 
| @@ -57,8 +54,7 @@ discard block | ||
| 57 | 54 | ); | 
| 58 | 55 | } | 
| 59 | 56 | |
| 60 | -function db_buddy_list_by_user($user_id) | |
| 61 | -{ | |
| 57 | +function db_buddy_list_by_user($user_id) { | |
| 62 | 58 | // return ($user_id = intval($user_id)) ? doquery( | 
| 63 | 59 | return ($user_id = idval($user_id)) ? doquery( | 
| 64 | 60 | "SELECT | 
| @@ -84,8 +80,7 @@ discard block | ||
| 84 | 80 | |
| 85 | 81 | |
| 86 | 82 | |
| 87 | -function db_message_list_outbox_by_user_id($user_id) | |
| 88 | -{ | |
| 83 | +function db_message_list_outbox_by_user_id($user_id) { | |
| 89 | 84 | // return ($user_id = intval($user_id)) | 
| 90 | 85 | return ($user_id = idval($user_id)) | 
| 91 | 86 |      ? doquery("SELECT {{messages}}.message_id, {{messages}}.message_owner, {{users}}.id AS message_sender, {{messages}}.message_time, | 
| @@ -101,8 +96,7 @@ discard block | ||
| 101 | 96 | |
| 102 | 97 | |
| 103 | 98 | |
| 104 | -function db_unit_records_sum($unit_id, $user_skip_list_unit) | |
| 105 | -{ | |
| 99 | +function db_unit_records_sum($unit_id, $user_skip_list_unit) { | |
| 106 | 100 | return doquery ( | 
| 107 | 101 | "SELECT unit_player_id, username, sum(unit_level) as unit_level | 
| 108 | 102 |            FROM {{unit}} JOIN {{users}} AS u ON u.id = unit_player_id | 
| @@ -113,8 +107,7 @@ discard block | ||
| 113 | 107 | , true); | 
| 114 | 108 | } | 
| 115 | 109 | |
| 116 | -function db_unit_records_plain($unit_id, $user_skip_list_unit) | |
| 117 | -{ | |
| 110 | +function db_unit_records_plain($unit_id, $user_skip_list_unit) { | |
| 118 | 111 | return doquery ( | 
| 119 | 112 | "SELECT unit_player_id, username, unit_level | 
| 120 | 113 |            FROM {{unit}} JOIN {{users}} AS u ON u.id = unit_player_id | 
| @@ -198,25 +191,21 @@ discard block | ||
| 198 | 191 | } | 
| 199 | 192 | |
| 200 | 193 | |
| 201 | -function db_stat_list_update_user_stats() | |
| 202 | -{ | |
| 194 | +function db_stat_list_update_user_stats() { | |
| 203 | 195 |    return doquery("UPDATE {{users}} AS u JOIN {{statpoints}} AS sp ON sp.id_owner = u.id AND sp.stat_code = 1 AND sp.stat_type = 1 SET u.total_rank = sp.total_rank, u.total_points = sp.total_points WHERE user_as_ally IS NULL;"); | 
| 204 | 196 | } | 
| 205 | 197 | |
| 206 | -function db_stat_list_update_ally_stats() | |
| 207 | -{ | |
| 198 | +function db_stat_list_update_ally_stats() { | |
| 208 | 199 |    return doquery("UPDATE {{alliance}} AS a JOIN {{statpoints}} AS sp ON sp.id_ally = a.id AND sp.stat_code = 1 AND sp.stat_type = 2 SET a.total_rank = sp.total_rank, a.total_points = sp.total_points;"); | 
| 209 | 200 | } | 
| 210 | 201 | |
| 211 | -function db_stat_list_delete_ally_player() | |
| 212 | -{ | |
| 202 | +function db_stat_list_delete_ally_player() { | |
| 213 | 203 |    return doquery('DELETE s FROM {{statpoints}} AS s JOIN {{users}} AS u ON u.id = s.id_owner WHERE s.id_ally IS NULL AND u.user_as_ally IS NOT NULL'); | 
| 214 | 204 | } | 
| 215 | 205 | |
| 216 | 206 | |
| 217 | 207 | |
| 218 | -function db_chat_player_list_online($chat_refresh_rate, $ally_add) | |
| 219 | -{ | |
| 208 | +function db_chat_player_list_online($chat_refresh_rate, $ally_add) { | |
| 220 | 209 | $sql_date = SN_TIME_NOW - $chat_refresh_rate * 2; | 
| 221 | 210 | |
| 222 | 211 | return doquery( | 
| @@ -230,13 +219,11 @@ discard block | ||
| 230 | 219 | ORDER BY authlevel DESC, `username`"); | 
| 231 | 220 | } | 
| 232 | 221 | |
| 233 | -function db_referrals_list_by_id($user_id) | |
| 234 | -{ | |
| 222 | +function db_referrals_list_by_id($user_id) { | |
| 235 | 223 |    return doquery("SELECT r.*, u.username, u.register_time FROM {{referrals}} AS r LEFT JOIN {{users}} AS u ON u.id = r.id WHERE id_partner = {$user_id}"); | 
| 236 | 224 | } | 
| 237 | 225 | |
| 238 | -function db_message_list_admin_by_type($int_type_selected, $StartRec) | |
| 239 | -{ | |
| 226 | +function db_message_list_admin_by_type($int_type_selected, $StartRec) { | |
| 240 | 227 |    return doquery("SELECT | 
| 241 | 228 | message_id as `ID`, | 
| 242 | 229 | message_from as `FROM`, | 
| @@ -255,8 +242,7 @@ discard block | ||
| 255 | 242 | } | 
| 256 | 243 | |
| 257 | 244 | |
| 258 | -function db_message_insert_all($message_type, $from, $subject, $text) | |
| 259 | -{ | |
| 245 | +function db_message_insert_all($message_type, $from, $subject, $text) { | |
| 260 | 246 |    return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' . | 
| 261 | 247 |      "SELECT `id`, 0, unix_timestamp(now()), {$message_type}, '{$from}', '{$subject}', '{$text}' FROM {{users}}"); | 
| 262 | 248 | } | 
| @@ -1,5 +1,8 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | +/** | |
| 4 | + * @param boolean $player | |
| 5 | + */ | |
| 3 | 6 |  function db_user_by_id($user_id_unsafe, $for_update = false, $fields = '*', $player = null) { | 
| 4 | 7 | return classSupernova::db_get_user_by_id($user_id_unsafe, $for_update, $fields, $player); | 
| 5 | 8 | } | 
| @@ -10,6 +10,7 @@ discard block | ||
| 10 | 10 | * | 
| 11 | 11 | * 1.0 - copyright (c) 2010 by Gorlum for http://supernova.ws | 
| 12 | 12 | * @version 1.0 | 
| 13 | + * @param integer $lab_require | |
| 13 | 14 | */ | 
| 14 | 15 | function eco_get_lab_max_effective_level(&$user, $lab_require) | 
| 15 | 16 |  { | 
| @@ -193,6 +194,9 @@ discard block | ||
| 193 | 194 | return $result; | 
| 194 | 195 | } | 
| 195 | 196 | |
| 197 | +/** | |
| 198 | + * @param integer[] $unit_list | |
| 199 | + */ | |
| 196 | 200 | function eco_is_builds_in_que($planet_que, $unit_list) | 
| 197 | 201 |  { | 
| 198 | 202 | $eco_is_builds_in_que = false; | 
| @@ -1,7 +1,6 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | -function eco_lab_sort_effectivness($a, $b) | |
| 4 | -{ | |
| 3 | +function eco_lab_sort_effectivness($a, $b) { | |
| 5 | 4 | return $a['laboratory_effective_level'] > $b['laboratory_effective_level'] ? -1 : ($a['laboratory_effective_level'] < $b['laboratory_effective_level'] ? 1 : 0); | 
| 6 | 5 | } | 
| 7 | 6 | |
| @@ -11,8 +10,7 @@ discard block | ||
| 11 | 10 | * 1.0 - copyright (c) 2010 by Gorlum for http://supernova.ws | 
| 12 | 11 | * @version 1.0 | 
| 13 | 12 | */ | 
| 14 | -function eco_get_lab_max_effective_level(&$user, $lab_require) | |
| 15 | -{ | |
| 13 | +function eco_get_lab_max_effective_level(&$user, $lab_require) { | |
| 16 | 14 | if(!$user['user_as_ally'] && !isset($user['laboratories_active'])) | 
| 17 | 15 |    { | 
| 18 | 16 | $user['laboratories_active'] = array(); | 
| @@ -38,8 +36,7 @@ discard block | ||
| 38 | 36 | if($user['user_as_ally']) | 
| 39 | 37 |      { | 
| 40 | 38 |        $lab_level = doquery("SELECT ally_members AS effective_level FROM {{alliance}} WHERE id = {$user['user_as_ally']} LIMIT 1", true); | 
| 41 | - } | |
| 42 | - else | |
| 39 | + } else | |
| 43 | 40 |      { | 
| 44 | 41 | $tech_intergalactic = mrc_get_level($user, false, TECH_RESEARCH) + 1; | 
| 45 | 42 | $lab_level['effective_level'] = 0; | 
| @@ -193,8 +190,7 @@ discard block | ||
| 193 | 190 | return $result; | 
| 194 | 191 | } | 
| 195 | 192 | |
| 196 | -function eco_is_builds_in_que($planet_que, $unit_list) | |
| 197 | -{ | |
| 193 | +function eco_is_builds_in_que($planet_que, $unit_list) { | |
| 198 | 194 | $eco_is_builds_in_que = false; | 
| 199 | 195 | |
| 200 | 196 | $unit_list = is_array($unit_list) ? $unit_list : array($unit_list => $unit_list); | 
| @@ -216,8 +212,7 @@ discard block | ||
| 216 | 212 | } | 
| 217 | 213 | |
| 218 | 214 |  function eco_unit_busy(&$user, &$planet, $unit_id){return sn_function_call('eco_unit_busy', array(&$user, &$planet, $unit_id, &$result));} | 
| 219 | -function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) | |
| 220 | -{ | |
| 215 | +function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) { | |
| 221 | 216 | global $config; | 
| 222 | 217 | |
| 223 | 218 | $result = isset($result) ? $result : false; | 
| @@ -238,8 +233,7 @@ discard block | ||
| 238 | 233 |        //{ | 
| 239 | 234 | // $result = true; | 
| 240 | 235 | //} | 
| 241 | - } | |
| 242 | -    elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) | |
| 236 | +    } elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) | |
| 243 | 237 |      { | 
| 244 | 238 | $result = eco_is_builds_in_que($planet['que'], array(STRUC_LABORATORY, STRUC_LABORATORY_NANO)); | 
| 245 | 239 | } | 
| @@ -55,6 +55,9 @@ discard block | ||
| 55 | 55 | } | 
| 56 | 56 | |
| 57 | 57 | |
| 58 | +/** | |
| 59 | + * @param integer $build_mode | |
| 60 | + */ | |
| 58 | 61 |  function que_build($user, $planet, $build_mode = BUILD_CREATE, $redirect = true) { | 
| 59 | 62 | global $lang, $config; | 
| 60 | 63 | |
| @@ -378,6 +381,9 @@ discard block | ||
| 378 | 381 | return classSupernova::db_que_list_by_type_location($user_id, $planet_id, $que_type, $for_update); | 
| 379 | 382 | } | 
| 380 | 383 | |
| 384 | +/** | |
| 385 | + * @param integer $unit_id | |
| 386 | + */ | |
| 381 | 387 |  function que_add_unit($unit_id, $user = array(), $planet = array(), $build_data, $unit_level = 0, $unit_amount = 1, $build_mode = BUILD_CREATE) { | 
| 382 | 388 | // TODO Унифицировать проверки | 
| 383 | 389 | |
| @@ -458,8 +458,7 @@ | ||
| 458 | 458 | |
| 459 | 459 |      if(is_numeric($planet['id'])) { | 
| 460 | 460 | DBStaticPlanet::db_planet_set_by_id($planet['id'], "`que_processed` = UNIX_TIMESTAMP(NOW())"); | 
| 461 | - } | |
| 462 | -    elseif(is_numeric($user['id'])) { | |
| 461 | +    } elseif(is_numeric($user['id'])) { | |
| 463 | 462 | db_user_set_by_id($user['id'], '`que_processed` = UNIX_TIMESTAMP(NOW())'); | 
| 464 | 463 | } | 
| 465 | 464 | |
| @@ -135,6 +135,10 @@ | ||
| 135 | 135 | return $fleet_events; | 
| 136 | 136 | } | 
| 137 | 137 | |
| 138 | +/** | |
| 139 | + * @param integer $ov_label | |
| 140 | + * @param integer $planet_end_type | |
| 141 | + */ | |
| 138 | 142 | function flt_register_fleet_event($fleet, $ov_label, $planet_end_type) | 
| 139 | 143 |  { | 
| 140 | 144 | global $user, $planetrow, $fleet_number; | 
| @@ -1,8 +1,7 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | 3 | |
| 4 | -function flt_parse_fleets_to_events($fleet_list, $planet_scanned = false) | |
| 5 | -{ | |
| 4 | +function flt_parse_fleets_to_events($fleet_list, $planet_scanned = false) { | |
| 6 | 5 | global $config, $user, $fleet_number, $lang; | 
| 7 | 6 | |
| 8 | 7 | $fleet_events = array(); | 
| @@ -23,12 +22,10 @@ discard block | ||
| 23 | 22 | if($fleet['fleet_end_planet'] > $config->game_maxPlanet) | 
| 24 | 23 |      { | 
| 25 | 24 | $fleet['fleet_end_name'] = $lang['ov_fleet_exploration']; | 
| 26 | - } | |
| 27 | - elseif($fleet['fleet_mission'] == MT_COLONIZE) | |
| 25 | + } elseif($fleet['fleet_mission'] == MT_COLONIZE) | |
| 28 | 26 |      { | 
| 29 | 27 | $fleet['fleet_end_name'] = $lang['ov_fleet_colonization']; | 
| 30 | - } | |
| 31 | - else | |
| 28 | + } else | |
| 32 | 29 |      { | 
| 33 | 30 | $planet_end = DBStaticPlanet::db_planet_by_gspt($fleet['fleet_end_galaxy'], $fleet['fleet_end_system'], $fleet['fleet_end_planet'], $planet_end_type, false, 'name'); | 
| 34 | 31 | $fleet['fleet_end_name'] = $planet_end['name']; | 
| @@ -80,8 +77,7 @@ discard block | ||
| 80 | 77 | return $fleet_events; | 
| 81 | 78 | } | 
| 82 | 79 | |
| 83 | -function flt_register_fleet_event($fleet, $ov_label, $planet_end_type) | |
| 84 | -{ | |
| 80 | +function flt_register_fleet_event($fleet, $ov_label, $planet_end_type) { | |
| 85 | 81 | global $user, $planetrow, $fleet_number; | 
| 86 | 82 | |
| 87 | 83 | switch($fleet['ov_label'] = $ov_label) | 
| @@ -121,8 +117,7 @@ discard block | ||
| 121 | 117 | if($fleet['fleet_owner'] == $user['id']) | 
| 122 | 118 |    { | 
| 123 | 119 | $user_data = $user; | 
| 124 | - } | |
| 125 | - else | |
| 120 | + } else | |
| 126 | 121 |    { | 
| 127 | 122 | $user_data = db_user_by_id($fleet['fleet_owner']); | 
| 128 | 123 | } | 
| @@ -130,8 +125,7 @@ discard block | ||
| 130 | 125 | return tpl_parse_fleet_db($fleet, ++$fleet_number, $user_data); | 
| 131 | 126 | } | 
| 132 | 127 | |
| 133 | -function int_planet_pretemplate($planetrow, &$template) | |
| 134 | -{ | |
| 128 | +function int_planet_pretemplate($planetrow, &$template) { | |
| 135 | 129 | global $lang, $user; | 
| 136 | 130 | |
| 137 | 131 | $governor_id = $planetrow['PLANET_GOVERNOR_ID']; | 
| @@ -37,6 +37,9 @@ | ||
| 37 | 37 | return $list; | 
| 38 | 38 | } | 
| 39 | 39 | |
| 40 | +/** | |
| 41 | + * @param integer $message_type | |
| 42 | + */ | |
| 40 | 43 | function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = false, $force = false) | 
| 41 | 44 |  { | 
| 42 | 45 | global $config, $user, $sn_message_class_list; | 
| @@ -15,8 +15,7 @@ discard block | ||
| 15 | 15 | 1.5 - copyright (c) 2010-2011 by Gorlum for http://supernova.ws | 
| 16 | 16 |           [+] SuperMassMailing - authlevel=3 player can send messages to whole server ('*' as $owners) | 
| 17 | 17 | */ | 
| 18 | -function msg_ali_send($message, $subject, $ally_rank_id = 0, $ally_id = 0) | |
| 19 | -{ | |
| 18 | +function msg_ali_send($message, $subject, $ally_rank_id = 0, $ally_id = 0) { | |
| 20 | 19 | global $user; | 
| 21 | 20 | |
| 22 | 21 | $ally_id = $ally_id ? $ally_id : $user['ally_id']; | 
| @@ -37,8 +36,7 @@ discard block | ||
| 37 | 36 | return $list; | 
| 38 | 37 | } | 
| 39 | 38 | |
| 40 | -function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = false, $force = false) | |
| 41 | -{ | |
| 39 | +function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = false, $force = false) { | |
| 42 | 40 | global $config, $user, $sn_message_class_list; | 
| 43 | 41 | |
| 44 | 42 | if(!$owners) | 
| @@ -79,8 +77,7 @@ discard block | ||
| 79 | 77 | // TODO Добавить $sender - рассылка может быть и от кого-то | 
| 80 | 78 | db_message_insert_all($message_type, $from, $subject, $text); | 
| 81 | 79 | $owners = array(); | 
| 82 | - } | |
| 83 | - else | |
| 80 | + } else | |
| 84 | 81 |    { | 
| 85 | 82 | $insert_values = array(); | 
| 86 | 83 |      $insert_template = "('%u'," . str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}')"); | 
| @@ -90,8 +87,7 @@ discard block | ||
| 90 | 87 | if($user['id'] != $owner) | 
| 91 | 88 |        { | 
| 92 | 89 | $owner_row = db_user_by_id($owner); | 
| 93 | - } | |
| 94 | - else | |
| 90 | + } else | |
| 95 | 91 |        { | 
| 96 | 92 | $owner_row = $user; | 
| 97 | 93 | } | 
| @@ -161,6 +161,9 @@ discard block | ||
| 161 | 161 | return $rows_affected; | 
| 162 | 162 | } | 
| 163 | 163 | |
| 164 | +/** | |
| 165 | + * @param integer $type | |
| 166 | + */ | |
| 164 | 167 | function rpg_level_up(&$user, $type, $xp_to_add = 0) | 
| 165 | 168 |  { | 
| 166 | 169 | $q = 1.03; | 
| @@ -223,6 +226,10 @@ discard block | ||
| 223 | 226 | } | 
| 224 | 227 | } | 
| 225 | 228 | |
| 229 | +/** | |
| 230 | + * @param integer $b1 | |
| 231 | + * @param double $q | |
| 232 | + */ | |
| 226 | 233 | function rpg_xp_for_level($level, $b1, $q) | 
| 227 | 234 |  { | 
| 228 | 235 | return floor($b1 * (pow($q, $level) - 1)/($q - 1)); | 
| @@ -233,6 +240,9 @@ discard block | ||
| 233 | 240 | return rpg_xp_for_level($level, 50, 1.03); | 
| 234 | 241 | } | 
| 235 | 242 | |
| 243 | +/** | |
| 244 | + * @param integer $level | |
| 245 | + */ | |
| 236 | 246 | function RPG_get_raider_xp($level) | 
| 237 | 247 |  { | 
| 238 | 248 | return rpg_xp_for_level($level, 10, 1.03); | 
| @@ -161,8 +161,7 @@ discard block | ||
| 161 | 161 | return $rows_affected; | 
| 162 | 162 | } | 
| 163 | 163 | |
| 164 | -function rpg_level_up(&$user, $type, $xp_to_add = 0) | |
| 165 | -{ | |
| 164 | +function rpg_level_up(&$user, $type, $xp_to_add = 0) { | |
| 166 | 165 | $q = 1.03; | 
| 167 | 166 | |
| 168 | 167 | switch($type) | 
| @@ -223,27 +222,22 @@ discard block | ||
| 223 | 222 | } | 
| 224 | 223 | } | 
| 225 | 224 | |
| 226 | -function rpg_xp_for_level($level, $b1, $q) | |
| 227 | -{ | |
| 225 | +function rpg_xp_for_level($level, $b1, $q) { | |
| 228 | 226 | return floor($b1 * (pow($q, $level) - 1)/($q - 1)); | 
| 229 | 227 | } | 
| 230 | 228 | |
| 231 | -function rpg_get_miner_xp($level) | |
| 232 | -{ | |
| 229 | +function rpg_get_miner_xp($level) { | |
| 233 | 230 | return rpg_xp_for_level($level, 50, 1.03); | 
| 234 | 231 | } | 
| 235 | 232 | |
| 236 | -function RPG_get_raider_xp($level) | |
| 237 | -{ | |
| 233 | +function RPG_get_raider_xp($level) { | |
| 238 | 234 | return rpg_xp_for_level($level, 10, 1.03); | 
| 239 | 235 | } | 
| 240 | 236 | |
| 241 | -function rpg_get_tech_xp($level) | |
| 242 | -{ | |
| 237 | +function rpg_get_tech_xp($level) { | |
| 243 | 238 | return rpg_xp_for_level($level, 50, 1.03); | 
| 244 | 239 | } | 
| 245 | 240 | |
| 246 | -function rpg_get_explore_xp($level) | |
| 247 | -{ | |
| 241 | +function rpg_get_explore_xp($level) { | |
| 248 | 242 | return rpg_xp_for_level($level, 10, 1.05); | 
| 249 | 243 | } | 
| @@ -141,6 +141,9 @@ | ||
| 141 | 141 | "); | 
| 142 | 142 | } | 
| 143 | 143 | |
| 144 | +/** | |
| 145 | + * @param string $email_unsafe | |
| 146 | + */ | |
| 144 | 147 |  function player_create($username_unsafe, $email_unsafe, $options) { | 
| 145 | 148 | sn_db_transaction_check(true); | 
| 146 | 149 | |
| @@ -17,6 +17,9 @@ discard block | ||
| 17 | 17 | } | 
| 18 | 18 | } | 
| 19 | 19 | |
| 20 | +/** | |
| 21 | + * @param template $template | |
| 22 | + */ | |
| 20 | 23 | function tpl_assign_fleet(&$template, $fleets, $js_name = 'fleets') | 
| 21 | 24 |  { | 
| 22 | 25 | if(!$fleets) | 
| @@ -165,6 +168,9 @@ discard block | ||
| 165 | 168 | return $result; | 
| 166 | 169 | } | 
| 167 | 170 | |
| 171 | +/** | |
| 172 | + * @param integer $que_id | |
| 173 | + */ | |
| 168 | 174 | function tpl_parse_planet_que($que, $planet, $que_id) | 
| 169 | 175 |  { | 
| 170 | 176 | $hangar_que = array(); | 
| @@ -1,8 +1,7 @@ discard block | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | 3 | // Compare function to sort fleet in time order | 
| 4 | -function tpl_assign_fleet_compare($a, $b) | |
| 5 | -{ | |
| 4 | +function tpl_assign_fleet_compare($a, $b) { | |
| 6 | 5 | if($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) | 
| 7 | 6 |    { | 
| 8 | 7 | if($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) | 
| @@ -10,15 +9,13 @@ discard block | ||
| 10 | 9 | return 0; | 
| 11 | 10 | } | 
| 12 | 11 | return ($a['fleet']['OV_LEFT'] < $b['fleet']['OV_LEFT']) ? -1 : 1; | 
| 13 | - } | |
| 14 | - else | |
| 12 | + } else | |
| 15 | 13 |    { | 
| 16 | 14 | return $a['fleet']['OV_THIS_PLANET'] ? -1 : 1; | 
| 17 | 15 | } | 
| 18 | 16 | } | 
| 19 | 17 | |
| 20 | -function tpl_assign_fleet(&$template, $fleets, $js_name = 'fleets') | |
| 21 | -{ | |
| 18 | +function tpl_assign_fleet(&$template, $fleets, $js_name = 'fleets') { | |
| 22 | 19 | if(!$fleets) | 
| 23 | 20 |    { | 
| 24 | 21 | return; | 
| @@ -41,8 +38,7 @@ discard block | ||
| 41 | 38 | } | 
| 42 | 39 | |
| 43 | 40 | // function that parses internal fleet representation (as array(id => count)) | 
| 44 | -function tpl_parse_fleet_sn($fleet, $fleet_id) | |
| 45 | -{ | |
| 41 | +function tpl_parse_fleet_sn($fleet, $fleet_id) { | |
| 46 | 42 | global $lang, $user; | 
| 47 | 43 | |
| 48 | 44 | $user_data = &$user; | 
| @@ -167,8 +163,7 @@ discard block | ||
| 167 | 163 | return $result; | 
| 168 | 164 | } | 
| 169 | 165 | |
| 170 | -function tpl_parse_planet_que($que, $planet, $que_id) | |
| 171 | -{ | |
| 166 | +function tpl_parse_planet_que($que, $planet, $que_id) { | |
| 172 | 167 | $hangar_que = array(); | 
| 173 | 168 | $que_hangar = $que['ques'][$que_id][$planet['id_owner']][$planet['id']]; | 
| 174 | 169 | if(!empty($que_hangar)) | 
| @@ -183,8 +178,7 @@ discard block | ||
| 183 | 178 | return $hangar_que; | 
| 184 | 179 | } | 
| 185 | 180 | |
| 186 | -function tpl_parse_planet($planet) | |
| 187 | -{ | |
| 181 | +function tpl_parse_planet($planet) { | |
| 188 | 182 | global $lang; | 
| 189 | 183 | |
| 190 | 184 | $fleet_list = flt_get_fleets_to_planet($planet); | 
| @@ -252,8 +246,7 @@ discard block | ||
| 252 | 246 | return $result; | 
| 253 | 247 | } | 
| 254 | 248 | |
| 255 | -function flt_get_fleets_to_planet($planet, $fleet_db_list = 0) | |
| 256 | -{ | |
| 249 | +function flt_get_fleets_to_planet($planet, $fleet_db_list = 0) { | |
| 257 | 250 | if(!($planet && $planet['id']) && !$fleet_db_list) | 
| 258 | 251 |    { | 
| 259 | 252 | return $planet; | 
| @@ -275,8 +268,7 @@ discard block | ||
| 275 | 268 | continue; | 
| 276 | 269 | } | 
| 277 | 270 | $fleet_ownage = 'own'; | 
| 278 | - } | |
| 279 | - else | |
| 271 | + } else | |
| 280 | 272 |      { | 
| 281 | 273 | switch($fleet['fleet_mission']) | 
| 282 | 274 |        { | 
| @@ -325,8 +317,7 @@ discard block | ||
| 325 | 317 | * @param array $fleets_to_planet | 
| 326 | 318 | * @param int $round | 
| 327 | 319 | */ | 
| 328 | -function tpl_set_resource_info(&$template, $planetrow, $fleets_to_planet = array(), $round = 0) | |
| 329 | -{ | |
| 320 | +function tpl_set_resource_info(&$template, $planetrow, $fleets_to_planet = array(), $round = 0) { | |
| 330 | 321 | $template->assign_vars(array( | 
| 331 | 322 | 'RESOURCE_ROUNDING' => $round, | 
| 332 | 323 | |