|
|
@ -7,8 +7,9 @@ use libpso::character::character::{DEFAULT_PALETTE_CONFIG, DEFAULT_TECH_MENU}; |
|
|
|
use crate::entity::item::tech::Technique;
|
|
|
|
use crate::entity::account::UserAccountId;
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, enum_utils::FromStr, derive_more::Display, Serialize, Deserialize)]
|
|
|
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, enum_utils::FromStr, derive_more::Display, Serialize, Deserialize, Default)]
|
|
|
|
pub enum CharacterClass {
|
|
|
|
#[default]
|
|
|
|
HUmar,
|
|
|
|
HUnewearl,
|
|
|
|
HUcast,
|
|
|
@ -90,8 +91,9 @@ impl CharacterClass { |
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, enum_utils::FromStr, derive_more::Display, Serialize, Deserialize)]
|
|
|
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, enum_utils::FromStr, derive_more::Display, Serialize, Deserialize, Default)]
|
|
|
|
pub enum SectionID {
|
|
|
|
#[default]
|
|
|
|
Viridia,
|
|
|
|
Greenill,
|
|
|
|
Skyly,
|
|
|
@ -163,13 +165,15 @@ pub struct CharacterTechniques { |
|
|
|
pub techs: HashMap<Technique, TechLevel>
|
|
|
|
}
|
|
|
|
|
|
|
|
impl CharacterTechniques {
|
|
|
|
fn new() -> CharacterTechniques {
|
|
|
|
impl Default for CharacterTechniques {
|
|
|
|
fn default() -> CharacterTechniques {
|
|
|
|
CharacterTechniques {
|
|
|
|
techs: HashMap::new(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl CharacterTechniques {
|
|
|
|
pub fn set_tech(&mut self, tech: Technique, level: TechLevel) {
|
|
|
|
self.techs.insert(tech, TechLevel(level.0 - 1));
|
|
|
|
}
|
|
|
@ -192,13 +196,15 @@ pub struct CharacterConfig { |
|
|
|
pub raw_data: [u8; 0xE8],
|
|
|
|
}
|
|
|
|
|
|
|
|
impl CharacterConfig {
|
|
|
|
fn new() -> CharacterConfig {
|
|
|
|
impl Default for CharacterConfig {
|
|
|
|
fn default() -> CharacterConfig {
|
|
|
|
CharacterConfig {
|
|
|
|
raw_data: DEFAULT_PALETTE_CONFIG,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl CharacterConfig {
|
|
|
|
pub fn update(&mut self, new_config: &UpdateConfig) {
|
|
|
|
self.raw_data = new_config.config;
|
|
|
|
}
|
|
|
@ -213,13 +219,15 @@ pub struct CharacterInfoboard { |
|
|
|
pub board: [u16; 172],
|
|
|
|
}
|
|
|
|
|
|
|
|
impl CharacterInfoboard {
|
|
|
|
fn new() -> CharacterInfoboard {
|
|
|
|
impl Default for CharacterInfoboard {
|
|
|
|
fn default() -> CharacterInfoboard {
|
|
|
|
CharacterInfoboard {
|
|
|
|
board: [0; 172]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl CharacterInfoboard {
|
|
|
|
pub fn as_bytes(&self) -> [u16; 172] {
|
|
|
|
self.board
|
|
|
|
}
|
|
|
@ -239,13 +247,15 @@ pub struct CharacterTechMenu { |
|
|
|
pub tech_menu: [u8; 40],
|
|
|
|
}
|
|
|
|
|
|
|
|
impl CharacterTechMenu {
|
|
|
|
fn new() -> CharacterTechMenu {
|
|
|
|
impl Default for CharacterTechMenu {
|
|
|
|
fn default() -> CharacterTechMenu {
|
|
|
|
CharacterTechMenu {
|
|
|
|
tech_menu: DEFAULT_TECH_MENU,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl CharacterTechMenu {
|
|
|
|
pub fn as_bytes(&self) -> [u8; 40] {
|
|
|
|
self.tech_menu
|
|
|
|
}
|
|
|
@ -262,7 +272,7 @@ pub struct CharacterMaterials { |
|
|
|
pub tp: u32,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
|
|
|
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, Default)]
|
|
|
|
pub struct CharacterEntityId(pub u32);
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
@ -299,12 +309,12 @@ impl NewCharacterEntity { |
|
|
|
char_class: CharacterClass::HUmar,
|
|
|
|
section_id: SectionID::Viridia,
|
|
|
|
appearance: CharacterAppearance::default(),
|
|
|
|
techs: CharacterTechniques::new(),
|
|
|
|
config: CharacterConfig::new(),
|
|
|
|
info_board: CharacterInfoboard::new(),
|
|
|
|
techs: CharacterTechniques::default(),
|
|
|
|
config: CharacterConfig::default(),
|
|
|
|
info_board: CharacterInfoboard::default(),
|
|
|
|
guildcard: CharacterGuildCard::default(),
|
|
|
|
materials: CharacterMaterials::default(),
|
|
|
|
tech_menu: CharacterTechMenu::new(),
|
|
|
|
tech_menu: CharacterTechMenu::default(),
|
|
|
|
meseta: 0,
|
|
|
|
bank_meseta: 0,
|
|
|
|
option_flags: 0,
|
|
|
@ -312,7 +322,7 @@ impl NewCharacterEntity { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
#[derive(Clone, Default)]
|
|
|
|
pub struct CharacterEntity {
|
|
|
|
pub id: CharacterEntityId,
|
|
|
|
pub user_id: UserAccountId,
|
|
|
|