1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-24 16:17:44 +00:00
kawari/src/lobby/ipc/character_list.rs
Joshua Goins 0900d0b94e Implement basic character persistence, World <-> Lobby server communication
This is unfortunately lumped into one big commit, and is very hacky and WIP but
does indeed work! Since the Lobby and World server are two separate servers, it
uses it's own custom IPC packets (reusing the same packet structures as regular
game ones.)

The characters you create in the Lobby server are now saved in the World server,
but this is not yet reflected in the Lobby screen.
2025-03-21 19:56:16 -04:00

68 lines
1.7 KiB
Rust

use binrw::binrw;
use crate::CHAR_NAME_MAX_LENGTH;
use super::{read_string, write_string};
#[binrw]
#[derive(Debug, Clone, Default)]
pub struct CharacterDetails {
#[brw(pad_after = 4)]
pub actor_id: u32,
pub content_id: u64,
#[brw(pad_after = 4)]
pub index: u32,
pub origin_server_id: u16,
pub current_server_id: u16,
pub unk1: [u8; 16],
#[bw(pad_size_to = CHAR_NAME_MAX_LENGTH)]
#[br(count = CHAR_NAME_MAX_LENGTH)]
#[br(map = read_string)]
#[bw(map = write_string)]
pub character_name: String,
#[bw(pad_size_to = 32)]
#[br(count = 32)]
#[br(map = read_string)]
#[bw(map = write_string)]
pub origin_server_name: String,
#[bw(pad_size_to = 32)]
#[br(count = 32)]
#[br(map = read_string)]
#[bw(map = write_string)]
pub current_server_name: String,
#[bw(pad_size_to = 1024)]
#[br(count = 1024)]
#[br(map = read_string)]
#[bw(map = write_string)]
pub character_detail_json: String,
pub unk2: [u8; 20],
}
#[binrw]
#[derive(Debug, Clone, Default)]
pub struct LobbyCharacterList {
pub sequence: u64,
pub counter: u8,
#[brw(pad_after = 2)]
pub num_in_packet: u8,
pub unk1: u8,
pub unk2: u8,
pub unk3: u8,
/// Set to 128 if legacy character
pub unk4: u8,
pub unk5: [u32; 7],
pub unk6: u8,
pub veteran_rank: u8,
#[brw(pad_after = 1)]
pub unk7: u8,
pub days_subscribed: u32,
pub remaining_days: u32,
pub days_to_next_rank: u32,
pub max_characters_on_world: u16,
pub unk8: u16,
#[brw(pad_after = 12)]
pub entitled_expansion: u32,
#[br(count = 2)]
#[brw(pad_size_to = (1196 * 2))]
pub characters: Vec<CharacterDetails>,
}