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 {
AddSlot {
addslot: ItemEntityId,
@ -297,7 +297,7 @@ pub enum ArmorModifier {
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Armor {
pub armor: ArmorType,
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 esweapon: ESWeaponType,
pub special: Option<ESWeaponSpecial>,

4
src/entity/item/mag.rs

@ -519,7 +519,7 @@ pub enum MagModifier {
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 {
Farlla,
Estlla,
@ -529,7 +529,7 @@ pub enum PhotonBlast {
MyllaYoulla,
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct Mag {
pub mag: MagType,
def: u16,

5
src/entity/item/mod.rs

@ -8,11 +8,12 @@ pub mod unit;
pub mod mag;
pub mod esweapon;
use serde::{Serialize, Deserialize};
use crate::entity::character::CharacterEntityId;
use crate::ship::map::MapArea;
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);
#[derive(Hash, PartialEq, Eq, Debug, Clone)]
pub struct ItemId(u32);
@ -88,7 +89,7 @@ pub enum ItemParseError {
InvalidBytes
}
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum ItemDetail {
Weapon(weapon::Weapon),
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 shield: ShieldType,
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 tool: ToolType,
}

2
src/entity/item/unit.rs

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

Loading…
Cancel
Save