|
|
@ -986,13 +986,17 @@ impl ItemManager { |
|
|
|
item_ids: [u32; 30])
|
|
|
|
-> Result<(), ItemManagerError> {
|
|
|
|
let inventory = self.character_inventory.get_mut(&character.id).ok_or(ItemManagerError::NoCharacter(character.id))?;
|
|
|
|
let sorted_inventory_items: Vec<(usize, Option<&InventoryItem>)> = item_ids.iter()
|
|
|
|
.enumerate()
|
|
|
|
.filter(|(slot, &client_item_id)| client_item_id < 0xFFFFFFFF)
|
|
|
|
.map(|(slot, &client_item_id)| (slot, inventory.get_item_by_id(ClientItemId(client_item_id))))
|
|
|
|
.collect();
|
|
|
|
|
|
|
|
let sorted_inventory_items: Vec<(usize, &InventoryItem)> = item_ids.iter()
|
|
|
|
.filter(|&client_item_id| *client_item_id < 0xFFFFFFFF)
|
|
|
|
.enumerate()
|
|
|
|
.map(|(slot, &client_item_id)| (slot, inventory.get_item_by_id(ClientItemId(client_item_id)).unwrap()))
|
|
|
|
.collect();
|
|
|
|
println!("sorted_inventory_items: {:?}", sorted_inventory_items);
|
|
|
|
|
|
|
|
// wait how is this different than update_inventory_slots() ???
|
|
|
|
for (slot, item) in sorted_inventory_items {
|
|
|
|
match item.unwrap() {
|
|
|
|
match item {
|
|
|
|
InventoryItem::Individual(i) => {
|
|
|
|
entity_gateway.change_item_location(&i.entity_id, ItemLocation::Inventory {
|
|
|
|
character_id: character.id,
|
|
|
@ -1011,6 +1015,16 @@ impl ItemManager { |
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
let sorted_inventory_items: Vec<InventoryItem> = item_ids.iter()
|
|
|
|
.filter(|&client_item_id| *client_item_id < 0xFFFFFFFF)
|
|
|
|
.map(|&client_item_id| inventory.get_item_by_id(ClientItemId(client_item_id)).cloned().unwrap())
|
|
|
|
.collect();
|
|
|
|
|
|
|
|
let sorted_inventory = CharacterInventory::new(sorted_inventory_items);
|
|
|
|
update_inventory_slots(entity_gateway, character, &sorted_inventory).await;
|
|
|
|
*/
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|