|
|
@ -312,22 +312,6 @@ async fn test_use_barta_1() { |
|
|
|
|
|
|
|
let (user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
|
|
/*
|
|
|
|
let mut p1_inv = Vec::new();
|
|
|
|
for tool in vec![item::tool::ToolType::PowerMaterial, item::tool::ToolType::].into_iter() {
|
|
|
|
let mut item = Vec::new();
|
|
|
|
for _ in 0..5usize {
|
|
|
|
item.push(entity_gateway.create_item(
|
|
|
|
item::NewItemEntity {
|
|
|
|
item: item::ItemDetail::Tool(
|
|
|
|
item::tool::Tool {
|
|
|
|
tool: tool
|
|
|
|
}
|
|
|
|
),
|
|
|
|
}).await.unwrap());
|
|
|
|
}
|
|
|
|
p1_inv.push(item::InventoryItemEntity::Stacked(item));
|
|
|
|
}*/
|
|
|
|
let inv = vec![
|
|
|
|
entity_gateway.create_item(
|
|
|
|
item::NewItemEntity {
|
|
|
@ -391,6 +375,76 @@ async fn test_use_barta_1() { |
|
|
|
assert!(char.techs.techs.get(&item::tech::Technique::Barta).is_none());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[async_std::test]
|
|
|
|
async fn test_use_monogrinder() {
|
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
|
|
|
|
let saber = entity_gateway.create_item(
|
|
|
|
item::NewItemEntity {
|
|
|
|
item: item::ItemDetail::Weapon(
|
|
|
|
item::weapon::Weapon {
|
|
|
|
weapon: item::weapon::WeaponType::Saber,
|
|
|
|
grind: 0,
|
|
|
|
special: None,
|
|
|
|
attrs: [None, None, None],
|
|
|
|
tekked: true,
|
|
|
|
}
|
|
|
|
),
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
|
|
let mut grinders = Vec::new();
|
|
|
|
for _ in 0..3usize {
|
|
|
|
grinders.push(entity_gateway.create_item(
|
|
|
|
item::NewItemEntity {
|
|
|
|
item: item::ItemDetail::Tool(
|
|
|
|
item::tool::Tool {
|
|
|
|
tool: item::tool::ToolType::Monogrinder,
|
|
|
|
}
|
|
|
|
),
|
|
|
|
}).await.unwrap());
|
|
|
|
}
|
|
|
|
|
|
|
|
let equipped = item::EquippedEntity {
|
|
|
|
weapon: Some(saber.id),
|
|
|
|
armor: None,
|
|
|
|
shield: None,
|
|
|
|
unit: [None; 4],
|
|
|
|
mag: None,
|
|
|
|
};
|
|
|
|
entity_gateway.set_character_equips(&char1.id, &equipped).await.unwrap();
|
|
|
|
entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(vec![item::InventoryItemEntity::Individual(saber),
|
|
|
|
item::InventoryItemEntity::Stacked(grinders)])).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
|
.build());
|
|
|
|
log_in_char(&mut ship, ClientId(1), "a1", "a").await;
|
|
|
|
join_lobby(&mut ship, ClientId(1)).await;
|
|
|
|
create_room(&mut ship, ClientId(1), "room", "").await;
|
|
|
|
|
|
|
|
ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerUseItem(PlayerUseItem {
|
|
|
|
client: 0,
|
|
|
|
target: 0,
|
|
|
|
item_id: 0x10001,
|
|
|
|
})))).await.unwrap();
|
|
|
|
|
|
|
|
ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerUseItem(PlayerUseItem {
|
|
|
|
client: 0,
|
|
|
|
target: 0,
|
|
|
|
item_id: 0x10001,
|
|
|
|
})))).await.unwrap();
|
|
|
|
|
|
|
|
let inventory_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
|
assert_eq!(inventory_items.items.len(), 2);
|
|
|
|
|
|
|
|
assert!(matches!(inventory_items.items[0], item::InventoryItemEntity::Individual(item::ItemEntity{ item: item::ItemDetail::Weapon(item::weapon::Weapon {grind: 2, ..}), ..})));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: tests for ALL ITEMS WOW
|
|
|
|
|
|
|
|
/*
|
|
|
|