rename test file
This commit is contained in:
parent
6d4f5ae8f6
commit
51240a31e3
@ -986,37 +986,6 @@ impl ItemManager {
|
|||||||
item_ids: [u32; 30])
|
item_ids: [u32; 30])
|
||||||
-> Result<(), ItemManagerError> {
|
-> Result<(), ItemManagerError> {
|
||||||
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<(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 {
|
|
||||||
InventoryItem::Individual(i) => {
|
|
||||||
entity_gateway.change_item_location(&i.entity_id, ItemLocation::Inventory {
|
|
||||||
character_id: character.id,
|
|
||||||
slot: slot,
|
|
||||||
equipped: i.equipped,
|
|
||||||
}).await
|
|
||||||
},
|
|
||||||
InventoryItem::Stacked(s) => {
|
|
||||||
for entity_id in s.entity_ids.iter() {
|
|
||||||
entity_gateway.change_item_location(&entity_id, ItemLocation::Inventory {
|
|
||||||
character_id: character.id,
|
|
||||||
slot: slot,
|
|
||||||
equipped: false,
|
|
||||||
}).await
|
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
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)).cloned().unwrap())
|
||||||
@ -1024,7 +993,6 @@ impl ItemManager {
|
|||||||
|
|
||||||
let sorted_inventory = CharacterInventory::new(sorted_inventory_items);
|
let sorted_inventory = CharacterInventory::new(sorted_inventory_items);
|
||||||
update_inventory_slots(entity_gateway, character, &sorted_inventory).await;
|
update_inventory_slots(entity_gateway, character, &sorted_inventory).await;
|
||||||
*/
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,6 +278,7 @@ async fn test_sort_items() {
|
|||||||
create_room(&mut ship, ClientId(1), "room", "").await;
|
create_room(&mut ship, ClientId(1), "room", "").await;
|
||||||
|
|
||||||
let old_items = entity_gateway.get_items_by_character(&char1).await;
|
let old_items = entity_gateway.get_items_by_character(&char1).await;
|
||||||
|
assert!(old_items[0].item.item_type() == item::ItemType::Armor(item::armor::ArmorType::Frame));
|
||||||
assert!(old_items[0].location == item::ItemLocation::Inventory{
|
assert!(old_items[0].location == item::ItemLocation::Inventory{
|
||||||
character_id: char1.id,
|
character_id: char1.id,
|
||||||
slot: 0,
|
slot: 0,
|
Loading…
x
Reference in New Issue
Block a user