You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1097 lines
39 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
3 years ago
  1. use networking::serverstate::{ClientId, ServerState};
  2. use entity::gateway::{EntityGateway, InMemoryGateway};
  3. use entity::item;
  4. use elseware::ship::ship::{ShipServerState, RecvShipPacket, SendShipPacket};
  5. use maps::room::Difficulty;
  6. use items::state::ItemStateError;
  7. use libpso::packet::ship::*;
  8. use libpso::packet::messages::*;
  9. #[path = "common.rs"]
  10. mod common;
  11. use common::*;
  12. #[async_std::test]
  13. async fn test_player_opens_weapon_shop() {
  14. let mut entity_gateway = InMemoryGateway::default();
  15. let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  16. char1.exp = 80000000;
  17. entity_gateway.save_character(&char1).await.unwrap();
  18. let mut ship = standard_ship(entity_gateway.clone());
  19. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  20. join_lobby(&mut ship, ClientId(1)).await;
  21. create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await;
  22. let packets = ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::ShopRequest(ShopRequest {
  23. client: 255,
  24. target: 255,
  25. shop_type: 1
  26. })))).await.unwrap();
  27. assert_eq!(packets.len(), 1);
  28. match &packets[0].1 {
  29. SendShipPacket::Message(Message {msg: GameMessage::ShopList(shop_list)}) => {
  30. assert_eq!(shop_list.items.len(), 16)
  31. }
  32. _ => panic!("")
  33. }
  34. }
  35. #[async_std::test]
  36. async fn test_player_opens_tool_shop() {
  37. let mut entity_gateway = InMemoryGateway::default();
  38. let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  39. char1.exp = 80000000;
  40. entity_gateway.save_character(&char1).await.unwrap();
  41. let mut ship = standard_ship(entity_gateway.clone());
  42. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  43. join_lobby(&mut ship, ClientId(1)).await;
  44. create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await;
  45. let packets = ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::ShopRequest(ShopRequest {
  46. client: 255,
  47. target: 255,
  48. shop_type: 0
  49. })))).await.unwrap();
  50. assert_eq!(packets.len(), 1);
  51. match &packets[0].1 {
  52. SendShipPacket::Message(Message {msg: GameMessage::ShopList(shop_list)}) => {
  53. assert_eq!(shop_list.items.len(), 18)
  54. }
  55. _ => panic!("")
  56. }
  57. }
  58. #[async_std::test]
  59. async fn test_player_opens_armor_shop() {
  60. let mut entity_gateway = InMemoryGateway::default();
  61. let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  62. char1.exp = 80000000;
  63. entity_gateway.save_character(&char1).await.unwrap();
  64. let mut ship = standard_ship(entity_gateway.clone());
  65. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  66. join_lobby(&mut ship, ClientId(1)).await;
  67. create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await;
  68. let packets = ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::ShopRequest(ShopRequest {
  69. client: 255,
  70. target: 255,
  71. shop_type: 2
  72. })))).await.unwrap();
  73. assert_eq!(packets.len(), 1);
  74. match &packets[0].1 {
  75. SendShipPacket::Message(Message {msg: GameMessage::ShopList(shop_list)}) => {
  76. assert_eq!(shop_list.items.len(), 21)
  77. }
  78. _ => panic!("")
  79. }
  80. }
  81. #[async_std::test]
  82. async fn test_player_buys_from_weapon_shop() {
  83. let mut entity_gateway = InMemoryGateway::default();
  84. let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  85. char1.exp = 80000000;
  86. entity_gateway.save_character(&char1).await.unwrap();
  87. entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
  88. let mut ship = standard_ship(entity_gateway.clone());
  89. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  90. join_lobby(&mut ship, ClientId(1)).await;
  91. create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await;
  92. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::ShopRequest(ShopRequest {
  93. client: 255,
  94. target: 255,
  95. shop_type: 1
  96. })))).await.unwrap();
  97. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BuyItem(BuyItem {
  98. client: 255,
  99. target: 255,
  100. item_id: 0x10000,
  101. shop_type: 1,
  102. shop_index: 0,
  103. amount: 1,
  104. unknown1: 0,
  105. })))).await.unwrap();
  106. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  107. assert!(c1_meseta.0 < 999999);
  108. //let p1_items = entity_gateway.get_items_by_character(&char1.id).await.unwrap();
  109. let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
  110. assert_eq!(p1_items.items.len(), 1);
  111. }
  112. #[async_std::test]
  113. async fn test_player_buys_from_tool_shop() {
  114. let mut entity_gateway = InMemoryGateway::default();
  115. let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  116. char1.exp = 80000000;
  117. entity_gateway.save_character(&char1).await.unwrap();
  118. entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
  119. let mut ship = standard_ship(entity_gateway.clone());
  120. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  121. join_lobby(&mut ship, ClientId(1)).await;
  122. create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await;
  123. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::ShopRequest(ShopRequest {
  124. client: 255,
  125. target: 255,
  126. shop_type: 0,
  127. })))).await.unwrap();
  128. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BuyItem(BuyItem {
  129. client: 255,
  130. target: 255,
  131. item_id: 0x10000,
  132. shop_type: 0,
  133. shop_index: 0,
  134. amount: 1,
  135. unknown1: 0,
  136. })))).await.unwrap();
  137. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  138. assert!(c1_meseta.0 < 999999);
  139. let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
  140. assert_eq!(p1_items.items.len(), 1);
  141. }
  142. #[async_std::test]
  143. async fn test_player_buys_multiple_from_tool_shop() {
  144. let mut entity_gateway = InMemoryGateway::default();
  145. let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  146. char1.exp = 80000000;
  147. entity_gateway.save_character(&char1).await.unwrap();
  148. entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
  149. let mut ship = standard_ship(entity_gateway.clone());
  150. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  151. join_lobby(&mut ship, ClientId(1)).await;
  152. create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await;
  153. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::ShopRequest(ShopRequest {
  154. client: 255,
  155. target: 255,
  156. shop_type: 0,
  157. })))).await.unwrap();
  158. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BuyItem(BuyItem {
  159. client: 255,
  160. target: 255,
  161. item_id: 0x10000,
  162. shop_type: 0,
  163. shop_index: 0,
  164. amount: 5,
  165. unknown1: 0,
  166. })))).await.unwrap();
  167. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  168. assert_eq!(c1_meseta.0, 999749);
  169. let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
  170. assert_eq!(p1_items.items.len(), 1);
  171. p1_items.items[0].with_stacked(|item| {
  172. assert_eq!(item.len(), 5);
  173. assert_eq!(item[0].item.item_type(), item::ItemType::Tool(item::tool::ToolType::Monomate));
  174. }).unwrap();
  175. }
  176. #[async_std::test]
  177. async fn test_player_buys_from_armor_shop() {
  178. let mut entity_gateway = InMemoryGateway::default();
  179. let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  180. char1.exp = 80000000;
  181. entity_gateway.save_character(&char1).await.unwrap();
  182. entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
  183. let mut ship = standard_ship(entity_gateway.clone());
  184. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  185. join_lobby(&mut ship, ClientId(1)).await;
  186. create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await;
  187. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::ShopRequest(ShopRequest {
  188. client: 255,
  189. target: 255,
  190. shop_type: 2
  191. })))).await.unwrap();
  192. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BuyItem(BuyItem {
  193. client: 255,
  194. target: 255,
  195. item_id: 0x10000,
  196. shop_type: 2,
  197. shop_index: 0,
  198. amount: 1,
  199. unknown1: 0,
  200. })))).await.unwrap();
  201. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  202. assert!(c1_meseta.0 < 999999);
  203. let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
  204. assert_eq!(p1_items.items.len(), 1);
  205. }
  206. #[async_std::test]
  207. async fn test_player_sells_3_attr_weapon_to_shop() {
  208. let mut entity_gateway = InMemoryGateway::default();
  209. let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  210. let mut p1_inv = Vec::new();
  211. p1_inv.push(entity_gateway.create_item(
  212. item::NewItemEntity {
  213. item: item::ItemDetail::Weapon(
  214. item::weapon::Weapon {
  215. weapon: item::weapon::WeaponType::Vulcan,
  216. grind: 5,
  217. special: Some(item::weapon::WeaponSpecial::Charge),
  218. attrs: [Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Hit, value: 100}),
  219. Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 100}),
  220. Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Native, value: 100}),],
  221. tekked: true,
  222. }
  223. ),
  224. }).await.unwrap());
  225. entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap();
  226. let mut ship = standard_ship(entity_gateway.clone());
  227. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  228. join_lobby(&mut ship, ClientId(1)).await;
  229. create_room(&mut ship, ClientId(1), "room", "").await;
  230. ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem {
  231. client: 0,
  232. target: 0,
  233. item_id: 0x10000,
  234. amount: 1,
  235. })))).await.unwrap();
  236. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  237. assert_eq!(c1_meseta.0, 4406);
  238. }
  239. #[async_std::test]
  240. async fn test_other_clients_see_purchase() {
  241. let mut entity_gateway = InMemoryGateway::default();
  242. let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  243. let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
  244. char1.exp = 80000000;
  245. entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
  246. entity_gateway.save_character(&char1).await.unwrap();
  247. let mut ship = standard_ship(entity_gateway.clone());
  248. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  249. log_in_char(&mut ship, ClientId(2), "a2", "a").await;
  250. join_lobby(&mut ship, ClientId(1)).await;
  251. join_lobby(&mut ship, ClientId(2)).await;
  252. create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Normal).await;
  253. join_room(&mut ship, ClientId(2), 0).await;
  254. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::ShopRequest(ShopRequest {
  255. client: 255,
  256. target: 255,
  257. shop_type: 1
  258. })))).await.unwrap();
  259. let packets = ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BuyItem(BuyItem {
  260. client: 255,
  261. target: 255,
  262. item_id: 0x10000,
  263. shop_type: 1,
  264. shop_index: 0,
  265. amount: 1,
  266. unknown1: 0,
  267. })))).await.unwrap();
  268. assert_eq!(packets.len(), 1);
  269. assert_eq!(packets[0].0, ClientId(2));
  270. match &packets[0].1 {
  271. SendShipPacket::Message(Message{msg: GameMessage::CreateItem(_)}) => {},
  272. _ => panic!(""),
  273. }
  274. }
  275. #[async_std::test]
  276. async fn test_other_clients_see_stacked_purchase() {
  277. let mut entity_gateway = InMemoryGateway::default();
  278. let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  279. let (_user2, _char2) = new_user_character(&mut entity_gateway, "a2", "a", 1).await;
  280. char1.exp = 80000000;
  281. entity_gateway.save_character(&char1).await.unwrap();
  282. entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
  283. entity_gateway.create_item(
  284. item::NewItemEntity {
  285. item: item::ItemDetail::Tool(
  286. item::tool::Tool {
  287. tool: item::tool::ToolType::Monomate
  288. }
  289. ),
  290. }).await.unwrap();
  291. let mut ship = standard_ship(entity_gateway.clone());
  292. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  293. log_in_char(&mut ship, ClientId(2), "a2", "a").await;
  294. join_lobby(&mut ship, ClientId(1)).await;
  295. join_lobby(&mut ship, ClientId(2)).await;
  296. create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Normal).await;
  297. join_room(&mut ship, ClientId(2), 0).await;
  298. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::ShopRequest(ShopRequest {
  299. client: 255,
  300. target: 255,
  301. shop_type: 1
  302. })))).await.unwrap();
  303. let packets = ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BuyItem(BuyItem {
  304. client: 255,
  305. target: 255,
  306. item_id: 0x10000,
  307. shop_type: 1,
  308. shop_index: 0,
  309. amount: 1,
  310. unknown1: 0,
  311. })))).await.unwrap();
  312. assert_eq!(packets.len(), 1);
  313. assert_eq!(packets[0].0, ClientId(2));
  314. match &packets[0].1 {
  315. SendShipPacket::Message(Message{msg: GameMessage::CreateItem(_)}) => {},
  316. _ => panic!(""),
  317. }
  318. }
  319. #[async_std::test]
  320. async fn test_buying_item_without_enough_mseseta() {
  321. let mut entity_gateway = InMemoryGateway::default();
  322. let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  323. let mut ship = standard_ship(entity_gateway.clone());
  324. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  325. join_lobby(&mut ship, ClientId(1)).await;
  326. create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Normal).await;
  327. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::ShopRequest(ShopRequest {
  328. client: 255,
  329. target: 255,
  330. shop_type: 1
  331. })))).await.unwrap();
  332. let packets = ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BuyItem(BuyItem {
  333. client: 255,
  334. target: 255,
  335. item_id: 0x10000,
  336. shop_type: 1,
  337. shop_index: 0,
  338. amount: 1,
  339. unknown1: 0,
  340. })))).await;
  341. assert!(packets.is_err());
  342. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  343. assert_eq!(c1_meseta.0, 0);
  344. let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
  345. assert_eq!(p1_items.items.len(), 0);
  346. }
  347. #[async_std::test]
  348. async fn test_player_double_buys_from_tool_shop() {
  349. let mut entity_gateway = InMemoryGateway::default();
  350. let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  351. char1.exp = 80000000;
  352. entity_gateway.save_character(&char1).await.unwrap();
  353. entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
  354. let mut ship = standard_ship(entity_gateway.clone());
  355. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  356. join_lobby(&mut ship, ClientId(1)).await;
  357. create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await;
  358. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::ShopRequest(ShopRequest {
  359. client: 255,
  360. target: 255,
  361. shop_type: 0,
  362. })))).await.unwrap();
  363. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BuyItem(BuyItem {
  364. client: 255,
  365. target: 255,
  366. item_id: 0x10000,
  367. shop_type: 0,
  368. shop_index: 0,
  369. amount: 3,
  370. unknown1: 0,
  371. })))).await.unwrap();
  372. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BuyItem(BuyItem {
  373. client: 255,
  374. target: 255,
  375. item_id: 0x10001,
  376. shop_type: 0,
  377. shop_index: 1,
  378. amount: 2,
  379. unknown1: 0,
  380. })))).await.unwrap();
  381. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BuyItem(BuyItem {
  382. client: 255,
  383. target: 255,
  384. item_id: 0x10002,
  385. shop_type: 0,
  386. shop_index: 0,
  387. amount: 4,
  388. unknown1: 0,
  389. })))).await.unwrap();
  390. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  391. assert!(c1_meseta.0 < 999999);
  392. let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
  393. assert_eq!(p1_items.items.len(), 2);
  394. p1_items.items[0].with_stacked(|item| {
  395. assert_eq!(item.len(), 7);
  396. assert_eq!(item[0].item.item_type(), item::ItemType::Tool(item::tool::ToolType::Monomate));
  397. }).unwrap();
  398. p1_items.items[1].with_stacked(|item| {
  399. assert_eq!(item.len(), 2);
  400. assert_eq!(item[0].item.item_type(), item::ItemType::Tool(item::tool::ToolType::Dimate));
  401. }).unwrap();
  402. }
  403. #[async_std::test]
  404. async fn test_techs_disappear_from_shop_when_bought() {
  405. let mut entity_gateway = InMemoryGateway::default();
  406. let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  407. char1.exp = 80000000;
  408. entity_gateway.save_character(&char1).await.unwrap();
  409. entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
  410. let mut ship = standard_ship(entity_gateway.clone());
  411. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  412. join_lobby(&mut ship, ClientId(1)).await;
  413. create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await;
  414. let packets = ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::ShopRequest(ShopRequest {
  415. client: 255,
  416. target: 255,
  417. shop_type: 0,
  418. })))).await.unwrap();
  419. let first_tech = match &packets[0].1 {
  420. SendShipPacket::Message(Message {msg: GameMessage::ShopList(shop_list)}) => {
  421. shop_list.items.iter()
  422. .enumerate()
  423. .filter(|(_, item)| {
  424. item.item_bytes[0] == 3 && item.item_bytes[1] == 2
  425. })
  426. .nth(0).unwrap().0
  427. },
  428. _ => panic!(""),
  429. };
  430. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BuyItem(BuyItem {
  431. client: 255,
  432. target: 255,
  433. item_id: 0x10000,
  434. shop_type: 0,
  435. shop_index: first_tech as u8,
  436. amount: 1,
  437. unknown1: 0,
  438. })))).await.unwrap();
  439. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BuyItem(BuyItem {
  440. client: 255,
  441. target: 255,
  442. item_id: 0x10001,
  443. shop_type: 0,
  444. shop_index: first_tech as u8,
  445. amount: 1,
  446. unknown1: 0,
  447. })))).await.unwrap();
  448. let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
  449. p1_items.items[0].with_individual(|item1| {
  450. p1_items.items[1].with_individual(|item2| {
  451. assert_ne!(item1, item2);
  452. }).unwrap();
  453. }).unwrap();
  454. }
  455. // TOOD: this is not deterministic and can randomly fail
  456. #[async_std::test]
  457. async fn test_units_disappear_from_shop_when_bought() {
  458. let mut entity_gateway = InMemoryGateway::default();
  459. let (_user1, mut char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  460. char1.exp = 80000000;
  461. entity_gateway.save_character(&char1).await.unwrap();
  462. entity_gateway.set_character_meseta(&char1.id, item::Meseta(999999)).await.unwrap();
  463. let mut ship = standard_ship(entity_gateway.clone());
  464. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  465. join_lobby(&mut ship, ClientId(1)).await;
  466. create_room_with_difficulty(&mut ship, ClientId(1), "room", "", Difficulty::Ultimate).await;
  467. let packets = ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::ShopRequest(ShopRequest {
  468. client: 255,
  469. target: 255,
  470. shop_type: 2,
  471. })))).await.unwrap();
  472. let first_unit = match &packets[0].1 {
  473. SendShipPacket::Message(Message {msg: GameMessage::ShopList(shop_list)}) => {
  474. shop_list.items.iter()
  475. .enumerate()
  476. .filter(|(_, item)| {
  477. item.item_bytes[0] == 1 && item.item_bytes[1] == 3
  478. })
  479. .nth(0).unwrap().0
  480. },
  481. _ => panic!(""),
  482. };
  483. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BuyItem(BuyItem {
  484. client: 255,
  485. target: 255,
  486. item_id: 0x10000,
  487. shop_type: 2,
  488. shop_index: first_unit as u8,
  489. amount: 1,
  490. unknown1: 0,
  491. })))).await.unwrap();
  492. ship.handle(ClientId(1), RecvShipPacket::DirectMessage(DirectMessage::new(0, GameMessage::BuyItem(BuyItem {
  493. client: 255,
  494. target: 255,
  495. item_id: 0x10001,
  496. shop_type: 2,
  497. shop_index: first_unit as u8,
  498. amount: 1,
  499. unknown1: 0,
  500. })))).await.unwrap();
  501. let p1_items = entity_gateway.get_character_inventory(&char1.id).await.unwrap();
  502. p1_items.items[0].with_individual(|item1| {
  503. p1_items.items[1].with_individual(|item2| {
  504. assert_ne!(item1, item2);
  505. }).unwrap();
  506. }).unwrap();
  507. }
  508. #[async_std::test]
  509. async fn test_player_sells_untekked_weapon() {
  510. let mut entity_gateway = InMemoryGateway::default();
  511. let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  512. let mut p1_inv = Vec::new();
  513. p1_inv.push(entity_gateway.create_item(
  514. item::NewItemEntity {
  515. item: item::ItemDetail::Weapon(
  516. item::weapon::Weapon {
  517. weapon: item::weapon::WeaponType::Vulcan,
  518. grind: 5,
  519. special: Some(item::weapon::WeaponSpecial::Charge),
  520. attrs: [Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Hit, value: 100}),
  521. Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 100}),
  522. Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Native, value: 100}),],
  523. tekked: false,
  524. }
  525. ),
  526. }).await.unwrap());
  527. entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap();
  528. let mut ship = standard_ship(entity_gateway.clone());
  529. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  530. join_lobby(&mut ship, ClientId(1)).await;
  531. create_room(&mut ship, ClientId(1), "room", "").await;
  532. ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem {
  533. client: 0,
  534. target: 0,
  535. item_id: 0x10000,
  536. amount: 1,
  537. })))).await.unwrap();
  538. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  539. assert_eq!(c1_meseta.0, 1);
  540. }
  541. #[async_std::test]
  542. async fn test_player_sells_rare_item() {
  543. let mut entity_gateway = InMemoryGateway::default();
  544. let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  545. let mut p1_inv = Vec::new();
  546. p1_inv.push(entity_gateway.create_item(
  547. item::NewItemEntity {
  548. item: item::ItemDetail::Weapon(
  549. item::weapon::Weapon {
  550. weapon: item::weapon::WeaponType::DarkFlow,
  551. grind: 5,
  552. special: None,
  553. attrs: [Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Hit, value: 100}),
  554. Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Dark, value: 100}),
  555. Some(item::weapon::WeaponAttribute{attr: item::weapon::Attribute::Native, value: 100}),],
  556. tekked: true,
  557. }
  558. ),
  559. }).await.unwrap());
  560. entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap();
  561. let mut ship = standard_ship(entity_gateway.clone());
  562. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  563. join_lobby(&mut ship, ClientId(1)).await;
  564. create_room(&mut ship, ClientId(1), "room", "").await;
  565. ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem {
  566. client: 0,
  567. target: 0,
  568. item_id: 0x10000,
  569. amount: 1,
  570. })))).await.unwrap();
  571. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  572. assert_eq!(c1_meseta.0, 10);
  573. }
  574. #[async_std::test]
  575. async fn test_player_sells_partial_photon_drop_stack() {
  576. let mut entity_gateway = InMemoryGateway::default();
  577. let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  578. let mut p1_inv = Vec::new();
  579. let mut photon_drops = Vec::new();
  580. for _ in 0..7usize {
  581. photon_drops.push(entity_gateway.create_item(
  582. item::NewItemEntity {
  583. item: item::ItemDetail::Tool(
  584. item::tool::Tool {
  585. tool: item::tool::ToolType::PhotonDrop,
  586. }
  587. ),
  588. }).await.unwrap());
  589. }
  590. p1_inv.push(item::InventoryItemEntity::Stacked(photon_drops));
  591. entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap();
  592. let mut ship = standard_ship(entity_gateway.clone());
  593. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  594. join_lobby(&mut ship, ClientId(1)).await;
  595. create_room(&mut ship, ClientId(1), "room", "").await;
  596. ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem {
  597. client: 0,
  598. target: 0,
  599. item_id: 0x10000,
  600. amount: 3,
  601. })))).await.unwrap();
  602. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  603. assert_eq!(c1_meseta.0, 3000);
  604. }
  605. #[async_std::test]
  606. async fn test_player_sells_basic_frame() {
  607. let mut entity_gateway = InMemoryGateway::default();
  608. let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  609. let mut p1_inv = Vec::new();
  610. p1_inv.push(entity_gateway.create_item(
  611. item::NewItemEntity {
  612. item: item::ItemDetail::Armor(
  613. item::armor::Armor {
  614. armor: item::armor::ArmorType::Frame,
  615. dfp: 0,
  616. evp: 0,
  617. slots: 0,
  618. }
  619. ),
  620. }).await.unwrap());
  621. entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap();
  622. let mut ship = standard_ship(entity_gateway.clone());
  623. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  624. join_lobby(&mut ship, ClientId(1)).await;
  625. create_room(&mut ship, ClientId(1), "room", "").await;
  626. ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem {
  627. client: 0,
  628. target: 0,
  629. item_id: 0x10000,
  630. amount: 1,
  631. })))).await.unwrap();
  632. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  633. assert_eq!(c1_meseta.0, 24);
  634. }
  635. #[async_std::test]
  636. async fn test_player_sells_max_frame() {
  637. let mut entity_gateway = InMemoryGateway::default();
  638. let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  639. let mut p1_inv = Vec::new();
  640. p1_inv.push(entity_gateway.create_item(
  641. item::NewItemEntity {
  642. item: item::ItemDetail::Armor(
  643. item::armor::Armor {
  644. armor: item::armor::ArmorType::Frame,
  645. dfp: 2,
  646. evp: 2,
  647. slots: 4,
  648. }
  649. ),
  650. }).await.unwrap());
  651. entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap();
  652. let mut ship = standard_ship(entity_gateway.clone());
  653. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  654. join_lobby(&mut ship, ClientId(1)).await;
  655. create_room(&mut ship, ClientId(1), "room", "").await;
  656. ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem {
  657. client: 0,
  658. target: 0,
  659. item_id: 0x10000,
  660. amount: 1,
  661. })))).await.unwrap();
  662. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  663. assert_eq!(c1_meseta.0, 74);
  664. }
  665. #[async_std::test]
  666. async fn test_player_sells_basic_barrier() {
  667. let mut entity_gateway = InMemoryGateway::default();
  668. let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  669. let mut p1_inv = Vec::new();
  670. p1_inv.push(entity_gateway.create_item(
  671. item::NewItemEntity {
  672. item: item::ItemDetail::Shield(
  673. item::shield::Shield {
  674. shield: item::shield::ShieldType::Barrier,
  675. dfp: 0,
  676. evp: 0,
  677. }
  678. ),
  679. }).await.unwrap());
  680. entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap();
  681. let mut ship = standard_ship(entity_gateway.clone());
  682. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  683. join_lobby(&mut ship, ClientId(1)).await;
  684. create_room(&mut ship, ClientId(1), "room", "").await;
  685. ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem {
  686. client: 0,
  687. target: 0,
  688. item_id: 0x10000,
  689. amount: 1,
  690. })))).await.unwrap();
  691. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  692. assert_eq!(c1_meseta.0, 69);
  693. }
  694. #[async_std::test]
  695. async fn test_player_sells_max_barrier() {
  696. let mut entity_gateway = InMemoryGateway::default();
  697. let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  698. let mut p1_inv = Vec::new();
  699. p1_inv.push(entity_gateway.create_item(
  700. item::NewItemEntity {
  701. item: item::ItemDetail::Shield(
  702. item::shield::Shield {
  703. shield: item::shield::ShieldType::Barrier,
  704. dfp: 5,
  705. evp: 5,
  706. }
  707. ),
  708. }).await.unwrap());
  709. entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap();
  710. let mut ship = standard_ship(entity_gateway.clone());
  711. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  712. join_lobby(&mut ship, ClientId(1)).await;
  713. create_room(&mut ship, ClientId(1), "room", "").await;
  714. ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem {
  715. client: 0,
  716. target: 0,
  717. item_id: 0x10000,
  718. amount: 1,
  719. })))).await.unwrap();
  720. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  721. assert_eq!(c1_meseta.0, 122);
  722. }
  723. #[async_std::test]
  724. async fn test_player_sells_1_star_minusminus_unit() {
  725. let mut entity_gateway = InMemoryGateway::default();
  726. let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  727. let mut p1_inv = Vec::new();
  728. p1_inv.push(entity_gateway.create_item(
  729. item::NewItemEntity {
  730. item: item::ItemDetail::Unit(
  731. item::unit::Unit {
  732. unit: item::unit::UnitType::PriestMind,
  733. modifier: Some(item::unit::UnitModifier::MinusMinus),
  734. }
  735. ),
  736. }).await.unwrap());
  737. entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap();
  738. let mut ship = standard_ship(entity_gateway.clone());
  739. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  740. join_lobby(&mut ship, ClientId(1)).await;
  741. create_room(&mut ship, ClientId(1), "room", "").await;
  742. ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem {
  743. client: 0,
  744. target: 0,
  745. item_id: 0x10000,
  746. amount: 1,
  747. })))).await.unwrap();
  748. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  749. assert_eq!(c1_meseta.0, 125);
  750. }
  751. #[async_std::test]
  752. async fn test_player_sells_5_star_plusplus_unit() {
  753. let mut entity_gateway = InMemoryGateway::default();
  754. let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  755. let mut p1_inv = Vec::new();
  756. p1_inv.push(entity_gateway.create_item(
  757. item::NewItemEntity {
  758. item: item::ItemDetail::Unit(
  759. item::unit::Unit {
  760. unit: item::unit::UnitType::GeneralHp,
  761. modifier: Some(item::unit::UnitModifier::PlusPlus),
  762. }
  763. ),
  764. }).await.unwrap());
  765. entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap();
  766. let mut ship = standard_ship(entity_gateway.clone());
  767. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  768. join_lobby(&mut ship, ClientId(1)).await;
  769. create_room(&mut ship, ClientId(1), "room", "").await;
  770. ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem {
  771. client: 0,
  772. target: 0,
  773. item_id: 0x10000,
  774. amount: 1,
  775. })))).await.unwrap();
  776. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  777. assert_eq!(c1_meseta.0, 625);
  778. }
  779. #[async_std::test]
  780. async fn test_player_sells_rare_frame() {
  781. let mut entity_gateway = InMemoryGateway::default();
  782. let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  783. let mut p1_inv = Vec::new();
  784. p1_inv.push(entity_gateway.create_item(
  785. item::NewItemEntity {
  786. item: item::ItemDetail::Armor(
  787. item::armor::Armor {
  788. armor: item::armor::ArmorType::StinkFrame,
  789. dfp: 10,
  790. evp: 20,
  791. slots: 3,
  792. }
  793. ),
  794. }).await.unwrap());
  795. entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap();
  796. let mut ship = standard_ship(entity_gateway.clone());
  797. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  798. join_lobby(&mut ship, ClientId(1)).await;
  799. create_room(&mut ship, ClientId(1), "room", "").await;
  800. ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem {
  801. client: 0,
  802. target: 0,
  803. item_id: 0x10000,
  804. amount: 1,
  805. })))).await.unwrap();
  806. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  807. assert_eq!(c1_meseta.0, 10);
  808. }
  809. #[async_std::test]
  810. async fn test_player_sells_rare_barrier() {
  811. let mut entity_gateway = InMemoryGateway::default();
  812. let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  813. let mut p1_inv = Vec::new();
  814. p1_inv.push(entity_gateway.create_item(
  815. item::NewItemEntity {
  816. item: item::ItemDetail::Shield(
  817. item::shield::Shield {
  818. shield: item::shield::ShieldType::RedRing,
  819. dfp: 10,
  820. evp: 20,
  821. }
  822. ),
  823. }).await.unwrap());
  824. entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap();
  825. let mut ship = standard_ship(entity_gateway.clone());
  826. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  827. join_lobby(&mut ship, ClientId(1)).await;
  828. create_room(&mut ship, ClientId(1), "room", "").await;
  829. ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem {
  830. client: 0,
  831. target: 0,
  832. item_id: 0x10000,
  833. amount: 1,
  834. })))).await.unwrap();
  835. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  836. assert_eq!(c1_meseta.0, 10);
  837. }
  838. #[async_std::test]
  839. async fn test_player_sells_rare_unit() {
  840. let mut entity_gateway = InMemoryGateway::default();
  841. let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  842. let mut p1_inv = Vec::new();
  843. p1_inv.push(entity_gateway.create_item(
  844. item::NewItemEntity {
  845. item: item::ItemDetail::Unit(
  846. item::unit::Unit {
  847. unit: item::unit::UnitType::V101,
  848. modifier: None,
  849. }
  850. ),
  851. }).await.unwrap());
  852. entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap();
  853. let mut ship = standard_ship(entity_gateway.clone());
  854. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  855. join_lobby(&mut ship, ClientId(1)).await;
  856. create_room(&mut ship, ClientId(1), "room", "").await;
  857. ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem {
  858. client: 0,
  859. target: 0,
  860. item_id: 0x10000,
  861. amount: 1,
  862. })))).await.unwrap();
  863. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  864. assert_eq!(c1_meseta.0, 10);
  865. }
  866. #[async_std::test]
  867. async fn test_player_cant_sell_if_meseta_would_go_over_max() {
  868. let mut entity_gateway = InMemoryGateway::default();
  869. let (_user1, char1) = new_user_character(&mut entity_gateway, "a1", "a", 1).await;
  870. entity_gateway.set_character_meseta(&char1.id, item::Meseta(999995)).await.unwrap();
  871. let mut p1_inv = Vec::new();
  872. p1_inv.push(entity_gateway.create_item(
  873. item::NewItemEntity {
  874. item: item::ItemDetail::Unit(
  875. item::unit::Unit {
  876. unit: item::unit::UnitType::V101,
  877. modifier: None,
  878. }
  879. ),
  880. }).await.unwrap());
  881. entity_gateway.set_character_inventory(&char1.id, &item::InventoryEntity::new(p1_inv)).await.unwrap();
  882. let mut ship = standard_ship(entity_gateway.clone());
  883. log_in_char(&mut ship, ClientId(1), "a1", "a").await;
  884. join_lobby(&mut ship, ClientId(1)).await;
  885. create_room(&mut ship, ClientId(1), "room", "").await;
  886. let ack = ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerSoldItem(PlayerSoldItem {
  887. client: 0,
  888. target: 0,
  889. item_id: 0x10000,
  890. amount: 1,
  891. })))).await.err().unwrap();
  892. //assert_eq!(ack, ShipError::ItemStateError(ItemStateError::FullOfMeseta));
  893. assert!(matches!(ack.downcast::<ItemStateError>().unwrap(), ItemStateError::FullOfMeseta));
  894. //assert!(matches!(ack.downcast::<ShipError>().unwrap(), ShipError::ItemStateError(ItemStateError::FullOfMeseta)));
  895. let c1_meseta = entity_gateway.get_character_meseta(&char1.id).await.unwrap();
  896. assert_eq!(c1_meseta.0, 999995);
  897. }