Completed
Push — trunk ( ad61f6...5a98ee )
by SuperNova.WS
04:15
created

sn_ube_combat_round_analyze()   C

Complexity

Conditions 11
Paths 18

Size

Total Lines 45
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 11
eloc 22
nc 18
nop 2
dl 0
loc 45
rs 5.2653
c 0
b 0
f 0

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 94 and the first side effect is on line 3.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
require_once('ube_report.php');
4
5
/*
6
7
// TODO: Для админского боя обнулять обломки до луны - что бы не создавалась луна и не писалось количество обломков
8
9
// TODO: В симуляторе все равно печтатать поле обломков и изменить надпись "Средний диаметр луны с указанным шансом %%" UBE_MOON_SIMULATED
10
11
// TODO: Отсылать каждому игроку сообщение на его языке!
12
13
// TODO: Перевод на английский
14
15
*/
16
17
/*
18
Планы
19
20
[*] UBEv4: Уменьшать каждый раунд значение общей брони кораблей на % от дамаджа, прошедшего за щиты
21
    Так будет эмулироваться распределение повреждений по всем кораблям. На этот же процент уменьшать атаку. Процент брать от брони кораблей
22
[*] UBEv4: Рандомизировать броню в самом начале боя
23
[*] UBEv4: Можно прописать разным кораблям разную стойкость ко взрыву
24
[*] UBEv4: Уровень регенерации щитов
25
[*] UBEv4: При атаке и проигрыше выбрасывать в космос излишки ресурсов со складов - часть ресурсов, которые за пределами складов. А часть - терять
26
27
[*] UBEv4: Боевые порядки юнитов
28
[*] UBEv4: Collateral damage: Взрыв корабля наносит урон соседям. Взрыв всех или только одиночек ?
29
[*] UBEv4: Регенерация брони - спецмодуль корабля. И вообще подумать о спецмодулях - скорее всего через прошивки
30
[*] UBEv4: Распределить планетарный щит в пропорции между всеми защитными сооружениями - эмуляция первого залпа. Или просто добавить такое количество щитов всем оборонам
31
[*] UBEv4: Динамическое цветовое кодирование результатов боя - для защитников отдельно, для атакующих - отдельно
32
[*] UBEv4: При отлете СН и ЗС могут уничтожить новосозданную луну (?)
33
[*] UBEv4: Броня влияет на количество брони, соотношение брони и структуры - т.е. как быстро рванет корабль, а так же на ходовые качества
34
    Типы брони: дюралюминий (легкая, но непрочная - минус к весу, минус к броне), броневая сталь (стандартная броня),
35
    легированная сталь (более прочная и более дорогая версия стальной - плюс к броне, плюс к цене), комозитная броня (по прочности, как сталь, но легче - минус к весу, плюс к цене),
36
    урановая броня (более прочная и заметно тяжелее, чем стальная - плюс к весу, плюс к броне, плюс к цене),
37
    титановая броня (хай-энд: прочная, как уран, легкая, как дюралюминия, дорогая, как пиздец)
38
    Модуль активной брони против кинетического оружия
39
[*] UBEv4: Щиты
40
    Модуль для щитов "Перегрузка": дает 200% щитов на первый залп
41
42
[*] ЧР: Инфа об удержании
43
44
[*] Симулятор: Поддержка мультифлотов. Переписать интерфейс симулятора под работу с любым количеством флотов
45
46
[*] Артефакты: Гиперсборщик - позволяет собрать обломки сразу после боя
47
48
[*] Наемники: Мародер. Капитан или офицер. +1% к вывозимым ресурсам за каждый уровень. Скажем, до +25%. Считаем от общей доли вывоза или от всех ресов на планете?
49
50
[*] Боты: Захватывать ничьи планеты
51
52
*/
53
54
if (BE_DEBUG === true) {
0 ignored issues
show
introduced by
The condition BE_DEBUG === true can never be false.
Loading history...
55
  require_once('ube_zi_helpers.php');
56
}
57
58
global $ube_combat_bonus_list, $ube_convert_techs, $ube_convert_to_techs;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
59
60
$ube_combat_bonus_list = array(
61
  UBE_ATTACK => UBE_ATTACK,
62
  UBE_ARMOR  => UBE_ARMOR,
63
  UBE_SHIELD => UBE_SHIELD,
64
);
65
66
$ube_convert_techs = array(
67
  TECH_WEAPON => UBE_ATTACK,
68
  TECH_ARMOR  => UBE_ARMOR,
69
  TECH_SHIELD => UBE_SHIELD,
70
);
71
72
$ube_convert_to_techs = array(
73
  UBE_ATTACK => 'attack',
74
  UBE_ARMOR  => 'armor',
75
  UBE_SHIELD => 'shield',
76
);
77
78
79
// ------------------------------------------------------------------------------------------------
80
//
81
/**
82
 * Заполняет данные по флоту
83
 *
84
 * Через жопу для сохранения обратной совместимости
85
 *
86
 * @param $combat_data
87
 * @param $fleet
88
 * @param $is_attacker
89
 *
90
 * @return mixed
91
 *
92
 * @deprecated
93
 */
