diff --git a/src/ship/packet/handler/message.rs b/src/ship/packet/handler/message.rs index 36c97d6..f4e4d69 100644 --- a/src/ship/packet/handler/message.rs +++ b/src/ship/packet/handler/message.rs @@ -59,7 +59,7 @@ where let (_, before_stats) = LEVEL_TABLE.get_stats_from_exp(char_class, exp); let (after_level, after_stats) = LEVEL_TABLE.get_stats_from_exp(char_class, exp + exp_gain); - let level_up_pkt = builder::message::character_leveled_up(area_client, after_level, before_stats, after_stats); + let level_up_pkt = builder::message::character_leveled_up(area_client, after_level-1, before_stats, after_stats); exp_pkts.extend(clients_in_area.into_iter() .map(move |c| { (c.client, SendShipPacket::Message(Message::new(GameMessage::PlayerLevelUp(level_up_pkt.clone())))) diff --git a/tests/test_exp_gain.rs b/tests/test_exp_gain.rs index 465f949..0317e9d 100644 --- a/tests/test_exp_gain.rs +++ b/tests/test_exp_gain.rs @@ -81,7 +81,7 @@ async fn test_character_levels_up() { last_hitter: 1, })))).await.unwrap(); - assert!(matches!(levelup_pkt[1].1, SendShipPacket::Message(Message {msg: GameMessage::PlayerLevelUp(PlayerLevelUp {lvl: 2, ..})}))); + assert!(matches!(levelup_pkt[1].1, SendShipPacket::Message(Message {msg: GameMessage::PlayerLevelUp(PlayerLevelUp {lvl: 1, ..})}))); let leveltable = CharacterLevelTable::default(); ship.clients.with(ClientId(1), |client| Box::pin(async move { @@ -118,7 +118,7 @@ async fn test_character_levels_up_multiple_times() { last_hitter: 1, })))).await.unwrap(); - assert!(matches!(levelup_pkt[1].1, SendShipPacket::Message(Message {msg: GameMessage::PlayerLevelUp(PlayerLevelUp {lvl: 8, ..})}))); + assert!(matches!(levelup_pkt[1].1, SendShipPacket::Message(Message {msg: GameMessage::PlayerLevelUp(PlayerLevelUp {lvl: 7, ..})}))); ship.clients.with(ClientId(1), |client| Box::pin(async move { assert!(3000 == client.character.exp);