|
|
@ -31,7 +31,7 @@ async fn test_bank_items_sent_in_character_login() { |
|
|
|
),
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![item]), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![item]), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -69,7 +69,7 @@ async fn test_request_bank_items() { |
|
|
|
}).await.unwrap());
|
|
|
|
}
|
|
|
|
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(bank), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(bank), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -113,7 +113,7 @@ async fn test_request_stacked_bank_items() { |
|
|
|
}).await.unwrap());
|
|
|
|
}
|
|
|
|
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![monomates]), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![monomates]), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -178,7 +178,7 @@ async fn test_request_bank_items_sorted() { |
|
|
|
}).await.unwrap();
|
|
|
|
|
|
|
|
let bank = vec![item::BankItemEntity::Individual(item1), vec![monomate].into(), item2.into()];
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(bank), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(bank), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -269,7 +269,13 @@ async fn test_deposit_individual_item() { |
|
|
|
&& player_no_longer_has_item.amount == 0
|
|
|
|
));
|
|
|
|
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let inventory_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
|
assert_eq!(inventory_items.items.len(), 1);
|
|
|
|
inventory_items.items[0].with_individual(|item| {
|
|
|
|
assert_eq!(item.id, item::ItemEntityId(1));
|
|
|
|
}).unwrap();
|
|
|
|
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert_eq!(bank_items.items.len(), 1);
|
|
|
|
bank_items.items[0].with_individual(|item| {
|
|
|
|
assert_eq!(item.id, item::ItemEntityId(2));
|
|
|
@ -329,7 +335,7 @@ async fn test_deposit_stacked_item() { |
|
|
|
&& player_no_longer_has_item.amount == 3
|
|
|
|
));
|
|
|
|
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert_eq!(bank_items.items.len(), 1);
|
|
|
|
bank_items.items[0].with_stacked(|items| {
|
|
|
|
assert_eq!(items.iter().map(|i| i.id).collect::<Vec<_>>(),
|
|
|
@ -391,7 +397,7 @@ async fn test_deposit_partial_stacked_item() { |
|
|
|
));
|
|
|
|
|
|
|
|
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert_eq!(bank_items.items.len(), 1);
|
|
|
|
bank_items.items[0].with_stacked(|items| {
|
|
|
|
assert_eq!(items.iter().map(|i| i.id).collect::<Vec<_>>(),
|
|
|
@ -437,7 +443,7 @@ async fn test_deposit_stacked_item_with_stack_already_in_bank() { |
|
|
|
}
|
|
|
|
|
|
|
|
entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(vec![inventory_monomates])).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![bank_monomates]), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![bank_monomates]), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -471,7 +477,7 @@ async fn test_deposit_stacked_item_with_stack_already_in_bank() { |
|
|
|
&& player_no_longer_has_item.amount == 2
|
|
|
|
));
|
|
|
|
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert_eq!(bank_items.items.len(), 1);
|
|
|
|
bank_items.items[0].with_stacked(|items| {
|
|
|
|
assert_eq!(items.iter().map(|i| i.id).collect::<BTreeSet<_>>(),
|
|
|
@ -510,7 +516,7 @@ async fn test_deposit_stacked_item_with_full_stack_in_bank() { |
|
|
|
}
|
|
|
|
|
|
|
|
entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(vec![inventory_monomates])).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![bank_monomates]), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![bank_monomates]), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -537,7 +543,7 @@ async fn test_deposit_stacked_item_with_full_stack_in_bank() { |
|
|
|
|
|
|
|
assert!(packets.is_err());
|
|
|
|
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert_eq!(bank_items.items.len(), 1);
|
|
|
|
bank_items.items[0].with_stacked(|items| {
|
|
|
|
assert_eq!(items.len(), 10);
|
|
|
@ -588,7 +594,7 @@ async fn test_deposit_individual_item_in_full_bank() { |
|
|
|
}
|
|
|
|
|
|
|
|
entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(inventory)).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(bank), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(bank), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -615,7 +621,7 @@ async fn test_deposit_individual_item_in_full_bank() { |
|
|
|
|
|
|
|
assert!(packets.is_err());
|
|
|
|
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert_eq!(bank_items.items.len(), 200);
|
|
|
|
|
|
|
|
let inventory_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
@ -660,7 +666,7 @@ async fn test_deposit_stacked_item_in_full_bank() { |
|
|
|
}
|
|
|
|
|
|
|
|
entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(vec![monomates])).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(full_bank), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(full_bank), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -687,7 +693,7 @@ async fn test_deposit_stacked_item_in_full_bank() { |
|
|
|
|
|
|
|
assert!(packets.is_err());
|
|
|
|
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert_eq!(bank_items.items.len(), 200);
|
|
|
|
|
|
|
|
let inventory_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
@ -746,7 +752,7 @@ async fn test_deposit_stacked_item_in_full_bank_with_partial_stack() { |
|
|
|
almost_full_bank.push(bank_monomates.into());
|
|
|
|
|
|
|
|
entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(vec![monomates])).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(almost_full_bank), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(almost_full_bank), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -771,7 +777,7 @@ async fn test_deposit_stacked_item_in_full_bank_with_partial_stack() { |
|
|
|
unknown: 0,
|
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert_eq!(bank_items.items.len(), 200);
|
|
|
|
bank_items.items[199].with_stacked(|items| {
|
|
|
|
assert_eq!(items.len(), 4);
|
|
|
@ -812,7 +818,7 @@ async fn test_deposit_meseta() { |
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert!(c1_meseta.0 == 277);
|
|
|
|
assert!(c1_bank_meseta.0 == 23);
|
|
|
|
}
|
|
|
@ -823,7 +829,7 @@ async fn test_deposit_too_much_meseta() { |
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(300)).await.unwrap();
|
|
|
|
entity_gateway.set_bank_meseta(&char1.id, item::BankName("".into()), item::Meseta(999980)).await.unwrap();
|
|
|
|
entity_gateway.set_bank_meseta(&char1.id, &item::BankName("".into()), item::Meseta(999980)).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -849,7 +855,7 @@ async fn test_deposit_too_much_meseta() { |
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert!(c1_meseta.0 == 300);
|
|
|
|
assert!(c1_bank_meseta.0 == 999980);
|
|
|
|
}
|
|
|
@ -860,7 +866,7 @@ async fn test_deposit_meseta_when_bank_is_maxed() { |
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(300)).await.unwrap();
|
|
|
|
entity_gateway.set_bank_meseta(&char1.id, item::BankName("".into()), item::Meseta(999999)).await.unwrap();
|
|
|
|
entity_gateway.set_bank_meseta(&char1.id, &item::BankName("".into()), item::Meseta(999999)).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -886,7 +892,7 @@ async fn test_deposit_meseta_when_bank_is_maxed() { |
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert!(c1_meseta.0 == 300);
|
|
|
|
assert!(c1_bank_meseta.0 == 999999);
|
|
|
|
}
|
|
|
@ -913,7 +919,7 @@ async fn test_withdraw_individual_item() { |
|
|
|
),
|
|
|
|
}).await.unwrap());
|
|
|
|
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(bank), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(bank), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -973,7 +979,7 @@ async fn test_withdraw_stacked_item() { |
|
|
|
}).await.unwrap());
|
|
|
|
}
|
|
|
|
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![monomates]), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![monomates]), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -1032,7 +1038,7 @@ async fn test_withdraw_partial_stacked_item() { |
|
|
|
),
|
|
|
|
}).await.unwrap());
|
|
|
|
}
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![monomates]), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![monomates]), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -1062,10 +1068,10 @@ async fn test_withdraw_partial_stacked_item() { |
|
|
|
|
|
|
|
assert!(packets.len() == 2);
|
|
|
|
assert!(matches!(&packets[1], (ClientId(2), SendShipPacket::Message(Message {msg: GameMessage::CreateItem(create_item)}))
|
|
|
|
if create_item.item_id == 0x10002
|
|
|
|
if create_item.item_id == 0x20002
|
|
|
|
));
|
|
|
|
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert_eq!(bank_items.items.len(), 1);
|
|
|
|
bank_items.items[0].with_stacked(|items| {
|
|
|
|
assert_eq!(items.iter().map(|i| i.id).collect::<Vec<_>>(),
|
|
|
@ -1110,7 +1116,7 @@ async fn test_withdraw_stacked_item_with_stack_already_in_inventory() { |
|
|
|
}
|
|
|
|
|
|
|
|
entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(vec![inventory_monomates])).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![bank_monomates]), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![bank_monomates]), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -1143,7 +1149,7 @@ async fn test_withdraw_stacked_item_with_stack_already_in_inventory() { |
|
|
|
if create_item.item_id == 0x10000
|
|
|
|
));
|
|
|
|
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert_eq!(bank_items.items.len(), 0);
|
|
|
|
|
|
|
|
let inventory_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
@ -1185,7 +1191,7 @@ async fn test_withdraw_stacked_item_with_full_stack_in_inventory() { |
|
|
|
}
|
|
|
|
|
|
|
|
entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(vec![inventory_monomates])).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![bank_monomates]), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![bank_monomates]), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -1212,7 +1218,7 @@ async fn test_withdraw_stacked_item_with_full_stack_in_inventory() { |
|
|
|
|
|
|
|
assert!(packets.is_err());
|
|
|
|
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert_eq!(bank_items.items.len(), 1);
|
|
|
|
bank_items.items[0].with_stacked(|items| {
|
|
|
|
assert_eq!(items.iter().map(|i| i.id).collect::<Vec<_>>(),
|
|
|
@ -1263,7 +1269,7 @@ async fn test_withdraw_individual_item_in_full_inventory() { |
|
|
|
}
|
|
|
|
|
|
|
|
entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(inventory)).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(bank), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(bank), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -1289,7 +1295,7 @@ async fn test_withdraw_individual_item_in_full_inventory() { |
|
|
|
})))).await;
|
|
|
|
assert!(packets.is_err());
|
|
|
|
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert_eq!(bank_items.items.len(), 1);
|
|
|
|
|
|
|
|
let inventory_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
@ -1331,7 +1337,7 @@ async fn test_withdraw_stacked_item_in_full_inventory() { |
|
|
|
}
|
|
|
|
|
|
|
|
entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(inventory)).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![monomates]), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![monomates]), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -1359,7 +1365,7 @@ async fn test_withdraw_stacked_item_in_full_inventory() { |
|
|
|
assert!(packets.is_err());
|
|
|
|
|
|
|
|
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert_eq!(bank_items.items.len(), 1);
|
|
|
|
bank_items.items[0].with_stacked(|items| {
|
|
|
|
assert_eq!(items.iter().map(|i| i.id).collect::<Vec<_>>(),
|
|
|
@ -1387,7 +1393,7 @@ async fn test_withdraw_stacked_item_in_full_inventory_with_partial_stack() { |
|
|
|
),
|
|
|
|
}).await.unwrap());
|
|
|
|
}
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![bank_item]), item::BankName("".into())).await.unwrap();
|
|
|
|
entity_gateway.set_character_bank(&char1.id, &item::BankEntity::new(vec![bank_item]), &item::BankName("".into())).await.unwrap();
|
|
|
|
|
|
|
|
let mut items = Vec::new();
|
|
|
|
for _i in 0..29usize {
|
|
|
@ -1443,7 +1449,7 @@ async fn test_withdraw_stacked_item_in_full_inventory_with_partial_stack() { |
|
|
|
unknown: 0,
|
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let bank_items = entity_gateway.get_character_bank(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert!(bank_items.items.len() == 0);
|
|
|
|
|
|
|
|
let inventory_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
@ -1461,7 +1467,7 @@ async fn test_withdraw_meseta() { |
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
entity_gateway.set_bank_meseta(&char1.id, item::BankName("".into()), item::Meseta(300)).await.unwrap();
|
|
|
|
entity_gateway.set_bank_meseta(&char1.id, &item::BankName("".into()), item::Meseta(300)).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -1487,7 +1493,7 @@ async fn test_withdraw_meseta() { |
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert!(c1_meseta.0 == 23);
|
|
|
|
assert!(c1_bank_meseta.0 == 277);
|
|
|
|
}
|
|
|
@ -1498,7 +1504,7 @@ async fn test_withdraw_too_much_meseta() { |
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999980)).await.unwrap();
|
|
|
|
entity_gateway.set_bank_meseta(&char1.id, item::BankName("".into()), item::Meseta(300)).await.unwrap();
|
|
|
|
entity_gateway.set_bank_meseta(&char1.id, &item::BankName("".into()), item::Meseta(300)).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -1524,7 +1530,7 @@ async fn test_withdraw_too_much_meseta() { |
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert!(c1_meseta.0 == 999980);
|
|
|
|
assert!(c1_bank_meseta.0 == 300);
|
|
|
|
}
|
|
|
@ -1535,7 +1541,7 @@ async fn test_withdraw_meseta_inventory_is_maxed() { |
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
|
|
|
|
entity_gateway.set_bank_meseta(&char1.id, item::BankName("".into()), item::Meseta(300)).await.unwrap();
|
|
|
|
entity_gateway.set_bank_meseta(&char1.id, &item::BankName("".into()), item::Meseta(300)).await.unwrap();
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
|
.gateway(entity_gateway.clone())
|
|
|
@ -1561,7 +1567,7 @@ async fn test_withdraw_meseta_inventory_is_maxed() { |
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, item::BankName("".into())).await.unwrap();
|
|
|
|
let c1_bank_meseta = entity_gateway.get_bank_meseta(&char1.id, &item::BankName("".into())).await.unwrap();
|
|
|
|
assert!(c1_meseta.0 == 999999);
|
|
|
|
assert!(c1_bank_meseta.0 == 300);
|
|
|
|
}
|