From 27a6c9a1367747d4099f248cea18339effdc9274 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 28 Dec 2021 01:22:46 +0000 Subject: [PATCH] creating rooms with difficulties is bad for selling tests? --- src/ship/packet/handler/direct_message.rs | 1 - tests/test_shops.rs | 26 +++++++++++------------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/ship/packet/handler/direct_message.rs b/src/ship/packet/handler/direct_message.rs index f17f1a1..2268bb7 100644 --- a/src/ship/packet/handler/direct_message.rs +++ b/src/ship/packet/handler/direct_message.rs @@ -370,7 +370,6 @@ where } }; - // TODO: stop giving away wares for free if client.character.meseta < (item.price() * buy_item.amount as usize) as u32 { return Err(ShipError::ShopError.into()) } diff --git a/tests/test_shops.rs b/tests/test_shops.rs index 5c414f1..3555c8c 100644 --- a/tests/test_shops.rs +++ b/tests/test_shops.rs @@ -292,7 +292,7 @@ async fn test_player_sells_3_attr_weapon_to_shop() { log_in_char(&mut ship, ClientId(1), "a1", "a").await; join_lobby(&mut ship, ClientId(1)).await; - create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await; + create_room(&mut ship, ClientId(1), "room", "").await; ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem { client: 0, @@ -662,7 +662,7 @@ async fn test_player_sells_untekked_weapon() { log_in_char(&mut ship, ClientId(1), "a1", "a").await; join_lobby(&mut ship, ClientId(1)).await; - create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await; + create_room(&mut ship, ClientId(1), "room", "").await; ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem { client: 0, @@ -710,7 +710,7 @@ async fn test_player_sells_rare_item() { log_in_char(&mut ship, ClientId(1), "a1", "a").await; join_lobby(&mut ship, ClientId(1)).await; - create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await; + create_room(&mut ship, ClientId(1), "room", "").await; ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem { client: 0, @@ -757,7 +757,7 @@ async fn test_player_sells_partial_photon_drop_stack() { log_in_char(&mut ship, ClientId(1), "a1", "a").await; join_lobby(&mut ship, ClientId(1)).await; - create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await; + create_room(&mut ship, ClientId(1), "room", "").await; ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem { client: 0, @@ -802,7 +802,7 @@ async fn test_player_sells_basic_frame() { log_in_char(&mut ship, ClientId(1), "a1", "a").await; join_lobby(&mut ship, ClientId(1)).await; - create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await; + create_room(&mut ship, ClientId(1), "room", "").await; ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem { client: 0, @@ -847,7 +847,7 @@ async fn test_player_sells_max_frame() { log_in_char(&mut ship, ClientId(1), "a1", "a").await; join_lobby(&mut ship, ClientId(1)).await; - create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await; + create_room(&mut ship, ClientId(1), "room", "").await; ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem { client: 0, @@ -891,7 +891,7 @@ async fn test_player_sells_basic_barrier() { log_in_char(&mut ship, ClientId(1), "a1", "a").await; join_lobby(&mut ship, ClientId(1)).await; - create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await; + create_room(&mut ship, ClientId(1), "room", "").await; ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem { client: 0, @@ -935,7 +935,7 @@ async fn test_player_sells_max_barrier() { log_in_char(&mut ship, ClientId(1), "a1", "a").await; join_lobby(&mut ship, ClientId(1)).await; - create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await; + create_room(&mut ship, ClientId(1), "room", "").await; ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem { client: 0, @@ -978,7 +978,7 @@ async fn test_player_sells_1_star_minusminus_unit() { log_in_char(&mut ship, ClientId(1), "a1", "a").await; join_lobby(&mut ship, ClientId(1)).await; - create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await; + create_room(&mut ship, ClientId(1), "room", "").await; ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem { client: 0, @@ -1021,7 +1021,7 @@ async fn test_player_sells_5_star_plusplus_unit() { log_in_char(&mut ship, ClientId(1), "a1", "a").await; join_lobby(&mut ship, ClientId(1)).await; - create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await; + create_room(&mut ship, ClientId(1), "room", "").await; ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem { client: 0, @@ -1066,7 +1066,7 @@ async fn test_player_sells_rare_frame() { log_in_char(&mut ship, ClientId(1), "a1", "a").await; join_lobby(&mut ship, ClientId(1)).await; - create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await; + create_room(&mut ship, ClientId(1), "room", "").await; ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem { client: 0, @@ -1110,7 +1110,7 @@ async fn test_player_sells_rare_barrier() { log_in_char(&mut ship, ClientId(1), "a1", "a").await; join_lobby(&mut ship, ClientId(1)).await; - create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await; + create_room(&mut ship, ClientId(1), "room", "").await; ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem { client: 0, @@ -1153,7 +1153,7 @@ async fn test_player_sells_rare_unit() { log_in_char(&mut ship, ClientId(1), "a1", "a").await; join_lobby(&mut ship, ClientId(1)).await; - create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await; + create_room(&mut ship, ClientId(1), "room", "").await; ship.handle(ClientId(1), &RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem { client: 0,