Проверка на возврат пустой строки.
This commit is contained in:
parent
65aa6fba8e
commit
9c4e8fb035
@ -124,6 +124,54 @@ class Stats
|
||||
];
|
||||
}
|
||||
|
||||
public static function saveBattleStats(array $stats, int $id): void
|
||||
{
|
||||
if (!isset(
|
||||
$stats['hpnow'],
|
||||
$stats['mpNow'],
|
||||
$stats['tactic1'],
|
||||
$stats['tactic2'],
|
||||
$stats['tactic3'],
|
||||
$stats['tactic4'],
|
||||
$stats['tactic5'],
|
||||
$stats['tactic6'],
|
||||
$stats['tactic7'],
|
||||
$stats['enemy'],
|
||||
$stats['battle_yron'],
|
||||
$stats['battle_exp'],
|
||||
$stats['last_hp'],
|
||||
$stats['priems_z'],
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
Db::sql(
|
||||
'update stats set hpNow = ?,mpNow = ?,
|
||||
tactic1 = ?,tactic2 = ?,tactic3 = ?,tactic4 = ?,tactic5 = ?,tactic6 = ?,tactic7 = ?,
|
||||
enemy = ?,battle_yron = ?,last_hp = ?,battle_exp = ?,priems_z = ?
|
||||
where id = ?',
|
||||
[
|
||||
$stats['hpnow'],
|
||||
$stats['mpNow'],
|
||||
$stats['tactic1'],
|
||||
$stats['tactic2'],
|
||||
$stats['tactic3'],
|
||||
$stats['tactic4'],
|
||||
$stats['tactic5'],
|
||||
$stats['tactic6'],
|
||||
$stats['tactic7'],
|
||||
$stats['enemy'],
|
||||
$stats['battle_yron'],
|
||||
$stats['battle_exp'],
|
||||
$stats['last_hp'],
|
||||
$stats['priems_z'],
|
||||
$id,
|
||||
]
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public function getStats(int|array|null $uid = null, $i1 = 0, $reimg = false, $btl_cache = false): array
|
||||
{
|
||||
$u = match (true) {
|
||||
@ -293,9 +341,6 @@ class Stats
|
||||
$st['m19'] += (int)($st['s3'] * 0.03);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Бонусы комплектов
|
||||
if (isset($coms['new']) && is_iterable($coms['new'])) {
|
||||
foreach ($coms['new'] as $complect) {
|
||||
@ -477,8 +522,8 @@ class Stats
|
||||
|
||||
/** Собираем динамически создаваемые параметры. Если ключа нет - создаём.
|
||||
* @param string $key
|
||||
* @param int $value
|
||||
* @param array $st
|
||||
* @param int $value
|
||||
* @param array $st
|
||||
* @return void
|
||||
*/
|
||||
private function addKeyIfNotExist(string $key, int $value, array &$st): void
|
||||
@ -493,7 +538,7 @@ class Stats
|
||||
/**
|
||||
* Добавляет бонусы к статам игрока.
|
||||
* Генерирует переменную User:class->stats['items'], где лежат одетые предметы.
|
||||
* @param int $uid
|
||||
* @param int $uid
|
||||
* @param array $st
|
||||
* @param array $s_v
|
||||
* @param array $baseStats
|
||||
@ -1081,6 +1126,10 @@ class Stats
|
||||
0 as finished from rep where id = ?', [$id]
|
||||
);
|
||||
|
||||
if (empty($finishedDungeons)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Бонус за количество полностью вырытых пещер.
|
||||
if (isset($st['m10'])) {
|
||||
$st['m10'] += 10 * $finishedDungeons;
|
||||
@ -1133,52 +1182,4 @@ class Stats
|
||||
}
|
||||
unset($st['level'], $st['hpnow'], $st['mpnow'], $st['hpall'], $st['mpall']);
|
||||
}
|
||||
|
||||
public static function saveBattleStats(array $stats, int $id): void
|
||||
{
|
||||
if (!isset(
|
||||
$stats['hpnow'],
|
||||
$stats['mpNow'],
|
||||
$stats['tactic1'],
|
||||
$stats['tactic2'],
|
||||
$stats['tactic3'],
|
||||
$stats['tactic4'],
|
||||
$stats['tactic5'],
|
||||
$stats['tactic6'],
|
||||
$stats['tactic7'],
|
||||
$stats['enemy'],
|
||||
$stats['battle_yron'],
|
||||
$stats['battle_exp'],
|
||||
$stats['last_hp'],
|
||||
$stats['priems_z'],
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
Db::sql(
|
||||
'update stats set hpNow = ?,mpNow = ?,
|
||||
tactic1 = ?,tactic2 = ?,tactic3 = ?,tactic4 = ?,tactic5 = ?,tactic6 = ?,tactic7 = ?,
|
||||
enemy = ?,battle_yron = ?,last_hp = ?,battle_exp = ?,priems_z = ?
|
||||
where id = ?',
|
||||
[
|
||||
$stats['hpnow'],
|
||||
$stats['mpNow'],
|
||||
$stats['tactic1'],
|
||||
$stats['tactic2'],
|
||||
$stats['tactic3'],
|
||||
$stats['tactic4'],
|
||||
$stats['tactic5'],
|
||||
$stats['tactic6'],
|
||||
$stats['tactic7'],
|
||||
$stats['enemy'],
|
||||
$stats['battle_yron'],
|
||||
$stats['battle_exp'],
|
||||
$stats['last_hp'],
|
||||
$stats['priems_z'],
|
||||
$id,
|
||||
]
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user