@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $user_auth_level = isset($user['authlevel']) ? $user['authlevel'] : AUTH_LEVEL_ANONYMOUS; |
37 | 37 | |
38 | 38 | $mode = sys_get_param_int('mode'); |
39 | - switch($mode) { |
|
39 | + switch ($mode) { |
|
40 | 40 | case CHAT_MODE_ALLY: |
41 | 41 | $template_result['ALLY'] = intval($user['ally_id']); |
42 | 42 | $page_title = classLocale::$lang['chat_ally']; |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | $template_result['.']['smiles'] = array(); |
52 | - foreach(classSupernova::$design['smiles'] as $auth_level => $replaces) { |
|
53 | - if($auth_level > $user_auth_level) { |
|
52 | + foreach (classSupernova::$design['smiles'] as $auth_level => $replaces) { |
|
53 | + if ($auth_level > $user_auth_level) { |
|
54 | 54 | continue; |
55 | 55 | } |
56 | 56 | |
57 | - foreach($replaces as $bbcode => $filename) { |
|
57 | + foreach ($replaces as $bbcode => $filename) { |
|
58 | 58 | $template_result['.']['smiles'][] = array( |
59 | 59 | 'BBCODE' => $bbcode, |
60 | 60 | 'FILENAME' => $filename, |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | define('IN_AJAX', true); |
78 | 78 | $skip_fleet_update = true; |
79 | 79 | |
80 | - if(classSupernova::$config->_MODE != CACHER_NO_CACHE && classSupernova::$config->chat_timeout && SN_TIME_MICRO - classSupernova::$config->array_get('users', $user['id'], 'chat_last_activity') > classSupernova::$config->chat_timeout) { |
|
80 | + if (classSupernova::$config->_MODE != CACHER_NO_CACHE && classSupernova::$config->chat_timeout && SN_TIME_MICRO - classSupernova::$config->array_get('users', $user['id'], 'chat_last_activity') > classSupernova::$config->chat_timeout) { |
|
81 | 81 | die(); |
82 | 82 | } |
83 | 83 | |
84 | - if(($message = sys_get_param_str('message')) && $user['username']) { |
|
84 | + if (($message = sys_get_param_str('message')) && $user['username']) { |
|
85 | 85 | $ally_id = sys_get_param('ally') && $user['ally_id'] ? $user['ally_id'] : 0; |
86 | 86 | $nick = db_escape(player_nick_compact(player_nick_render_current_to_array($user, array('color' => true, 'icons' => true, 'ally' => !$ally_id)))); |
87 | 87 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $skip_fleet_update = true; |
104 | 104 | |
105 | 105 | $history = sys_get_param_str('history'); |
106 | - if(!$history) { |
|
106 | + if (!$history) { |
|
107 | 107 | classSupernova::$config->array_set('users', $user['id'], 'chat_last_refresh', SN_TIME_MICRO); |
108 | 108 | } |
109 | 109 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $last_message = ''; |
112 | 112 | $alliance = 0; |
113 | 113 | $template_result['.']['chat'] = array(); |
114 | - if(!$history && classSupernova::$config->_MODE != CACHER_NO_CACHE && classSupernova::$config->chat_timeout && SN_TIME_MICRO - classSupernova::$config->array_get('users', $user['id'], 'chat_last_activity') > classSupernova::$config->chat_timeout) { |
|
114 | + if (!$history && classSupernova::$config->_MODE != CACHER_NO_CACHE && classSupernova::$config->chat_timeout && SN_TIME_MICRO - classSupernova::$config->array_get('users', $user['id'], 'chat_last_activity') > classSupernova::$config->chat_timeout) { |
|
115 | 115 | $result['disable'] = true; |
116 | 116 | $template_result['.']['chat'][] = array( |
117 | 117 | 'TIME' => date(FMT_DATE_TIME, htmlentities(SN_CLIENT_TIME_LOCAL, ENT_QUOTES, 'utf-8')), |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | |
125 | 125 | $where_add = ''; |
126 | 126 | $last_message = 0; |
127 | - if($history) { |
|
127 | + if ($history) { |
|
128 | 128 | $rows = DBStaticChat::db_chat_message_count_by_ally($alliance); |
129 | 129 | $page_count = ceil($rows['CNT'] / $page_limit); |
130 | 130 | |
131 | - for($i = 0; $i < $page_count; $i++) { |
|
131 | + for ($i = 0; $i < $page_count; $i++) { |
|
132 | 132 | $template_result['.']['page'][] = array( |
133 | 133 | 'NUMBER' => $i |
134 | 134 | ); |
@@ -142,12 +142,12 @@ discard block |
||
142 | 142 | |
143 | 143 | $start_row = $page * $page_limit; |
144 | 144 | $query = DBStaticChat::db_chat_message_get_page($alliance, $where_add, $start_row, $page_limit); |
145 | - while($chat_row = db_fetch($query)) { |
|
145 | + while ($chat_row = db_fetch($query)) { |
|
146 | 146 | // Little magik here - to retain HTML codes from DB and stripping HTML codes from nick |
147 | 147 | $chat_row['user'] = player_nick_render_to_html($chat_row['user']); |
148 | 148 | $nick_stripped = htmlentities(strip_tags($chat_row['user']), ENT_QUOTES, 'utf-8'); |
149 | 149 | $nick = str_replace(strip_tags($chat_row['user']), $nick_stripped, $chat_row['user']); |
150 | - if(!$history) { |
|
150 | + if (!$history) { |
|
151 | 151 | $nick = "<span style=\"cursor: pointer;\" onclick=\"addSmiley('({$nick_stripped})');\">{$nick}</span>"; |
152 | 152 | } |
153 | 153 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $template = gettemplate('chat_messages', $template); |
173 | 173 | $template->assign_recursive($template_result); |
174 | 174 | |
175 | - if($history) { |
|
175 | + if ($history) { |
|
176 | 176 | display($template, "{$classLocale['chat_history']} - {$classLocale[$alliance ? 'chat_ally' : 'chat_common']}", true, '', false, true); |
177 | 177 | } else { |
178 | 178 | $result['last_message'] = $last_message; |
@@ -76,6 +76,9 @@ discard block |
||
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | + /** |
|
80 | + * @param string $name |
|
81 | + */ |
|
79 | 82 | private function getPhysicalPropertyName($name) { |
80 | 83 | return '_' . $name; |
81 | 84 | } |
@@ -146,6 +149,9 @@ discard block |
||
146 | 149 | return $this->propertyMethodResult($name, $diff, 'delta'); |
147 | 150 | } |
148 | 151 | |
152 | + /** |
|
153 | + * @param string $action |
|
154 | + */ |
|
149 | 155 | protected function actionProperty($action, $name, $value) { |
150 | 156 | $result = null; |
151 | 157 | // Now deciding - will we call a protected setter or will we work with protected property |
@@ -66,18 +66,18 @@ discard block |
||
66 | 66 | |
67 | 67 | protected function checkPropertyExists($name) { |
68 | 68 | if (!array_key_exists($name, static::$_properties)) { |
69 | - throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] not exists', ERR_ERROR); |
|
69 | + throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] not exists', ERR_ERROR); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | 73 | protected function checkOverwriteAdjusted($name) { |
74 | 74 | if (array_key_exists($name, $this->propertiesAdjusted)) { |
75 | - throw new PropertyAccessException('Property [' . get_called_class() . '::' . $name . '] already was adjusted so no SET is possible until dbSave', ERR_ERROR); |
|
75 | + throw new PropertyAccessException('Property ['.get_called_class().'::'.$name.'] already was adjusted so no SET is possible until dbSave', ERR_ERROR); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | 79 | private function getPhysicalPropertyName($name) { |
80 | - return '_' . $name; |
|
80 | + return '_'.$name; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -149,15 +149,15 @@ discard block |
||
149 | 149 | protected function actionProperty($action, $name, $value) { |
150 | 150 | $result = null; |
151 | 151 | // Now deciding - will we call a protected setter or will we work with protected property |
152 | - if (method_exists($this, $methodName = $action . ucfirst($name))) { |
|
152 | + if (method_exists($this, $methodName = $action.ucfirst($name))) { |
|
153 | 153 | // If method exists - just calling it |
154 | 154 | // TODO - should return TRUE if value changed or FALSE otherwise |
155 | 155 | $result = call_user_func_array(array($this, $methodName), array($value)); |
156 | 156 | } elseif ($this->isPropertyActionAvailable($name, $action)) { |
157 | 157 | // No setter exists - works directly with protected property |
158 | - $result = $this->{$action . 'Property'}($name, $value); |
|
158 | + $result = $this->{$action.'Property'}($name, $value); |
|
159 | 159 | } else { |
160 | - throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] does not have ' . $action . 'ter/property to ' . $action, ERR_ERROR); |
|
160 | + throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] does not have '.$action.'ter/property to '.$action, ERR_ERROR); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | return $result; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @return string |
249 | 249 | */ |
250 | 250 | protected function adjustPropertyString($name, $diff) { |
251 | - return (string)$this->$name . (string)$diff; |
|
251 | + return (string) $this->$name.(string) $diff; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | * @return array |
259 | 259 | */ |
260 | 260 | protected function adjustPropertyArray($name, $diff) { |
261 | - $copy = (array)$this->$name; |
|
262 | - HelperArray::merge($copy, (array)$diff, HelperArray::MERGE_PHP); |
|
261 | + $copy = (array) $this->$name; |
|
262 | + HelperArray::merge($copy, (array) $diff, HelperArray::MERGE_PHP); |
|
263 | 263 | |
264 | 264 | return $copy; |
265 | 265 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @return int |
272 | 272 | */ |
273 | 273 | protected function deltaInteger($name, $diff) { |
274 | - return (int)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int)$diff; |
|
274 | + return (int) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int) $diff; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * @return float |
282 | 282 | */ |
283 | 283 | protected function deltaDouble($name, $diff) { |
284 | - return (float)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float)$diff; |
|
284 | + return (float) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float) $diff; |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @return string |
292 | 292 | */ |
293 | 293 | protected function deltaString($name, $diff) { |
294 | - return (string)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '') . (string)$diff; |
|
294 | + return (string) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '').(string) $diff; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * @return array |
302 | 302 | */ |
303 | 303 | protected function deltaArray($name, $diff) { |
304 | - $copy = (array)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array()); |
|
304 | + $copy = (array) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array()); |
|
305 | 305 | HelperArray::merge($copy, $diff, HelperArray::MERGE_PHP); |
306 | 306 | |
307 | 307 | return $copy; |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | // Capitalizing type name |
325 | 325 | $methodName = explode(' ', $type); |
326 | 326 | array_walk($methodName, 'DbSqlHelper::UCFirstByRef'); |
327 | - $methodName = $prefix . implode('', $methodName); |
|
327 | + $methodName = $prefix.implode('', $methodName); |
|
328 | 328 | |
329 | 329 | if (!method_exists($this, $methodName)) { |
330 | - throw new ExceptionTypeUnsupported('Type "' . $type . '" is unsupported in PropertyHider::propertyMethodResult'); |
|
330 | + throw new ExceptionTypeUnsupported('Type "'.$type.'" is unsupported in PropertyHider::propertyMethodResult'); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | return call_user_func(array($this, $methodName), $name, $diff); |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | |
39 | 39 | // Game type constants starts with GAME_ |
40 | 40 | define('GAME_SUPERNOVA', 0); |
41 | -define('GAME_OGAME' , 1); |
|
42 | -define('GAME_BLITZ' , 2); |
|
41 | +define('GAME_OGAME', 1); |
|
42 | +define('GAME_BLITZ', 2); |
|
43 | 43 | |
44 | 44 | // Date & time range constants |
45 | 45 | define('DATE_FOREVER', 2000000000); |
@@ -52,27 +52,27 @@ discard block |
||
52 | 52 | define('PERIOD_YEAR', PERIOD_DAY * 365); |
53 | 53 | define('PERIOD_FOREVER', PERIOD_YEAR * 100); |
54 | 54 | |
55 | -define('PERIOD_MINUTE_2' , PERIOD_MINUTE * 2); |
|
56 | -define('PERIOD_MINUTE_3' , PERIOD_MINUTE * 3); |
|
57 | -define('PERIOD_MINUTE_5' , PERIOD_MINUTE * 5); |
|
55 | +define('PERIOD_MINUTE_2', PERIOD_MINUTE * 2); |
|
56 | +define('PERIOD_MINUTE_3', PERIOD_MINUTE * 3); |
|
57 | +define('PERIOD_MINUTE_5', PERIOD_MINUTE * 5); |
|
58 | 58 | define('PERIOD_MINUTE_10', PERIOD_MINUTE * 10); |
59 | -define('PERIOD_DAY_3' , PERIOD_DAY * 3); |
|
60 | -define('PERIOD_WEEK_2' , PERIOD_WEEK * 2); |
|
61 | -define('PERIOD_MONTH_2' , PERIOD_MONTH * 2); |
|
62 | -define('PERIOD_MONTH_3' , PERIOD_MONTH * 3); |
|
59 | +define('PERIOD_DAY_3', PERIOD_DAY * 3); |
|
60 | +define('PERIOD_WEEK_2', PERIOD_WEEK * 2); |
|
61 | +define('PERIOD_MONTH_2', PERIOD_MONTH * 2); |
|
62 | +define('PERIOD_MONTH_3', PERIOD_MONTH * 3); |
|
63 | 63 | |
64 | 64 | define('FONT_SIZE_PERCENT_MIN', 56.25); |
65 | 65 | define('FONT_SIZE_PERCENT_DEFAULT', 68.75); |
66 | 66 | define('FONT_SIZE_PERCENT_MAX', 131.25); |
67 | 67 | define('FONT_SIZE_PERCENT_STEP', 12.5); |
68 | -define('FONT_SIZE_PERCENT_DEFAULT_STRING', FONT_SIZE_PERCENT_DEFAULT . '%'); |
|
68 | +define('FONT_SIZE_PERCENT_DEFAULT_STRING', FONT_SIZE_PERCENT_DEFAULT.'%'); |
|
69 | 69 | |
70 | 70 | define('FONT_SIZE_PIXELS_BROWSER_BASE', 16); |
71 | 71 | define('FONT_SIZE_PIXELS_MIN', 9); |
72 | 72 | define('FONT_SIZE_PIXELS_DEFAULT', 11); |
73 | 73 | define('FONT_SIZE_PIXELS_MAX', 21); |
74 | 74 | define('FONT_SIZE_PIXELS_STEP', 1); |
75 | -define('FONT_SIZE_PIXELS_DEFAULT_STRING', FONT_SIZE_PIXELS_DEFAULT . 'px'); |
|
75 | +define('FONT_SIZE_PIXELS_DEFAULT_STRING', FONT_SIZE_PIXELS_DEFAULT.'px'); |
|
76 | 76 | |
77 | 77 | define('DEFAULT_PICTURE_EXTENSION_DOTTED', '.jpg'); |
78 | 78 | |
@@ -115,54 +115,54 @@ discard block |
||
115 | 115 | define('SN_SYS_SEC_CHARS_ALLOWED', 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghkmnpqrstuvwxyz0123456789'); |
116 | 116 | |
117 | 117 | // Mot qui sont interdit a la saisie ! |
118 | -$ListCensure = array ( '/</', '/>/', '/script/i', '/doquery/i', '/http/i', '/javascript/i'); |
|
118 | +$ListCensure = array('/</', '/>/', '/script/i', '/doquery/i', '/http/i', '/javascript/i'); |
|
119 | 119 | |
120 | 120 | // Confirmation record types |
121 | -define('CONFIRM_REGISTRATION' , 1); |
|
121 | +define('CONFIRM_REGISTRATION', 1); |
|
122 | 122 | define('CONFIRM_PASSWORD_RESET', 2); |
123 | -define('CONFIRM_DELETE' , 3); |
|
123 | +define('CONFIRM_DELETE', 3); |
|
124 | 124 | |
125 | 125 | define('AFFILIATE_MM_TO_REFERRAL_DM', 2); |
126 | 126 | |
127 | 127 | // Ally diplomacy statuses |
128 | -define('ALLY_DIPLOMACY_SELF' , 'self'); |
|
129 | -define('ALLY_DIPLOMACY_NEUTRAL' , 'neutral'); |
|
130 | -define('ALLY_DIPLOMACY_WAR' , 'war'); |
|
131 | -define('ALLY_DIPLOMACY_PEACE' , 'peace'); |
|
128 | +define('ALLY_DIPLOMACY_SELF', 'self'); |
|
129 | +define('ALLY_DIPLOMACY_NEUTRAL', 'neutral'); |
|
130 | +define('ALLY_DIPLOMACY_WAR', 'war'); |
|
131 | +define('ALLY_DIPLOMACY_PEACE', 'peace'); |
|
132 | 132 | define('ALLY_DIPLOMACY_CONFEDERATION', 'confederation'); |
133 | -define('ALLY_DIPLOMACY_FEDERATION' , 'federation'); |
|
134 | -define('ALLY_DIPLOMACY_UNION' , 'union'); |
|
135 | -define('ALLY_DIPLOMACY_MASTER' , 'master'); |
|
136 | -define('ALLY_DIPLOMACY_SLAVE' , 'slave'); |
|
133 | +define('ALLY_DIPLOMACY_FEDERATION', 'federation'); |
|
134 | +define('ALLY_DIPLOMACY_UNION', 'union'); |
|
135 | +define('ALLY_DIPLOMACY_MASTER', 'master'); |
|
136 | +define('ALLY_DIPLOMACY_SLAVE', 'slave'); |
|
137 | 137 | |
138 | 138 | define('ALLY_PROPOSE_SEND', 0); |
139 | 139 | |
140 | 140 | // Quest types |
141 | -define('QUEST_TYPE_BUILD' , 1); |
|
141 | +define('QUEST_TYPE_BUILD', 1); |
|
142 | 142 | define('QUEST_TYPE_RESEARCH', 2); |
143 | -define('QUEST_TYPE_COMBAT' , 3); |
|
143 | +define('QUEST_TYPE_COMBAT', 3); |
|
144 | 144 | |
145 | -define('QUEST_STATUS_NOT_STARTED' , 0); |
|
146 | -define('QUEST_STATUS_STARTED' , 1); |
|
147 | -define('QUEST_STATUS_COMPLETE' , 2); |
|
145 | +define('QUEST_STATUS_NOT_STARTED', 0); |
|
146 | +define('QUEST_STATUS_STARTED', 1); |
|
147 | +define('QUEST_STATUS_COMPLETE', 2); |
|
148 | 148 | |
149 | 149 | // *** Combat-related constants |
150 | 150 | // *** Mission Type constants starts with MT_ |
151 | -define('MT_NONE' , 0); |
|
152 | -define('MT_EXPLORE' , 15); |
|
153 | -define('MT_COLONIZE' , 7); |
|
154 | -define('MT_RECYCLE' , 8); |
|
151 | +define('MT_NONE', 0); |
|
152 | +define('MT_EXPLORE', 15); |
|
153 | +define('MT_COLONIZE', 7); |
|
154 | +define('MT_RECYCLE', 8); |
|
155 | 155 | |
156 | -define('MT_RELOCATE' , 4); |
|
156 | +define('MT_RELOCATE', 4); |
|
157 | 157 | |
158 | -define('MT_TRANSPORT', 3); |
|
159 | -define('MT_HOLD' , 5); |
|
158 | +define('MT_TRANSPORT', 3); |
|
159 | +define('MT_HOLD', 5); |
|
160 | 160 | |
161 | -define('MT_MISSILE' , 10); |
|
162 | -define('MT_SPY' , 6); |
|
163 | -define('MT_ATTACK' , 1); |
|
164 | -define('MT_ACS' , 2); |
|
165 | -define('MT_DESTROY' , 9); |
|
161 | +define('MT_MISSILE', 10); |
|
162 | +define('MT_SPY', 6); |
|
163 | +define('MT_ATTACK', 1); |
|
164 | +define('MT_ACS', 2); |
|
165 | +define('MT_DESTROY', 9); |
|
166 | 166 | // 11, 12, 13, 14, 16... |
167 | 167 | |
168 | 168 | // *** Planet Target constants starts with PT_ |
@@ -170,49 +170,49 @@ discard block |
||
170 | 170 | define('PT_ALL', 0); |
171 | 171 | define('PT_PLANET', 1); |
172 | 172 | define('PT_DEBRIS', 2); |
173 | -define('PT_MOON' , 3); |
|
173 | +define('PT_MOON', 3); |
|
174 | 174 | |
175 | 175 | // *** Unit locations - shows db table where unit belong |
176 | 176 | // Also cache indexes |
177 | -define('LOC_NONE', -1); |
|
177 | +define('LOC_NONE', -1); |
|
178 | 178 | define('LOC_UNIVERSE', 0); |
179 | -define('LOC_PLANET', 1); |
|
180 | -define('LOC_DEBRIS', 2); // Translates to `planets` table planet_type = 1, `debris_*` fields |
|
181 | -define('LOC_MOON', 3); // Translates to `planets` table planet_type = 3 |
|
182 | -define('LOC_USER', 4); |
|
183 | -define('LOC_FLEET', 5); |
|
184 | -define('LOC_ALLY', 6); |
|
185 | -define('LOC_UNIT_NUMERIC', 7); |
|
186 | -define('LOC_UNIT_LIST', 8); |
|
179 | +define('LOC_PLANET', 1); |
|
180 | +define('LOC_DEBRIS', 2); // Translates to `planets` table planet_type = 1, `debris_*` fields |
|
181 | +define('LOC_MOON', 3); // Translates to `planets` table planet_type = 3 |
|
182 | +define('LOC_USER', 4); |
|
183 | +define('LOC_FLEET', 5); |
|
184 | +define('LOC_ALLY', 6); |
|
185 | +define('LOC_UNIT_NUMERIC', 7); |
|
186 | +define('LOC_UNIT_LIST', 8); |
|
187 | 187 | |
188 | 188 | // ТОЛЬКО ВНУТРЕНЕЕ!!! |
189 | -define('LOC_UNIT', 'LOC_UNIT'); |
|
190 | -define('LOC_QUE', 'LOC_QUE'); |
|
191 | -define('LOC_LOCATION','LOC_LOCATION'); |
|
192 | -define('LOC_LOCKS','LOC_LOCKS'); |
|
189 | +define('LOC_UNIT', 'LOC_UNIT'); |
|
190 | +define('LOC_QUE', 'LOC_QUE'); |
|
191 | +define('LOC_LOCATION', 'LOC_LOCATION'); |
|
192 | +define('LOC_LOCKS', 'LOC_LOCKS'); |
|
193 | 193 | |
194 | 194 | // *** Caching masks |
195 | -define('CACHE_NOTHING' , 0); |
|
196 | -define('CACHE_FLEET' , 1); |
|
197 | -define('CACHE_PLANET' , 2); |
|
198 | -define('CACHE_USER' , 4); |
|
199 | -define('CACHE_SOURCE' , 8); |
|
195 | +define('CACHE_NOTHING', 0); |
|
196 | +define('CACHE_FLEET', 1); |
|
197 | +define('CACHE_PLANET', 2); |
|
198 | +define('CACHE_USER', 4); |
|
199 | +define('CACHE_SOURCE', 8); |
|
200 | 200 | define('CACHE_DESTINATION', 16); |
201 | -define('CACHE_EVENT' , 32); |
|
201 | +define('CACHE_EVENT', 32); |
|
202 | 202 | |
203 | -define('CACHE_USER_SRC' , CACHE_USER | CACHE_SOURCE); |
|
204 | -define('CACHE_USER_DST' , CACHE_USER | CACHE_DESTINATION); |
|
203 | +define('CACHE_USER_SRC', CACHE_USER | CACHE_SOURCE); |
|
204 | +define('CACHE_USER_DST', CACHE_USER | CACHE_DESTINATION); |
|
205 | 205 | define('CACHE_PLANET_SRC', CACHE_PLANET | CACHE_SOURCE); |
206 | 206 | define('CACHE_PLANET_DST', CACHE_PLANET | CACHE_DESTINATION); |
207 | -define('CACHE_COMBAT' , CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION); |
|
207 | +define('CACHE_COMBAT', CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION); |
|
208 | 208 | |
209 | -define('CACHE_ALL' , CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION | CACHE_EVENT); |
|
209 | +define('CACHE_ALL', CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION | CACHE_EVENT); |
|
210 | 210 | |
211 | -define('CACHE_NONE' , CACHE_NOTHING); // Alias for me |
|
211 | +define('CACHE_NONE', CACHE_NOTHING); // Alias for me |
|
212 | 212 | |
213 | 213 | // *** Event types |
214 | 214 | define('EVENT_FLEET_ARRIVE', 1); |
215 | -define('EVENT_FLEET_STAY' , 2); |
|
215 | +define('EVENT_FLEET_STAY', 2); |
|
216 | 216 | define('EVENT_FLEET_RETURN', 3); |
217 | 217 | |
218 | 218 | // *** Constants for changing DM |
@@ -267,10 +267,10 @@ discard block |
||
267 | 267 | |
268 | 268 | |
269 | 269 | // Operation error status HARDCODE! |
270 | -define('ERR_NONE' , 0); // No error |
|
271 | -define('ERR_WARNING' , 1); // There is warning - something altering normal operation process |
|
272 | -define('ERR_ERROR' , 2); // There is error - something permits operation from process |
|
273 | -define('ERR_HACK' , 4); // Operation is qualified as hack attempt |
|
270 | +define('ERR_NONE', 0); // No error |
|
271 | +define('ERR_WARNING', 1); // There is warning - something altering normal operation process |
|
272 | +define('ERR_ERROR', 2); // There is error - something permits operation from process |
|
273 | +define('ERR_HACK', 4); // Operation is qualified as hack attempt |
|
274 | 274 | // New GLOBAL operation results |
275 | 275 | //define('RESULT_DEFAULT' , 0); // Default result - all went OK or result really doesn't matter |
276 | 276 | //define('RESULT_WARNING' , 1); |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | define('SN_PAYMENT_REQUEST_OK', 0); |
291 | 291 | define('SN_PAYMENT_REQUEST_ERROR_UNIT_AMOUNT', 1); |
292 | 292 | define('SN_PAYMENT_REQUEST_ERROR_PAYLINK_UNSUPPORTED', 2); |
293 | -define('SN_PAYMENT_REQUEST_IP_WRONG', 3); // Неправильный IP входящей системы - обычно хак |
|
293 | +define('SN_PAYMENT_REQUEST_IP_WRONG', 3); // Неправильный IP входящей системы - обычно хак |
|
294 | 294 | define('SN_PAYMENT_REQUEST_COMMAND_UNSUPPORTED', 4); // Неподдерживаемая команда - обычно хак |
295 | 295 | define('SN_PAYMENT_REQUEST_SIGNATURE_INVALID', 5); // Неправильная подпись или не сошлась контрольная сумма - обычно хак |
296 | 296 | define('SN_MODULE_DISABLED', 6); // Модуль отключен // УНИВЕРСАЛЬНЫЙ ОТВЕТ! |
@@ -563,16 +563,16 @@ discard block |
||
563 | 563 | //define('F_DEVICE_ID', 'F_DEVICE_ID'); |
564 | 564 | //define('F_DEVICE_CYPHER', 'F_DEVICE_CYPHER'); |
565 | 565 | |
566 | -define('F_PROVIDER_ID', 'F_PROVIDER_ID'); |
|
566 | +define('F_PROVIDER_ID', 'F_PROVIDER_ID'); |
|
567 | 567 | // define('F_PROVIDER_LIST', 'F_PROVIDER_LIST'); |
568 | 568 | |
569 | 569 | define('F_IMPERSONATE_STATUS', 'F_IMPERSONATE_STATUS'); |
570 | 570 | define('F_IMPERSONATE_OPERATOR', 'F_IMPERSONATE_OPERATOR'); |
571 | 571 | |
572 | -define('F_LOGIN_STATUS', 'F_LOGIN_STATUS'); |
|
572 | +define('F_LOGIN_STATUS', 'F_LOGIN_STATUS'); |
|
573 | 573 | define('F_LOGIN_MESSAGE', 'F_LOGIN_MESSAGE'); |
574 | 574 | |
575 | -define('F_PLAYER_REGISTER_STATUS', 'F_PLAYER_REGISTER_STATUS'); |
|
575 | +define('F_PLAYER_REGISTER_STATUS', 'F_PLAYER_REGISTER_STATUS'); |
|
576 | 576 | define('F_PLAYER_REGISTER_MESSAGE', 'F_PLAYER_REGISTER_MESSAGE'); |
577 | 577 | |
578 | 578 | define('F_USER_ID', 'F_USER_ID'); |
@@ -616,68 +616,68 @@ discard block |
||
616 | 616 | |
617 | 617 | |
618 | 618 | // Option groups |
619 | -define('OPT_ALL', 0); |
|
620 | -define('OPT_MESSAGE', 1); |
|
619 | +define('OPT_ALL', 0); |
|
620 | +define('OPT_MESSAGE', 1); |
|
621 | 621 | define('OPT_UNIVERSE', 2); |
622 | 622 | define('OPT_INTERFACE', 3); |
623 | 623 | |
624 | 624 | // Message classes |
625 | -define('MSG_TYPE_OUTBOX' , -1); |
|
626 | -define('MSG_TYPE_SPY' , 0); |
|
627 | -define('MSG_TYPE_PLAYER' , 1); |
|
628 | -define('MSG_TYPE_ALLIANCE' , 2); |
|
629 | -define('MSG_TYPE_COMBAT' , 3); |
|
630 | -define('MSG_TYPE_RECYCLE' , 4); |
|
631 | -define('MSG_TYPE_TRANSPORT', 5); |
|
632 | -define('MSG_TYPE_ADMIN' , 6); |
|
633 | -define('MSG_TYPE_EXPLORE' , 15); |
|
634 | -define('MSG_TYPE_QUE' , 99); |
|
635 | -define('MSG_TYPE_NEW' , 100); |
|
625 | +define('MSG_TYPE_OUTBOX', -1); |
|
626 | +define('MSG_TYPE_SPY', 0); |
|
627 | +define('MSG_TYPE_PLAYER', 1); |
|
628 | +define('MSG_TYPE_ALLIANCE', 2); |
|
629 | +define('MSG_TYPE_COMBAT', 3); |
|
630 | +define('MSG_TYPE_RECYCLE', 4); |
|
631 | +define('MSG_TYPE_TRANSPORT', 5); |
|
632 | +define('MSG_TYPE_ADMIN', 6); |
|
633 | +define('MSG_TYPE_EXPLORE', 15); |
|
634 | +define('MSG_TYPE_QUE', 99); |
|
635 | +define('MSG_TYPE_NEW', 100); |
|
636 | 636 | |
637 | 637 | // Attack verification statuses |
638 | -define('FLIGHT_ALLOWED_NEW' , -1); |
|
638 | +define('FLIGHT_ALLOWED_NEW', -1); |
|
639 | 639 | //define('FLIGHT_DO_NOTHING' , 0); |
640 | -define('FLIGHT_ALLOWED' , 0); |
|
641 | -define('FLIGHT_VECTOR_NO_TARGET' , 1); |
|
642 | -define('FLIGHT_PLAYER_OWN' , 2); |
|
643 | -define('FLIGHT_MISSION_IMPOSSIBLE' , 3); |
|
644 | -define('FLIGHT_MISSION_HOLD_NO_ALLY_DEPOSIT' , 4); |
|
645 | -define('FLIGHT_MISSION_RECYCLE_NO_DEBRIS' , 5); |
|
646 | -define('FLIGHT_PLAYER_VACATION' , 6); |
|
647 | -define('FLIGHT_PLAYER_SAME_IP' , 7); |
|
648 | -define('FLIGHT_PLAYER_BUFFING' , 8); |
|
649 | -define('FLIGHT_PLAYER_ADMIN' , 9); |
|
650 | -define('FLIGHT_PLAYER_NOOB' , 10); |
|
651 | -define('FLIGHT_PLAYER_VACATION_OWN' , 11); |
|
652 | -define('FLIGHT_MISSION_MISSILE_NO_SILO' , 12); |
|
653 | -define('FLIGHT_MISSION_MISSILE_NO_MISSILES' , 13); |
|
654 | -define('FLIGHT_SHIPS_NO_SHIPS' , 14); |
|
655 | -define('FLIGHT_FLEET_NO_SLOTS' , 15); |
|
656 | -define('FLIGHT_SHIPS_NOT_ENOUGH_OR_RESOURCES' , 16); |
|
657 | -define('FLIGHT_SHIPS_NO_RECYCLERS' , 17); |
|
658 | -define('FLIGHT_MISSION_SPY_NO_SPIES' , 18); |
|
659 | -define('FLIGHT_SHIPS_NO_COLONIZER' , 19); |
|
660 | -define('FLIGHT_MISSION_MISSILE_TOO_FAR' , 20); |
|
661 | -define('FLIGHT_MISSION_MISSILE_WRONG_STRUCTURE' , 21); |
|
662 | -define('FLIGHT_RESOURCES_FUEL_NOT_ENOUGH' , 22); |
|
663 | -define('FLIGHT_RESOURCES_NOT_ENOUGH' , 23); |
|
664 | -define('FLIGHT_MISSION_ACS_NOT_EXISTS' , 24); |
|
665 | -define('FLIGHT_MISSION_ACS_MISSTARGET' , 25); |
|
666 | -define('FLIGHT_FLEET_SPEED_WRONG' , 26); |
|
667 | -define('FLIGHT_MISSION_ACS_TOO_LATE' , 27); |
|
668 | -define('FLIGHT_MISSION_ATTACK_BASHING' , 28); |
|
669 | -define('FLIGHT_MISSION_ATTACK_BASHING_WAR_DELAY' , 29); |
|
670 | -define('FLIGHT_MISSION_ACS_WRONG_TARGET' , 30); |
|
671 | -define('FLIGHT_VECTOR_SAME_SOURCE' , 31); |
|
640 | +define('FLIGHT_ALLOWED', 0); |
|
641 | +define('FLIGHT_VECTOR_NO_TARGET', 1); |
|
642 | +define('FLIGHT_PLAYER_OWN', 2); |
|
643 | +define('FLIGHT_MISSION_IMPOSSIBLE', 3); |
|
644 | +define('FLIGHT_MISSION_HOLD_NO_ALLY_DEPOSIT', 4); |
|
645 | +define('FLIGHT_MISSION_RECYCLE_NO_DEBRIS', 5); |
|
646 | +define('FLIGHT_PLAYER_VACATION', 6); |
|
647 | +define('FLIGHT_PLAYER_SAME_IP', 7); |
|
648 | +define('FLIGHT_PLAYER_BUFFING', 8); |
|
649 | +define('FLIGHT_PLAYER_ADMIN', 9); |
|
650 | +define('FLIGHT_PLAYER_NOOB', 10); |
|
651 | +define('FLIGHT_PLAYER_VACATION_OWN', 11); |
|
652 | +define('FLIGHT_MISSION_MISSILE_NO_SILO', 12); |
|
653 | +define('FLIGHT_MISSION_MISSILE_NO_MISSILES', 13); |
|
654 | +define('FLIGHT_SHIPS_NO_SHIPS', 14); |
|
655 | +define('FLIGHT_FLEET_NO_SLOTS', 15); |
|
656 | +define('FLIGHT_SHIPS_NOT_ENOUGH_OR_RESOURCES', 16); |
|
657 | +define('FLIGHT_SHIPS_NO_RECYCLERS', 17); |
|
658 | +define('FLIGHT_MISSION_SPY_NO_SPIES', 18); |
|
659 | +define('FLIGHT_SHIPS_NO_COLONIZER', 19); |
|
660 | +define('FLIGHT_MISSION_MISSILE_TOO_FAR', 20); |
|
661 | +define('FLIGHT_MISSION_MISSILE_WRONG_STRUCTURE', 21); |
|
662 | +define('FLIGHT_RESOURCES_FUEL_NOT_ENOUGH', 22); |
|
663 | +define('FLIGHT_RESOURCES_NOT_ENOUGH', 23); |
|
664 | +define('FLIGHT_MISSION_ACS_NOT_EXISTS', 24); |
|
665 | +define('FLIGHT_MISSION_ACS_MISSTARGET', 25); |
|
666 | +define('FLIGHT_FLEET_SPEED_WRONG', 26); |
|
667 | +define('FLIGHT_MISSION_ACS_TOO_LATE', 27); |
|
668 | +define('FLIGHT_MISSION_ATTACK_BASHING', 28); |
|
669 | +define('FLIGHT_MISSION_ATTACK_BASHING_WAR_DELAY', 29); |
|
670 | +define('FLIGHT_MISSION_ACS_WRONG_TARGET', 30); |
|
671 | +define('FLIGHT_VECTOR_SAME_SOURCE', 31); |
|
672 | 672 | define('FLIGHT_RESOURCES_FORBIDDEN', 32); |
673 | -define('FLIGHT_MISSION_TRANSPORT_EMPTY_CARGO' , 33); |
|
674 | -define('FLIGHT_SHIPS_NOT_ONLY_SPIES' , 34); |
|
675 | -define('FLIGHT_FLEET_TOO_FAR' , 35); |
|
676 | -define('FLIGHT_FLEET_OVERLOAD' , 36); |
|
677 | -define('FLIGHT_MISSION_UNKNOWN' , 37); |
|
678 | -define('FLIGHT_SHIPS_UNIT_WRONG' , 38); |
|
679 | -define('FLIGHT_SHIPS_UNMOVABLE' , 39); |
|
680 | -define('FLIGHT_SHIPS_NEGATIVE' , 40); |
|
673 | +define('FLIGHT_MISSION_TRANSPORT_EMPTY_CARGO', 33); |
|
674 | +define('FLIGHT_SHIPS_NOT_ONLY_SPIES', 34); |
|
675 | +define('FLIGHT_FLEET_TOO_FAR', 35); |
|
676 | +define('FLIGHT_FLEET_OVERLOAD', 36); |
|
677 | +define('FLIGHT_MISSION_UNKNOWN', 37); |
|
678 | +define('FLIGHT_SHIPS_UNIT_WRONG', 38); |
|
679 | +define('FLIGHT_SHIPS_UNMOVABLE', 39); |
|
680 | +define('FLIGHT_SHIPS_NEGATIVE', 40); |
|
681 | 681 | define('FLIGHT_RESOURCES_NEGATIVE', 41); |
682 | 682 | define('FLIGHT_MISSION_MORATORIUM', 42); |
683 | 683 | define('FLIGHT_PLAYER_CHILD_PROTECTION', 43); |
@@ -711,12 +711,12 @@ discard block |
||
711 | 711 | |
712 | 712 | |
713 | 713 | // *** Races - Homeworlds |
714 | -define('RACE_NONE' , 0); |
|
715 | -define('RACE_EARTH' , 1); |
|
716 | -define('RACE_MOON' , 2); |
|
717 | -define('RACE_MERCURY' , 3); |
|
718 | -define('RACE_VENUS' , 4); |
|
719 | -define('RACE_MARS' , 5); |
|
714 | +define('RACE_NONE', 0); |
|
715 | +define('RACE_EARTH', 1); |
|
716 | +define('RACE_MOON', 2); |
|
717 | +define('RACE_MERCURY', 3); |
|
718 | +define('RACE_VENUS', 4); |
|
719 | +define('RACE_MARS', 5); |
|
720 | 720 | define('RACE_ASTEROID', 6); |
721 | 721 | // define('MARKET_INFO' , 7); |
722 | 722 | |
@@ -724,114 +724,114 @@ discard block |
||
724 | 724 | |
725 | 725 | // *** Market variables |
726 | 726 | // === Market blocks |
727 | -define('MARKET_ENTRY' , 0); |
|
728 | -define('MARKET_RESOURCES' , 1); |
|
729 | -define('MARKET_SCRAPPER' , 2); |
|
730 | -define('MARKET_STOCKMAN' , 3); |
|
731 | -define('MARKET_EXCHANGE' , 4); |
|
732 | -define('MARKET_BANKER' , 5); |
|
733 | -define('MARKET_PAWNSHOP' , 6); |
|
734 | -define('MARKET_INFO' , 7); |
|
727 | +define('MARKET_ENTRY', 0); |
|
728 | +define('MARKET_RESOURCES', 1); |
|
729 | +define('MARKET_SCRAPPER', 2); |
|
730 | +define('MARKET_STOCKMAN', 3); |
|
731 | +define('MARKET_EXCHANGE', 4); |
|
732 | +define('MARKET_BANKER', 5); |
|
733 | +define('MARKET_PAWNSHOP', 6); |
|
734 | +define('MARKET_INFO', 7); |
|
735 | 735 | |
736 | 736 | // === Market error statuses |
737 | -define('MARKET_NOTHING' , 0); |
|
738 | -define('MARKET_DEAL' , 1); |
|
739 | -define('MARKET_DEAL_TRADE' , 2); |
|
740 | -define('MARKET_NO_DM' , 3); |
|
741 | -define('MARKET_NO_RESOURCES' , 4); |
|
742 | -define('MARKET_ZERO_DEAL' , 5); |
|
743 | -define('MARKET_NO_SHIPS' , 6); |
|
744 | -define('MARKET_NOT_A_SHIP' , 7); |
|
745 | -define('MARKET_NO_STOCK' , 8); |
|
746 | -define('MARKET_ZERO_RES_STOCK' , 9); |
|
747 | -define('MARKET_NEGATIVE_SHIPS' , 10); |
|
748 | - |
|
749 | -define('MARKET_INFO_PLAYER' , 12); |
|
750 | -define('MARKET_INFO_WRONG' , 11); |
|
737 | +define('MARKET_NOTHING', 0); |
|
738 | +define('MARKET_DEAL', 1); |
|
739 | +define('MARKET_DEAL_TRADE', 2); |
|
740 | +define('MARKET_NO_DM', 3); |
|
741 | +define('MARKET_NO_RESOURCES', 4); |
|
742 | +define('MARKET_ZERO_DEAL', 5); |
|
743 | +define('MARKET_NO_SHIPS', 6); |
|
744 | +define('MARKET_NOT_A_SHIP', 7); |
|
745 | +define('MARKET_NO_STOCK', 8); |
|
746 | +define('MARKET_ZERO_RES_STOCK', 9); |
|
747 | +define('MARKET_NEGATIVE_SHIPS', 10); |
|
748 | + |
|
749 | +define('MARKET_INFO_PLAYER', 12); |
|
750 | +define('MARKET_INFO_WRONG', 11); |
|
751 | 751 | define('MARKET_INFO_PLAYER_NOT_FOUND', 13); |
752 | -define('MARKET_INFO_PLAYER_WRONG' , 14); |
|
753 | -define('MARKET_INFO_PLAYER_SAME' , 15); |
|
752 | +define('MARKET_INFO_PLAYER_WRONG', 14); |
|
753 | +define('MARKET_INFO_PLAYER_SAME', 15); |
|
754 | 754 | |
755 | 755 | |
756 | 756 | |
757 | 757 | |
758 | 758 | // *** Mercenary/talent bonus types |
759 | -define('BONUS_NONE' , 0); // No bonus |
|
760 | -define('BONUS_PERCENT' , 1); // Percent on base value |
|
761 | -define('BONUS_ADD' , 2); // Add |
|
762 | -define('BONUS_ABILITY' , 3); // Some ability |
|
763 | -define('BONUS_MULTIPLY', 4); // Multiply by value |
|
764 | -define('BONUS_PERCENT_CUMULATIVE' , 5); // Cumulative percent on base value |
|
765 | -define('BONUS_PERCENT_DEGRADED' , 6); // Bonus amount degraded with increase as pow(bonus, level) (?) |
|
766 | -define('BONUS_SPEED', 7); // Speed bonus |
|
759 | +define('BONUS_NONE', 0); // No bonus |
|
760 | +define('BONUS_PERCENT', 1); // Percent on base value |
|
761 | +define('BONUS_ADD', 2); // Add |
|
762 | +define('BONUS_ABILITY', 3); // Some ability |
|
763 | +define('BONUS_MULTIPLY', 4); // Multiply by value |
|
764 | +define('BONUS_PERCENT_CUMULATIVE', 5); // Cumulative percent on base value |
|
765 | +define('BONUS_PERCENT_DEGRADED', 6); // Bonus amount degraded with increase as pow(bonus, level) (?) |
|
766 | +define('BONUS_SPEED', 7); // Speed bonus |
|
767 | 767 | |
768 | 768 | // *** Action constant (build should be replaced with ACTION) |
769 | -define('BUILD_CREATE' , 1); |
|
769 | +define('BUILD_CREATE', 1); |
|
770 | 770 | define('BUILD_DESTROY', -1); |
771 | 771 | define('BUILD_AUTOCONVERT', 2); |
772 | 772 | |
773 | -define('ACTION_SELL' , -1); |
|
774 | -define('ACTION_NOTHING' , 0); |
|
775 | -define('ACTION_BUY' , 1); |
|
776 | -define('ACTION_USE' , 2); |
|
777 | -define('ACTION_DELETE' , 3); |
|
773 | +define('ACTION_SELL', -1); |
|
774 | +define('ACTION_NOTHING', 0); |
|
775 | +define('ACTION_BUY', 1); |
|
776 | +define('ACTION_USE', 2); |
|
777 | +define('ACTION_DELETE', 3); |
|
778 | 778 | |
779 | 779 | // *** Check unit availability codes |
780 | -define('BUILD_ALLOWED' , 0); // HARDCODED! DO NOT CHANGE! |
|
780 | +define('BUILD_ALLOWED', 0); // HARDCODED! DO NOT CHANGE! |
|
781 | 781 | define('BUILD_REQUIRE_NOT_MEET', 1); |
782 | -define('BUILD_AMOUNT_WRONG' , 2); |
|
783 | -define('BUILD_QUE_WRONG' , 3); |
|
784 | -define('BUILD_QUE_UNIT_WRONG' , 4); |
|
785 | -define('BUILD_INDESTRUCTABLE' , 5); |
|
786 | -define('BUILD_NO_RESOURCES' , 6); |
|
787 | -define('BUILD_NO_UNITS' , 7); |
|
788 | -define('BUILD_UNIT_BUSY' , 8); |
|
789 | -define('BUILD_QUE_FULL' , 9); |
|
790 | -define('BUILD_SILO_FULL' ,10); |
|
791 | -define('BUILD_MAX_REACHED' ,11); |
|
792 | -define('BUILD_SECTORS_NONE' ,12); |
|
782 | +define('BUILD_AMOUNT_WRONG', 2); |
|
783 | +define('BUILD_QUE_WRONG', 3); |
|
784 | +define('BUILD_QUE_UNIT_WRONG', 4); |
|
785 | +define('BUILD_INDESTRUCTABLE', 5); |
|
786 | +define('BUILD_NO_RESOURCES', 6); |
|
787 | +define('BUILD_NO_UNITS', 7); |
|
788 | +define('BUILD_UNIT_BUSY', 8); |
|
789 | +define('BUILD_QUE_FULL', 9); |
|
790 | +define('BUILD_SILO_FULL', 10); |
|
791 | +define('BUILD_MAX_REACHED', 11); |
|
792 | +define('BUILD_SECTORS_NONE', 12); |
|
793 | 793 | define('BUILD_AUTOCONVERT_AVAILABLE', 13); |
794 | 794 | |
795 | 795 | |
796 | 796 | // *** Que types |
797 | 797 | define('QUE_STRUCTURES', 1); |
798 | -define('QUE_HANGAR' , 4); |
|
799 | -define('QUE_RESEARCH' , 7); |
|
800 | -define('QUE_MERCENARY' , 600); // UNIT_MERCENARIES |
|
798 | +define('QUE_HANGAR', 4); |
|
799 | +define('QUE_RESEARCH', 7); |
|
800 | +define('QUE_MERCENARY', 600); // UNIT_MERCENARIES |
|
801 | 801 | // *** Subque types |
802 | -define('SUBQUE_PLANET' , 1); |
|
803 | -define('SUBQUE_MOON' , 3); |
|
804 | -define('SUBQUE_FLEET' , 4); |
|
805 | -define('SUBQUE_DEFENSE' , 6); |
|
802 | +define('SUBQUE_PLANET', 1); |
|
803 | +define('SUBQUE_MOON', 3); |
|
804 | +define('SUBQUE_FLEET', 4); |
|
805 | +define('SUBQUE_DEFENSE', 6); |
|
806 | 806 | define('SUBQUE_RESEARCH', 7); |
807 | 807 | |
808 | 808 | // *** Que items |
809 | -define('QI_UNIT_ID' , 0); |
|
810 | -define('QI_AMOUNT' , 1); |
|
811 | -define('QI_TIME' , 2); |
|
812 | -define('QI_MODE' , 3); |
|
813 | -define('QI_QUE_ID' , 4); |
|
814 | -define('QI_QUE_TYPE' , 4); |
|
815 | -define('QI_PLANET_ID' , 5); |
|
809 | +define('QI_UNIT_ID', 0); |
|
810 | +define('QI_AMOUNT', 1); |
|
811 | +define('QI_TIME', 2); |
|
812 | +define('QI_MODE', 3); |
|
813 | +define('QI_QUE_ID', 4); |
|
814 | +define('QI_QUE_TYPE', 4); |
|
815 | +define('QI_PLANET_ID', 5); |
|
816 | 816 | |
817 | 817 | |
818 | 818 | // *** Units |
819 | 819 | |
820 | 820 | // *** Sort options |
821 | -define('SORT_ASCENDING' , 0); |
|
821 | +define('SORT_ASCENDING', 0); |
|
822 | 822 | define('SORT_DESCENDING', 1); |
823 | 823 | |
824 | -define('SORT_ID' , 0); |
|
825 | -define('SORT_LOCATION' , 1); |
|
826 | -define('SORT_NAME' , 2); |
|
827 | -define('SORT_SIZE' , 3); |
|
828 | -define('SORT_EMAIL' , 4); |
|
829 | -define('SORT_IP' , 5); |
|
824 | +define('SORT_ID', 0); |
|
825 | +define('SORT_LOCATION', 1); |
|
826 | +define('SORT_NAME', 2); |
|
827 | +define('SORT_SIZE', 3); |
|
828 | +define('SORT_EMAIL', 4); |
|
829 | +define('SORT_IP', 5); |
|
830 | 830 | define('SORT_TIME_REGISTERED', 6); |
831 | 831 | define('SORT_TIME_LAST_VISIT', 7); |
832 | -define('SORT_TIME_BAN_UNTIL' , 8); |
|
833 | -define('SORT_REFERRAL_COUNT' , 9); |
|
834 | -define('SORT_REFERRAL_DM' , 10); |
|
832 | +define('SORT_TIME_BAN_UNTIL', 8); |
|
833 | +define('SORT_REFERRAL_COUNT', 9); |
|
834 | +define('SORT_REFERRAL_DM', 10); |
|
835 | 835 | |
836 | 836 | |
837 | 837 | define('HULL_SIZE_TINY', 1); |
@@ -974,10 +974,10 @@ discard block |
||
974 | 974 | |
975 | 975 | // === Artifacts |
976 | 976 | define('UNIT_ARTIFACTS', 1000); |
977 | -define('ART_LHC', 1001); // Additional moon chance |
|
978 | -define('ART_RCD_SMALL', 1002); // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 - 405 DM |
|
979 | -define('ART_RCD_MEDIUM', 1003); // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 - 4704 DM |
|
980 | -define('ART_RCD_LARGE', 1004); // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM |
|
977 | +define('ART_LHC', 1001); // Additional moon chance |
|
978 | +define('ART_RCD_SMALL', 1002); // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 - 405 DM |
|
979 | +define('ART_RCD_MEDIUM', 1003); // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 - 4704 DM |
|
980 | +define('ART_RCD_LARGE', 1004); // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM |
|
981 | 981 | define('ART_HEURISTIC_CHIP', 1005); // Speed up research |
982 | 982 | define('ART_NANO_BUILDER', 1006); // Speed up building |
983 | 983 | define('ART_NANO_CONSTRUCTOR', 1007); // RESERVED Speed up hangar constructions |
@@ -1048,18 +1048,18 @@ discard block |
||
1048 | 1048 | define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE1', 2201); // Блиц-сервер, участник 0-го раунда, 1-е место |
1049 | 1049 | define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE2', 2202); // Блиц-сервер, участник 0-го раунда, 2-е место |
1050 | 1050 | define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE3', 2203); // Блиц-сервер, участник 0-го раунда, 3-е место |
1051 | -define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1051 | +define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1052 | 1052 | |
1053 | 1053 | define('UNIT_AWARD_MEMORY', 2300); // Памятные знаки за существование и участие - например "4 года в игре". "Был онлайн в новогоднюю ночь 2013". итд |
1054 | -define('UNIT_AWARD_MEMORY_IMMORTAL', 2301); // Бессмертный |
|
1055 | -define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года |
|
1054 | +define('UNIT_AWARD_MEMORY_IMMORTAL', 2301); // Бессмертный |
|
1055 | +define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года |
|
1056 | 1056 | define('UNIT_AWARD_MEMORY_BLITZ_R0', 2303); // Блиц-сервер, участник 0-го раунда |
1057 | 1057 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SIMPLE', 2304); // День Рождения СН |
1058 | 1058 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_BRONZE', 2305); // День Рождения СН |
1059 | 1059 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SILVER', 2306); // День Рождения СН |
1060 | 1060 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_GOLD', 2307); // День Рождения СН |
1061 | 1061 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_PLATINUM', 2308); // День Рождения СН |
1062 | -define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1062 | +define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1063 | 1063 | |
1064 | 1064 | define('UNIT_AWARD_PENNANT', 2400); // Переходящий вымпел - индикация статуса на сервере: "Топ-1", "Топ", "Сабтоп", "Самый большой флот" итд |
1065 | 1065 | define('UNIT_AWARD_BADGE', 2600); // Бейджики/значки за ачивки - например, "Построил 1000 кораблей" |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | |
1157 | 1157 | define('UNIT_NEXT', 4000); // !!! Next unit start on 4000 !!! |
1158 | 1158 | |
1159 | -define('GROUP_PART', 800000); |
|
1159 | +define('GROUP_PART', 800000); |
|
1160 | 1160 | // Зарезервировано для запчастей: 800.001 - 899.999 |
1161 | 1161 | // define('GROUP_PART_HULL', 801000); // Корпуса - 1000 штук |
1162 | 1162 | // define('GROUP_PART_ARMOR', 802000); // Броня - 1000 штук |
@@ -1413,32 +1413,32 @@ discard block |
||
1413 | 1413 | |
1414 | 1414 | |
1415 | 1415 | // define('NICK_ID', -1); |
1416 | -define('NICK_HTML', 0); |
|
1417 | - |
|
1418 | -define('NICK_FIRST', 1); |
|
1419 | -define('NICK_RACE', 1000); |
|
1420 | -define('NICK_GENDER', 2000); |
|
1421 | -define('NICK_AWARD', 3000); |
|
1422 | -define('NICK_VACATION', 3500); |
|
1423 | -define('NICK_BIRTHSDAY', 4000); |
|
1424 | -define('NICK_PREMIUM', 5000); |
|
1425 | -define('NICK_AUTH_LEVEL', 6000); |
|
1426 | - |
|
1427 | -define('NICK_HIGHLIGHT', 6300); |
|
1428 | -define('NICK_CLASS', 6450); |
|
1429 | - |
|
1430 | -define('NICK_NICK_CLASS', 6600); |
|
1431 | -define('NICK_NICK', 7000); |
|
1416 | +define('NICK_HTML', 0); |
|
1417 | + |
|
1418 | +define('NICK_FIRST', 1); |
|
1419 | +define('NICK_RACE', 1000); |
|
1420 | +define('NICK_GENDER', 2000); |
|
1421 | +define('NICK_AWARD', 3000); |
|
1422 | +define('NICK_VACATION', 3500); |
|
1423 | +define('NICK_BIRTHSDAY', 4000); |
|
1424 | +define('NICK_PREMIUM', 5000); |
|
1425 | +define('NICK_AUTH_LEVEL', 6000); |
|
1426 | + |
|
1427 | +define('NICK_HIGHLIGHT', 6300); |
|
1428 | +define('NICK_CLASS', 6450); |
|
1429 | + |
|
1430 | +define('NICK_NICK_CLASS', 6600); |
|
1431 | +define('NICK_NICK', 7000); |
|
1432 | 1432 | define('NICK_NICK_CLASS_END', 7300); |
1433 | 1433 | |
1434 | -define('NICK_ALLY_CLASS', 7600); |
|
1435 | -define('NICK_ALLY', 8000); |
|
1434 | +define('NICK_ALLY_CLASS', 7600); |
|
1435 | +define('NICK_ALLY', 8000); |
|
1436 | 1436 | define('NICK_ALLY_CLASS_END', 8300); |
1437 | 1437 | |
1438 | -define('NICK_CLASS_END', 8450); |
|
1439 | -define('NICK_HIGHLIGHT_END', 8600); |
|
1438 | +define('NICK_CLASS_END', 8450); |
|
1439 | +define('NICK_HIGHLIGHT_END', 8600); |
|
1440 | 1440 | |
1441 | -define('NICK_LAST', 9999); |
|
1441 | +define('NICK_LAST', 9999); |
|
1442 | 1442 | |
1443 | 1443 | // Настройки игрока |
1444 | 1444 | define('PLAYER_OPTION_MENU_SORT', 1); |
@@ -1531,8 +1531,8 @@ discard block |
||
1531 | 1531 | define('LOG_ONLIINE_AGGREGATE_PERIOD_MINUTE_10', 1); |
1532 | 1532 | |
1533 | 1533 | define('BLITZ_REGISTER_DISABLED', 0); |
1534 | -define('BLITZ_REGISTER_OPEN' , 1); |
|
1535 | -define('BLITZ_REGISTER_CLOSED' , 2); |
|
1534 | +define('BLITZ_REGISTER_OPEN', 1); |
|
1535 | +define('BLITZ_REGISTER_CLOSED', 2); |
|
1536 | 1536 | define('BLITZ_REGISTER_SHOW_LOGIN', 3); |
1537 | 1537 | define('BLITZ_REGISTER_DISCLOSURE_NAMES', 4); |
1538 | 1538 |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | define('INSIDE', true); |
13 | 13 | define('INSTALL', false); |
14 | 14 | define('IN_ADMIN', true); |
15 | -require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
15 | +require('../common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
16 | 16 | |
17 | 17 | global $user; |
18 | -if($user['authlevel'] < 3) { |
|
18 | +if ($user['authlevel'] < 3) { |
|
19 | 19 | AdminMessage(classLocale::$lang['adm_err_denied']); |
20 | 20 | } |
21 | 21 | |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | $sort = sys_get_param_int('sort', SORT_ID); |
40 | 40 | $sort = $sort_fields[$sort] ? $sort : SORT_ID; |
41 | 41 | |
42 | -if(($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid'))) { |
|
42 | +if (($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid'))) { |
|
43 | 43 | $user_selected = DBStaticUser::db_user_by_id($user_id, false, 'id, username, authlevel'); |
44 | - if($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) { |
|
45 | - switch($action) { |
|
44 | + if ($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) { |
|
45 | + switch ($action) { |
|
46 | 46 | case ACTION_DELETE: |
47 | 47 | DeleteSelectedUser($user_id); |
48 | 48 | sys_redirect("{$_SERVER['SCRIPT_NAME']}?sort={$sort}"); |
@@ -62,20 +62,20 @@ discard block |
||
62 | 62 | $template = gettemplate('admin/userlist', true); |
63 | 63 | |
64 | 64 | $multi_ip = array(); |
65 | -foreach(DBStaticUser::db_user_list_admin_multiaccounts() as $ip) { |
|
65 | +foreach (DBStaticUser::db_user_list_admin_multiaccounts() as $ip) { |
|
66 | 66 | $multi_ip[$ip['user_lastip']] = $ip['ip_count']; |
67 | 67 | } |
68 | 68 | |
69 | 69 | $geoip = geoip_status(); |
70 | 70 | $count = 0; |
71 | -foreach(DBStaticUser::db_user_list_admin_sorted($sort_fields[$sort], $is_players_online_page) as $user_row ) { |
|
71 | +foreach (DBStaticUser::db_user_list_admin_sorted($sort_fields[$sort], $is_players_online_page) as $user_row) { |
|
72 | 72 | $count++; |
73 | - if($user_row['banaday']) { |
|
73 | + if ($user_row['banaday']) { |
|
74 | 74 | $ban_details = db_ban_list_get_details($user_row); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $geoip_info = $geoip ? geoip_ip_info(ip2longu($user_row['user_lastip'])) : array(); |
78 | - foreach($geoip_info as $key => $value) { |
|
78 | + foreach ($geoip_info as $key => $value) { |
|
79 | 79 | $geoip_info[strtoupper($key)] = $value; |
80 | 80 | unset($geoip_info[$key]); |
81 | 81 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | foreach ($checklist as $condition => $action) { |
58 | 58 | |
59 | 59 | $checkResult = call_user_func(array($this, $condition)); |
60 | - pdump($action, $condition . ' ' . ($checkResult ? 'TRUE' : 'FALSE')); |
|
60 | + pdump($action, $condition.' '.($checkResult ? 'TRUE' : 'FALSE')); |
|
61 | 61 | |
62 | 62 | // // Simple action on failed check |
63 | 63 | // if(!is_array($action)) { |
@@ -542,10 +542,10 @@ discard block |
||
542 | 542 | protected function checkMissionPrefix($name, $prefix) { |
543 | 543 | $result = false; |
544 | 544 | if (strpos($name, $prefix) === 0) { |
545 | - $mission = 'MT_' . strtoupper(substr($name, strlen($prefix))); |
|
545 | + $mission = 'MT_'.strtoupper(substr($name, strlen($prefix))); |
|
546 | 546 | if (!defined($mission)) { |
547 | 547 | // TODO - Ну, как-то получше это обделать |
548 | - throw new Exception('Mission type "' . $mission . '" is not defined'); |
|
548 | + throw new Exception('Mission type "'.$mission.'" is not defined'); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | $result = constant($mission); |
@@ -116,12 +116,12 @@ |
||
116 | 116 | * @return static |
117 | 117 | */ |
118 | 118 | public static function convertToVector($coordinates, $prefix = '') { |
119 | - $galaxy = !empty($coordinates[$prefix . 'galaxy']) ? intval($coordinates[$prefix . 'galaxy']) : 0; |
|
120 | - $system = !empty($coordinates[$prefix . 'system']) ? intval($coordinates[$prefix . 'system']) : 0; |
|
121 | - $planet = !empty($coordinates[$prefix . 'planet']) ? intval($coordinates[$prefix . 'planet']) : 0; |
|
122 | - $type = !empty($coordinates[$prefix . 'type']) |
|
123 | - ? intval($coordinates[$prefix . 'type']) |
|
124 | - : (!empty($coordinates[$prefix . 'planet_type']) ? intval($coordinates[$prefix . 'planet_type']) : 0); |
|
119 | + $galaxy = !empty($coordinates[$prefix.'galaxy']) ? intval($coordinates[$prefix.'galaxy']) : 0; |
|
120 | + $system = !empty($coordinates[$prefix.'system']) ? intval($coordinates[$prefix.'system']) : 0; |
|
121 | + $planet = !empty($coordinates[$prefix.'planet']) ? intval($coordinates[$prefix.'planet']) : 0; |
|
122 | + $type = !empty($coordinates[$prefix.'type']) |
|
123 | + ? intval($coordinates[$prefix.'type']) |
|
124 | + : (!empty($coordinates[$prefix.'planet_type']) ? intval($coordinates[$prefix.'planet_type']) : 0); |
|
125 | 125 | |
126 | 126 | return new static($galaxy, $system, $planet, $type); |
127 | 127 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Защита от двойного инита |
4 | -if(defined('INIT')) { |
|
4 | +if (defined('INIT')) { |
|
5 | 5 | return; |
6 | 6 | } |
7 | 7 | |
@@ -20,22 +20,22 @@ discard block |
||
20 | 20 | version_compare(PHP_VERSION, '5.3.2') < 0 ? die('FATAL ERROR: SuperNova REQUIRE PHP version > 5.3.2') : false; |
21 | 21 | |
22 | 22 | // Бенчмарк |
23 | -register_shutdown_function(function () { |
|
24 | - if(defined('IN_AJAX')) { |
|
23 | +register_shutdown_function(function() { |
|
24 | + if (defined('IN_AJAX')) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | |
28 | 28 | global $user, $locale_cache_statistic; |
29 | 29 | |
30 | - print('<hr><div class="benchmark">Benchmark ' . (microtime(true) - SN_TIME_MICRO) . 's, memory: ' . number_format(memory_get_usage() - SN_MEM_START) . |
|
31 | - (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : '') . |
|
32 | - (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: ' . classSupernova::$db->time_mysql_total . 'ms' : '') . |
|
30 | + print('<hr><div class="benchmark">Benchmark '.(microtime(true) - SN_TIME_MICRO).'s, memory: '.number_format(memory_get_usage() - SN_MEM_START). |
|
31 | + (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : ''). |
|
32 | + (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: '.classSupernova::$db->time_mysql_total.'ms' : ''). |
|
33 | 33 | '</div>'); |
34 | - if($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) { |
|
34 | + if ($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL.'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL.'badqrys.txt') > 0) { |
|
35 | 35 | echo '<a href="badqrys.txt" target="_blank" style="color:red">', 'HACK ALERT!', '</a>'; |
36 | 36 | } |
37 | 37 | |
38 | - if(!empty($locale_cache_statistic['misses'])) { |
|
38 | + if (!empty($locale_cache_statistic['misses'])) { |
|
39 | 39 | print('<!--'); |
40 | 40 | pdump($locale_cache_statistic); |
41 | 41 | print('-->'); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | define('SN_TIME_NOW_GMT_STRING', gmdate(DATE_ATOM, SN_TIME_NOW)); |
57 | 57 | |
58 | -if(strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
58 | +if (strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
59 | 59 | define('SN_GOOGLE', true); |
60 | 60 | } |
61 | 61 | |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | $sn_root_relative = str_replace($sn_root_relative, '', $_SERVER['SCRIPT_NAME']); |
75 | 75 | define('SN_ROOT_RELATIVE', $sn_root_relative); |
76 | 76 | |
77 | -define('SN_ROOT_VIRTUAL', 'http' . (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . SN_ROOT_RELATIVE); |
|
77 | +define('SN_ROOT_VIRTUAL', 'http'.(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://'.$_SERVER['HTTP_HOST'].SN_ROOT_RELATIVE); |
|
78 | 78 | define('SN_ROOT_VIRTUAL_PARENT', str_replace('//google.', '//', SN_ROOT_VIRTUAL)); |
79 | 79 | |
80 | 80 | $phpEx = strpos($phpEx = substr(strrchr(__FILE__, '.'), 1), '/') === false ? $phpEx : ''; |
81 | 81 | define('PHP_EX', $phpEx); // PHP extension on this server |
82 | -define('DOT_PHP_EX', '.' . PHP_EX); // PHP extension on this server |
|
82 | +define('DOT_PHP_EX', '.'.PHP_EX); // PHP extension on this server |
|
83 | 83 | |
84 | 84 | |
85 | 85 | require_once('constants.php'); |
@@ -100,16 +100,16 @@ discard block |
||
100 | 100 | |
101 | 101 | // required for db.php |
102 | 102 | // Initializing global 'debug' object |
103 | -require_once(SN_ROOT_PHYSICAL . "includes/debug.class" . DOT_PHP_EX); |
|
103 | +require_once(SN_ROOT_PHYSICAL."includes/debug.class".DOT_PHP_EX); |
|
104 | 104 | classSupernova::$debug = new debug(); |
105 | 105 | |
106 | -empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL . 'includes/classes/' : false; |
|
107 | -spl_autoload_register(function ($class) use ($classRoot) { |
|
106 | +empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL.'includes/classes/' : false; |
|
107 | +spl_autoload_register(function($class) use ($classRoot) { |
|
108 | 108 | $class = str_replace('\\', '/', $class); |
109 | - if (file_exists($classRoot . $class . '.php')) { |
|
110 | - require_once $classRoot . $class . '.php'; |
|
111 | - } elseif (file_exists($classRoot . 'UBE/' . $class . '.php')) { |
|
112 | - require_once $classRoot . 'UBE/' . $class . '.php'; |
|
109 | + if (file_exists($classRoot.$class.'.php')) { |
|
110 | + require_once $classRoot.$class.'.php'; |
|
111 | + } elseif (file_exists($classRoot.'UBE/'.$class.'.php')) { |
|
112 | + require_once $classRoot.'UBE/'.$class.'.php'; |
|
113 | 113 | } |
114 | 114 | }); |
115 | 115 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | //}); |
125 | 125 | |
126 | 126 | |
127 | -require_once(SN_ROOT_PHYSICAL . "includes/db" . DOT_PHP_EX); |
|
127 | +require_once(SN_ROOT_PHYSICAL."includes/db".DOT_PHP_EX); |
|
128 | 128 | require_once('classes/db_mysql_v4.php'); |
129 | 129 | require_once('classes/db_mysql_v5.php'); |
130 | 130 | require_once('classes/db_mysql.php'); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | require_once('classes/module.php'); |
138 | 138 | |
139 | 139 | require_once('classes/user_options.php'); |
140 | -require_once(SN_ROOT_PHYSICAL . "includes/init/init_functions" . DOT_PHP_EX); |
|
140 | +require_once(SN_ROOT_PHYSICAL."includes/init/init_functions".DOT_PHP_EX); |
|
141 | 141 | |
142 | 142 | /** |
143 | 143 | * @var classConfig $config |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | // define('BE_DEBUG', true); // Отладка боевого движка |
151 | 151 | classSupernova::init_debug_state(); |
152 | 152 | |
153 | -require_once(SN_ROOT_PHYSICAL . "includes/vars/vars" . DOT_PHP_EX); |
|
154 | -require_once(SN_ROOT_PHYSICAL . "includes/general" . DOT_PHP_EX); |
|
153 | +require_once(SN_ROOT_PHYSICAL."includes/vars/vars".DOT_PHP_EX); |
|
154 | +require_once(SN_ROOT_PHYSICAL."includes/general".DOT_PHP_EX); |
|
155 | 155 | |
156 | 156 | init_update(); |
157 | 157 | |
@@ -160,28 +160,28 @@ discard block |
||
160 | 160 | ? trim(strip_tags($_GET['page'])) |
161 | 161 | : str_replace(DOT_PHP_EX, '', str_replace(SN_ROOT_RELATIVE, '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME']))); |
162 | 162 | define('INITIAL_PAGE', $sn_page_name_original); |
163 | -define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova') . (defined('SN_GOOGLE') ? '_G' : '')); |
|
164 | -define('SN_COOKIE_I', SN_COOKIE . AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
165 | -define('SN_COOKIE_D', SN_COOKIE . '_D'); |
|
166 | -define('SN_COOKIE_T', SN_COOKIE . '_T'); // Time measure cookie |
|
167 | -define('SN_COOKIE_F', SN_COOKIE . '_F'); // Font size cookie |
|
168 | -define('SN_COOKIE_U', SN_COOKIE . '_U'); // Current user cookie aka user ID |
|
169 | -define('SN_COOKIE_U_I', SN_COOKIE_U . AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
163 | +define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova').(defined('SN_GOOGLE') ? '_G' : '')); |
|
164 | +define('SN_COOKIE_I', SN_COOKIE.AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
165 | +define('SN_COOKIE_D', SN_COOKIE.'_D'); |
|
166 | +define('SN_COOKIE_T', SN_COOKIE.'_T'); // Time measure cookie |
|
167 | +define('SN_COOKIE_F', SN_COOKIE.'_F'); // Font size cookie |
|
168 | +define('SN_COOKIE_U', SN_COOKIE.'_U'); // Current user cookie aka user ID |
|
169 | +define('SN_COOKIE_U_I', SN_COOKIE_U.AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
170 | 170 | define('TEMPLATE_NAME', classSupernova::$config->game_default_template ? classSupernova::$config->game_default_template : 'OpenGame'); |
171 | -define('TEMPLATE_PATH', 'design/templates/' . TEMPLATE_NAME); |
|
172 | -define('TEMPLATE_DIR', SN_ROOT_PHYSICAL . TEMPLATE_PATH); |
|
171 | +define('TEMPLATE_PATH', 'design/templates/'.TEMPLATE_NAME); |
|
172 | +define('TEMPLATE_DIR', SN_ROOT_PHYSICAL.TEMPLATE_PATH); |
|
173 | 173 | define('DEFAULT_SKINPATH', classSupernova::$config->game_default_skin ? classSupernova::$config->game_default_skin : 'skins/EpicBlue/'); |
174 | 174 | define('DEFAULT_LANG', classSupernova::$config->game_default_language ? classSupernova::$config->game_default_language : 'ru'); |
175 | 175 | define('FMT_DATE', classSupernova::$config->int_format_date ? classSupernova::$config->int_format_date : 'd.m.Y'); |
176 | 176 | define('FMT_TIME', classSupernova::$config->int_format_time ? classSupernova::$config->int_format_time : 'H:i:s'); |
177 | -define('FMT_DATE_TIME', FMT_DATE . ' ' . FMT_TIME); |
|
177 | +define('FMT_DATE_TIME', FMT_DATE.' '.FMT_TIME); |
|
178 | 178 | |
179 | 179 | $HTTP_ACCEPT_LANGUAGE = DEFAULT_LANG; |
180 | 180 | |
181 | -require_once(SN_ROOT_PHYSICAL . "includes/template" . DOT_PHP_EX); |
|
181 | +require_once(SN_ROOT_PHYSICAL."includes/template".DOT_PHP_EX); |
|
182 | 182 | $template_result = array('.' => array('result' => array())); |
183 | 183 | |
184 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "includes/functions/", PHP_EX); |
|
184 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."includes/functions/", PHP_EX); |
|
185 | 185 | |
186 | 186 | |
187 | 187 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | // Конфиг - часть манифеста? |
193 | 193 | classSupernova::$auth = new core_auth(); |
194 | 194 | |
195 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "modules/", PHP_EX, true); |
|
195 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."modules/", PHP_EX, true); |
|
196 | 196 | // Здесь - потому что core_auth модуль лежит в другом каталоге и его нужно инициализировать отдельно |
197 | 197 | |
198 | 198 | // Подключаем дефолтную страницу |
@@ -200,10 +200,10 @@ discard block |
||
200 | 200 | // Сейчас мы делаем это здесь только для того, что бы содержание дефолтной страницы оказалось вверху. Что не факт, что нужно всегда |
201 | 201 | // Но нужно, пока у нас есть не MVC-страницы |
202 | 202 | $sn_page_data = $sn_data['pages'][$sn_page_name]; |
203 | -$sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
|
204 | -if($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
203 | +$sn_page_name_file = 'includes/pages/'.$sn_page_data['filename'].DOT_PHP_EX; |
|
204 | +if ($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
205 | 205 | require_once($sn_page_name_file); |
206 | - if(is_array($sn_page_data['options'])) { |
|
206 | + if (is_array($sn_page_data['options'])) { |
|
207 | 207 | classSupernova::$options = array_merge(classSupernova::$options, $sn_page_data['options']); |
208 | 208 | } |
209 | 209 | } |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | $load_order = array(); |
219 | 219 | $sn_req = array(); |
220 | 220 | |
221 | -foreach(sn_module::$sn_module as $loaded_module_name => $module_data) { |
|
221 | +foreach (sn_module::$sn_module as $loaded_module_name => $module_data) { |
|
222 | 222 | $load_order[$loaded_module_name] = isset($module_data->manifest['load_order']) && !empty($module_data->manifest['load_order']) ? $module_data->manifest['load_order'] : 100000; |
223 | - if(isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) { |
|
224 | - foreach($module_data->manifest['require'] as $require_name) { |
|
223 | + if (isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) { |
|
224 | + foreach ($module_data->manifest['require'] as $require_name) { |
|
225 | 225 | $sn_req[$loaded_module_name][$require_name] = 0; |
226 | 226 | } |
227 | 227 | } |
@@ -234,10 +234,10 @@ discard block |
||
234 | 234 | do { |
235 | 235 | $prev_order = $load_order; |
236 | 236 | |
237 | - foreach($sn_req as $loaded_module_name => &$req_data) { |
|
237 | + foreach ($sn_req as $loaded_module_name => &$req_data) { |
|
238 | 238 | $level = 1; |
239 | - foreach($req_data as $req_name => &$req_level) { |
|
240 | - if($load_order[$req_name] == -1 || !isset($load_order[$req_name])) { |
|
239 | + foreach ($req_data as $req_name => &$req_level) { |
|
240 | + if ($load_order[$req_name] == -1 || !isset($load_order[$req_name])) { |
|
241 | 241 | $level = $req_level = -1; |
242 | 242 | break; |
243 | 243 | } else { |
@@ -245,20 +245,20 @@ discard block |
||
245 | 245 | } |
246 | 246 | $req_level = $load_order[$req_name]; |
247 | 247 | } |
248 | - if($level > $load_order[$loaded_module_name] || $level == -1) { |
|
248 | + if ($level > $load_order[$loaded_module_name] || $level == -1) { |
|
249 | 249 | $load_order[$loaded_module_name] = $level; |
250 | 250 | } |
251 | 251 | } |
252 | -} while($prev_order != $load_order); |
|
252 | +} while ($prev_order != $load_order); |
|
253 | 253 | |
254 | 254 | asort($load_order); |
255 | 255 | |
256 | 256 | // Инициализируем модули |
257 | 257 | // По нормальным делам это должна быть загрузка модулей и лишь затем инициализация - что бы минимизировать размер процесса в памяти |
258 | -foreach($load_order as $loaded_module_name => $load_order_order) { |
|
259 | - if($load_order_order >= 0) { |
|
258 | +foreach ($load_order as $loaded_module_name => $load_order_order) { |
|
259 | + if ($load_order_order >= 0) { |
|
260 | 260 | sn_module::$sn_module[$loaded_module_name]->check_status(); |
261 | - if(!sn_module::$sn_module[$loaded_module_name]->manifest['active']) { |
|
261 | + if (!sn_module::$sn_module[$loaded_module_name]->manifest['active']) { |
|
262 | 262 | unset(sn_module::$sn_module[$loaded_module_name]); |
263 | 263 | continue; |
264 | 264 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | unset($sn_req); |
276 | 276 | |
277 | 277 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
278 | -if(!isset($sn_data['pages'][$sn_page_name])) { |
|
278 | +if (!isset($sn_data['pages'][$sn_page_name])) { |
|
279 | 279 | $sn_page_name = ''; |
280 | 280 | } |
281 | 281 | |
@@ -283,6 +283,6 @@ discard block |
||
283 | 283 | classLocale::$lang = $lang = new classLocale(classSupernova::$config->server_locale_log_usage); |
284 | 284 | classLocale::$lang->lng_switch(sys_get_param_str('lang')); |
285 | 285 | |
286 | -if(!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
286 | +if (!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
287 | 287 | require_once "init_secondary.php"; |
288 | 288 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | 'checkSpeedPercentOld' => FLIGHT_FLEET_SPEED_WRONG, |
11 | 11 | 'checkTargetInUniverse' => FLIGHT_VECTOR_BEYOND_UNIVERSE, |
12 | 12 | 'checkTargetNotSource' => FLIGHT_VECTOR_SAME_SOURCE, |
13 | - 'checkSenderNoVacation' => FLIGHT_PLAYER_VACATION_OWN, // tODO |
|
13 | + 'checkSenderNoVacation' => FLIGHT_PLAYER_VACATION_OWN, // tODO |
|
14 | 14 | 'checkTargetNoVacation' => FLIGHT_PLAYER_VACATION, |
15 | 15 | 'checkFleetNotEmpty' => FLIGHT_SHIPS_NO_SHIPS, |
16 | 16 | // 'checkUnitsPositive' => FLIGHT_SHIPS_NEGATIVE, // Unused - 'cause it's not allowed to put negative units into Unit class |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | 'factor' => 1.5, |
16 | 16 | ), |
17 | 17 | P_UNIT_PRODUCTION => array( |
18 | - RES_METAL => function ($level, $production_factor, $user, $planet_row) {return 40 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
19 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
18 | + RES_METAL => function($level, $production_factor, $user, $planet_row) {return 40 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
19 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
20 | 20 | ), |
21 | 21 | P_MINING_IS_MANAGED => true, |
22 | 22 | ), |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | 'factor' => 1.6, |
34 | 34 | ), |
35 | 35 | P_UNIT_PRODUCTION => array( |
36 | - RES_CRYSTAL => function ($level, $production_factor, $user, $planet_row) {return 32 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
37 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
36 | + RES_CRYSTAL => function($level, $production_factor, $user, $planet_row) {return 32 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
37 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
38 | 38 | ), |
39 | 39 | P_MINING_IS_MANAGED => true, |
40 | 40 | ), |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | 'factor' => 1.5, |
52 | 52 | ), |
53 | 53 | P_UNIT_PRODUCTION => array( |
54 | - RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return 10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28);}, |
|
55 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
54 | + RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return 10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28); }, |
|
55 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
56 | 56 | ), |
57 | 57 | P_MINING_IS_MANAGED => true, |
58 | 58 | ), |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | 'factor' => 1.5, |
70 | 70 | ), |
71 | 71 | P_UNIT_PRODUCTION => array( |
72 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
72 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
73 | 73 | ), |
74 | 74 | P_MINING_IS_MANAGED => true, |
75 | 75 | ), |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | 'factor' => 1.8, |
88 | 88 | ), |
89 | 89 | P_UNIT_PRODUCTION => array( |
90 | - RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor);}, |
|
91 | - RES_ENERGY => function ($level, $production_factor, $user, $planet_row) {return 30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, null, TECH_ENERGY), $level) * (0.1 * $production_factor);}, |
|
90 | + RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) {return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor); }, |
|
91 | + RES_ENERGY => function($level, $production_factor, $user, $planet_row) {return 30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, null, TECH_ENERGY), $level) * (0.1 * $production_factor); }, |
|
92 | 92 | ), |
93 | 93 | P_MINING_IS_MANAGED => true, |
94 | 94 | ), |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | 'factor' => 2, |
106 | 106 | ), |
107 | 107 | 'storage' => array( |
108 | - RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);}, |
|
108 | + RES_METAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
109 | 109 | ), |
110 | 110 | ), |
111 | 111 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'factor' => 2, |
122 | 122 | ), |
123 | 123 | 'storage' => array( |
124 | - RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);}, |
|
124 | + RES_CRYSTAL => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
125 | 125 | ), |
126 | 126 | ), |
127 | 127 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | 'factor' => 2, |
138 | 138 | ), |
139 | 139 | 'storage' => array( |
140 | - RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level);}, |
|
140 | + RES_DEUTERIUM => function($level) {return BASE_STORAGE_SIZE * pow(1.5, $level); }, |
|
141 | 141 | ), |
142 | 142 | ), |
143 | 143 |