Отказ от старой дублирующей destructitem() в пользу классовой InventoryItem::destroyItem().
This commit is contained in:
@@ -468,21 +468,6 @@ function ref_drop()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Уничтожить предмет, принадлежащий игроку, вызывающего функцию.
|
||||
* @param $id - ID предмета игрока.
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
*/
|
||||
function destructitem($id)
|
||||
{
|
||||
global $user;
|
||||
$item = db::c()->query('SELECT 1 FROM inventory WHERE owner_id = ?i AND item_id = ?i', $user->getId(), $id);
|
||||
if ($item->getNumRows()) {
|
||||
db::c()->query('DELETE FROM `inventory` WHERE `id` = ?i', $id);
|
||||
}
|
||||
}
|
||||
|
||||
// использовать магию
|
||||
function usemagic($id, $target)
|
||||
{
|
||||
@@ -543,7 +528,7 @@ function usemagic($id, $target)
|
||||
}
|
||||
if ($bat) {
|
||||
if ($row['maxdur'] <= ($row['duration'] + 1)) {
|
||||
destructitem($row['id']);
|
||||
\Battles\InventoryItem::destroyItem($row['id']);
|
||||
} else {
|
||||
if (!$row['magic']) {
|
||||
db::c()->query('UPDATE `inventory` SET `includemagicdex` =`includemagicdex` - ?i WHERE id = ?i', $bat, $row['id']);
|
||||
|
||||
Reference in New Issue
Block a user