|
|
@ -1579,3 +1579,57 @@ async fn test_withdraw_meseta_inventory_is_maxed() { |
|
|
|
assert!(c1_meseta.0 == 999999);
|
|
|
|
assert!(c1_bank_meseta.0 == 300);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[async_std::test]
|
|
|
|
async fn test_withdraw_meseta_and_buy_a_few_monomates_with_it() {
|
|
|
|
let mut entity_gateway = InMemoryGateway::default();
|
|
|
|
|
|
|
|
let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(100)).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())
|
|
|
|
.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::DirectMessage(DirectMessage::new(0, GameMessage::BankRequest(BankRequest {
|
|
|
|
client: 0,
|
|
|
|
target: 0,
|
|
|
|
unknown: 0,
|
|
|
|
})))).await.unwrap();
|
|
|
|
|
|
|
|
ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BankInteraction(BankInteraction {
|
|
|
|
client: 0,
|
|
|
|
target: 0,
|
|
|
|
item_id: 0xFFFFFFFF,
|
|
|
|
action: 1,
|
|
|
|
item_amount: 0,
|
|
|
|
meseta_amount: 60,
|
|
|
|
unknown: 0,
|
|
|
|
})))).await.unwrap();
|
|
|
|
|
|
|
|
ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::ShopRequest(ShopRequest {
|
|
|
|
client: 255,
|
|
|
|
target: 255,
|
|
|
|
shop_type: 0,
|
|
|
|
})))).await.unwrap();
|
|
|
|
ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BuyItem(BuyItem {
|
|
|
|
client: 255,
|
|
|
|
target: 255,
|
|
|
|
item_id: 0x10000,
|
|
|
|
shop_type: 0,
|
|
|
|
shop_index: 0,
|
|
|
|
amount: 3,
|
|
|
|
unknown1: 0,
|
|
|
|
})))).await.unwrap();
|
|
|
|
|
|
|
|
//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();
|
|
|
|
//assert!(c1_meseta.0 == 23);
|
|
|
|
//assert!(c1_bank_meseta.0 == 277);
|
|
|
|
}
|