From 580bed3cb02db6b1fae15725bddf888bbabcae2c Mon Sep 17 00:00:00 2001 From: jake Date: Tue, 14 Feb 2023 00:59:57 -0700 Subject: [PATCH] fix dumb itemid problem --- src/ship/packet/handler/room.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ship/packet/handler/room.rs b/src/ship/packet/handler/room.rs index 4cdf611..1055b28 100644 --- a/src/ship/packet/handler/room.rs +++ b/src/ship/packet/handler/room.rs @@ -44,14 +44,15 @@ pub async fn create_room(id: ClientId, }; let area = client_location.get_area(id).await?; - let area_client = client_location.get_local_client(id).await?; + let old_area_client = client_location.get_local_client(id).await?; let lobby_neighbors = client_location.get_client_neighbors(id).await?; let room_id = client_location.create_new_room(id).await?; + let new_area_client = client_location.get_local_client(id).await?; let room = clients.with(id, |client| { let mut item_state = item_state.clone(); Box::pin(async move { - item_state.add_character_to_room(room_id, &client.character, area_client).await; + item_state.add_character_to_room(room_id, &client.character, new_area_client).await; let mut room = RoomState::from_create_room(&create_room, map_builder, drop_table_builder, client.character.section_id, event)?; room.bursting = true; Ok::<_, anyhow::Error>(room) @@ -62,7 +63,7 @@ pub async fn create_room(id: ClientId, let mut result = vec![(id, SendShipPacket::JoinRoom(join_room))]; if let Ok(leader) = client_location.get_area_leader(area).await { - let leave_lobby = SendShipPacket::LeaveLobby(LeaveLobby::new(area_client.local_client.id(), leader.local_client.id())); + let leave_lobby = SendShipPacket::LeaveLobby(LeaveLobby::new(old_area_client.local_client.id(), leader.local_client.id())); result.extend(lobby_neighbors .into_iter() .map(move |c| {