Доработка функции снятия предмета

This commit is contained in:
Igor Barkov (iwork) 2020-07-22 12:45:41 +03:00
parent ec15c2cbcc
commit 08ed1c1f4c
1 changed files with 9 additions and 1 deletions

View File

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