@@ -18,7 +18,7 @@ |
||
18 | 18 | ->setIdField($entity->getIdFieldName()) |
19 | 19 | ->field('*') |
20 | 20 | ->from($entity->getTableName()) |
21 | - ->where($entity->getIdFieldName() . ' = "' . $entity->dbId . '"'); |
|
21 | + ->where($entity->getIdFieldName().' = "'.$entity->dbId.'"'); |
|
22 | 22 | |
23 | 23 | return $stmt->selectRow(); |
24 | 24 | } |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | $query = $this->db->doSelect( |
199 | 199 | "SELECT |
200 | 200 | distinct({{{$location_info[P_TABLE_NAME]}}}.{$owner_data[P_OWNER_FIELD]}) AS parent_id |
201 | - FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
202 | - ($filter ? ' WHERE ' . $filter : '') . |
|
201 | + FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
202 | + ($filter ? ' WHERE '.$filter : ''). |
|
203 | 203 | ($fetch ? ' LIMIT 1' : '')); |
204 | - while($row = db_fetch($query)) { |
|
204 | + while ($row = db_fetch($query)) { |
|
205 | 205 | // Исключаем из списка родительских ИД уже заблокированные записи |
206 | 206 | if (!$this->snCache->cache_lock_get($owner_location_type, $row['parent_id'])) { |
207 | 207 | $parent_id_list[$row['parent_id']] = $row['parent_id']; |
@@ -212,17 +212,17 @@ discard block |
||
212 | 212 | if ($indexes_str = implode(',', $parent_id_list)) { |
213 | 213 | $parent_id_field = static::$location_info[$owner_location_type][P_ID]; |
214 | 214 | classSupernova::$gc->cacheOperator->db_get_record_list($owner_location_type, |
215 | - $parent_id_field . (count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
215 | + $parent_id_field.(count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
220 | 220 | $query = $this->db->doSelect( |
221 | - "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
221 | + "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
222 | 222 | (($filter = trim($filter)) ? " WHERE {$filter}" : '') |
223 | 223 | . " FOR UPDATE" |
224 | 224 | ); |
225 | - while($row = db_fetch($query)) { |
|
225 | + while ($row = db_fetch($query)) { |
|
226 | 226 | // Caching record in row cache |
227 | 227 | $this->snCache->cache_set($location_type, $row); |
228 | 228 | // Making ref to cached record in query cache |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $condition = trim($condition); |
293 | 293 | $table_name = static::$location_info[$location_type][P_TABLE_NAME]; |
294 | 294 | |
295 | - if ($result = $this->db->doUpdate("UPDATE {{{$table_name}}} SET " . $set . ($condition ? ' WHERE ' . $condition : ''))) { |
|
295 | + if ($result = $this->db->doUpdate("UPDATE {{{$table_name}}} SET ".$set.($condition ? ' WHERE '.$condition : ''))) { |
|
296 | 296 | |
297 | 297 | if ($this->db->db_affected_rows()) { // Обновляем данные только если ряд был затронут |
298 | 298 | // Поскольку нам неизвестно, что и как обновилось - сбрасываем кэш этого типа полностью |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | public function db_lock_tables($tables) { |
364 | 364 | $tables = is_array($tables) ? $tables : array($tables => ''); |
365 | 365 | foreach ($tables as $table_name => $condition) { |
366 | - $this->db->doSelect("SELECT 1 FROM {{{$table_name}}}" . ($condition ? ' WHERE ' . $condition : '')); |
|
366 | + $this->db->doSelect("SELECT 1 FROM {{{$table_name}}}".($condition ? ' WHERE '.$condition : '')); |
|
367 | 367 | } |
368 | 368 | } |
369 | 369 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | if (classSupernova::$gc->snCache->isUnitLocatorNotSet($location_type, $location_id)) { |
27 | - $got_data = classSupernova::$gc->cacheOperator->db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND " . DBStaticUnit::db_unit_time_restrictions()); |
|
27 | + $got_data = classSupernova::$gc->cacheOperator->db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND ".DBStaticUnit::db_unit_time_restrictions()); |
|
28 | 28 | if (!empty($got_data) && is_array($got_data)) { |
29 | 29 | foreach ($got_data as $unit_id => $unit_data) { |
30 | 30 | classSupernova::$gc->snCache->setUnitLocatorByLocationAndIDs($location_type, $location_id, $unit_data); |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | |
60 | 60 | public static function db_unit_count_by_user_and_type_and_snid($user_id, $unit_type = 0, $unit_snid = 0) { |
61 | 61 | $query = classSupernova::$db->doSelect( |
62 | - "SELECT unit_snid, sum(unit_level) as `qty` FROM {{unit}} WHERE `unit_player_id` = {$user_id} " . |
|
63 | - ($unit_type ? "AND `unit_type` = {$unit_type} " : '') . |
|
64 | - ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : '') . |
|
62 | + "SELECT unit_snid, sum(unit_level) as `qty` FROM {{unit}} WHERE `unit_player_id` = {$user_id} ". |
|
63 | + ($unit_type ? "AND `unit_type` = {$unit_type} " : ''). |
|
64 | + ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : ''). |
|
65 | 65 | 'GROUP BY `unit_snid`' |
66 | 66 | ); |
67 | 67 | $result = array(); |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | WHERE |
82 | 82 | f.fleet_owner = {$user_id} AND |
83 | 83 | (f.fleet_start_planet_id = {$location_id} OR f.fleet_end_planet_id = {$location_id}) |
84 | - AND u.unit_snid = {$unit_snid} AND u.`unit_location_type` = " . LOC_FLEET . " AND " . self::db_unit_time_restrictions() . |
|
85 | - " LIMIT 1" . |
|
84 | + AND u.unit_snid = {$unit_snid} AND u.`unit_location_type` = ".LOC_FLEET." AND ".self::db_unit_time_restrictions(). |
|
85 | + " LIMIT 1". |
|
86 | 86 | ($for_update ? ' FOR UPDATE' : '')); |
87 | 87 | } |
88 | 88 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | public static function db_unit_list_laboratories($user_id) { |
91 | 91 | return classSupernova::$db->doSelect("SELECT DISTINCT unit_location_id AS `id` |
92 | 92 | FROM {{unit}} |
93 | - WHERE unit_player_id = {$user_id} AND unit_location_type = " . LOC_PLANET . " AND unit_level > 0 AND unit_snid IN (" . STRUC_LABORATORY . ", " . STRUC_LABORATORY_NANO . ");"); |
|
93 | + WHERE unit_player_id = {$user_id} AND unit_location_type = ".LOC_PLANET." AND unit_level > 0 AND unit_snid IN (".STRUC_LABORATORY.", ".STRUC_LABORATORY_NANO.");"); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | public static function db_unit_set_by_id($unit_id, $set) { |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | return classSupernova::$db->doSelect( |
125 | 125 | "SELECT unit_player_id, unit_type, unit_snid, unit_level, count(*) AS unit_amount |
126 | 126 | FROM `{{unit}}` |
127 | - WHERE unit_level > 0 AND " . self::db_unit_time_restrictions() . |
|
127 | + WHERE unit_level > 0 AND " . self::db_unit_time_restrictions(). |
|
128 | 128 | " GROUP BY unit_player_id, unit_type, unit_snid, unit_level" |
129 | 129 | ); |
130 | 130 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | public static function db_unit_list_admin_delete_mercenaries_finished() { |
139 | 139 | return classSupernova::$db->doDeleteDeprecated(TABLE_UNIT, array( |
140 | 140 | 'unit_time_finish IS NOT NULL', |
141 | - "unit_time_finish < FROM_UNIXTIME(" . SN_TIME_NOW . ")", |
|
141 | + "unit_time_finish < FROM_UNIXTIME(".SN_TIME_NOW.")", |
|
142 | 142 | 'unit_type' => UNIT_MERCENARIES, |
143 | 143 | )); |
144 | 144 | } |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | return classSupernova::$db->doUpdate( |
148 | 148 | "UPDATE `{{unit}}` |
149 | 149 | SET |
150 | - unit_time_start = FROM_UNIXTIME(" . SN_TIME_NOW . "), |
|
151 | - unit_time_finish = FROM_UNIXTIME(" . (SN_TIME_NOW + $default_length) . ") |
|
150 | + unit_time_start = FROM_UNIXTIME(" . SN_TIME_NOW."), |
|
151 | + unit_time_finish = FROM_UNIXTIME(" . (SN_TIME_NOW + $default_length).") |
|
152 | 152 | WHERE unit_type = " . UNIT_MERCENARIES |
153 | 153 | ); |
154 | 154 | } |
@@ -173,19 +173,19 @@ discard block |
||
173 | 173 | |
174 | 174 | $temp = DBStaticUnit::db_get_unit_by_location($user['id'], $unit_location, $location_id, $unit_id, true, 'unit_id'); |
175 | 175 | if (!empty($temp['unit_id'])) { |
176 | - $result = (bool)classSupernova::$gc->cacheOperator->db_upd_record_list( |
|
176 | + $result = (bool) classSupernova::$gc->cacheOperator->db_upd_record_list( |
|
177 | 177 | LOC_UNIT, "`unit_level` = `unit_level` + ($unit_value)", "`unit_id` = {$temp['unit_id']}" |
178 | 178 | ); |
179 | 179 | } else { |
180 | 180 | $locationIdRendered = $unit_location == LOC_USER ? $user['id'] : $planet_id; |
181 | 181 | $unitType = get_unit_param($unit_id, P_UNIT_TYPE); |
182 | - $result = (bool)classSupernova::$gc->cacheOperator->db_ins_record(LOC_UNIT, array( |
|
182 | + $result = (bool) classSupernova::$gc->cacheOperator->db_ins_record(LOC_UNIT, array( |
|
183 | 183 | 'unit_player_id' => $user['id'], |
184 | - 'unit_location_type' => (int)$unit_location, |
|
184 | + 'unit_location_type' => (int) $unit_location, |
|
185 | 185 | 'unit_location_id' => $locationIdRendered, |
186 | - 'unit_type' => (int)$unitType, |
|
187 | - 'unit_snid' => (int)$unit_id, |
|
188 | - 'unit_level' => (float)$unit_value, |
|
186 | + 'unit_type' => (int) $unitType, |
|
187 | + 'unit_snid' => (int) $unit_id, |
|
188 | + 'unit_level' => (float) $unit_value, |
|
189 | 189 | )); |
190 | 190 | } |
191 | 191 |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param db_mysql|null $db |
87 | 87 | */ |
88 | 88 | public static function setDb($db = null) { |
89 | - if(empty($db) || !($db instanceof db_mysql)) { |
|
89 | + if (empty($db) || !($db instanceof db_mysql)) { |
|
90 | 90 | $db = null; |
91 | 91 | } |
92 | 92 | static::$db = !empty($db) || !class_exists('classSupernova', false) ? $db : classSupernova::$db; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | public function dbLoad($dbId, $lockSkip = false) { |
150 | 150 | $dbId = idval($dbId); |
151 | 151 | if ($dbId <= 0) { |
152 | - classSupernova::$debug->error(get_called_class() . '::' . __METHOD__ . ' $dbId not positive = ' . $dbId); |
|
152 | + classSupernova::$debug->error(get_called_class().'::'.__METHOD__.' $dbId not positive = '.$dbId); |
|
153 | 153 | |
154 | 154 | return; |
155 | 155 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $this->dbGetLockById($this->_dbId); |
162 | 162 | } |
163 | 163 | |
164 | - $db_row = classSupernova::$db->doSelectFetch("SELECT * FROM `{{" . static::$_table . "}}` WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId . " LIMIT 1 FOR UPDATE;"); |
|
164 | + $db_row = classSupernova::$db->doSelectFetch("SELECT * FROM `{{".static::$_table."}}` WHERE `".static::$_dbIdFieldName."` = ".$this->_dbId." LIMIT 1 FOR UPDATE;"); |
|
165 | 165 | if (empty($db_row)) { |
166 | 166 | return; |
167 | 167 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | if ($this->isNew()) { |
194 | 194 | // No DB_ID - new unit |
195 | 195 | if ($this->isEmpty()) { |
196 | - classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - object is empty on ' . get_called_class() . '::dbSave'); |
|
196 | + classSupernova::$debug->error(__FILE__.':'.__LINE__.' - object is empty on '.get_called_class().'::dbSave'); |
|
197 | 197 | } |
198 | 198 | $this->dbInsert(); |
199 | 199 | } else { |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $this->dbDelete(); |
203 | 203 | } else { |
204 | 204 | if (!sn_db_transaction_check(false)) { |
205 | - classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - transaction should always be started on ' . get_called_class() . '::dbUpdate'); |
|
205 | + classSupernova::$debug->error(__FILE__.':'.__LINE__.' - transaction should always be started on '.get_called_class().'::dbUpdate'); |
|
206 | 206 | } |
207 | 207 | $this->dbUpdate(); |
208 | 208 | } |
@@ -230,12 +230,12 @@ discard block |
||
230 | 230 | // TODO - protected |
231 | 231 | public function dbInsert() { |
232 | 232 | if (!$this->isNew()) { |
233 | - classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - record db_id is not empty on ' . get_called_class() . '::dbInsert'); |
|
233 | + classSupernova::$debug->error(__FILE__.':'.__LINE__.' - record db_id is not empty on '.get_called_class().'::dbInsert'); |
|
234 | 234 | } |
235 | 235 | $this->_dbId = $this->db_field_set_create($this->dbMakeFieldSet()); |
236 | 236 | |
237 | 237 | if (empty($this->_dbId)) { |
238 | - classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - error saving record ' . get_called_class() . '::dbInsert'); |
|
238 | + classSupernova::$debug->error(__FILE__.':'.__LINE__.' - error saving record '.get_called_class().'::dbInsert'); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | return $this->_dbId; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | public function dbUpdate() { |
249 | 249 | // TODO - Update |
250 | 250 | if ($this->isNew()) { |
251 | - classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbUpdate'); |
|
251 | + classSupernova::$debug->error(__FILE__.':'.__LINE__.' - unit db_id is empty on dbUpdate'); |
|
252 | 252 | } |
253 | 253 | $this->db_field_update($this->dbMakeFieldSet(true)); |
254 | 254 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | // TODO - protected |
260 | 260 | public function dbDelete() { |
261 | 261 | if ($this->isNew()) { |
262 | - classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbDelete'); |
|
262 | + classSupernova::$debug->error(__FILE__.':'.__LINE__.' - unit db_id is empty on dbDelete'); |
|
263 | 263 | } |
264 | 264 | classSupernova::$gc->db->doDeleteRowWhere(static::$_table, array(static::$_dbIdFieldName => $this->_dbId)); |
265 | 265 | $this->_dbId = 0; |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $fields = implode(',', array_keys($field_set)); |
415 | 415 | |
416 | 416 | $result = 0; |
417 | - if (classSupernova::$db->doInsertComplex("INSERT INTO `{{" . static::$_table . "}}` ({$fields}) VALUES ({$values});")) { |
|
417 | + if (classSupernova::$db->doInsertComplex("INSERT INTO `{{".static::$_table."}}` ({$fields}) VALUES ({$values});")) { |
|
418 | 418 | $result = classSupernova::$db->db_insert_id(); |
419 | 419 | } |
420 | 420 | |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | |
451 | 451 | return empty($set_string) |
452 | 452 | ? true |
453 | - : classSupernova::$db->doUpdate("UPDATE `{{" . static::$_table . "}}` SET {$set_string} WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId); |
|
453 | + : classSupernova::$db->doUpdate("UPDATE `{{".static::$_table."}}` SET {$set_string} WHERE `".static::$_dbIdFieldName."` = ".$this->_dbId); |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | LEFT JOIN {{survey}} AS s ON s.survey_announce_id = a.idAnnounce |
44 | 44 | LEFT JOIN {{users}} AS u ON u.id = a.user_id |
45 | 45 | {$query_where} |
46 | - ORDER BY `tsTimeStamp` DESC, idAnnounce" . |
|
46 | + ORDER BY `tsTimeStamp` DESC, idAnnounce". |
|
47 | 47 | ($query_limit ? " LIMIT {$query_limit}" : '')); |
48 | 48 | |
49 | 49 | $template->assign_var('NEWS_COUNT', classSupernova::$db->db_num_rows($announce_list)); |
@@ -36,7 +36,7 @@ |
||
36 | 36 | * @param $note_id_edit |
37 | 37 | */ |
38 | 38 | public static function db_note_update_by_id($note_priority, $note_title, $note_text, $note_galaxy, $note_system, $note_planet, $note_planet_type, $note_sticky, $note_id_edit) { |
39 | - classSupernova::$db->doUpdate("UPDATE {{notes}} SET `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
39 | + classSupernova::$db->doUpdate("UPDATE {{notes}} SET `time` = ".SN_TIME_NOW.", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
40 | 40 | `galaxy` = {$note_galaxy}, `system` = {$note_system}, `planet` = {$note_planet}, `planet_type` = {$note_planet_type}, `sticky` = {$note_sticky} |
41 | 41 | WHERE `id` = {$note_id_edit} LIMIT 1;"); |
42 | 42 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function debris_add_resource($resource_id, $resource_amount) { |
29 | 29 | // В обломках может быть только металл или кристалл |
30 | - if($resource_id != RES_METAL && $resource_id != RES_CRYSTAL) { |
|
30 | + if ($resource_id != RES_METAL && $resource_id != RES_CRYSTAL) { |
|
31 | 31 | return; |
32 | 32 | } |
33 | 33 | $this->debris[$resource_id] += $resource_amount; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param bool $is_simulator |
39 | 39 | */ |
40 | 40 | public function add_wrecks(array $wreckage, $is_simulator) { |
41 | - foreach($wreckage as $resource_id => $resource_amount) { |
|
41 | + foreach ($wreckage as $resource_id => $resource_amount) { |
|
42 | 42 | $this->debris_add_resource($resource_id, floor($resource_amount * |
43 | 43 | ($is_simulator |
44 | 44 | ? UBE_SHIP_WRECKS_TO_DEBRIS_AVG |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param bool $is_simulator |
55 | 55 | */ |
56 | 56 | public function add_cargo_drop(array $dropped_resources, $is_simulator) { |
57 | - foreach($dropped_resources as $resource_id => $resource_amount) { |
|
57 | + foreach ($dropped_resources as $resource_id => $resource_amount) { |
|
58 | 58 | $this->debris_add_resource($resource_id, floor($resource_amount * |
59 | 59 | ($is_simulator |
60 | 60 | ? UBE_CARGO_DROPPED_TO_DEBRIS_AVG |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param $moon_debris_left_part |
94 | 94 | */ |
95 | 95 | public function debris_adjust_proportional($moon_debris_left_part) { |
96 | - foreach($this->debris as $resource_id => &$resource_amount) { |
|
96 | + foreach ($this->debris as $resource_id => &$resource_amount) { |
|
97 | 97 | $resource_amount = floor($resource_amount * $moon_debris_left_part); |
98 | 98 | } |
99 | 99 | } |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function report_generate_array() { |
116 | 116 | return array( |
117 | - 'ube_report_debris_metal' => (float)$this->debris_get_resource(RES_METAL), |
|
118 | - 'ube_report_debris_crystal' => (float)$this->debris_get_resource(RES_CRYSTAL), |
|
119 | - 'ube_report_debris_total_in_metal' => (float)$this->debris_in_metal(), |
|
117 | + 'ube_report_debris_metal' => (float) $this->debris_get_resource(RES_METAL), |
|
118 | + 'ube_report_debris_crystal' => (float) $this->debris_get_resource(RES_CRYSTAL), |
|
119 | + 'ube_report_debris_total_in_metal' => (float) $this->debris_in_metal(), |
|
120 | 120 | ); |
121 | 121 | } |
122 | 122 |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | $debris_for_moon = $debris->debris_total(); |
72 | 72 | |
73 | - if(!$debris_for_moon) { |
|
73 | + if (!$debris_for_moon) { |
|
74 | 74 | return; |
75 | 75 | } |
76 | 76 | |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | $moon_chance = min($debris_for_moon / UBE_MOON_DEBRIS_PER_PERCENT, UBE_MOON_PERCENT_MAX); // TODO Configure |
79 | 79 | $moon_chance = $moon_chance >= UBE_MOON_PERCENT_MIN ? $moon_chance : 0; |
80 | 80 | $this->create_chance = $moon_chance; |
81 | - if($moon_chance) { |
|
82 | - if($is_simulator || mt_rand(1, 100) <= $moon_chance) { |
|
81 | + if ($moon_chance) { |
|
82 | + if ($is_simulator || mt_rand(1, 100) <= $moon_chance) { |
|
83 | 83 | $this->status = UBE_MOON_CREATE_SUCCESS; |
84 | 84 | $this->moon_diameter = round($is_simulator ? $moon_chance * 150 + 1999 : mt_rand($moon_chance * 100 + 1000, $moon_chance * 200 + 2999)); |
85 | 85 | |
86 | - if($debris_for_moon <= UBE_MOON_DEBRIS_MAX_SPENT) { |
|
86 | + if ($debris_for_moon <= UBE_MOON_DEBRIS_MAX_SPENT) { |
|
87 | 87 | $debris->_reset(); |
88 | 88 | } else { |
89 | 89 | $moon_debris_left_percent = ($debris_for_moon - UBE_MOON_DEBRIS_MAX_SPENT) / $debris_for_moon; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | protected function moon_destroy_try($reapers) { |
104 | 104 | // TODO: $is_simulator |
105 | - if($reapers <= 0) { |
|
105 | + if ($reapers <= 0) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | 108 | |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | * @version 2016-02-25 23:42:45 41a4.68 |
121 | 121 | */ |
122 | 122 | public function calculate_moon(UBE $ube) { |
123 | - if(UBE_MOON_EXISTS == $this->status) { |
|
124 | - if($ube->mission_type_id == MT_DESTROY && $ube->combat_result == UBE_COMBAT_RESULT_WIN) { |
|
123 | + if (UBE_MOON_EXISTS == $this->status) { |
|
124 | + if ($ube->mission_type_id == MT_DESTROY && $ube->combat_result == UBE_COMBAT_RESULT_WIN) { |
|
125 | 125 | $reapers = $ube->fleet_list->ube_calculate_attack_reapers(); |
126 | 126 | $this->moon_destroy_try($reapers); |
127 | 127 | } |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function report_generate_array() { |
137 | 137 | return array( |
138 | - 'ube_report_moon' => (int)$this->status, |
|
139 | - 'ube_report_moon_chance' => (int)$this->create_chance, |
|
140 | - 'ube_report_moon_size' => (float)$this->moon_diameter, |
|
141 | - 'ube_report_moon_reapers' => (int)$this->reapers_status, |
|
142 | - 'ube_report_moon_destroy_chance' => (int)$this->destroy_chance, |
|
143 | - 'ube_report_moon_reapers_die_chance' => (int)$this->reaper_die_chance, |
|
138 | + 'ube_report_moon' => (int) $this->status, |
|
139 | + 'ube_report_moon_chance' => (int) $this->create_chance, |
|
140 | + 'ube_report_moon_size' => (float) $this->moon_diameter, |
|
141 | + 'ube_report_moon_reapers' => (int) $this->reapers_status, |
|
142 | + 'ube_report_moon_destroy_chance' => (int) $this->destroy_chance, |
|
143 | + 'ube_report_moon_reapers_die_chance' => (int) $this->reaper_die_chance, |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | * @param $planet_id |
172 | 172 | */ |
173 | 173 | public function db_apply_result($planet_info, $destination_user_id) { |
174 | - if($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
174 | + if ($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
175 | 175 | $moon_row = uni_create_moon($planet_info[PLANET_GALAXY], $planet_info[PLANET_SYSTEM], $planet_info[PLANET_PLANET], $destination_user_id, $this->moon_diameter, '', false); |
176 | 176 | $this->moon_name = $moon_row['name']; |
177 | 177 | unset($moon_row); |
178 | - } elseif($this->status == UBE_MOON_DESTROY_SUCCESS) { |
|
178 | + } elseif ($this->status == UBE_MOON_DESTROY_SUCCESS) { |
|
179 | 179 | DBStaticPlanet::db_planet_delete_by_id($planet_info[PLANET_ID]); |
180 | 180 | } |
181 | 181 | } |
@@ -184,18 +184,18 @@ discard block |
||
184 | 184 | $classLocale = classLocale::$lang; |
185 | 185 | |
186 | 186 | $text_defender = ''; |
187 | - if($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
187 | + if ($this->status == UBE_MOON_CREATE_SUCCESS) { |
|
188 | 188 | $text_defender .= "{$classLocale['ube_report_moon_created']} {$this->moon_diameter} {$classLocale['sys_kilometers_short']}<br /><br />"; |
189 | - } elseif($this->status == UBE_MOON_CREATE_FAILED) { |
|
189 | + } elseif ($this->status == UBE_MOON_CREATE_FAILED) { |
|
190 | 190 | $text_defender .= "{$classLocale['ube_report_moon_chance']} {$this->create_chance}%<br /><br />"; |
191 | 191 | } |
192 | 192 | |
193 | - if($ube->mission_type_id == MT_DESTROY) { |
|
194 | - if($this->reapers_status == UBE_MOON_REAPERS_NONE) { |
|
193 | + if ($ube->mission_type_id == MT_DESTROY) { |
|
194 | + if ($this->reapers_status == UBE_MOON_REAPERS_NONE) { |
|
195 | 195 | $text_defender .= classLocale::$lang['ube_report_moon_reapers_none']; |
196 | 196 | } else { |
197 | 197 | $text_defender .= "{$classLocale['ube_report_moon_reapers_wave']}. {$classLocale['ube_report_moon_reapers_chance']} {$this->destroy_chance}%. "; |
198 | - $text_defender .= classLocale::$lang[$this->status == UBE_MOON_DESTROY_SUCCESS ? 'ube_report_moon_reapers_success' : 'ube_report_moon_reapers_failure'] . "<br />"; |
|
198 | + $text_defender .= classLocale::$lang[$this->status == UBE_MOON_DESTROY_SUCCESS ? 'ube_report_moon_reapers_success' : 'ube_report_moon_reapers_failure']."<br />"; |
|
199 | 199 | |
200 | 200 | $text_defender .= "{$classLocale['ube_report_moon_reapers_outcome']} {$this->reaper_die_chance}%. "; |
201 | 201 | $text_defender .= classLocale::$lang[$this->reapers_status == UBE_MOON_REAPERS_RETURNED ? 'ube_report_moon_reapers_survive' : 'ube_report_moon_reapers_died']; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @version 2016-02-25 23:42:45 41a4.68 |
221 | 221 | */ |
222 | 222 | public function ubeInitLoadStatis($destination_planet) { |
223 | - if($destination_planet['planet_type'] == PT_MOON || is_array($moon = DBStaticPlanet::db_planet_by_parent($destination_planet['id'], true, '`id`'))) { |
|
223 | + if ($destination_planet['planet_type'] == PT_MOON || is_array($moon = DBStaticPlanet::db_planet_by_parent($destination_planet['id'], true, '`id`'))) { |
|
224 | 224 | $this->status = UBE_MOON_EXISTS; |
225 | 225 | $this->moon_diameter = !empty($moon['planet_type']) && $moon['planet_type'] == PT_MOON ? $moon['diameter'] : $destination_planet['diameter']; |
226 | 226 | $this->reapers_status = UBE_MOON_REAPERS_NONE; |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public static function db_acs_insert($fleetid, $userId, $objFleet) { |
53 | 53 | classSupernova::$db->doInsertSet(TABLE_AKS, array( |
54 | - 'name' => classLocale::$lang['flt_acs_prefix'] . $fleetid, |
|
54 | + 'name' => classLocale::$lang['flt_acs_prefix'].$fleetid, |
|
55 | 55 | 'teilnehmer' => $userId, |
56 | 56 | 'flotten' => $fleetid, |
57 | 57 | 'ankunft' => $objFleet->time_arrive_to_target, |