2020-01-18 23:38:42 -08:00
|
|
|
use std::collections::HashMap;
|
|
|
|
|
|
|
|
use libpso::character::character::InventoryItem;
|
|
|
|
|
2020-03-21 17:47:28 -07:00
|
|
|
use crate::entity::gateway::EntityGateway;
|
2020-03-29 12:43:20 -07:00
|
|
|
use crate::entity::character::CharacterEntity;
|
2020-03-29 14:53:51 -07:00
|
|
|
use crate::entity::item::{ItemEntity, ItemId, ItemDetail, ItemLocation};
|
2020-03-16 20:34:50 -07:00
|
|
|
use crate::entity::item::weapon::Weapon;
|
2020-03-16 20:57:19 -07:00
|
|
|
use crate::entity::item::armor::Armor;
|
2020-03-16 21:48:26 -07:00
|
|
|
use crate::entity::item::shield::Shield;
|
|
|
|
use crate::entity::item::unit::Unit;
|
2020-03-21 17:47:28 -07:00
|
|
|
use crate::entity::item::tool::Tool;
|
2020-03-21 21:46:52 -07:00
|
|
|
use crate::entity::item::mag::Mag;
|
2020-04-26 22:01:05 -06:00
|
|
|
use crate::entity::item::{Meseta, NewItemEntity};
|
|
|
|
use crate::ship::map::MapArea;
|
|
|
|
use crate::ship::drops::{ItemDrop, ItemDropType};
|
2020-04-26 22:23:59 -06:00
|
|
|
use crate::ship::ship::ShipError;
|
2020-01-18 23:38:42 -08:00
|
|
|
|
|
|
|
|
2020-04-27 07:07:09 -06:00
|
|
|
#[derive(Debug, PartialEq)]
|
2020-04-26 21:58:43 -06:00
|
|
|
enum ItemInstance {
|
2020-03-29 14:53:51 -07:00
|
|
|
Individual(ItemEntity),
|
|
|
|
Stacked(Vec<ItemEntity>),
|
2020-04-03 22:56:14 -07:00
|
|
|
Meseta(Meseta),
|
2020-01-18 23:38:42 -08:00
|
|
|
}
|
|
|
|
|
2020-03-21 17:47:28 -07:00
|
|
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
2020-04-26 22:01:05 -06:00
|
|
|
pub struct ActiveItemId(pub u32);
|
2020-01-18 23:38:42 -08:00
|
|
|
|
|
|
|
|
2020-03-21 17:47:28 -07:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct ActiveItem {
|
2020-04-26 22:01:05 -06:00
|
|
|
pub id: ActiveItemId,
|
2020-04-03 22:56:14 -07:00
|
|
|
item: ItemInstance,
|
2020-03-21 17:47:28 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
impl ActiveItem {
|
|
|
|
pub fn as_client_bytes(&self) -> [u8; 16] {
|
|
|
|
match &self.item {
|
2020-04-03 22:56:14 -07:00
|
|
|
ItemInstance::Individual(i) => {
|
2020-03-21 17:47:28 -07:00
|
|
|
match &i.item {
|
|
|
|
ItemDetail::Weapon(w) => w.as_bytes(),
|
|
|
|
ItemDetail::Armor(a) => a.as_bytes(),
|
|
|
|
ItemDetail::Shield(s) => s.as_bytes(),
|
|
|
|
ItemDetail::Unit(u) => u.as_bytes(),
|
|
|
|
ItemDetail::Tool(t) => t.as_individual_bytes(),
|
|
|
|
ItemDetail::TechniqueDisk(d) => d.as_bytes(),
|
2020-03-21 21:46:52 -07:00
|
|
|
ItemDetail::Mag(m) => m.as_bytes(),
|
2020-03-21 17:47:28 -07:00
|
|
|
}
|
|
|
|
},
|
2020-04-03 22:56:14 -07:00
|
|
|
ItemInstance::Stacked(i) => {
|
2020-03-21 17:47:28 -07:00
|
|
|
let len = i.len();
|
|
|
|
match &i[0].item {
|
|
|
|
ItemDetail::Tool(t) => t.as_stacked_bytes(len),
|
|
|
|
_ => panic!(),
|
2020-01-18 23:38:42 -08:00
|
|
|
}
|
2020-04-03 22:56:14 -07:00
|
|
|
},
|
|
|
|
ItemInstance::Meseta(m) => {
|
|
|
|
m.as_bytes()
|
2020-01-18 23:38:42 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-21 17:47:28 -07:00
|
|
|
pub struct ActiveInventory(Vec<ActiveItem>);
|
2020-01-18 23:38:42 -08:00
|
|
|
|
2020-03-21 17:47:28 -07:00
|
|
|
impl ActiveInventory {
|
|
|
|
pub fn as_client_inventory_items(&self) -> [InventoryItem; 30] {
|
|
|
|
self.0.iter()
|
|
|
|
.enumerate()
|
|
|
|
.fold([InventoryItem::default(); 30], |mut inventory, (index, item)| {
|
|
|
|
let bytes = item.as_client_bytes();
|
|
|
|
inventory[index].data1.copy_from_slice(&bytes[0..12]);
|
2020-03-21 21:46:52 -07:00
|
|
|
inventory[index].data2.copy_from_slice(&bytes[12..16]);
|
2020-03-21 17:47:28 -07:00
|
|
|
inventory[index].item_id = item.id.0;
|
|
|
|
|
|
|
|
// does this do anything?
|
|
|
|
inventory[index].equipped = match item.item {
|
2020-04-03 22:56:14 -07:00
|
|
|
ItemInstance::Individual(ItemEntity {location: ItemLocation::Inventory{ equipped: true, ..}, ..}) => 1,
|
2020-03-21 17:47:28 -07:00
|
|
|
_ => 0,
|
|
|
|
};
|
|
|
|
// because this actually equips the item
|
|
|
|
inventory[index].flags |= match item.item {
|
2020-04-03 22:56:14 -07:00
|
|
|
ItemInstance::Individual(ItemEntity {location: ItemLocation::Inventory{ equipped: true, ..}, ..}) => 8,
|
2020-03-21 17:47:28 -07:00
|
|
|
_ => 0,
|
|
|
|
};
|
|
|
|
inventory
|
|
|
|
})
|
2020-01-18 23:38:42 -08:00
|
|
|
}
|
|
|
|
|
2020-03-21 17:47:28 -07:00
|
|
|
pub fn count(&self) -> usize {
|
|
|
|
self.0.len()
|
2020-01-18 23:38:42 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-03 22:56:14 -07:00
|
|
|
fn inventory_item_index(item: &ItemInstance) -> usize {
|
2020-03-21 17:47:28 -07:00
|
|
|
match item {
|
2020-04-03 22:56:14 -07:00
|
|
|
ItemInstance::Individual(i) => {
|
2020-03-21 17:47:28 -07:00
|
|
|
match i.location {
|
|
|
|
ItemLocation::Inventory{index: index, ..} => index,
|
|
|
|
_ => panic!()
|
|
|
|
}
|
|
|
|
},
|
2020-04-03 22:56:14 -07:00
|
|
|
ItemInstance::Stacked(i) => {
|
2020-03-21 17:47:28 -07:00
|
|
|
match i[0].location {
|
|
|
|
ItemLocation::Inventory{index: index, ..} => index,
|
|
|
|
_ => panic!()
|
|
|
|
}
|
2020-04-03 22:56:14 -07:00
|
|
|
},
|
|
|
|
_ => panic!(),
|
2020-01-18 23:38:42 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-26 22:01:05 -06:00
|
|
|
pub struct ActiveItemOnFloor {
|
|
|
|
pub map_area: MapArea,
|
|
|
|
pub x: f32,
|
|
|
|
pub y: f32,
|
|
|
|
pub z: f32,
|
|
|
|
pub item: ActiveItem,
|
|
|
|
}
|
|
|
|
|
2020-04-03 22:56:14 -07:00
|
|
|
fn stack_items(items: Vec<ItemEntity>) -> Vec<ItemInstance> {
|
2020-03-21 17:47:28 -07:00
|
|
|
let mut stacks = HashMap::new();
|
2020-01-18 23:38:42 -08:00
|
|
|
|
2020-03-21 17:47:28 -07:00
|
|
|
for item in items {
|
|
|
|
stacks.entry(item.item.item_type()).or_insert(Vec::new()).push(item);
|
|
|
|
}
|
2020-01-18 23:38:42 -08:00
|
|
|
|
2020-03-21 17:47:28 -07:00
|
|
|
stacks.into_iter()
|
|
|
|
.map(|(itype, items)| {
|
|
|
|
match items[0].item.is_stackable() {
|
|
|
|
true => {
|
2020-04-03 22:56:14 -07:00
|
|
|
vec![ItemInstance::Stacked(items)]
|
2020-03-21 17:47:28 -07:00
|
|
|
},
|
|
|
|
false => {
|
|
|
|
items.into_iter().map(|i| {
|
2020-04-03 22:56:14 -07:00
|
|
|
ItemInstance::Individual(i)
|
2020-03-21 17:47:28 -07:00
|
|
|
}).collect()
|
|
|
|
}
|
2020-01-18 23:38:42 -08:00
|
|
|
}
|
|
|
|
})
|
2020-03-21 17:47:28 -07:00
|
|
|
.flatten()
|
|
|
|
.collect()
|
2020-01-18 23:38:42 -08:00
|
|
|
}
|
|
|
|
|
2020-03-21 17:47:28 -07:00
|
|
|
struct ActiveBank([Option<ActiveItemId>; 200]);
|
2020-01-18 23:38:42 -08:00
|
|
|
|
2020-03-21 17:47:28 -07:00
|
|
|
pub struct ActiveItemDatabase {
|
|
|
|
id: u32,
|
2020-01-18 23:38:42 -08:00
|
|
|
}
|
|
|
|
|
2020-03-21 17:47:28 -07:00
|
|
|
impl ActiveItemDatabase {
|
|
|
|
pub fn new() -> ActiveItemDatabase {
|
|
|
|
ActiveItemDatabase {
|
|
|
|
id: 0,
|
|
|
|
}
|
2020-01-18 23:38:42 -08:00
|
|
|
}
|
|
|
|
|
2020-04-03 22:56:14 -07:00
|
|
|
fn activate_item(&mut self, item: ItemInstance) -> ActiveItem {
|
2020-03-21 17:47:28 -07:00
|
|
|
self.id += 1;
|
|
|
|
ActiveItem {
|
|
|
|
id: ActiveItemId(self.id),
|
|
|
|
item: item,
|
|
|
|
}
|
2020-01-18 23:38:42 -08:00
|
|
|
}
|
|
|
|
|
2020-04-26 22:01:05 -06:00
|
|
|
// TODO: deactivate item
|
2020-01-18 23:38:42 -08:00
|
|
|
|
2020-03-29 12:43:20 -07:00
|
|
|
pub fn get_character_inventory<EG: EntityGateway>(&mut self, entity_gateway: &mut EG, character: &CharacterEntity) -> ActiveInventory {
|
2020-03-21 17:47:28 -07:00
|
|
|
let items = entity_gateway.get_items_by_character(&character);
|
|
|
|
let inventory_items = items.into_iter()
|
|
|
|
.filter(|item| {
|
|
|
|
match item.location {
|
|
|
|
ItemLocation::Inventory{..} => true,
|
|
|
|
_ => false,
|
2020-01-18 23:38:42 -08:00
|
|
|
}
|
2020-03-21 17:47:28 -07:00
|
|
|
}).collect();
|
|
|
|
let mut stacked = stack_items(inventory_items);
|
|
|
|
stacked.sort_by(|a, b| {
|
|
|
|
inventory_item_index(a).partial_cmp(&inventory_item_index(b)).unwrap()
|
|
|
|
});
|
|
|
|
let activated = stacked.into_iter().map(|i| self.activate_item(i));
|
|
|
|
ActiveInventory(activated.take(30).collect())
|
2020-01-18 23:38:42 -08:00
|
|
|
}
|
2020-04-26 22:01:05 -06:00
|
|
|
|
2020-04-26 22:23:59 -06:00
|
|
|
pub fn activate_item_drop<EG: EntityGateway>(&mut self, entity_gateway: &mut EG, item_drop: ItemDrop) -> Result<ActiveItemOnFloor, ShipError> {
|
2020-04-26 22:01:05 -06:00
|
|
|
let item_detail = match item_drop.item {
|
|
|
|
ItemDropType::Weapon(w) => Some(ItemDetail::Weapon(w)),
|
|
|
|
ItemDropType::Armor(w) => Some(ItemDetail::Armor(w)),
|
|
|
|
ItemDropType::Shield(w) => Some(ItemDetail::Shield(w)),
|
|
|
|
ItemDropType::Unit(w) => Some(ItemDetail::Unit(w)),
|
|
|
|
ItemDropType::Tool(w) => Some(ItemDetail::Tool(w)),
|
|
|
|
ItemDropType::TechniqueDisk(w) => Some(ItemDetail::TechniqueDisk(w)),
|
|
|
|
ItemDropType::Mag(w) => Some(ItemDetail::Mag(w)),
|
|
|
|
ItemDropType::Meseta(_) => None
|
|
|
|
};
|
|
|
|
let item_instance = match item_detail {
|
|
|
|
Some(item) => {
|
|
|
|
let item_entity = entity_gateway.create_item(NewItemEntity {
|
|
|
|
item: item,
|
|
|
|
location: ItemLocation::Floor {
|
|
|
|
map_area: item_drop.map_area,
|
|
|
|
x: item_drop.x,
|
|
|
|
y: item_drop.y,
|
|
|
|
z: item_drop.z,
|
|
|
|
}
|
|
|
|
}).unwrap();
|
2020-04-26 22:23:59 -06:00
|
|
|
stack_items(vec![item_entity]).pop().ok_or(ShipError::ItemError)?
|
2020-04-26 22:01:05 -06:00
|
|
|
},
|
|
|
|
None => {
|
|
|
|
let meseta = match item_drop.item {
|
|
|
|
ItemDropType::Meseta(m) => m,
|
|
|
|
_ => panic!(),
|
|
|
|
};
|
|
|
|
ItemInstance::Meseta(Meseta(meseta))
|
|
|
|
}
|
|
|
|
};
|
|
|
|
let active_item = self.activate_item(item_instance);
|
|
|
|
|
2020-04-26 22:23:59 -06:00
|
|
|
Ok(ActiveItemOnFloor {
|
2020-04-26 22:01:05 -06:00
|
|
|
map_area: item_drop.map_area,
|
|
|
|
x: item_drop.x,
|
|
|
|
y: item_drop.y,
|
|
|
|
z: item_drop.z,
|
|
|
|
item: active_item,
|
2020-04-26 22:23:59 -06:00
|
|
|
})
|
2020-04-26 22:01:05 -06:00
|
|
|
}
|
2020-01-18 23:38:42 -08:00
|
|
|
}
|
|
|
|
|
2020-03-21 17:47:28 -07:00
|
|
|
#[cfg(test)]
|
2020-01-18 23:38:42 -08:00
|
|
|
mod test {
|
|
|
|
use super::*;
|
2020-03-29 14:40:24 -07:00
|
|
|
use crate::entity::character::CharacterEntityId;
|
2020-02-06 23:08:52 -08:00
|
|
|
use crate::entity::item;
|
2020-03-29 14:53:51 -07:00
|
|
|
use crate::entity::item::{ItemEntity, ItemDetail, ItemEntityId, ItemLocation};
|
2020-01-18 23:38:42 -08:00
|
|
|
#[test]
|
2020-03-21 17:47:28 -07:00
|
|
|
fn test_stack_items() {
|
2020-03-29 14:53:51 -07:00
|
|
|
let item1 = ItemEntity {
|
2020-03-30 19:28:49 -07:00
|
|
|
id: ItemEntityId(1),
|
2020-01-18 23:38:42 -08:00
|
|
|
location: ItemLocation::Inventory {
|
2020-03-29 14:40:24 -07:00
|
|
|
character_id: CharacterEntityId(0),
|
2020-01-18 23:38:42 -08:00
|
|
|
index: 0,
|
2020-03-29 10:45:01 -07:00
|
|
|
equipped: false,
|
2020-01-18 23:38:42 -08:00
|
|
|
},
|
2020-03-16 20:34:50 -07:00
|
|
|
item: ItemDetail::Weapon(item::weapon::Weapon {
|
|
|
|
weapon: item::weapon::WeaponType::Saber,
|
|
|
|
grind: 0,
|
|
|
|
special: None,
|
|
|
|
attrs: [None; 3],
|
2020-03-14 10:44:27 -07:00
|
|
|
tekked: true,
|
2020-01-18 23:38:42 -08:00
|
|
|
})
|
|
|
|
};
|
2020-03-29 14:53:51 -07:00
|
|
|
let item2 = ItemEntity {
|
2020-03-30 19:28:49 -07:00
|
|
|
id: ItemEntityId(2),
|
2020-01-18 23:38:42 -08:00
|
|
|
location: ItemLocation::Inventory {
|
2020-03-29 14:40:24 -07:00
|
|
|
character_id: CharacterEntityId(0),
|
2020-03-29 10:45:01 -07:00
|
|
|
index: 1,
|
|
|
|
equipped: false,
|
2020-01-18 23:38:42 -08:00
|
|
|
},
|
|
|
|
item: ItemDetail::Tool(Tool {
|
|
|
|
tool: item::tool::ToolType::Monofluid,
|
|
|
|
})
|
|
|
|
};
|
2020-03-29 14:53:51 -07:00
|
|
|
let item3 = ItemEntity {
|
2020-03-30 19:28:49 -07:00
|
|
|
id: ItemEntityId(3),
|
2020-01-18 23:38:42 -08:00
|
|
|
location: ItemLocation::Inventory {
|
2020-03-29 14:40:24 -07:00
|
|
|
character_id: CharacterEntityId(0),
|
2020-01-18 23:38:42 -08:00
|
|
|
index: 2,
|
2020-03-29 10:45:01 -07:00
|
|
|
equipped: false,
|
2020-01-18 23:38:42 -08:00
|
|
|
},
|
2020-03-16 20:34:50 -07:00
|
|
|
item: ItemDetail::Weapon(item::weapon::Weapon {
|
|
|
|
weapon: item::weapon::WeaponType::Handgun,
|
|
|
|
grind: 12,
|
|
|
|
special: None,
|
|
|
|
attrs: [None; 3],
|
2020-03-14 10:44:27 -07:00
|
|
|
tekked: true,
|
2020-01-18 23:38:42 -08:00
|
|
|
})
|
|
|
|
};
|
2020-03-29 22:00:07 -07:00
|
|
|
let item4 = ItemEntity {
|
2020-03-30 19:28:49 -07:00
|
|
|
id: ItemEntityId(4),
|
2020-01-18 23:38:42 -08:00
|
|
|
location: ItemLocation::Inventory {
|
2020-03-29 14:40:24 -07:00
|
|
|
character_id: CharacterEntityId(0),
|
2020-03-29 10:45:01 -07:00
|
|
|
index: 1,
|
|
|
|
equipped: false,
|
2020-01-18 23:38:42 -08:00
|
|
|
},
|
|
|
|
item: ItemDetail::Tool(Tool {
|
|
|
|
tool: item::tool::ToolType::Monofluid,
|
|
|
|
})
|
|
|
|
};
|
2020-03-29 14:53:51 -07:00
|
|
|
let item5 = ItemEntity {
|
2020-03-30 19:28:49 -07:00
|
|
|
id: ItemEntityId(5),
|
2020-01-18 23:38:42 -08:00
|
|
|
location: ItemLocation::Inventory {
|
2020-03-29 14:40:24 -07:00
|
|
|
character_id: CharacterEntityId(0),
|
2020-03-29 10:45:01 -07:00
|
|
|
index: 1,
|
|
|
|
equipped: false,
|
2020-01-18 23:38:42 -08:00
|
|
|
},
|
|
|
|
item: ItemDetail::Tool(Tool {
|
|
|
|
tool: item::tool::ToolType::Monofluid,
|
|
|
|
})
|
|
|
|
};
|
2020-03-29 14:53:51 -07:00
|
|
|
let item6 = ItemEntity {
|
2020-03-30 19:28:49 -07:00
|
|
|
id: ItemEntityId(6),
|
2020-01-18 23:38:42 -08:00
|
|
|
location: ItemLocation::Inventory {
|
2020-03-29 14:40:24 -07:00
|
|
|
character_id: CharacterEntityId(0),
|
2020-01-18 23:38:42 -08:00
|
|
|
index: 3,
|
2020-03-29 10:45:01 -07:00
|
|
|
equipped: false,
|
2020-01-18 23:38:42 -08:00
|
|
|
},
|
2020-03-16 20:34:50 -07:00
|
|
|
item: ItemDetail::Weapon(item::weapon::Weapon {
|
|
|
|
weapon: item::weapon::WeaponType::Handgun,
|
|
|
|
grind: 12,
|
|
|
|
special: None,
|
|
|
|
attrs: [None; 3],
|
2020-03-14 10:44:27 -07:00
|
|
|
tekked: true,
|
2020-01-18 23:38:42 -08:00
|
|
|
})
|
|
|
|
};
|
2020-03-29 14:53:51 -07:00
|
|
|
let item7 = ItemEntity {
|
2020-03-30 19:28:49 -07:00
|
|
|
id: ItemEntityId(7),
|
2020-01-18 23:38:42 -08:00
|
|
|
location: ItemLocation::Inventory {
|
2020-03-29 14:40:24 -07:00
|
|
|
character_id: CharacterEntityId(0),
|
2020-03-29 10:45:01 -07:00
|
|
|
index: 4,
|
|
|
|
equipped: false,
|
2020-01-18 23:38:42 -08:00
|
|
|
},
|
|
|
|
item: ItemDetail::Tool(Tool {
|
|
|
|
tool: item::tool::ToolType::Monomate,
|
|
|
|
})
|
|
|
|
};
|
2020-03-29 14:53:51 -07:00
|
|
|
let item8 = ItemEntity {
|
2020-03-30 19:28:49 -07:00
|
|
|
id: ItemEntityId(8),
|
2020-01-18 23:38:42 -08:00
|
|
|
location: ItemLocation::Inventory {
|
2020-03-29 14:40:24 -07:00
|
|
|
character_id: CharacterEntityId(0),
|
2020-03-29 10:45:01 -07:00
|
|
|
index: 4,
|
|
|
|
equipped: false,
|
2020-01-18 23:38:42 -08:00
|
|
|
},
|
|
|
|
item: ItemDetail::Tool(Tool {
|
|
|
|
tool: item::tool::ToolType::Monomate,
|
|
|
|
})
|
|
|
|
};
|
2020-03-29 14:53:51 -07:00
|
|
|
let item9 = ItemEntity {
|
2020-03-30 19:28:49 -07:00
|
|
|
id: ItemEntityId(9),
|
2020-01-18 23:38:42 -08:00
|
|
|
location: ItemLocation::Inventory {
|
2020-03-29 14:40:24 -07:00
|
|
|
character_id: CharacterEntityId(0),
|
2020-03-29 10:45:01 -07:00
|
|
|
index: 4,
|
|
|
|
equipped: false,
|
2020-01-18 23:38:42 -08:00
|
|
|
},
|
|
|
|
item: ItemDetail::Tool(Tool {
|
|
|
|
tool: item::tool::ToolType::Monomate,
|
|
|
|
})
|
|
|
|
};
|
|
|
|
let item_vec = vec![item1.clone(), item2.clone(), item3.clone(), item4.clone(), item5.clone(), item6.clone(), item7.clone(), item8.clone(), item9.clone()];
|
|
|
|
|
|
|
|
let stacked = stack_items(item_vec);
|
|
|
|
|
|
|
|
assert!(stacked.len() == 5);
|
|
|
|
assert!(stacked.iter().filter(|k| {
|
2020-04-03 22:56:14 -07:00
|
|
|
**k == ItemInstance::Individual(item6.clone())
|
2020-01-18 23:38:42 -08:00
|
|
|
}).count() == 1);
|
|
|
|
|
|
|
|
assert!(stacked.iter().filter(|k| {
|
2020-04-03 22:56:14 -07:00
|
|
|
**k == ItemInstance::Individual(item3.clone())
|
2020-01-18 23:38:42 -08:00
|
|
|
}).count() == 1);
|
|
|
|
|
|
|
|
assert!(stacked.iter().filter(|k| {
|
2020-04-03 22:56:14 -07:00
|
|
|
**k == ItemInstance::Individual(item1.clone())
|
2020-01-18 23:38:42 -08:00
|
|
|
}).count() == 1);
|
|
|
|
|
|
|
|
assert!(stacked.iter().filter(|k| {
|
2020-04-03 22:56:14 -07:00
|
|
|
**k == ItemInstance::Stacked(vec![item2.clone(), item4.clone(), item5.clone()])
|
2020-01-18 23:38:42 -08:00
|
|
|
}).count() == 1);
|
|
|
|
|
|
|
|
assert!(stacked.iter().filter(|k| {
|
2020-04-03 22:56:14 -07:00
|
|
|
**k == ItemInstance::Stacked(vec![item7.clone(), item8.clone(), item9.clone()])
|
2020-01-18 23:38:42 -08:00
|
|
|
}).count() == 1);
|
|
|
|
}
|
|
|
|
}
|