@ -114,8 +114,8 @@ impl TradeItemBuilder {
async fn test_trade_one_individual_item ( ) {
async fn test_trade_one_individual_item ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let mut p1_inv = Vec ::new ( ) ;
let mut p1_inv = Vec ::new ( ) ;
p1_inv . push ( entity_gateway . create_item (
p1_inv . push ( entity_gateway . create_item (
@ -215,8 +215,8 @@ async fn test_trade_one_individual_item() {
async fn test_trade_player2_to_player1 ( ) {
async fn test_trade_player2_to_player1 ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let mut p2_inv = Vec ::new ( ) ;
let mut p2_inv = Vec ::new ( ) ;
p2_inv . push ( entity_gateway . create_item (
p2_inv . push ( entity_gateway . create_item (
@ -316,8 +316,8 @@ async fn test_trade_player2_to_player1() {
async fn test_reverse_trade_ack_order ( ) {
async fn test_reverse_trade_ack_order ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let mut p1_inv = Vec ::new ( ) ;
let mut p1_inv = Vec ::new ( ) ;
p1_inv . push ( entity_gateway . create_item (
p1_inv . push ( entity_gateway . create_item (
@ -417,8 +417,8 @@ async fn test_reverse_trade_ack_order() {
async fn test_trade_one_stacked_item ( ) {
async fn test_trade_one_stacked_item ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_stack = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let p1_stack = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -521,8 +521,8 @@ async fn test_trade_one_stacked_item() {
async fn test_trade_partial_stacked_item ( ) {
async fn test_trade_partial_stacked_item ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_stack = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let p1_stack = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -628,8 +628,8 @@ async fn test_trade_partial_stacked_item() {
async fn test_trade_individual_both ( ) {
async fn test_trade_individual_both ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_inv = vec ! [
let p1_inv = vec ! [
entity_gateway . create_item (
entity_gateway . create_item (
@ -793,8 +793,8 @@ async fn test_trade_individual_both() {
async fn test_trade_stacked_both ( ) {
async fn test_trade_stacked_both ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_stack = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let p1_stack = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -963,8 +963,8 @@ async fn test_trade_stacked_both() {
async fn test_trade_partial_stack_both ( ) {
async fn test_trade_partial_stack_both ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_stack = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let p1_stack = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -1139,8 +1139,8 @@ async fn test_trade_partial_stack_both() {
async fn test_trade_same_stacked_item_to_eachother ( ) {
async fn test_trade_same_stacked_item_to_eachother ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_stack = futures ::future ::join_all ( ( 0 . . 3 ) . map ( | _ | {
let p1_stack = futures ::future ::join_all ( ( 0 . . 3 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -1311,8 +1311,8 @@ async fn test_trade_same_stacked_item_to_eachother() {
async fn test_trade_stacked_when_already_have_partial_stack ( ) {
async fn test_trade_stacked_when_already_have_partial_stack ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_stack = futures ::future ::join_all ( ( 0 . . 3 ) . map ( | _ | {
let p1_stack = futures ::future ::join_all ( ( 0 . . 3 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -1451,8 +1451,8 @@ async fn test_trade_stacked_when_already_have_partial_stack() {
async fn test_trade_individual_for_stacked ( ) {
async fn test_trade_individual_for_stacked ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_inv = vec ! [
let p1_inv = vec ! [
entity_gateway . create_item (
entity_gateway . create_item (
@ -1621,8 +1621,8 @@ async fn test_trade_individual_for_stacked() {
async fn test_trade_multiple_individual ( ) {
async fn test_trade_multiple_individual ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_inv = vec ! [
let p1_inv = vec ! [
entity_gateway . create_item (
entity_gateway . create_item (
@ -1879,8 +1879,8 @@ async fn test_trade_multiple_individual() {
async fn test_trade_multiple_stacked ( ) {
async fn test_trade_multiple_stacked ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_stack1 = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let p1_stack1 = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -2146,8 +2146,8 @@ async fn test_trade_multiple_stacked() {
async fn test_trade_not_enough_inventory_space_individual ( ) {
async fn test_trade_not_enough_inventory_space_individual ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_inv = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let p1_inv = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -2268,8 +2268,8 @@ async fn test_trade_not_enough_inventory_space_individual() {
async fn test_trade_not_enough_inventory_space_stacked ( ) {
async fn test_trade_not_enough_inventory_space_stacked ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_stack = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let p1_stack = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -2385,8 +2385,8 @@ async fn test_trade_not_enough_inventory_space_stacked() {
async fn test_trade_stack_too_big ( ) {
async fn test_trade_stack_too_big ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_stack = futures ::future ::join_all ( ( 0 . . 8 ) . map ( | _ | {
let p1_stack = futures ::future ::join_all ( ( 0 . . 8 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -2501,8 +2501,8 @@ async fn test_trade_stack_too_big() {
async fn test_trade_meseta ( ) {
async fn test_trade_meseta ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
entity_gateway . set_character_meseta ( & char1 . id , Meseta ( 2323 ) ) . await . unwrap ( ) ;
entity_gateway . set_character_meseta ( & char1 . id , Meseta ( 2323 ) ) . await . unwrap ( ) ;
@ -2582,8 +2582,8 @@ async fn test_trade_meseta() {
async fn test_trade_too_much_meseta ( ) {
async fn test_trade_too_much_meseta ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
entity_gateway . set_character_meseta ( & char1 . id , Meseta ( 4000 ) ) . await . unwrap ( ) ;
entity_gateway . set_character_meseta ( & char1 . id , Meseta ( 4000 ) ) . await . unwrap ( ) ;
entity_gateway . set_character_meseta ( & char2 . id , Meseta ( 999000 ) ) . await . unwrap ( ) ;
entity_gateway . set_character_meseta ( & char2 . id , Meseta ( 999000 ) ) . await . unwrap ( ) ;
@ -2634,8 +2634,8 @@ async fn test_trade_too_much_meseta() {
async fn test_trade_invalid_amount_of_meseta ( ) {
async fn test_trade_invalid_amount_of_meseta ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
entity_gateway . set_character_meseta ( & char1 . id , Meseta ( 4000 ) ) . await . unwrap ( ) ;
entity_gateway . set_character_meseta ( & char1 . id , Meseta ( 4000 ) ) . await . unwrap ( ) ;
entity_gateway . set_character_meseta ( & char2 . id , Meseta ( 999000 ) ) . await . unwrap ( ) ;
entity_gateway . set_character_meseta ( & char2 . id , Meseta ( 999000 ) ) . await . unwrap ( ) ;
@ -2686,8 +2686,8 @@ async fn test_trade_invalid_amount_of_meseta() {
async fn test_trade_meseta_request_and_items_dont_match ( ) {
async fn test_trade_meseta_request_and_items_dont_match ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
entity_gateway . set_character_meseta ( & char1 . id , Meseta ( 4000 ) ) . await . unwrap ( ) ;
entity_gateway . set_character_meseta ( & char1 . id , Meseta ( 4000 ) ) . await . unwrap ( ) ;
entity_gateway . set_character_meseta ( & char2 . id , Meseta ( 999000 ) ) . await . unwrap ( ) ;
entity_gateway . set_character_meseta ( & char2 . id , Meseta ( 999000 ) ) . await . unwrap ( ) ;
@ -2738,8 +2738,8 @@ async fn test_trade_meseta_request_and_items_dont_match() {
async fn test_player_declined_trade ( ) {
async fn test_player_declined_trade ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , _char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , _char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , _char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , _char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let mut ship = Box ::new ( ShipServerState ::builder ( )
let mut ship = Box ::new ( ShipServerState ::builder ( )
. gateway ( entity_gateway . clone ( ) )
. gateway ( entity_gateway . clone ( ) )
@ -2769,8 +2769,8 @@ async fn test_player_declined_trade() {
async fn test_back_out_of_trade_last_minute ( ) {
async fn test_back_out_of_trade_last_minute ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let mut p1_inv = Vec ::new ( ) ;
let mut p1_inv = Vec ::new ( ) ;
p1_inv . push ( entity_gateway . create_item (
p1_inv . push ( entity_gateway . create_item (
@ -2835,8 +2835,8 @@ async fn test_back_out_of_trade_last_minute() {
async fn test_valid_trade_when_both_inventories_are_full ( ) {
async fn test_valid_trade_when_both_inventories_are_full ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_inv = futures ::future ::join_all ( ( 0 . . 30 ) . map ( | _ | {
let p1_inv = futures ::future ::join_all ( ( 0 . . 30 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -2977,8 +2977,8 @@ async fn test_valid_trade_when_both_inventories_are_full() {
async fn test_invalid_trade_when_both_inventories_are_full ( ) {
async fn test_invalid_trade_when_both_inventories_are_full ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_inv = futures ::future ::join_all ( ( 0 . . 30 ) . map ( | _ | {
let p1_inv = futures ::future ::join_all ( ( 0 . . 30 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -3128,9 +3128,9 @@ async fn test_invalid_trade_when_both_inventories_are_full() {
async fn test_client_tries_to_start_two_trades ( ) {
async fn test_client_tries_to_start_two_trades ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , _char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , _char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user2 , _char3 ) = new_user_character ( & mut entity_gateway , "a3" , "a" ) . await ;
let ( _user1 , _char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , _char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let ( _user2 , _char3 ) = new_user_character ( & mut entity_gateway , "a3" , "a" , 1 ) . await ;
let mut ship = Box ::new ( ShipServerState ::builder ( )
let mut ship = Box ::new ( ShipServerState ::builder ( )
. gateway ( entity_gateway . clone ( ) )
. gateway ( entity_gateway . clone ( ) )
@ -3160,9 +3160,9 @@ async fn test_client_tries_to_start_two_trades() {
async fn test_client_tries_trading_with_client_already_trading ( ) {
async fn test_client_tries_trading_with_client_already_trading ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , _char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , _char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user2 , _char3 ) = new_user_character ( & mut entity_gateway , "a3" , "a" ) . await ;
let ( _user1 , _char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , _char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let ( _user2 , _char3 ) = new_user_character ( & mut entity_gateway , "a3" , "a" , 1 ) . await ;
let mut ship = Box ::new ( ShipServerState ::builder ( )
let mut ship = Box ::new ( ShipServerState ::builder ( )
. gateway ( entity_gateway . clone ( ) )
. gateway ( entity_gateway . clone ( ) )
@ -3199,8 +3199,8 @@ async fn test_client_tries_trading_with_client_already_trading() {
async fn test_add_then_remove_individual_item ( ) {
async fn test_add_then_remove_individual_item ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let mut p1_inv = Vec ::new ( ) ;
let mut p1_inv = Vec ::new ( ) ;
for _ in 0 . . 2 {
for _ in 0 . . 2 {
@ -3312,8 +3312,8 @@ async fn test_add_then_remove_individual_item() {
async fn test_add_then_remove_stacked_item ( ) {
async fn test_add_then_remove_stacked_item ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_stack1 = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let p1_stack1 = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -3447,8 +3447,8 @@ async fn test_add_then_remove_stacked_item() {
async fn test_add_then_remove_partial_stack ( ) {
async fn test_add_then_remove_partial_stack ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_stack1 = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let p1_stack1 = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -3571,8 +3571,8 @@ async fn test_add_then_remove_partial_stack() {
async fn test_add_then_remove_meseta ( ) {
async fn test_add_then_remove_meseta ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
entity_gateway . set_character_meseta ( & char1 . id , Meseta ( 2323 ) ) . await . unwrap ( ) ;
entity_gateway . set_character_meseta ( & char1 . id , Meseta ( 2323 ) ) . await . unwrap ( ) ;
@ -3657,8 +3657,8 @@ async fn test_add_then_remove_meseta() {
async fn test_items_to_trade_data_does_not_match ( ) {
async fn test_items_to_trade_data_does_not_match ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let mut p1_inv = Vec ::new ( ) ;
let mut p1_inv = Vec ::new ( ) ;
p1_inv . push ( entity_gateway . create_item (
p1_inv . push ( entity_gateway . create_item (
@ -3740,8 +3740,8 @@ async fn test_items_to_trade_data_does_not_match() {
async fn test_items_to_trade_id_does_not_match ( ) {
async fn test_items_to_trade_id_does_not_match ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let mut p1_inv = Vec ::new ( ) ;
let mut p1_inv = Vec ::new ( ) ;
p1_inv . push ( entity_gateway . create_item (
p1_inv . push ( entity_gateway . create_item (
@ -3811,8 +3811,8 @@ async fn test_items_to_trade_id_does_not_match() {
async fn test_stack_is_same_amount_in_request_and_items_to_trade ( ) {
async fn test_stack_is_same_amount_in_request_and_items_to_trade ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_stack = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let p1_stack = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -3885,8 +3885,8 @@ async fn test_stack_is_same_amount_in_request_and_items_to_trade() {
async fn test_stack_is_same_amount_in_request_and_items_to_trade2 ( ) {
async fn test_stack_is_same_amount_in_request_and_items_to_trade2 ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_stack = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let p1_stack = futures ::future ::join_all ( ( 0 . . 2 ) . map ( | _ | {
let mut entity_gateway = entity_gateway . clone ( ) ;
let mut entity_gateway = entity_gateway . clone ( ) ;
@ -3959,8 +3959,8 @@ async fn test_stack_is_same_amount_in_request_and_items_to_trade2() {
async fn test_items_to_trade_count_less_than ( ) {
async fn test_items_to_trade_count_less_than ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_inv = vec ! [
let p1_inv = vec ! [
entity_gateway . create_item (
entity_gateway . create_item (
@ -4061,8 +4061,8 @@ async fn test_items_to_trade_count_less_than() {
async fn test_items_to_trade_count_greater_than ( ) {
async fn test_items_to_trade_count_greater_than ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
entity_gateway . set_character_meseta ( & char1 . id , Meseta ( 23 ) ) . await . unwrap ( ) ;
entity_gateway . set_character_meseta ( & char1 . id , Meseta ( 23 ) ) . await . unwrap ( ) ;
@ -4171,8 +4171,8 @@ async fn test_items_to_trade_count_greater_than() {
async fn test_items_to_trade_count_mismatch_with_meseta ( ) {
async fn test_items_to_trade_count_mismatch_with_meseta ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let p1_inv = vec ! [
let p1_inv = vec ! [
entity_gateway . create_item (
entity_gateway . create_item (
@ -4273,8 +4273,8 @@ async fn test_items_to_trade_count_mismatch_with_meseta() {
async fn test_dropping_item_after_trade ( ) {
async fn test_dropping_item_after_trade ( ) {
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let mut entity_gateway = InMemoryGateway ::default ( ) ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" ) . await ;
let ( _user1 , char1 ) = new_user_character ( & mut entity_gateway , "a1" , "a" , 1 ) . await ;
let ( _user2 , char2 ) = new_user_character ( & mut entity_gateway , "a2" , "a" , 1 ) . await ;
let mut p1_inv = Vec ::new ( ) ;
let mut p1_inv = Vec ::new ( ) ;
p1_inv . push ( entity_gateway . create_item (
p1_inv . push ( entity_gateway . create_item (
@ -4364,7 +4364,7 @@ async fn test_dropping_item_after_trade() {
assert ! ( matches ! ( ack [ 3 ] , ( ClientId ( 2 ) , SendShipPacket ::TradeSuccessful { . . } ) ) ) ;
assert ! ( matches ! ( ack [ 3 ] , ( ClientId ( 2 ) , SendShipPacket ::TradeSuccessful { . . } ) ) ) ;
assert ! ( matches ! ( ack [ 4 ] , ( ClientId ( 1 ) , SendShipPacket ::TradeSuccessful { . . } ) ) ) ;
assert ! ( matches ! ( ack [ 4 ] , ( ClientId ( 1 ) , SendShipPacket ::TradeSuccessful { . . } ) ) ) ;
let ack = ship . handle ( ClientId ( 2 ) , & RecvShipPacket ::Message ( Message ::new ( GameMessage ::PlayerDropItem ( PlayerDropItem {
let _ ack = ship . handle ( ClientId ( 2 ) , & RecvShipPacket ::Message ( Message ::new ( GameMessage ::PlayerDropItem ( PlayerDropItem {
client : 0 ,
client : 0 ,
target : 0 ,
target : 0 ,
unknown1 : 0 ,
unknown1 : 0 ,