diff --git a/functions.php b/functions.php index 1a74cdf..66af9a1 100644 --- a/functions.php +++ b/functions.php @@ -1644,16 +1644,22 @@ function setHP($hp, $maxhp) function echoscroll($slot) { global $user; + if ($user['battle']) { $script = 'fbattle'; } else { $script = 'main'; } - if ($user['battle'] > 0) $bat = db::c()->query('SELECT `id`, `magic` FROM `battle` WHERE `id` = ?i', $user['battle'])->fetch_assoc(); - $all_magic = unserialize($bat['magic']); + $all_magic = 0; + if ($user['battle'] > 0) { + $bat = db::c()->query('SELECT `magic` FROM `battle` WHERE `id` = ?i', $user['battle'])->fetch_assoc(); + $all_magic = unserialize($bat['magic']); + } + $dress = db::c()->query('SELECT `id`, `magic`, `name`, `img`, `duration`, `maxdur` FROM `inventory` WHERE `id` = ?i', $user[$slot])->fetch_assoc(); $need_charge = db::c()->query('SELECT `needcharge` FROM `magic` WHERE `id` = ?i', $dress['magic'])->fetch_assoc(); + if (($user[$slot] > 0) && ($all_magic[$user['id']] < 1 || $need_charge['needcharge'] == 0)) { $row['id'] = $user[$slot]; if ($dress['magic']) { @@ -2566,14 +2572,14 @@ function showpersout($pas = 0) // echo "У персонажа $trt травма."; // } $dd = db::c()->query('SELECT `time`, `type` FROM `effects` WHERE `owner` = ?i', $user['id']); - $param_bonus = []; + array_fill_keys($param_bonus, 0); while ($row = $dd->fetch_assoc()) { if ($row['time'] < time()) { $row['time'] = time(); } if ($row['type'] == 21) { - $param_bonus = array(); + $param_bonus = []; $param_bonus['sila'] = $row['sila']; $param_bonus['lovk'] = $row['lovk']; $param_bonus['inta'] = $row['inta'];