[Rpc(12, false)]//Use item private void UseItem(byte islot) { DB_Item item; var itemSlot = GetSlot(islot); if (itemSlot?.IsEmpty ?? true) { _player.SystemMsg($"Inventory slot {islot} is empty"); } else if (DataMgr.Select(itemSlot.Item.Id, out item)) { if ((item.Flags & ItemFlags.Usable) > 0) { ItemsScript.Use(item.ID, _mPlayer); } else { _player.SystemMsg($"You can't use item {item.Name ?? item.ID.ToString()}"); } } else { _player.SystemMsg($"Item {itemSlot.Item.Id} not found"); } }
[Rpc(12, false)]//Use item private void UseItem(byte islot) { if (m_items.TryGetValue(islot, out var slot)) { if (DataMgr.Select(slot.Item.Id, out DB_Item item)) { if ((item.Flags & ItemFlags.Usable) > 0) { ItemsScript.Use(item.ID, _mPlayer); } else { _player.SystemMsg($"You can't use item {item.Name ?? item.ID.ToString()}"); } } else { _player.SystemMsg($"Item {slot.Item.Id} not found"); } } else { _player.SystemMsg($"Inventory slot {islot} is empty"); } }