Browse Source

make itementity serializable

pbs
jake 4 years ago
parent
commit
01fe0931b1
  1. 4
      src/entity/item/armor.rs
  2. 2
      src/entity/item/esweapon.rs
  3. 4
      src/entity/item/mag.rs
  4. 5
      src/entity/item/mod.rs
  5. 2
      src/entity/item/shield.rs
  6. 2
      src/entity/item/tool.rs
  7. 2
      src/entity/item/unit.rs
  8. 10
      src/entity/item/weapon.rs

4
src/entity/item/armor.rs

@ -289,7 +289,7 @@ impl ArmorType {
} }
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum ArmorModifier { pub enum ArmorModifier {
AddSlot { AddSlot {
addslot: ItemEntityId, addslot: ItemEntityId,
@ -297,7 +297,7 @@ pub enum ArmorModifier {
} }
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Armor { pub struct Armor {
pub armor: ArmorType, pub armor: ArmorType,
pub dfp: u8, pub dfp: u8,

2
src/entity/item/esweapon.rs

@ -169,7 +169,7 @@ impl ESWeaponSpecial {
} }
} }
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ESWeapon { pub struct ESWeapon {
pub esweapon: ESWeaponType, pub esweapon: ESWeaponType,
pub special: Option<ESWeaponSpecial>, pub special: Option<ESWeaponSpecial>,

4
src/entity/item/mag.rs

@ -519,7 +519,7 @@ pub enum MagModifier {
OwnerChange(CharacterClass, SectionID) OwnerChange(CharacterClass, SectionID)
} }
#[derive(Debug, Copy, Clone, PartialEq, Deserialize, enum_utils::FromStr)]
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize, enum_utils::FromStr)]
pub enum PhotonBlast { pub enum PhotonBlast {
Farlla, Farlla,
Estlla, Estlla,
@ -529,7 +529,7 @@ pub enum PhotonBlast {
MyllaYoulla, MyllaYoulla,
} }
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Mag { pub struct Mag {
pub mag: MagType, pub mag: MagType,
def: u16, def: u16,

5
src/entity/item/mod.rs

@ -8,11 +8,12 @@ pub mod unit;
pub mod mag; pub mod mag;
pub mod esweapon; pub mod esweapon;
use serde::{Serialize, Deserialize};
use crate::entity::character::CharacterEntityId; use crate::entity::character::CharacterEntityId;
use crate::ship::map::MapArea; use crate::ship::map::MapArea;
use crate::ship::drops::ItemDropType; use crate::ship::drops::ItemDropType;
#[derive(PartialEq, Copy, Clone, Debug, Hash, Eq, PartialOrd, Ord)]
#[derive(PartialEq, Copy, Clone, Debug, Hash, Eq, PartialOrd, Ord, Serialize, Deserialize)]
pub struct ItemEntityId(pub u32); pub struct ItemEntityId(pub u32);
#[derive(Hash, PartialEq, Eq, Debug, Clone)] #[derive(Hash, PartialEq, Eq, Debug, Clone)]
pub struct ItemId(u32); pub struct ItemId(u32);
@ -88,7 +89,7 @@ pub enum ItemParseError {
InvalidBytes InvalidBytes
} }
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum ItemDetail { pub enum ItemDetail {
Weapon(weapon::Weapon), Weapon(weapon::Weapon),
Armor(armor::Armor), Armor(armor::Armor),

2
src/entity/item/shield.rs

@ -519,7 +519,7 @@ impl ShieldType {
} }
#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
pub struct Shield { pub struct Shield {
pub shield: ShieldType, pub shield: ShieldType,
pub dfp: u8, pub dfp: u8,

2
src/entity/item/tool.rs

@ -648,7 +648,7 @@ impl ToolType {
} }
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Tool { pub struct Tool {
pub tool: ToolType, pub tool: ToolType,
} }

2
src/entity/item/unit.rs

@ -331,7 +331,7 @@ pub enum UnitModifier {
MinusMinus, MinusMinus,
} }
#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
pub struct Unit { pub struct Unit {
pub unit: UnitType, pub unit: UnitType,
pub modifier: Option<UnitModifier>, pub modifier: Option<UnitModifier>,

10
src/entity/item/weapon.rs

@ -32,7 +32,7 @@ impl Attribute {
} }
} }
#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
pub struct WeaponAttribute { pub struct WeaponAttribute {
pub attr: Attribute, pub attr: Attribute,
pub value: i8, pub value: i8,
@ -1332,14 +1332,14 @@ impl WeaponType {
} }
#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
pub enum TekSpecialModifier { pub enum TekSpecialModifier {
Plus, Plus,
Neutral, Neutral,
Minus, Minus,
} }
#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
pub enum TekPercentModifier { pub enum TekPercentModifier {
PlusPlus, PlusPlus,
Plus, Plus,
@ -1348,7 +1348,7 @@ pub enum TekPercentModifier {
MinusMinus, MinusMinus,
} }
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum WeaponModifier { pub enum WeaponModifier {
AddPercents { AddPercents {
attr: WeaponAttribute, attr: WeaponAttribute,
@ -1364,7 +1364,7 @@ pub enum WeaponModifier {
}, },
} }
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Weapon { pub struct Weapon {
pub weapon: WeaponType, pub weapon: WeaponType,
pub special: Option<WeaponSpecial>, pub special: Option<WeaponSpecial>,

Loading…
Cancel
Save