mirror of
https://github.com/redstrate/Kawari.git
synced 2025-06-30 11:47:45 +00:00
Make size of bitmasks constants so they're easier to change, fix tests
This commit is contained in:
parent
5272439bca
commit
74f32121ef
3 changed files with 19 additions and 9 deletions
|
@ -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<u8>,
|
||||
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<u8>,
|
||||
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<u8>,
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue