From 08ed1c1f4c1a2711aab28b8c6f6e9e8435d455c5 Mon Sep 17 00:00:00 2001 From: "Igor Barkov (iwork)" Date: Wed, 22 Jul 2020 12:45:41 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D1=81=D0=BD=D1=8F=D1=82=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=BC=D0=B5=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/DressedItems.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/classes/DressedItems.php b/classes/DressedItems.php index 8edb106..da999ec 100644 --- a/classes/DressedItems.php +++ b/classes/DressedItems.php @@ -116,9 +116,17 @@ SQL; return self::getBonuses()['sum_weight']; } + /** + * Снимает с предмета статус одетого на персонажа в определённом слоте персонажа. + * @param $slot_id - номер слота. + * + * @throws \Krugozor\Database\Mysql\Exception + */ public function undressItem($slot_id) { - if (!$slot_id || $this->dressedItem[$slot_id]) { + self::getItemsInSlots(); + // Проверяем, что используется один из 12 слотов и наличие предмета в слоте. + if (in_array($slot_id, range(1,12)) && $this->dressedItem[$slot_id]) { db::c()->query('UPDATE inventory SET dressed_slot = 0 WHERE dressed_slot = ?i AND owner_id = ?i', $slot_id, $this->USERID); } }