|
@ -33,7 +33,7 @@ async fn test_bank_items_sent_in_character_login() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".to_string())
|
|
|
name: item::BankName("".to_string())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
@ -72,7 +72,7 @@ async fn test_request_bank_items() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".to_string())
|
|
|
name: item::BankName("".to_string())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -117,7 +117,7 @@ async fn test_request_stacked_bank_items() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".to_string())
|
|
|
name: item::BankName("".to_string())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -165,7 +165,7 @@ async fn test_request_bank_items_sorted() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".to_string())
|
|
|
name: item::BankName("".to_string())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
|
item::NewItemEntity {
|
|
|
item::NewItemEntity {
|
|
|
item: item::ItemDetail::Tool (
|
|
|
item: item::ItemDetail::Tool (
|
|
@ -177,7 +177,7 @@ async fn test_request_bank_items_sorted() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".to_string())
|
|
|
name: item::BankName("".to_string())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
|
item::NewItemEntity {
|
|
|
item::NewItemEntity {
|
|
|
item: item::ItemDetail::Weapon(
|
|
|
item: item::ItemDetail::Weapon(
|
|
@ -194,7 +194,7 @@ async fn test_request_bank_items_sorted() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".to_string())
|
|
|
name: item::BankName("".to_string())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
@ -243,7 +243,7 @@ async fn test_deposit_individual_item() { |
|
|
slot: 0,
|
|
|
slot: 0,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
|
item::NewItemEntity {
|
|
|
item::NewItemEntity {
|
|
|
item: item::ItemDetail::Weapon(
|
|
|
item: item::ItemDetail::Weapon(
|
|
@ -261,7 +261,7 @@ async fn test_deposit_individual_item() { |
|
|
slot: 1,
|
|
|
slot: 1,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
@ -295,7 +295,7 @@ async fn test_deposit_individual_item() { |
|
|
&& player_no_longer_has_item.amount == 0
|
|
|
&& player_no_longer_has_item.amount == 0
|
|
|
));
|
|
|
));
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let bank_item_ids = items.iter()
|
|
|
let bank_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
@ -329,7 +329,7 @@ async fn test_deposit_stacked_item() { |
|
|
slot: 0,
|
|
|
slot: 0,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -364,7 +364,7 @@ async fn test_deposit_stacked_item() { |
|
|
&& player_no_longer_has_item.amount == 3
|
|
|
&& player_no_longer_has_item.amount == 3
|
|
|
));
|
|
|
));
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let bank_item_ids = items.iter()
|
|
|
let bank_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
@ -398,7 +398,7 @@ async fn test_deposit_partial_stacked_item() { |
|
|
slot: 0,
|
|
|
slot: 0,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -433,7 +433,7 @@ async fn test_deposit_partial_stacked_item() { |
|
|
&& player_no_longer_has_item.amount == 2
|
|
|
&& player_no_longer_has_item.amount == 2
|
|
|
));
|
|
|
));
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let bank_item_ids = items.iter()
|
|
|
let bank_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
@ -480,7 +480,7 @@ async fn test_deposit_stacked_item_with_stack_already_in_bank() { |
|
|
slot: 0,
|
|
|
slot: 0,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
|
item::NewItemEntity {
|
|
|
item::NewItemEntity {
|
|
@ -493,7 +493,7 @@ async fn test_deposit_stacked_item_with_stack_already_in_bank() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".into()),
|
|
|
name: item::BankName("".into()),
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -528,7 +528,7 @@ async fn test_deposit_stacked_item_with_stack_already_in_bank() { |
|
|
&& player_no_longer_has_item.amount == 2
|
|
|
&& player_no_longer_has_item.amount == 2
|
|
|
));
|
|
|
));
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let bank_item_ids = items.iter()
|
|
|
let bank_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
@ -561,7 +561,7 @@ async fn test_deposit_stacked_item_with_full_stack_in_bank() { |
|
|
slot: 0,
|
|
|
slot: 0,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
for _ in 0..10 {
|
|
|
for _ in 0..10 {
|
|
@ -576,7 +576,7 @@ async fn test_deposit_stacked_item_with_full_stack_in_bank() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".into()),
|
|
|
name: item::BankName("".into()),
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -604,7 +604,7 @@ async fn test_deposit_stacked_item_with_full_stack_in_bank() { |
|
|
|
|
|
|
|
|
assert!(packets.is_err());
|
|
|
assert!(packets.is_err());
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let bank_item_ids = items.iter()
|
|
|
let bank_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
@ -653,7 +653,7 @@ async fn test_deposit_individual_item_in_full_bank() { |
|
|
slot: 0,
|
|
|
slot: 0,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
|
|
|
for _ in 0..200 {
|
|
|
for _ in 0..200 {
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
@ -672,7 +672,7 @@ async fn test_deposit_individual_item_in_full_bank() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".to_string())
|
|
|
name: item::BankName("".to_string())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -700,7 +700,7 @@ async fn test_deposit_individual_item_in_full_bank() { |
|
|
|
|
|
|
|
|
assert!(packets.is_err());
|
|
|
assert!(packets.is_err());
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let bank_item_ids = items.iter()
|
|
|
let bank_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
@ -745,7 +745,7 @@ async fn test_deposit_stacked_item_in_full_bank() { |
|
|
slot: 0,
|
|
|
slot: 0,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
for _ in 0..200 {
|
|
|
for _ in 0..200 {
|
|
@ -765,7 +765,7 @@ async fn test_deposit_stacked_item_in_full_bank() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".to_string())
|
|
|
name: item::BankName("".to_string())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -793,7 +793,7 @@ async fn test_deposit_stacked_item_in_full_bank() { |
|
|
|
|
|
|
|
|
assert!(packets.is_err());
|
|
|
assert!(packets.is_err());
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let bank_item_ids = items.iter()
|
|
|
let bank_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
@ -838,7 +838,7 @@ async fn test_deposit_stacked_item_in_full_bank_with_partial_stack() { |
|
|
slot: 0,
|
|
|
slot: 0,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
for _ in 0..199 {
|
|
|
for _ in 0..199 {
|
|
@ -858,7 +858,7 @@ async fn test_deposit_stacked_item_in_full_bank_with_partial_stack() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".to_string())
|
|
|
name: item::BankName("".to_string())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
for _ in 0..2 {
|
|
|
for _ in 0..2 {
|
|
@ -873,7 +873,7 @@ async fn test_deposit_stacked_item_in_full_bank_with_partial_stack() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".to_string())
|
|
|
name: item::BankName("".to_string())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -899,7 +899,7 @@ async fn test_deposit_stacked_item_in_full_bank_with_partial_stack() { |
|
|
unknown: 0,
|
|
|
unknown: 0,
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let bank_item_ids = items.iter()
|
|
|
let bank_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
@ -931,7 +931,7 @@ async fn test_deposit_meseta() { |
|
|
|
|
|
|
|
|
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.meseta = 300;
|
|
|
char1.meseta = 300;
|
|
|
entity_gateway.save_character(&char1).await;
|
|
|
|
|
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
@ -956,7 +956,7 @@ async fn test_deposit_meseta() { |
|
|
unknown: 0,
|
|
|
unknown: 0,
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await;
|
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
assert!(char.meseta == 277);
|
|
|
assert!(char.meseta == 277);
|
|
|
assert!(char.bank_meseta == 23);
|
|
|
assert!(char.bank_meseta == 23);
|
|
@ -969,7 +969,7 @@ async fn test_deposit_too_much_meseta() { |
|
|
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.meseta = 300;
|
|
|
char1.meseta = 300;
|
|
|
char1.bank_meseta = 999980;
|
|
|
char1.bank_meseta = 999980;
|
|
|
entity_gateway.save_character(&char1).await;
|
|
|
|
|
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
@ -994,7 +994,7 @@ async fn test_deposit_too_much_meseta() { |
|
|
unknown: 0,
|
|
|
unknown: 0,
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await;
|
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
assert!(char.meseta == 300);
|
|
|
assert!(char.meseta == 300);
|
|
|
assert!(char.bank_meseta == 999980);
|
|
|
assert!(char.bank_meseta == 999980);
|
|
@ -1033,7 +1033,7 @@ async fn test_deposit_meseta_when_bank_is_maxed() { |
|
|
unknown: 0,
|
|
|
unknown: 0,
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await;
|
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
assert!(char.meseta == 300);
|
|
|
assert!(char.meseta == 300);
|
|
|
assert!(char.bank_meseta == 999999);
|
|
|
assert!(char.bank_meseta == 999999);
|
|
@ -1063,7 +1063,7 @@ async fn test_withdraw_individual_item() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".to_string())
|
|
|
name: item::BankName("".to_string())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
@ -1096,7 +1096,7 @@ async fn test_withdraw_individual_item() { |
|
|
if create_item.item_id == 0x20000
|
|
|
if create_item.item_id == 0x20000
|
|
|
));
|
|
|
));
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let inventory_item_ids = items.iter()
|
|
|
let inventory_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Inventory{..} = item.location {
|
|
|
if let item::ItemLocation::Inventory{..} = item.location {
|
|
@ -1129,7 +1129,7 @@ async fn test_withdraw_stacked_item() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".to_string())
|
|
|
name: item::BankName("".to_string())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -1163,7 +1163,7 @@ async fn test_withdraw_stacked_item() { |
|
|
if create_item.item_id == 0x10002
|
|
|
if create_item.item_id == 0x10002
|
|
|
));
|
|
|
));
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let inventory_item_ids = items.iter()
|
|
|
let inventory_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Inventory {..} = item.location {
|
|
|
if let item::ItemLocation::Inventory {..} = item.location {
|
|
@ -1196,7 +1196,7 @@ async fn test_withdraw_partial_stacked_item() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".into())
|
|
|
name: item::BankName("".into())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -1230,7 +1230,7 @@ async fn test_withdraw_partial_stacked_item() { |
|
|
if create_item.item_id == 0x10002
|
|
|
if create_item.item_id == 0x10002
|
|
|
));
|
|
|
));
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let bank_item_ids = items.iter()
|
|
|
let bank_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
@ -1276,7 +1276,7 @@ async fn test_withdraw_stacked_item_with_stack_already_in_inventory() { |
|
|
slot: 0,
|
|
|
slot: 0,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
|
item::NewItemEntity {
|
|
|
item::NewItemEntity {
|
|
@ -1289,7 +1289,7 @@ async fn test_withdraw_stacked_item_with_stack_already_in_inventory() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".into()),
|
|
|
name: item::BankName("".into()),
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -1323,7 +1323,7 @@ async fn test_withdraw_stacked_item_with_stack_already_in_inventory() { |
|
|
if create_item.item_id == 0x10000
|
|
|
if create_item.item_id == 0x10000
|
|
|
));
|
|
|
));
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let inventory_item_ids = items.iter()
|
|
|
let inventory_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Inventory {..} = item.location {
|
|
|
if let item::ItemLocation::Inventory {..} = item.location {
|
|
@ -1355,7 +1355,7 @@ async fn test_withdraw_stacked_item_with_full_stack_in_inventory() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".into()),
|
|
|
name: item::BankName("".into()),
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
for _ in 0..10 {
|
|
|
for _ in 0..10 {
|
|
@ -1371,7 +1371,7 @@ async fn test_withdraw_stacked_item_with_full_stack_in_inventory() { |
|
|
slot: 0,
|
|
|
slot: 0,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -1399,7 +1399,7 @@ async fn test_withdraw_stacked_item_with_full_stack_in_inventory() { |
|
|
|
|
|
|
|
|
assert!(packets.is_err());
|
|
|
assert!(packets.is_err());
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let bank_item_ids = items.iter()
|
|
|
let bank_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
@ -1447,7 +1447,7 @@ async fn test_withdraw_individual_item_in_full_inventory() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".to_string())
|
|
|
name: item::BankName("".to_string())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
|
|
|
|
|
|
for i in 0..30 {
|
|
|
for i in 0..30 {
|
|
|
entity_gateway.create_item(
|
|
|
entity_gateway.create_item(
|
|
@ -1467,7 +1467,7 @@ async fn test_withdraw_individual_item_in_full_inventory() { |
|
|
slot: i,
|
|
|
slot: i,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -1495,7 +1495,7 @@ async fn test_withdraw_individual_item_in_full_inventory() { |
|
|
|
|
|
|
|
|
assert!(packets.is_err());
|
|
|
assert!(packets.is_err());
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let bank_item_ids = items.iter()
|
|
|
let bank_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
@ -1539,7 +1539,7 @@ async fn test_withdraw_stacked_item_in_full_inventory() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".to_string())
|
|
|
name: item::BankName("".to_string())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
for i in 0..30 {
|
|
|
for i in 0..30 {
|
|
@ -1560,7 +1560,7 @@ async fn test_withdraw_stacked_item_in_full_inventory() { |
|
|
slot: i,
|
|
|
slot: i,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -1588,7 +1588,7 @@ async fn test_withdraw_stacked_item_in_full_inventory() { |
|
|
|
|
|
|
|
|
assert!(packets.is_err());
|
|
|
assert!(packets.is_err());
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let bank_item_ids = items.iter()
|
|
|
let bank_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
@ -1632,7 +1632,7 @@ async fn test_withdraw_stacked_item_in_full_inventory_with_partial_stack() { |
|
|
character_id: char1.id,
|
|
|
character_id: char1.id,
|
|
|
name: item::BankName("".to_string())
|
|
|
name: item::BankName("".to_string())
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
for i in 0..29 {
|
|
|
for i in 0..29 {
|
|
@ -1653,7 +1653,7 @@ async fn test_withdraw_stacked_item_in_full_inventory_with_partial_stack() { |
|
|
slot: i,
|
|
|
slot: i,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
for _ in 0..2 {
|
|
|
for _ in 0..2 {
|
|
@ -1669,7 +1669,7 @@ async fn test_withdraw_stacked_item_in_full_inventory_with_partial_stack() { |
|
|
slot: 29,
|
|
|
slot: 29,
|
|
|
equipped: false,
|
|
|
equipped: false,
|
|
|
}
|
|
|
}
|
|
|
}).await;
|
|
|
|
|
|
|
|
|
}).await.unwrap();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
@ -1695,7 +1695,7 @@ async fn test_withdraw_stacked_item_in_full_inventory_with_partial_stack() { |
|
|
unknown: 0,
|
|
|
unknown: 0,
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await;
|
|
|
|
|
|
|
|
|
let items = entity_gateway.get_items_by_character(&char1).await.unwrap();
|
|
|
let bank_item_ids = items.iter()
|
|
|
let bank_item_ids = items.iter()
|
|
|
.filter_map(|item| {
|
|
|
.filter_map(|item| {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
|
if let item::ItemLocation::Bank {..} = item.location {
|
|
@ -1727,7 +1727,7 @@ async fn test_withdraw_meseta() { |
|
|
|
|
|
|
|
|
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.bank_meseta = 300;
|
|
|
char1.bank_meseta = 300;
|
|
|
entity_gateway.save_character(&char1).await;
|
|
|
|
|
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
@ -1752,7 +1752,7 @@ async fn test_withdraw_meseta() { |
|
|
unknown: 0,
|
|
|
unknown: 0,
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await;
|
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
assert!(char.meseta == 23);
|
|
|
assert!(char.meseta == 23);
|
|
|
assert!(char.bank_meseta == 277);
|
|
|
assert!(char.bank_meseta == 277);
|
|
@ -1765,7 +1765,7 @@ async fn test_withdraw_too_much_meseta() { |
|
|
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.meseta = 999980;
|
|
|
char1.meseta = 999980;
|
|
|
char1.bank_meseta = 300;
|
|
|
char1.bank_meseta = 300;
|
|
|
entity_gateway.save_character(&char1).await;
|
|
|
|
|
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
@ -1790,7 +1790,7 @@ async fn test_withdraw_too_much_meseta() { |
|
|
unknown: 0,
|
|
|
unknown: 0,
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await;
|
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
assert!(char.meseta == 999980);
|
|
|
assert!(char.meseta == 999980);
|
|
|
assert!(char.bank_meseta == 300);
|
|
|
assert!(char.bank_meseta == 300);
|
|
@ -1803,7 +1803,7 @@ async fn test_withdraw_meseta_inventory_is_maxed() { |
|
|
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.meseta = 999999;
|
|
|
char1.meseta = 999999;
|
|
|
char1.bank_meseta = 300;
|
|
|
char1.bank_meseta = 300;
|
|
|
entity_gateway.save_character(&char1).await;
|
|
|
|
|
|
|
|
|
entity_gateway.save_character(&char1).await.unwrap();
|
|
|
|
|
|
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
let mut ship = ShipServerState::builder()
|
|
|
.gateway(entity_gateway.clone())
|
|
|
.gateway(entity_gateway.clone())
|
|
@ -1828,7 +1828,7 @@ async fn test_withdraw_meseta_inventory_is_maxed() { |
|
|
unknown: 0,
|
|
|
unknown: 0,
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
})))).await.unwrap().for_each(drop);
|
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await;
|
|
|
|
|
|
|
|
|
let characters = entity_gateway.get_characters_by_user(&user1).await.unwrap();
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
let char = characters[0].as_ref().unwrap();
|
|
|
assert!(char.meseta == 999999);
|
|
|
assert!(char.meseta == 999999);
|
|
|
assert!(char.bank_meseta == 300);
|
|
|
assert!(char.bank_meseta == 300);
|
|
|