mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-26 08:37:44 +00:00
Fix various problems with the lobby
This commit is contained in:
parent
b127d44ddf
commit
3e34020282
2 changed files with 28 additions and 9 deletions
|
@ -141,6 +141,7 @@ async fn send_account_list(socket: &mut WriteHalf<TcpStream>, state: &State) {
|
|||
// TODO: make this configurable
|
||||
// See https://ffxiv.consolegameswiki.com/wiki/Servers for a list of possible IDs
|
||||
const WORLD_ID: u16 = 63;
|
||||
const WORLD_NAME: &str = "KAWARI";
|
||||
|
||||
async fn send_lobby_info(socket: &mut WriteHalf<TcpStream>, state: &State, sequence: u64) {
|
||||
let timestamp: u32 = SystemTime::now()
|
||||
|
@ -158,7 +159,7 @@ async fn send_lobby_info(socket: &mut WriteHalf<TcpStream>, state: &State, seque
|
|||
index: 0,
|
||||
flags: 0,
|
||||
icon: 0,
|
||||
name: "KAWARI".to_string(),
|
||||
name: WORLD_NAME.to_string(),
|
||||
}]
|
||||
.to_vec();
|
||||
// add any empty boys
|
||||
|
@ -222,19 +223,19 @@ async fn send_lobby_info(socket: &mut WriteHalf<TcpStream>, state: &State, seque
|
|||
server_id1: WORLD_ID,
|
||||
unk1: [0; 16],
|
||||
character_name: "test".to_string(),
|
||||
character_server_name: "test".to_string(),
|
||||
character_server_name1: "test".to_string(),
|
||||
character_server_name: WORLD_NAME.to_string(),
|
||||
character_server_name1: WORLD_NAME.to_string(),
|
||||
character_detail_json: "test".to_string(),
|
||||
unk2: [0; 20],
|
||||
}];
|
||||
// add any empty boys
|
||||
characters.resize(2, CharacterDetails::default());
|
||||
|
||||
for i in 0..4 {
|
||||
let mut characters_in_packet = Vec::new();
|
||||
for _ in 0..min(characters.len(), 2) {
|
||||
characters_in_packet.push(characters.swap_remove(0));
|
||||
}
|
||||
// add any empty boys
|
||||
characters_in_packet.resize(2, CharacterDetails::default());
|
||||
|
||||
let lobby_character_list = if i == 3 {
|
||||
// On the last packet, add the account-wide information
|
||||
|
|
26
src/ipc.rs
26
src/ipc.rs
|
@ -61,8 +61,8 @@ pub struct CharacterDetails {
|
|||
pub server_id: u16,
|
||||
pub server_id1: u16,
|
||||
pub unk1: [u8; 16],
|
||||
#[bw(pad_size_to = 16)]
|
||||
#[br(count = 16)]
|
||||
#[bw(pad_size_to = 32)]
|
||||
#[br(count = 32)]
|
||||
#[br(map = read_string)]
|
||||
#[bw(map = write_string)]
|
||||
pub character_name: String,
|
||||
|
@ -84,6 +84,24 @@ pub struct CharacterDetails {
|
|||
pub unk2: [u8; 20],
|
||||
}
|
||||
|
||||
/*impl Default for CharacterDetails {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
id: 0,
|
||||
content_id: 0,
|
||||
index: 1,
|
||||
server_id: 0,
|
||||
server_id1: 0,
|
||||
unk1: [0; 16],
|
||||
character_name: String::new(),
|
||||
character_server_name: String::new(),
|
||||
character_server_name1: String::new(),
|
||||
character_detail_json: String::new(),
|
||||
unk2: [0; 20],
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
#[binrw]
|
||||
#[br(import(magic: &IPCOpCode))]
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -154,7 +172,7 @@ pub enum IPCStructData {
|
|||
days_subscribed: u32,
|
||||
remaining_days: u32,
|
||||
days_to_next_rank: u32,
|
||||
max_characters_on_world: u32,
|
||||
max_characters_on_world: u16,
|
||||
unk8: u16,
|
||||
#[brw(pad_after = 12)]
|
||||
entitled_expansion: u32,
|
||||
|
@ -187,7 +205,7 @@ impl IPCSegment {
|
|||
IPCStructData::RequestCharacterList { .. } => todo!(),
|
||||
IPCStructData::LobbyServerList { .. } => 24 + (6 * 84),
|
||||
IPCStructData::LobbyRetainerList { .. } => 210,
|
||||
IPCStructData::LobbyCharacterList { .. } => 82 + (2 * 1168),
|
||||
IPCStructData::LobbyCharacterList { .. } => 80 + (2 * 1184),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue