dont make new inventory
This commit is contained in:
parent
e08c582f17
commit
34cf660cbd
@ -631,5 +631,9 @@ impl CharacterInventory {
|
|||||||
pub fn items(&self) -> &Vec<InventoryItem> {
|
pub fn items(&self) -> &Vec<InventoryItem> {
|
||||||
&self.items
|
&self.items
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_items(&mut self, sorted_items: Vec<InventoryItem>) {
|
||||||
|
self.items = sorted_items;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -988,11 +988,13 @@ impl ItemManager {
|
|||||||
let inventory = self.character_inventory.get_mut(&character.id).ok_or(ItemManagerError::NoCharacter(character.id))?;
|
let inventory = self.character_inventory.get_mut(&character.id).ok_or(ItemManagerError::NoCharacter(character.id))?;
|
||||||
let sorted_inventory_items: Vec<InventoryItem> = item_ids.iter()
|
let sorted_inventory_items: Vec<InventoryItem> = item_ids.iter()
|
||||||
.filter(|&client_item_id| *client_item_id < 0xFFFFFFFF)
|
.filter(|&client_item_id| *client_item_id < 0xFFFFFFFF)
|
||||||
.map(|&client_item_id| inventory.get_item_by_id(ClientItemId(client_item_id)).cloned().unwrap())
|
.map(|&client_item_id| inventory.get_item_by_id(ClientItemId(client_item_id)))
|
||||||
|
.filter(|&x| x.is_some() == true)
|
||||||
|
.map(|x| x.cloned().unwrap())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let sorted_inventory = CharacterInventory::new(sorted_inventory_items);
|
inventory.set_items(sorted_inventory_items);
|
||||||
update_inventory_slots(entity_gateway, character, &sorted_inventory).await;
|
update_inventory_slots(entity_gateway, character, &inventory).await;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user