remove item from inventory by id
This commit is contained in:
parent
5345939b1b
commit
d263bf4caa
@ -655,6 +655,14 @@ impl CharacterInventory {
|
||||
self.items = sorted_items;
|
||||
}
|
||||
|
||||
pub fn remove_by_id(&mut self, id: ClientItemId) -> Option<InventoryItem> {
|
||||
self.items.iter()
|
||||
.position(|i| i.item_id() == id)
|
||||
.map(|position| {
|
||||
self.items.remove(position)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn equip(&mut self, id: &ClientItemId, equip_slot: u8) {
|
||||
for item in &self.items {
|
||||
if let InventoryItem::Individual(inventory_item) = item {
|
||||
|
Loading…
x
Reference in New Issue
Block a user