Проверка на возврат пустой строки.

This commit is contained in:
Ivor Barhansky 2024-04-29 13:00:32 +03:00
parent 65aa6fba8e
commit 9c4e8fb035

View File

@ -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) {
@ -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,
]
);
}
}