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