- add: ability to refresh the current session

- add: delete type to delete character request
- add: ability to update key in redis
- add: handle alive packet to refresh the session
- fix: delete now actually returns the time remaining correctly
- fix: character list now has the correct time until character deletion
This commit is contained in:
2025-01-08 02:03:27 -05:00
parent 584892ab97
commit 6d35d15ac3
16 changed files with 158 additions and 25 deletions

View File

@@ -51,7 +51,6 @@ pub(crate) async fn handle_char_list_req(stream: &mut TcpStream, packet: Packet,
// query the character service for the character list for this user
let mut character_client = character_client.lock().await;
let character_list = character_client.get_character_list(&user_id.to_string()).await?;
debug!("{:?}", character_list.characters);
let mut characters = vec![];
let mut character_id_list:Vec<u8> = Vec::new();
for character in character_list.characters {
@@ -68,7 +67,6 @@ pub(crate) async fn handle_char_list_req(stream: &mut TcpStream, packet: Packet,
};
}
}
debug!("Item list is created as: {:?}", item_list);
let character_info = CharInfo {
name: NullTerminatedString(character.name),
@@ -89,7 +87,6 @@ pub(crate) async fn handle_char_list_req(stream: &mut TcpStream, packet: Packet,
state.character_list = Some(character_id_list); // Save the real character id's for later as the client sends what is selected from 0 index. It does not use the real character idss
}
debug!("{:?}", characters);
let data = SrvCharListReply { characters };
let response_packet = Packet::new(PacketType::PakccCharListReply, &data)?;
send_packet(stream, &response_packet).await?;
@@ -144,7 +141,7 @@ pub(crate) async fn handle_delete_char_req(stream: &mut TcpStream, packet: Packe
}
let mut character_client = character_client.lock().await;
let delete_response = character_client.delete_character(&user_id.to_string(), &character_id_list[request.char_id as usize].to_string()).await?;
let delete_response = character_client.delete_character(&user_id.to_string(), &character_id_list[request.char_id as usize].to_string(), request.is_delete as i32).await?;
let character_name = request.name;
let data = SrvDeleteCharReply { remaining_time: delete_response.remaining_time as u32, name: character_name };