Browse Source

add derives to item structs, make some things public

pbs
jake 4 years ago
parent
commit
d8c6dd817e
  1. 10
      src/entity/character.rs
  2. 7
      src/entity/item/esweapon.rs
  3. 2
      src/entity/item/unit.rs
  4. 4
      src/entity/item/weapon.rs
  5. 3
      src/ship/map/area.rs

10
src/entity/character.rs

@ -7,7 +7,7 @@ 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)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, enum_utils::FromStr, derive_more::Display, Serialize, Deserialize)]
pub enum CharacterClass { pub enum CharacterClass {
HUmar, HUmar,
HUnewearl, HUnewearl,
@ -64,7 +64,7 @@ impl Into<u8> for CharacterClass {
} }
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, derive_more::Display)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, enum_utils::FromStr, derive_more::Display, Serialize, Deserialize)]
pub enum SectionID { pub enum SectionID {
Viridia, Viridia,
Greenill, Greenill,
@ -134,7 +134,7 @@ pub struct TechLevel(pub u8);
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct CharacterTechniques { pub struct CharacterTechniques {
techs: HashMap<Technique, TechLevel>
pub techs: HashMap<Technique, TechLevel>
} }
impl CharacterTechniques { impl CharacterTechniques {
@ -163,7 +163,7 @@ impl CharacterTechniques {
#[derive(Clone)] #[derive(Clone)]
pub struct CharacterConfig { pub struct CharacterConfig {
raw_data: [u8; 0xE8],
pub raw_data: [u8; 0xE8],
} }
impl CharacterConfig { impl CharacterConfig {
@ -184,7 +184,7 @@ impl CharacterConfig {
#[derive(Clone)] #[derive(Clone)]
pub struct CharacterInfoboard { pub struct CharacterInfoboard {
board: [u16; 172],
pub board: [u16; 172],
} }
impl CharacterInfoboard { impl CharacterInfoboard {

7
src/entity/item/esweapon.rs

@ -1,3 +1,4 @@
use serde::{Serialize, Deserialize};
// TODO: actually use this // TODO: actually use this
#[derive(Debug)] #[derive(Debug)]
pub enum ItemParseError { pub enum ItemParseError {
@ -8,7 +9,7 @@ pub enum ItemParseError {
InvalidESWeaponName, InvalidESWeaponName,
} }
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ESWeaponType { pub enum ESWeaponType {
Saber = 0, Saber = 0,
Sword, Sword,
@ -120,7 +121,7 @@ impl ESWeaponType {
} }
} }
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
pub enum ESWeaponSpecial { pub enum ESWeaponSpecial {
Jellen = 1, Jellen = 1,
Zalure, Zalure,
@ -305,4 +306,4 @@ mod test {
} }
}
}

2
src/entity/item/unit.rs

@ -323,7 +323,7 @@ impl UnitType {
} }
} }
#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
pub enum UnitModifier { pub enum UnitModifier {
PlusPlus, PlusPlus,
Plus, Plus,

4
src/entity/item/weapon.rs

@ -10,7 +10,7 @@ pub enum ItemParseError {
InvalidWeaponAttribute, InvalidWeaponAttribute,
} }
#[derive(Debug, Copy, Clone, PartialEq, Eq, Ord, PartialOrd)]
#[derive(Debug, Copy, Clone, PartialEq, Hash, Eq, Ord, PartialOrd, Serialize, Deserialize)]
pub enum Attribute { pub enum Attribute {
Native = 1, Native = 1,
ABeast, ABeast,
@ -45,7 +45,7 @@ impl WeaponAttribute {
} }
#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
pub enum WeaponSpecial { pub enum WeaponSpecial {
Draw = 1, Draw = 1,
Drain, Drain,

3
src/ship/map/area.rs

@ -1,9 +1,10 @@
// TOOD: `pub(super) for most of these?` // TOOD: `pub(super) for most of these?`
use serde::{Serialize, Deserialize};
use std::collections::HashMap; use std::collections::HashMap;
use thiserror::Error; use thiserror::Error;
use crate::ship::room::Episode; use crate::ship::room::Episode;
#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
pub enum MapArea { pub enum MapArea {
Pioneer2Ep1, Pioneer2Ep1,
Forest1, Forest1,

Loading…
Cancel
Save