|
@ -134,21 +134,26 @@ pub fn remove_from_lobby(id: ClientId, |
|
|
pub fn get_room_tab_info(id: ClientId,
|
|
|
pub fn get_room_tab_info(id: ClientId,
|
|
|
pkt: &MenuDetail,
|
|
|
pkt: &MenuDetail,
|
|
|
client_location: &mut ClientLocation,
|
|
|
client_location: &mut ClientLocation,
|
|
|
clients: &Clients)
|
|
|
|
|
|
|
|
|
clients: &Clients,
|
|
|
|
|
|
rooms: &mut Rooms)
|
|
|
-> Result<Vec<(ClientId, SendShipPacket)>, anyhow::Error> {
|
|
|
-> Result<Vec<(ClientId, SendShipPacket)>, anyhow::Error> {
|
|
|
let room_id = RoomId(pkt.item as usize);
|
|
|
let room_id = RoomId(pkt.item as usize);
|
|
|
let clients_in_room = client_location.get_clients_in_room(room_id).map_err(|err| -> ClientLocationError { err.into() })?;
|
|
|
|
|
|
|
|
|
if let Some(_room) = rooms.get(pkt.item as usize).ok_or(ShipError::InvalidRoom(pkt.item))? {
|
|
|
let mut room_info = String::new();
|
|
|
let mut room_info = String::new();
|
|
|
|
|
|
let clients_in_room = client_location.get_clients_in_room(room_id).map_err(|err| -> ClientLocationError { err.into() })?;
|
|
|
for client in clients_in_room {
|
|
|
for client in clients_in_room {
|
|
|
let cs = clients.get(&client.client).ok_or(ShipError::ClientNotFound(client.client))?;
|
|
|
let cs = clients.get(&client.client).ok_or(ShipError::ClientNotFound(client.client))?;
|
|
|
let gc = cs.user.guildcard;
|
|
|
let gc = cs.user.guildcard;
|
|
|
let name = &cs.character.name;
|
|
|
let name = &cs.character.name;
|
|
|
let cls = cs.character.char_class;
|
|
|
|
|
|
|
|
|
let cc = cs.character.char_class;
|
|
|
let leveltable = CharacterLevelTable::default();
|
|
|
let leveltable = CharacterLevelTable::default();
|
|
|
let lv = leveltable.get_level_from_exp(cls, cs.character.exp);
|
|
|
|
|
|
|
|
|
let lv = leveltable.get_level_from_exp(cc, cs.character.exp);
|
|
|
let floor = cs.area.unwrap_or(MapArea::Pioneer2Ep1);
|
|
|
let floor = cs.area.unwrap_or(MapArea::Pioneer2Ep1);
|
|
|
|
|
|
|
|
|
room_info += format!("{} Lv{} {}\n{} {}\n", gc,lv,name,cls,floor).as_str();
|
|
|
|
|
|
|
|
|
room_info += format!("{} Lv{} {}\n{} {}\n", gc,lv,name,cc,floor).as_str();
|
|
|
}
|
|
|
}
|
|
|
Ok(vec![(id, SendShipPacket::SmallLeftDialog(SmallLeftDialog::new(room_info)))])
|
|
|
Ok(vec![(id, SendShipPacket::SmallLeftDialog(SmallLeftDialog::new(room_info)))])
|
|
|
|
|
|
} else {
|
|
|
|
|
|
Ok(vec![(id, SendShipPacket::SmallLeftDialog(SmallLeftDialog::new("Game is no longer active".into())))])
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|