|
@ -107,8 +107,8 @@ async fn test_player_buys_from_weapon_shop() { |
|
|
|
|
|
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
char1.exp = 80000000;
|
|
|
char1.exp = 80000000;
|
|
|
char1.meseta = 999999;
|
|
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
@ -132,9 +132,8 @@ async fn test_player_buys_from_weapon_shop() { |
|
|
unknown1: 0,
|
|
|
unknown1: 0,
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
|
let characters1 = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
|
|
|
let c1 = characters1.get(0).as_ref().unwrap().as_ref().unwrap();
|
|
|
|
|
|
assert!(c1.meseta < 999999);
|
|
|
|
|
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
|
|
assert!(c1_meseta.0 < 999999);
|
|
|
//let p1_items = entity_gateway.get_items_by_character(&char1.id).await.unwrap();
|
|
|
//let p1_items = entity_gateway.get_items_by_character(&char1.id).await.unwrap();
|
|
|
let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
assert_eq!(p1_items.items.len(), 1);
|
|
|
assert_eq!(p1_items.items.len(), 1);
|
|
@ -146,8 +145,8 @@ async fn test_player_buys_from_tool_shop() { |
|
|
|
|
|
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
char1.exp = 80000000;
|
|
|
char1.exp = 80000000;
|
|
|
char1.meseta = 999999;
|
|
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
@ -171,9 +170,8 @@ async fn test_player_buys_from_tool_shop() { |
|
|
unknown1: 0,
|
|
|
unknown1: 0,
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
|
let characters1 = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
|
|
|
let c1 = characters1.get(0).as_ref().unwrap().as_ref().unwrap();
|
|
|
|
|
|
assert!(c1.meseta < 999999);
|
|
|
|
|
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
|
|
assert!(c1_meseta.0 < 999999);
|
|
|
let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
assert_eq!(p1_items.items.len(), 1);
|
|
|
assert_eq!(p1_items.items.len(), 1);
|
|
|
}
|
|
|
}
|
|
@ -184,8 +182,8 @@ async fn test_player_buys_multiple_from_tool_shop() { |
|
|
|
|
|
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
char1.exp = 80000000;
|
|
|
char1.exp = 80000000;
|
|
|
char1.meseta = 999999;
|
|
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
@ -209,9 +207,8 @@ async fn test_player_buys_multiple_from_tool_shop() { |
|
|
unknown1: 0,
|
|
|
unknown1: 0,
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
|
let characters1 = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
|
|
|
let c1 = characters1.get(0).as_ref().unwrap().as_ref().unwrap();
|
|
|
|
|
|
assert!(c1.meseta < 999999);
|
|
|
|
|
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
|
|
assert!(c1_meseta.0 < 999999);
|
|
|
let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
assert_eq!(p1_items.items.len(), 1);
|
|
|
assert_eq!(p1_items.items.len(), 1);
|
|
|
p1_items.items[0].with_stacked(|item| {
|
|
|
p1_items.items[0].with_stacked(|item| {
|
|
@ -226,8 +223,8 @@ async fn test_player_buys_from_armor_shop() { |
|
|
|
|
|
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
char1.exp = 80000000;
|
|
|
char1.exp = 80000000;
|
|
|
char1.meseta = 999999;
|
|
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
@ -251,9 +248,8 @@ async fn test_player_buys_from_armor_shop() { |
|
|
unknown1: 0,
|
|
|
unknown1: 0,
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
|
let characters1 = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
|
|
|
let c1 = characters1.get(0).as_ref().unwrap().as_ref().unwrap();
|
|
|
|
|
|
assert!(c1.meseta < 999999);
|
|
|
|
|
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
|
|
assert!(c1_meseta.0 < 999999);
|
|
|
let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
assert_eq!(p1_items.items.len(), 1);
|
|
|
assert_eq!(p1_items.items.len(), 1);
|
|
|
}
|
|
|
}
|
|
@ -269,7 +265,7 @@ async fn test_other_clients_see_purchase() { |
|
|
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
char1.exp = 80000000;
|
|
|
char1.exp = 80000000;
|
|
|
char1.meseta = 999999;
|
|
|
|
|
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
@ -312,8 +308,8 @@ async fn test_other_clients_see_stacked_purchase() { |
|
|
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a").await;
|
|
|
char1.exp = 80000000;
|
|
|
char1.exp = 80000000;
|
|
|
char1.meseta = 999999;
|
|
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
|
item::NewItemEntity {
|
|
|
item::NewItemEntity {
|
|
|
item: item::ItemDetail::Tool(
|
|
|
item: item::ItemDetail::Tool(
|
|
@ -385,9 +381,8 @@ async fn test_buying_item_without_enough_mseseta() { |
|
|
})))).await;
|
|
|
})))).await;
|
|
|
|
|
|
|
|
|
assert!(packets.is_err());
|
|
|
assert!(packets.is_err());
|
|
|
let characters1 = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
|
|
|
let c1 = characters1.get(0).as_ref().unwrap().as_ref().unwrap();
|
|
|
|
|
|
assert_eq!(c1.meseta, 0);
|
|
|
|
|
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
|
|
assert_eq!(c1_meseta.0, 0);
|
|
|
let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
assert_eq!(p1_items.items.len(), 0);
|
|
|
assert_eq!(p1_items.items.len(), 0);
|
|
|
}
|
|
|
}
|
|
@ -398,8 +393,8 @@ async fn test_player_double_buys_from_tool_shop() { |
|
|
|
|
|
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
let (user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
char1.exp = 80000000;
|
|
|
char1.exp = 80000000;
|
|
|
char1.meseta = 999999;
|
|
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
@ -441,9 +436,8 @@ async fn test_player_double_buys_from_tool_shop() { |
|
|
unknown1: 0,
|
|
|
unknown1: 0,
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
|
let characters1 = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
|
|
|
let c1 = characters1.get(0).as_ref().unwrap().as_ref().unwrap();
|
|
|
|
|
|
assert!(c1.meseta < 999999);
|
|
|
|
|
|
|
|
|
let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
|
|
|
|
|
|
assert!(c1_meseta.0 < 999999);
|
|
|
let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
|
|
|
assert_eq!(p1_items.items.len(), 2);
|
|
|
assert_eq!(p1_items.items.len(), 2);
|
|
|
p1_items.items[0].with_stacked(|item| {
|
|
|
p1_items.items[0].with_stacked(|item| {
|
|
@ -464,8 +458,8 @@ async fn test_techs_disappear_from_shop_when_bought() { |
|
|
|
|
|
|
|
|
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
char1.exp = 80000000;
|
|
|
char1.exp = 80000000;
|
|
|
char1.meseta = 999999;
|
|
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
@ -526,8 +520,8 @@ async fn test_units_disappear_from_shop_when_bought() { |
|
|
|
|
|
|
|
|
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a").await;
|
|
|
char1.exp = 80000000;
|
|
|
char1.exp = 80000000;
|
|
|
char1.meseta = 999999;
|
|
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
|
|
entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
let mut ship = Box::new(ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
|