94
function ube_attack_prepare_fleet(&$combat_data, &$fleet, $is_attacker) { return sn_function_call('ube_attack_prepare_fleet', array(&$combat_data, &$fleet, $is_attacker)); }
95
96
/**
97
 * Заполняет данные по флоту
98
 *
99
 * Через жопу для сохранения обратной совместимости
100
 *
101
 * @param $combat_data
102
 * @param $fleet
103
 * @param $is_attacker
104
 *
105
 * @deprecated
106
 */
107
function sn_ube_attack_prepare_fleet(&$combat_data, &$fleet, $is_attacker) {
108
  /**
109
   * @var \Ube\Ube4_1\Ube4_1Prepare $ubePreparator
110
   */
111
  $ubePreparator = $combat_data[UBE_OBJ_PREPARATOR];
112
  $ubePreparator->sn_ube_attack_prepare_fleet($combat_data, $fleet, $is_attacker);
0 ignored issues
show
Deprecated Code introduced by
The function Ube\Ube4_1\Ube4_1Prepare..._attack_prepare_fleet() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

112
  /** @scrutinizer ignore-deprecated */ $ubePreparator->sn_ube_attack_prepare_fleet($combat_data, $fleet, $is_attacker);
Loading history...
113
//  $fleet_owner_id = $fleet['fleet_owner'];
0 ignored issues
show
Unused Code Comprehensibility introduced by
52% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
114
//  $fleet_id = $fleet['fleet_id'];
115
//
116
//  ube_attack_prepare_player($combat_data, $fleet_owner_id, $is_attacker);
117
//
118
//  $fleet_data = sys_unit_str2arr($fleet['fleet_array']);
119
//
120
//  $combat_data[UBE_FLEETS][$fleet_id][UBE_OWNER] = $fleet_owner_id;
121
//  $fleet_info = &$combat_data[UBE_FLEETS][$fleet_id];
122
//  $fleet_info[UBE_FLEET_GROUP] = $fleet['fleet_group'];
123
//  foreach ($fleet_data as $unit_id => $unit_count) {
124
//    if (!$unit_count) {
125
//      continue;
126
//    }
127
//
128
//    $unit_type = get_unit_param($unit_id, P_UNIT_TYPE);
129
//    if ($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) {
130
//      $fleet_info[UBE_COUNT][$unit_id] = $unit_count;
131
//    }
132
//  }
133
//
134
//  $fleet_info[UBE_RESOURCES] = array(
135
//    RES_METAL     => $fleet['fleet_resource_metal'],
136
//    RES_CRYSTAL   => $fleet['fleet_resource_crystal'],
137
//    RES_DEUTERIUM => $fleet['fleet_resource_deuterium'],
138
//  );
139
//
140
//  $fleet_info[UBE_PLANET] = array(
141
//    // TODO: Брать имя и кэшировать ИД и имя планеты?
142
//    PLANET_GALAXY => $fleet['fleet_start_galaxy'],
143
//    PLANET_SYSTEM => $fleet['fleet_start_system'],
144
//    PLANET_PLANET => $fleet['fleet_start_planet'],
145
//    PLANET_TYPE   => $fleet['fleet_start_type'],
146
//  );
147
}
148
149
150
// ------------------------------------------------------------------------------------------------
151
// Рассылает письма всем участникам боя
152
function sn_ube_message_send(&$combat_data) {
153
  global $lang;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
154
155
  // TODO: Отсылать каждому игроку сообщение на его языке!
156
157
  $outcome = &$combat_data[UBE_OUTCOME];
158
  $planet_info = &$outcome[UBE_PLANET];
159
160
  // Генерируем текст письма
161
  $text_common = sprintf($lang['ube_report_msg_body_common'],
162
    date(FMT_DATE_TIME, $combat_data['UBE_TIME']),
163
    $lang['sys_planet_type_sh'][$planet_info[PLANET_TYPE]],
164
    $planet_info[PLANET_GALAXY],
165
    $planet_info[PLANET_SYSTEM],
166
    $planet_info[PLANET_PLANET],
167
    htmlentities($planet_info[PLANET_NAME], ENT_COMPAT, 'UTF-8'),
168
    $lang[$outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' :
169
      ($outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')]
170
  );
171
172
  $text_defender = '';
173
  foreach ($outcome[UBE_DEBRIS] as $resource_id => $resource_amount) {
174
    if ($resource_id == RES_DEUTERIUM) {
175
      continue;
176
    }
177
178
    $text_defender .= "{$lang['tech'][$resource_id]}: " . HelperString::numberFloorAndFormat($resource_amount) . '<br />';
179
  }
180
  if ($text_defender) {
181
    $text_defender = "{$lang['ube_report_msg_body_debris']}{$text_defender}<br />";
182
  }
183
184
  if ($outcome[UBE_MOON] == UBE_MOON_CREATE_SUCCESS) {
185
    $text_defender .= "{$lang['ube_report_moon_created']} {$outcome[UBE_MOON_SIZE]} {$lang['sys_kilometers_short']}<br /><br />";
186
  } elseif ($outcome[UBE_MOON] == UBE_MOON_CREATE_FAILED) {
187
    $text_defender .= "{$lang['ube_report_moon_chance']} {$outcome[UBE_MOON_CHANCE]}%<br /><br />";
188
  }
189
190
  if ($combat_data[UBE_OPTIONS][UBE_MISSION_TYPE] == MT_DESTROY) {
191
    if ($outcome[UBE_MOON_REAPERS] == UBE_MOON_REAPERS_NONE) {
192
      $text_defender .= $lang['ube_report_moon_reapers_none'];
193
    } else {
194
      $text_defender .= "{$lang['ube_report_moon_reapers_wave']}. {$lang['ube_report_moon_reapers_chance']} {$outcome[UBE_MOON_DESTROY_CHANCE]}%. ";
195
      $text_defender .= $lang[$outcome[UBE_MOON] == UBE_MOON_DESTROY_SUCCESS ? 'ube_report_moon_reapers_success' : 'ube_report_moon_reapers_failure'] . "<br />";
196
197
      $text_defender .= "{$lang['ube_report_moon_reapers_outcome']} {$outcome[UBE_MOON_REAPERS_DIE_CHANCE]}%. ";
198
      $text_defender .= $lang[$outcome[UBE_MOON_REAPERS] == UBE_MOON_REAPERS_RETURNED ? 'ube_report_moon_reapers_survive' : 'ube_report_moon_reapers_died'];
199
    }
200
    $text_defender .= '<br /><br />';
201
  }
202
203
  $text_defender .= "{$lang['ube_report_info_link']}: <a href=\"index.php?page=battle_report&cypher={$combat_data[UBE_REPORT_CYPHER]}\">{$combat_data[UBE_REPORT_CYPHER]}</a>";
204
205
  // TODO: Оптимизировать отсылку сообщений - отсылать пакетами
206
  foreach ($combat_data[UBE_PLAYERS] as $player_id => $player_info) {
207
    $message = $text_common . ($outcome[UBE_SFR] && $player_info[UBE_ATTACKER] ? $lang['ube_report_msg_body_sfr'] : $text_defender);
208
    msg_send_simple_message($player_id, '', $combat_data[UBE_TIME], MSG_TYPE_COMBAT, $lang['sys_mess_tower'], $lang['sys_mess_attack_report'], $message);
209
  }
210
211
}
212
213
214
// ------------------------------------------------------------------------------------------------
215
// Записывает результат боя в БД
216
function ube_combat_result_apply(&$combat_data) { return sn_function_call('ube_combat_result_apply', array(&$combat_data)); }
217
218
function sn_ube_combat_result_apply(&$combat_data) {
219
// TODO: Поменять все отладки на запросы
220
  $destination_user_id = $combat_data[UBE_FLEETS][0][UBE_OWNER];
221
222
  $outcome = &$combat_data[UBE_OUTCOME];
223
  $planet_info = &$outcome[UBE_PLANET];
224
  $planet_id = $planet_info[PLANET_ID];
225
  // Обновляем поле обломков на планете
226
  if (!$combat_data[UBE_OPTIONS][UBE_COMBAT_ADMIN] && !empty($outcome[UBE_DEBRIS])) {
227
    DBStaticPlanet::db_planet_set_by_gspt($planet_info[PLANET_GALAXY], $planet_info[PLANET_SYSTEM], $planet_info[PLANET_PLANET], PT_PLANET,
228
      "`debris_metal` = `debris_metal` + " . floor($outcome[UBE_DEBRIS][RES_METAL]) . ", `debris_crystal` = `debris_crystal` + " . floor($outcome[UBE_DEBRIS][RES_CRYSTAL])
229
    );
230
  }
231
232
  $db_save = array(
233
    UBE_FLEET_GROUP => array(), // Для САБов
234
  );
235
236
  $fleets_outcome = &$outcome[UBE_FLEETS];
237
  foreach ($combat_data[UBE_FLEETS] as $fleet_id => &$fleet_info) {
238
    if ($fleet_info[UBE_FLEET_GROUP]) {
239
      $db_save[UBE_FLEET_GROUP][$fleet_info[UBE_FLEET_GROUP]] = $fleet_info[UBE_FLEET_GROUP];
240
    }
241
242
    $fleet_info[UBE_COUNT] = $fleet_info[UBE_COUNT] ? $fleet_info[UBE_COUNT] : array();
243
    $fleets_outcome[$fleet_id][UBE_UNITS_LOST] = $fleets_outcome[$fleet_id][UBE_UNITS_LOST] ? $fleets_outcome[$fleet_id][UBE_UNITS_LOST] : array();
244
245
    $fleet_query = array();
246
    $db_changeset = array();
247
    $old_fleet_count = array_sum($fleet_info[UBE_COUNT]);
248
    $new_fleet_count = $old_fleet_count - array_sum($fleets_outcome[$fleet_id][UBE_UNITS_LOST]);
249
    // Перебираем юниты если во время боя количество юнитов изменилось и при этом во флоту остались юниты или это планета
250
    if ($new_fleet_count != $old_fleet_count && (!$fleet_id || $new_fleet_count)) {
251
      // Просматриваем результаты изменения флотов
252
      foreach ($fleet_info[UBE_COUNT] as $unit_id => $unit_count) {
253
        // Перебираем аутком на случай восстановления юнитов
254
        $units_lost = (float)$fleets_outcome[$fleet_id][UBE_UNITS_LOST][$unit_id];
255
256
        $units_left = $unit_count - $units_lost;
257
        if ($fleet_id) {
258
          // Не планета - всегда сразу записываем строку итогов флота
259
          $fleet_query[$unit_id] = "{$unit_id},{$units_left}";
260
        } elseif ($units_lost) {
261
          // Планета - записываем в ИД юнита его потери только если есть потери
262
          $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, -$units_lost, $combat_data[UBE_PLAYERS][$destination_user_id][UBE_PLAYER_DATA], $planet_id);
0 ignored issues
show
Deprecated Code introduced by
The function OldDbChangeSet::db_changeset_prepare_unit() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

262
          $db_changeset['unit'][] = /** @scrutinizer ignore-deprecated */ OldDbChangeSet::db_changeset_prepare_unit($unit_id, -$units_lost, $combat_data[UBE_PLAYERS][$destination_user_id][UBE_PLAYER_DATA], $planet_id);
Loading history...
263
        }
264
      }
265
266
      if ($fleet_id) {
267
        // Для флотов перегенерируем массив как одно вхождение в SET SQL-запроса
268
        $fleet_query = array(
269
          'fleet_array' => implode(';', $fleet_query),
270
        );
271
      }
272
    }
273
274
    $fleet_delta = array();
275
    // Если во флоте остались юниты или это планета - генерируем изменение ресурсов
276
    if ($new_fleet_count || !$fleet_id) {
277
      foreach (sn_get_groups('resources_loot') as $resource_id) {
278
        $resource_change = (float)$fleets_outcome[$fleet_id][UBE_RESOURCES_LOOTED][$resource_id] + (float)$fleets_outcome[$fleet_id][UBE_CARGO_DROPPED][$resource_id];
279
        if ($resource_change) {
280
          $resource_db_name = ($fleet_id ? 'fleet_resource_' : '') . pname_resource_name($resource_id);
281
          $fleet_delta[$resource_db_name] = -($resource_change);
282
        }
283
      }
284
    }
285
286
    if ($fleet_id && $new_fleet_count) {
287
      // Если защитник и не РМФ - отправляем флот назад
288
      if (($fleet_info[UBE_FLEET_TYPE] == UBE_DEFENDERS && !$outcome[UBE_SFR]) || $fleet_info[UBE_FLEET_TYPE] == UBE_ATTACKERS) {
289
        $fleet_query['fleet_mess'] = 1;
290
      }
291
    }
292
293
    if ($fleet_id) // Не планета
294
    {
295
      if ($fleet_info[UBE_FLEET_TYPE] == UBE_ATTACKERS && $outcome[UBE_MOON_REAPERS] == UBE_MOON_REAPERS_DIED) {
296
        $new_fleet_count = 0;
297
      }
298
299
      if ($new_fleet_count) {
300
        if (!empty($fleet_query) || !empty($fleet_delta)) {
301
          $fleet_query['fleet_amount'] = $new_fleet_count;
302
          fleet_update_set($fleet_id, $fleet_query, $fleet_delta);
303
        }
304
      } else {
305
        // Удаляем пустые флоты
306
        db_fleet_delete($fleet_id);
307
        DBStaticUnit::db_unit_list_delete(0, LOC_FLEET, $fleet_id, 0);
308
      }
309
    } else // Планета
310
    {
311
      // Сохраняем изменения ресурсов - если они есть
312
      if (!empty($fleet_delta)) {
313
        $temp = array();
314
        foreach ($fleet_delta as $resource_db_name => $resource_amount) {
315
          $temp[] = "`{$resource_db_name}` = `{$resource_db_name}` + ({$resource_amount})";
316
        }
317
        DBStaticPlanet::db_planet_set_by_id($planet_id, implode(',', $temp));
318
      }
319
      if (!empty($db_changeset)) // Сохраняем изменения юнитов на планете - если они есть
320
      {
321
        OldDbChangeSet::db_changeset_apply($db_changeset);
0 ignored issues
show
Deprecated Code introduced by
The function OldDbChangeSet::db_changeset_apply() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

321
        /** @scrutinizer ignore-deprecated */ OldDbChangeSet::db_changeset_apply($db_changeset);
Loading history...
322
      }
323
    }
324
  }
325
326
  // TODO: Связать сабы с флотами констраинтами ON DELETE SET NULL
327
  if (!empty($db_save[UBE_FLEET_GROUP])) {
328
    $db_save[UBE_FLEET_GROUP] = implode(',', $db_save[UBE_FLEET_GROUP]);
329
    doquery("DELETE FROM {{aks}} WHERE `id` IN ({$db_save[UBE_FLEET_GROUP]})");
330
  }
331
332
  if ($outcome[UBE_MOON] == UBE_MOON_CREATE_SUCCESS) {
333
    $moon_row = uni_create_moon($planet_info[PLANET_GALAXY], $planet_info[PLANET_SYSTEM], $planet_info[PLANET_PLANET], $destination_user_id, $outcome[UBE_MOON_SIZE], '', false);
334
    $outcome[UBE_MOON_NAME] = $moon_row['name'];
335
    unset($moon_row);
336
  } elseif ($outcome[UBE_MOON] == UBE_MOON_DESTROY_SUCCESS) {
337
    DBStaticPlanet::db_planet_delete_by_id($planet_id);
338
  }
339
340
  {
341
    $bashing_list = array();
342
    foreach ($combat_data[UBE_PLAYERS] as $player_id => $player_info) {
343
      if ($player_info[UBE_ATTACKER]) {
344
        if ($outcome[UBE_MOON] != UBE_MOON_DESTROY_SUCCESS) {
345
          $bashing_list[] = "({$player_id}, {$planet_id}, {$combat_data[UBE_TIME]})";
346
        }
347
        if ($combat_data[UBE_OPTIONS][UBE_MISSION_TYPE] == MT_ATTACK && $combat_data[UBE_OPTIONS][UBE_DEFENDER_ACTIVE]) {
348
          $str_loose_or_win = $outcome[UBE_COMBAT_RESULT] == UBE_COMBAT_RESULT_WIN ? 'raidswin' : 'raidsloose';
349
          db_user_set_by_id($player_id, "`xpraid` = `xpraid` + 1, `raids` = `raids` + 1, `{$str_loose_or_win}` = `{$str_loose_or_win}` + 1");
0 ignored issues
show
Deprecated Code introduced by
The function db_user_set_by_id() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

349
          /** @scrutinizer ignore-deprecated */ db_user_set_by_id($player_id, "`xpraid` = `xpraid` + 1, `raids` = `raids` + 1, `{$str_loose_or_win}` = `{$str_loose_or_win}` + 1");
Loading history...
350
        }
351
      }
352
    }
353
    $bashing_list = implode(',', $bashing_list);
354
    if ($bashing_list) {
355
      doquery("INSERT INTO {{bashing}} (bashing_user_id, bashing_planet_id, bashing_time) VALUES {$bashing_list};");
356
    }
357
  }
358
}
359