|
@ -655,6 +655,14 @@ impl CharacterInventory { |
|
|
self.items = sorted_items;
|
|
|
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) {
|
|
|
pub fn equip(&mut self, id: &ClientItemId, equip_slot: u8) {
|
|
|
for item in &self.items {
|
|
|
for item in &self.items {
|
|
|
if let InventoryItem::Individual(inventory_item) = item {
|
|
|
if let InventoryItem::Individual(inventory_item) = item {
|
|
|