mirror of
https://github.com/redstrate/Kawari.git
synced 2025-07-13 17:07:45 +00:00
Add CLASSJOB_ARRAY_SIZE constant for various classjob arrays
This commit is contained in:
parent
5f57748a6f
commit
6a08ae4b0f
5 changed files with 19 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
||||||
use crate::common::CustomizeData;
|
use crate::{CLASSJOB_ARRAY_SIZE, common::CustomizeData};
|
||||||
|
|
||||||
// TODO: this isn't really an enum in the game, nor is it a flag either. it's weird!
|
// TODO: this isn't really an enum in the game, nor is it a flag either. it's weird!
|
||||||
#[derive(Debug, Clone, Copy, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Copy, Deserialize, Serialize)]
|
||||||
|
@ -39,7 +39,7 @@ impl rusqlite::types::FromSql for RemakeMode {
|
||||||
pub struct ClientSelectData {
|
pub struct ClientSelectData {
|
||||||
pub character_name: String,
|
pub character_name: String,
|
||||||
pub current_class: i32,
|
pub current_class: i32,
|
||||||
pub class_levels: [i32; 32],
|
pub class_levels: [i32; CLASSJOB_ARRAY_SIZE],
|
||||||
pub race: i32,
|
pub race: i32,
|
||||||
pub subrace: i32,
|
pub subrace: i32,
|
||||||
pub gender: i32,
|
pub gender: i32,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use binrw::binrw;
|
use binrw::binrw;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
AETHERYTE_UNLOCK_BITMASK_SIZE, UNLOCK_BITMASK_SIZE,
|
AETHERYTE_UNLOCK_BITMASK_SIZE, CLASSJOB_ARRAY_SIZE, UNLOCK_BITMASK_SIZE,
|
||||||
common::{CHAR_NAME_MAX_LENGTH, read_string, write_string},
|
common::{CHAR_NAME_MAX_LENGTH, read_string, write_string},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,13 +64,13 @@ pub struct PlayerStatus {
|
||||||
pub sightseeing21_to_80_unlock: u8,
|
pub sightseeing21_to_80_unlock: u8,
|
||||||
pub sightseeing_heavensward_unlock: u8,
|
pub sightseeing_heavensward_unlock: u8,
|
||||||
pub unknown9e: [u8; 26],
|
pub unknown9e: [u8; 26],
|
||||||
pub exp: [u32; 32],
|
pub exp: [u32; CLASSJOB_ARRAY_SIZE],
|
||||||
pub pvp_total_exp: u32,
|
pub pvp_total_exp: u32,
|
||||||
pub unknown_pvp124: u32,
|
pub unknown_pvp124: u32,
|
||||||
pub pvp_exp: u32,
|
pub pvp_exp: u32,
|
||||||
pub pvp_frontline_overall_ranks: [u32; 3],
|
pub pvp_frontline_overall_ranks: [u32; 3],
|
||||||
pub unknown138: u32,
|
pub unknown138: u32,
|
||||||
pub levels: [u16; 32],
|
pub levels: [u16; CLASSJOB_ARRAY_SIZE],
|
||||||
#[br(count = 218)]
|
#[br(count = 218)]
|
||||||
#[bw(pad_size_to = 218)]
|
#[bw(pad_size_to = 218)]
|
||||||
pub unknown194: Vec<u8>,
|
pub unknown194: Vec<u8>,
|
||||||
|
|
|
@ -76,6 +76,9 @@ pub const AETHERYTE_UNLOCK_BITMASK_SIZE: usize = 30;
|
||||||
/// The size of the completed quest bitmask.
|
/// The size of the completed quest bitmask.
|
||||||
pub const COMPLETED_QUEST_BITMASK_SIZE: usize = 691;
|
pub const COMPLETED_QUEST_BITMASK_SIZE: usize = 691;
|
||||||
|
|
||||||
|
/// The size of various classjob arrays.
|
||||||
|
pub const CLASSJOB_ARRAY_SIZE: usize = 32;
|
||||||
|
|
||||||
/// The maximum durability of an item.
|
/// The maximum durability of an item.
|
||||||
pub const ITEM_CONDITION_MAX: u16 = 30000;
|
pub const ITEM_CONDITION_MAX: u16 = 30000;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ use mlua::Function;
|
||||||
use tokio::net::TcpStream;
|
use tokio::net::TcpStream;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
COMPLETED_QUEST_BITMASK_SIZE,
|
CLASSJOB_ARRAY_SIZE, COMPLETED_QUEST_BITMASK_SIZE,
|
||||||
common::{
|
common::{
|
||||||
GameData, ObjectId, ObjectTypeId, Position, timestamp_secs, value_to_flag_byte_index_value,
|
GameData, ObjectId, ObjectTypeId, Position, timestamp_secs, value_to_flag_byte_index_value,
|
||||||
},
|
},
|
||||||
|
@ -62,8 +62,8 @@ pub struct PlayerData {
|
||||||
pub account_id: u32,
|
pub account_id: u32,
|
||||||
|
|
||||||
pub classjob_id: u8,
|
pub classjob_id: u8,
|
||||||
pub classjob_levels: [i32; 32],
|
pub classjob_levels: [i32; CLASSJOB_ARRAY_SIZE],
|
||||||
pub classjob_exp: [u32; 32],
|
pub classjob_exp: [u32; CLASSJOB_ARRAY_SIZE],
|
||||||
pub curr_hp: u32,
|
pub curr_hp: u32,
|
||||||
pub max_hp: u32,
|
pub max_hp: u32,
|
||||||
pub curr_mp: u16,
|
pub curr_mp: u16,
|
||||||
|
|
|
@ -4,7 +4,8 @@ use rusqlite::Connection;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
AETHERYTE_UNLOCK_BITMASK_SIZE, COMPLETED_QUEST_BITMASK_SIZE, UNLOCK_BITMASK_SIZE,
|
AETHERYTE_UNLOCK_BITMASK_SIZE, CLASSJOB_ARRAY_SIZE, COMPLETED_QUEST_BITMASK_SIZE,
|
||||||
|
UNLOCK_BITMASK_SIZE,
|
||||||
common::{
|
common::{
|
||||||
CustomizeData, GameData, Position,
|
CustomizeData, GameData, Position,
|
||||||
workdefinitions::{CharaMake, ClientSelectData, RemakeMode},
|
workdefinitions::{CharaMake, ClientSelectData, RemakeMode},
|
||||||
|
@ -305,8 +306,8 @@ impl WorldDatabase {
|
||||||
inventory: row.get(5)?,
|
inventory: row.get(5)?,
|
||||||
gm_rank: row.get(6)?,
|
gm_rank: row.get(6)?,
|
||||||
classjob_id: row.get(7)?,
|
classjob_id: row.get(7)?,
|
||||||
classjob_levels: json_unpack::<[i32; 32]>(row.get(8)?),
|
classjob_levels: json_unpack::<[i32; CLASSJOB_ARRAY_SIZE]>(row.get(8)?),
|
||||||
classjob_exp: json_unpack::<[u32; 32]>(row.get(9)?),
|
classjob_exp: json_unpack::<[u32; CLASSJOB_ARRAY_SIZE]>(row.get(9)?),
|
||||||
unlocks: json_unpack::<Vec<u8>>(row.get(10)?),
|
unlocks: json_unpack::<Vec<u8>>(row.get(10)?),
|
||||||
aetherytes: json_unpack::<Vec<u8>>(row.get(11)?),
|
aetherytes: json_unpack::<Vec<u8>>(row.get(11)?),
|
||||||
completed_quests: json_unpack::<Vec<u8>>(row.get(12)?),
|
completed_quests: json_unpack::<Vec<u8>>(row.get(12)?),
|
||||||
|
@ -397,7 +398,7 @@ impl WorldDatabase {
|
||||||
inventory: Inventory,
|
inventory: Inventory,
|
||||||
remake_mode: RemakeMode,
|
remake_mode: RemakeMode,
|
||||||
classjob_id: i32,
|
classjob_id: i32,
|
||||||
classjob_levels: [i32; 32],
|
classjob_levels: [i32; CLASSJOB_ARRAY_SIZE],
|
||||||
}
|
}
|
||||||
|
|
||||||
let result: Result<CharaListQuery, rusqlite::Error> =
|
let result: Result<CharaListQuery, rusqlite::Error> =
|
||||||
|
@ -409,7 +410,7 @@ impl WorldDatabase {
|
||||||
inventory: row.get(3)?,
|
inventory: row.get(3)?,
|
||||||
remake_mode: row.get(4)?,
|
remake_mode: row.get(4)?,
|
||||||
classjob_id: row.get(5)?,
|
classjob_id: row.get(5)?,
|
||||||
classjob_levels: json_unpack::<[i32; 32]>(row.get(6)?),
|
classjob_levels: json_unpack::<[i32; CLASSJOB_ARRAY_SIZE]>(row.get(6)?),
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -490,10 +491,10 @@ impl WorldDatabase {
|
||||||
|
|
||||||
// fill out the initial classjob
|
// fill out the initial classjob
|
||||||
let chara_make = CharaMake::from_json(chara_make_str);
|
let chara_make = CharaMake::from_json(chara_make_str);
|
||||||
let mut classjob_levels = [0i32; 32];
|
let mut classjob_levels = [0i32; CLASSJOB_ARRAY_SIZE];
|
||||||
classjob_levels[chara_make.classjob_id as usize] = 1; // inital level
|
classjob_levels[chara_make.classjob_id as usize] = 1; // inital level
|
||||||
|
|
||||||
let classjob_exp = [0u32; 32];
|
let classjob_exp = [0u32; CLASSJOB_ARRAY_SIZE];
|
||||||
|
|
||||||
// fill out initial unlocks
|
// fill out initial unlocks
|
||||||
let unlocks = vec![0u8; UNLOCK_BITMASK_SIZE];
|
let unlocks = vec![0u8; UNLOCK_BITMASK_SIZE];
|
||||||
|
|
Loading…
Add table
Reference in a new issue