mirror of
https://github.com/redstrate/Kawari.git
synced 2025-05-09 13:47:45 +00:00
My old setup of throwing *all* of the IPC types and opcodes into *one* enum was becoming unbearable. Now that we have multiple things using the same opcodes (because they can overlap) I think it's time to repay this technical debt. This overhauls the structure of the project to move IPC structs into their own modules, and separate the opcode data/lists into separate ones depending on if it's clientbound and serverbound. Nothing has changed functionall, but this is going to make it way easier to add more IPC in the future.
62 lines
1.3 KiB
Rust
62 lines
1.3 KiB
Rust
use binrw::binrw;
|
|
|
|
use crate::{
|
|
CHAR_NAME_MAX_LENGTH,
|
|
common::{read_string, write_string},
|
|
};
|
|
|
|
#[binrw]
|
|
#[brw(repr = u8)]
|
|
#[derive(Debug, Clone, Copy)]
|
|
pub enum SocialListRequestType {
|
|
Party = 0x1,
|
|
Friends = 0x2,
|
|
}
|
|
|
|
#[binrw]
|
|
#[derive(Debug, Clone)]
|
|
pub struct SocialListRequest {
|
|
#[brw(pad_before = 10)] // empty
|
|
pub request_type: SocialListRequestType,
|
|
#[brw(pad_after = 4)] // empty
|
|
pub count: u8,
|
|
}
|
|
|
|
#[binrw]
|
|
#[derive(Debug, Clone, Default)]
|
|
pub struct PlayerEntry {
|
|
pub content_id: u64,
|
|
pub unk: [u8; 12],
|
|
pub zone_id: u16,
|
|
pub zone_id1: u16,
|
|
pub unk2: [u8; 8],
|
|
pub online_status_mask: u64,
|
|
pub class_job: u8,
|
|
pub padding: u8,
|
|
pub level: u8,
|
|
pub padding1: u8,
|
|
pub padding2: u16,
|
|
pub one: u32,
|
|
#[br(count = CHAR_NAME_MAX_LENGTH)]
|
|
#[bw(pad_size_to = CHAR_NAME_MAX_LENGTH)]
|
|
#[br(map = read_string)]
|
|
#[bw(map = write_string)]
|
|
pub name: String,
|
|
#[br(count = 6)]
|
|
#[bw(pad_size_to = 6)]
|
|
#[br(map = read_string)]
|
|
#[bw(map = write_string)]
|
|
pub fc_tag: String,
|
|
}
|
|
|
|
#[binrw]
|
|
#[derive(Debug, Clone)]
|
|
pub struct SocialList {
|
|
#[brw(pad_before = 12)] // empty
|
|
pub request_type: SocialListRequestType,
|
|
pub sequence: u8,
|
|
#[brw(pad_before = 2)] // empty
|
|
#[br(count = 10)]
|
|
#[bw(pad_size_to = 112 * 10)]
|
|
pub entries: Vec<PlayerEntry>,
|
|
}
|