|
|
@ -3,144 +3,11 @@ use std::collections::HashMap; |
|
|
|
use serde::{Serialize, Deserialize};
|
|
|
|
|
|
|
|
use libpso::packet::ship::{UpdateConfig, WriteInfoboard};
|
|
|
|
use libpso::character::{CharacterClass, SectionID};
|
|
|
|
use libpso::character::settings::{DEFAULT_PALETTE_CONFIG, DEFAULT_TECH_MENU};
|
|
|
|
use crate::item::tech::Technique;
|
|
|
|
use crate::account::UserAccountId;
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, enum_utils::FromStr, derive_more::Display, Serialize, Deserialize, Default)]
|
|
|
|
pub enum CharacterClass {
|
|
|
|
#[default]
|
|
|
|
HUmar,
|
|
|
|
HUnewearl,
|
|
|
|
HUcast,
|
|
|
|
HUcaseal,
|
|
|
|
RAmar,
|
|
|
|
RAmarl,
|
|
|
|
RAcast,
|
|
|
|
RAcaseal,
|
|
|
|
FOmar,
|
|
|
|
FOmarl,
|
|
|
|
FOnewm,
|
|
|
|
FOnewearl,
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: TryFrom
|
|
|
|
impl From<u8> for CharacterClass {
|
|
|
|
fn from(f: u8) -> CharacterClass {
|
|
|
|
match f {
|
|
|
|
0 => CharacterClass::HUmar,
|
|
|
|
1 => CharacterClass::HUnewearl,
|
|
|
|
2 => CharacterClass::HUcast,
|
|
|
|
3 => CharacterClass::RAmar,
|
|
|
|
4 => CharacterClass::RAcast,
|
|
|
|
5 => CharacterClass::RAcaseal,
|
|
|
|
6 => CharacterClass::FOmarl,
|
|
|
|
7 => CharacterClass::FOnewm,
|
|
|
|
8 => CharacterClass::FOnewearl,
|
|
|
|
9 => CharacterClass::HUcaseal,
|
|
|
|
10 => CharacterClass::FOmar,
|
|
|
|
11 => CharacterClass::RAmarl,
|
|
|
|
_ => panic!("unknown class")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<CharacterClass> for u8 {
|
|
|
|
fn from(other: CharacterClass) -> u8 {
|
|
|
|
match other {
|
|
|
|
CharacterClass::HUmar => 0,
|
|
|
|
CharacterClass::HUnewearl => 1,
|
|
|
|
CharacterClass::HUcast => 2,
|
|
|
|
CharacterClass::RAmar => 3,
|
|
|
|
CharacterClass::RAcast => 4,
|
|
|
|
CharacterClass::RAcaseal => 5,
|
|
|
|
CharacterClass::FOmarl => 6,
|
|
|
|
CharacterClass::FOnewm => 7,
|
|
|
|
CharacterClass::FOnewearl => 8,
|
|
|
|
CharacterClass::HUcaseal => 9,
|
|
|
|
CharacterClass::FOmar => 10,
|
|
|
|
CharacterClass::RAmarl => 11,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl CharacterClass {
|
|
|
|
pub fn is_human(&self) -> bool {
|
|
|
|
matches!(self,
|
|
|
|
CharacterClass::HUmar |
|
|
|
|
CharacterClass::RAmar |
|
|
|
|
CharacterClass::RAmarl |
|
|
|
|
CharacterClass::FOmar |
|
|
|
|
CharacterClass::FOmarl)
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn is_newman(&self) -> bool {
|
|
|
|
matches!(self,
|
|
|
|
CharacterClass::HUnewearl |
|
|
|
|
CharacterClass::FOnewm |
|
|
|
|
CharacterClass::FOnewearl)
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn is_android(&self) -> bool {
|
|
|
|
matches!(self,
|
|
|
|
CharacterClass::HUcast |
|
|
|
|
CharacterClass::HUcaseal |
|
|
|
|
CharacterClass::RAcast |
|
|
|
|
CharacterClass::RAcaseal)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, enum_utils::FromStr, derive_more::Display, Serialize, Deserialize, Default)]
|
|
|
|
pub enum SectionID {
|
|
|
|
#[default]
|
|
|
|
Viridia,
|
|
|
|
Greenill,
|
|
|
|
Skyly,
|
|
|
|
Bluefull,
|
|
|
|
Purplenum,
|
|
|
|
Pinkal,
|
|
|
|
Redria,
|
|
|
|
Oran,
|
|
|
|
Yellowboze,
|
|
|
|
Whitill,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<u8> for SectionID {
|
|
|
|
fn from(id: u8) -> SectionID {
|
|
|
|
match id {
|
|
|
|
0 => SectionID::Viridia,
|
|
|
|
1 => SectionID::Greenill,
|
|
|
|
2 => SectionID::Skyly,
|
|
|
|
3 => SectionID::Bluefull,
|
|
|
|
4 => SectionID::Purplenum,
|
|
|
|
5 => SectionID::Pinkal,
|
|
|
|
6 => SectionID::Redria,
|
|
|
|
7 => SectionID::Oran,
|
|
|
|
8 => SectionID::Yellowboze,
|
|
|
|
9 => SectionID::Whitill,
|
|
|
|
_ => panic!(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<SectionID> for u8 {
|
|
|
|
fn from(other: SectionID) -> u8 {
|
|
|
|
match other {
|
|
|
|
SectionID::Viridia => 0,
|
|
|
|
SectionID::Greenill => 1,
|
|
|
|
SectionID::Skyly => 2,
|
|
|
|
SectionID::Bluefull => 3,
|
|
|
|
SectionID::Purplenum => 4,
|
|
|
|
SectionID::Pinkal => 5,
|
|
|
|
SectionID::Redria => 6,
|
|
|
|
SectionID::Oran => 7,
|
|
|
|
SectionID::Yellowboze => 8,
|
|
|
|
SectionID::Whitill => 9,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Default)]
|
|
|
|
pub struct CharacterAppearance {
|
|
|
|