From 2f977fab002ef7174ac1186a7c448ed497f134f3 Mon Sep 17 00:00:00 2001 From: "Igor Barkov (iwork)" Date: Mon, 25 Jan 2021 19:58:58 +0200 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20=D0=B2?= =?UTF-8?q?=20=D0=B8=D0=BC=D0=B5=D0=BD=D0=B8=20=D0=BF=D0=BE=D0=B4=D0=BA?= =?UTF-8?q?=D0=BB=D1=8E=D1=87=D0=B0=D0=B5=D0=BC=D0=BE=D0=B3=D0=BE=20=D0=BA?= =?UTF-8?q?=D0=BB=D0=B0=D1=81=D1=81=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/Battles/Magic/CureInjury.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/classes/Battles/Magic/CureInjury.php b/classes/Battles/Magic/CureInjury.php index b31f34d..0655c2f 100644 --- a/classes/Battles/Magic/CureInjury.php +++ b/classes/Battles/Magic/CureInjury.php @@ -4,8 +4,10 @@ namespace Battles\Magic; use Battles\UserEffects; use Battles\User; +use db; +use Krugozor\Database\Mysql\Exception; -class CureInjury extends magic +class CureInjury extends Magic { private $target; use UserEffects; @@ -14,16 +16,16 @@ class CureInjury extends magic * Магия лечения травм. Если у персонажа несколько травм, лечится самая тяжёлая. * @param $target - кого лечим. * @param $injuryType - тип травмы, которую лечим. 11 лёгкая, 12 средняя, 13 тяжёлая, 14 неизлечимая. - * @throws \Krugozor\Database\Mysql\Exception + * @throws Exception */ public function __construct($target, $injuryType) { $this->target = $target; if ($target && $this->isUsable()) { - $injury = \db::c()->query('SELECT effect_id, type, name FROM users_effects WHERE type IN (11,12,13,14) AND owner_id = ?i ORDER BY type DESC LIMIT 1', $target)->fetch_object(); + $injury = db::c()->query('SELECT effect_id, type, name FROM users_effects WHERE type IN (11,12,13,14) AND owner_id = ?i ORDER BY type DESC LIMIT 1', $target)->fetch_object(); $targetName = $this->target->login; if (in_array($injury->effect_id, [11, 12, 13, 14]) && $injuryType >= $injury->type) { - \db::c()->query('DELETE FROM users_effects WHERE effect_id = ?i', $injury->effect_id); + db::c()->query('DELETE FROM users_effects WHERE effect_id = ?i', $injury->effect_id); if (empty($injury->name) || $injury->name == 'Неизвестный эффект') { $injuryName = self::$effectName[$injury->type]; } else { @@ -31,7 +33,7 @@ class CureInjury extends magic } return "Вы вылечили повреждение ${injuryName} персонажу ${targetName}."; } elseif ($injury->effect_id && $injuryType == 15) { - \db::c()->query('DELETE FROM users_effects WHERE type IN (11,12,13,14) AND owner_id = ?i', $target); + db::c()->query('DELETE FROM users_effects WHERE type IN (11,12,13,14) AND owner_id = ?i', $target); return "Вы вылечили все повреждения персонажу ${targetName}."; } else { return false;