diff --git a/src/ipc/zone/player_setup.rs b/src/ipc/zone/player_setup.rs index 528d6a5..799f4df 100644 --- a/src/ipc/zone/player_setup.rs +++ b/src/ipc/zone/player_setup.rs @@ -1,6 +1,9 @@ use binrw::binrw; -use crate::common::{CHAR_NAME_MAX_LENGTH, read_string, write_string}; +use crate::{ + AETHERYTE_UNLOCK_BITMASK_SIZE, UNLOCK_BITMASK_SIZE, + common::{CHAR_NAME_MAX_LENGTH, read_string, write_string}, +}; #[binrw] #[derive(Debug, Clone, Default)] @@ -88,12 +91,12 @@ pub struct PlayerStatus { #[bw(map = write_string)] pub name: String, pub unknown293: [u8; 32], - #[br(count = 64)] - #[bw(pad_size_to = 64)] + #[br(count = UNLOCK_BITMASK_SIZE)] + #[bw(pad_size_to = UNLOCK_BITMASK_SIZE)] pub unlocks: Vec, pub unknown10e: [u8; 28], - #[br(count = 29)] - #[bw(pad_size_to = 29)] + #[br(count = AETHERYTE_UNLOCK_BITMASK_SIZE)] + #[bw(pad_size_to = AETHERYTE_UNLOCK_BITMASK_SIZE)] pub aetherytes: Vec, pub favorite_aetheryte_ids: [u16; 4], pub free_aetheryte_id: u16, @@ -161,8 +164,8 @@ pub struct PlayerStatus { pub cleared_pvp: [u8; 5], // meh, this is where i put all of the new data - #[br(count = 191)] - #[bw(pad_size_to = 191)] + #[br(count = 160)] + #[bw(pad_size_to = 160)] pub unknown948: Vec, } diff --git a/src/lib.rs b/src/lib.rs index df1a1b4..6dd9cf1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -68,3 +68,9 @@ pub fn get_supported_expac_versions() -> HashMap<&'static str, Version<'static>> /// Constant to enable packet obsfucation. Changes every patch. pub const OBFUSCATION_ENABLED_MODE: u8 = 41; + +/// The size of the unlock bitmask. +pub const UNLOCK_BITMASK_SIZE: usize = 64; + +/// The size of the aetheryte unlock bitmask. +pub const AETHERYTE_UNLOCK_BITMASK_SIZE: usize = 29; diff --git a/src/world/database.rs b/src/world/database.rs index e325b2e..98b64e3 100644 --- a/src/world/database.rs +++ b/src/world/database.rs @@ -4,6 +4,7 @@ use rusqlite::Connection; use serde::Deserialize; use crate::{ + AETHERYTE_UNLOCK_BITMASK_SIZE, UNLOCK_BITMASK_SIZE, common::{ CustomizeData, GameData, Position, workdefinitions::{CharaMake, ClientSelectData, RemakeMode}, @@ -384,10 +385,10 @@ impl WorldDatabase { classjob_levels[chara_make.classjob_id as usize] = 1; // inital level // fill out initial unlocks - let unlocks = vec![0u8; 64]; + let unlocks = vec![0u8; UNLOCK_BITMASK_SIZE]; // fill out initial aetherytes - let aetherytes = vec![0u8; 29]; + let aetherytes = vec![0u8; AETHERYTE_UNLOCK_BITMASK_SIZE]; // insert ids connection