|
|
@ -178,7 +178,6 @@ impl From<SectionID> for PgSectionId { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, sqlx::FromRow)]
|
|
|
|
pub struct PgCharacter {
|
|
|
|
pub id: i32,
|
|
|
@ -277,8 +276,6 @@ impl Into<CharacterEntity> for PgCharacter { |
|
|
|
pub struct PgGuildCard {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct PgWeapon {
|
|
|
|
weapon: weapon::WeaponType,
|
|
|
@ -329,6 +326,45 @@ pub struct PgWeaponModifier { |
|
|
|
pub modifier: sqlx::types::Json<weapon::WeaponModifier>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct PgESWeapon {
|
|
|
|
esweapon: esweapon::ESWeaponType,
|
|
|
|
special: Option<esweapon::ESWeaponSpecial>,
|
|
|
|
name: String,
|
|
|
|
grind: u8,
|
|
|
|
wrapping: Option<WrappingPaper>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<esweapon::ESWeapon> for PgESWeapon {
|
|
|
|
fn from(other: esweapon::ESWeapon) -> PgESWeapon {
|
|
|
|
PgESWeapon {
|
|
|
|
esweapon: other.esweapon,
|
|
|
|
special: other.special,
|
|
|
|
name: other.name,
|
|
|
|
grind: other.grind,
|
|
|
|
wrapping: other.wrapping,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Into<esweapon::ESWeapon> for PgESWeapon {
|
|
|
|
fn into(self) -> esweapon::ESWeapon {
|
|
|
|
esweapon::ESWeapon {
|
|
|
|
esweapon: self.esweapon,
|
|
|
|
special: self.special,
|
|
|
|
name: self.name,
|
|
|
|
grind: self.grind,
|
|
|
|
wrapping: self.wrapping,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, sqlx::FromRow)]
|
|
|
|
pub struct PgESWeaponModifier {
|
|
|
|
pub esweapon: i32,
|
|
|
|
pub modifier: sqlx::types::Json<esweapon::ESWeaponModifier>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct PgArmor {
|
|
|
|
armor: armor::ArmorType,
|
|
|
@ -368,42 +404,6 @@ pub struct PgArmorModifier { |
|
|
|
pub modifier: sqlx::types::Json<armor::ArmorModifier>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct PgShield {
|
|
|
|
shield: shield::ShieldType,
|
|
|
|
dfp: u8,
|
|
|
|
evp: u8,
|
|
|
|
wrapping: Option<WrappingPaper>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<shield::Shield> for PgShield {
|
|
|
|
fn from(other: shield::Shield) -> PgShield {
|
|
|
|
PgShield {
|
|
|
|
shield: other.shield,
|
|
|
|
dfp: other.dfp,
|
|
|
|
evp: other.evp,
|
|
|
|
wrapping: other.wrapping,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Into<shield::Shield> for PgShield {
|
|
|
|
fn into(self) -> shield::Shield {
|
|
|
|
shield::Shield {
|
|
|
|
shield: self.shield,
|
|
|
|
dfp: self.dfp,
|
|
|
|
evp: self.evp,
|
|
|
|
wrapping: self.wrapping,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, sqlx::FromRow)]
|
|
|
|
pub struct PgShieldModifier {
|
|
|
|
pub shield: i32,
|
|
|
|
pub modifier: sqlx::types::Json<shield::ShieldModifier>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct PgUnit {
|
|
|
|
unit: unit::UnitType,
|
|
|
@ -438,33 +438,68 @@ pub struct PgUnitModifier { |
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct PgTool {
|
|
|
|
pub tool: tool::ToolType,
|
|
|
|
pub struct PgShield {
|
|
|
|
shield: shield::ShieldType,
|
|
|
|
dfp: u8,
|
|
|
|
evp: u8,
|
|
|
|
wrapping: Option<WrappingPaper>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<tool::Tool> for PgTool {
|
|
|
|
fn from(other: tool::Tool) -> PgTool {
|
|
|
|
PgTool {
|
|
|
|
tool: other.tool,
|
|
|
|
impl From<shield::Shield> for PgShield {
|
|
|
|
fn from(other: shield::Shield) -> PgShield {
|
|
|
|
PgShield {
|
|
|
|
shield: other.shield,
|
|
|
|
dfp: other.dfp,
|
|
|
|
evp: other.evp,
|
|
|
|
wrapping: other.wrapping,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Into<tool::Tool> for PgTool {
|
|
|
|
fn into(self) -> tool::Tool {
|
|
|
|
tool::Tool {
|
|
|
|
tool: self.tool,
|
|
|
|
impl Into<shield::Shield> for PgShield {
|
|
|
|
fn into(self) -> shield::Shield {
|
|
|
|
shield::Shield {
|
|
|
|
shield: self.shield,
|
|
|
|
dfp: self.dfp,
|
|
|
|
evp: self.evp,
|
|
|
|
wrapping: self.wrapping,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, sqlx::FromRow)]
|
|
|
|
pub struct PgToolModifier {
|
|
|
|
pub tool: i32,
|
|
|
|
pub modifier: sqlx::types::Json<tool::ToolModifier>,
|
|
|
|
pub struct PgShieldModifier {
|
|
|
|
pub shield: i32,
|
|
|
|
pub modifier: sqlx::types::Json<shield::ShieldModifier>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct PgMag {
|
|
|
|
mag: mag::MagType,
|
|
|
|
synchro: u8,
|
|
|
|
color: u8,
|
|
|
|
wrapping: Option<WrappingPaper>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<mag::Mag> for PgMag {
|
|
|
|
fn from(other: mag::Mag) -> PgMag {
|
|
|
|
PgMag {
|
|
|
|
mag: other.mag,
|
|
|
|
synchro: other.synchro,
|
|
|
|
color: other.color,
|
|
|
|
wrapping: other.wrapping,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Into<mag::Mag> for PgMag {
|
|
|
|
fn into(self) -> mag::Mag {
|
|
|
|
let mut mag = mag::Mag::baby_mag(self.color as u16);
|
|
|
|
mag.mag = self.mag;
|
|
|
|
mag.synchro = self.synchro;
|
|
|
|
mag.wrapping = self.wrapping;
|
|
|
|
mag
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
@ -501,110 +536,58 @@ pub struct PgTechModifier { |
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct PgMag {
|
|
|
|
mag: mag::MagType,
|
|
|
|
synchro: u8,
|
|
|
|
color: u8,
|
|
|
|
wrapping: Option<WrappingPaper>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<mag::Mag> for PgMag {
|
|
|
|
fn from(other: mag::Mag) -> PgMag {
|
|
|
|
PgMag {
|
|
|
|
mag: other.mag,
|
|
|
|
synchro: other.synchro,
|
|
|
|
color: other.color,
|
|
|
|
wrapping: other.wrapping,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Into<mag::Mag> for PgMag {
|
|
|
|
fn into(self) -> mag::Mag {
|
|
|
|
/*mag::Mag {
|
|
|
|
mag: self.mag,
|
|
|
|
synchro: self.synchro,
|
|
|
|
color: self.color,
|
|
|
|
def: 500,
|
|
|
|
pow: 0,
|
|
|
|
dex: 0,
|
|
|
|
mnd: 0,
|
|
|
|
iq: 0,
|
|
|
|
photon_blast: [None; 3],
|
|
|
|
class: CharacterClass::HUmar,
|
|
|
|
id: SectionID::Viridia,
|
|
|
|
}*/
|
|
|
|
let mut mag = mag::Mag::baby_mag(self.color as u16);
|
|
|
|
mag.mag = self.mag;
|
|
|
|
mag.synchro = self.synchro;
|
|
|
|
mag.wrapping = self.wrapping;
|
|
|
|
mag
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub struct PgESWeapon {
|
|
|
|
esweapon: esweapon::ESWeaponType,
|
|
|
|
special: Option<esweapon::ESWeaponSpecial>,
|
|
|
|
name: String,
|
|
|
|
grind: u8,
|
|
|
|
pub struct PgTool {
|
|
|
|
pub tool: tool::ToolType,
|
|
|
|
wrapping: Option<WrappingPaper>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<esweapon::ESWeapon> for PgESWeapon {
|
|
|
|
fn from(other: esweapon::ESWeapon) -> PgESWeapon {
|
|
|
|
PgESWeapon {
|
|
|
|
esweapon: other.esweapon,
|
|
|
|
special: other.special,
|
|
|
|
name: other.name,
|
|
|
|
grind: other.grind,
|
|
|
|
impl From<tool::Tool> for PgTool {
|
|
|
|
fn from(other: tool::Tool) -> PgTool {
|
|
|
|
PgTool {
|
|
|
|
tool: other.tool,
|
|
|
|
wrapping: other.wrapping,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Into<esweapon::ESWeapon> for PgESWeapon {
|
|
|
|
fn into(self) -> esweapon::ESWeapon {
|
|
|
|
esweapon::ESWeapon {
|
|
|
|
esweapon: self.esweapon,
|
|
|
|
special: self.special,
|
|
|
|
name: self.name,
|
|
|
|
grind: self.grind,
|
|
|
|
impl Into<tool::Tool> for PgTool {
|
|
|
|
fn into(self) -> tool::Tool {
|
|
|
|
tool::Tool {
|
|
|
|
tool: self.tool,
|
|
|
|
wrapping: self.wrapping,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, sqlx::FromRow)]
|
|
|
|
pub struct PgESWeaponModifier {
|
|
|
|
pub esweapon: i32,
|
|
|
|
pub modifier: sqlx::types::Json<esweapon::ESWeaponModifier>,
|
|
|
|
pub struct PgToolModifier {
|
|
|
|
pub tool: i32,
|
|
|
|
pub modifier: sqlx::types::Json<tool::ToolModifier>,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub enum PgItemDetail {
|
|
|
|
Weapon(PgWeapon),
|
|
|
|
ESWeapon(PgESWeapon),
|
|
|
|
Armor(PgArmor),
|
|
|
|
Shield(PgShield),
|
|
|
|
Unit(PgUnit),
|
|
|
|
Tool(PgTool),
|
|
|
|
TechDisk(PgTechDisk),
|
|
|
|
Shield(PgShield),
|
|
|
|
Mag(PgMag),
|
|
|
|
ESWeapon(PgESWeapon),
|
|
|
|
TechDisk(PgTechDisk),
|
|
|
|
Tool(PgTool),
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<ItemDetail> for PgItemDetail {
|
|
|
|
fn from(other: ItemDetail) -> PgItemDetail {
|
|
|
|
match other {
|
|
|
|
ItemDetail::Weapon(weapon) => PgItemDetail::Weapon(weapon.into()),
|
|
|
|
ItemDetail::ESWeapon(esweapon) => PgItemDetail::ESWeapon(esweapon.into()),
|
|
|
|
ItemDetail::Armor(armor) => PgItemDetail::Armor(armor.into()),
|
|
|
|
ItemDetail::Shield(shield) => PgItemDetail::Shield(shield.into()),
|
|
|
|
ItemDetail::Unit(unit) => PgItemDetail::Unit(unit.into()),
|
|
|
|
ItemDetail::Tool(tool) => PgItemDetail::Tool(tool.into()),
|
|
|
|
ItemDetail::TechniqueDisk(tech_disk) => PgItemDetail::TechDisk(tech_disk.into()),
|
|
|
|
ItemDetail::Shield(shield) => PgItemDetail::Shield(shield.into()),
|
|
|
|
ItemDetail::Mag(mag) => PgItemDetail::Mag(mag.into()),
|
|
|
|
ItemDetail::ESWeapon(esweapon) => PgItemDetail::ESWeapon(esweapon.into()),
|
|
|
|
ItemDetail::TechniqueDisk(tech_disk) => PgItemDetail::TechDisk(tech_disk.into()),
|
|
|
|
ItemDetail::Tool(tool) => PgItemDetail::Tool(tool.into()),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -613,13 +596,13 @@ impl Into<ItemDetail> for PgItemDetail { |
|
|
|
fn into(self) -> ItemDetail {
|
|
|
|
match self {
|
|
|
|
PgItemDetail::Weapon(weapon) => ItemDetail::Weapon(weapon.into()),
|
|
|
|
PgItemDetail::ESWeapon(esweapon) => ItemDetail::ESWeapon(esweapon.into()),
|
|
|
|
PgItemDetail::Armor(armor) => ItemDetail::Armor(armor.into()),
|
|
|
|
PgItemDetail::Shield(shield) => ItemDetail::Shield(shield.into()),
|
|
|
|
PgItemDetail::Unit(unit) => ItemDetail::Unit(unit.into()),
|
|
|
|
PgItemDetail::Tool(tool) => ItemDetail::Tool(tool.into()),
|
|
|
|
PgItemDetail::TechDisk(tech_disk) => ItemDetail::TechniqueDisk(tech_disk.into()),
|
|
|
|
PgItemDetail::Shield(shield) => ItemDetail::Shield(shield.into()),
|
|
|
|
PgItemDetail::Mag(mag) => ItemDetail::Mag(mag.into()),
|
|
|
|
PgItemDetail::ESWeapon(esweapon) => ItemDetail::ESWeapon(esweapon.into()),
|
|
|
|
PgItemDetail::TechDisk(tech_disk) => ItemDetail::TechniqueDisk(tech_disk.into()),
|
|
|
|
PgItemDetail::Tool(tool) => ItemDetail::Tool(tool.into()),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -630,7 +613,6 @@ pub struct PgItem { |
|
|
|
pub item: sqlx::types::Json<PgItemDetail>,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub enum PgItemLocationDetail {
|
|
|
|
Inventory {
|
|
|
@ -688,7 +670,6 @@ impl Into<ItemLocation> for PgItemLocationDetail { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, sqlx::FromRow)]
|
|
|
|
pub struct PgItemLocation {
|
|
|
|
//pub id: i32,
|
|
|
@ -696,7 +677,6 @@ pub struct PgItemLocation { |
|
|
|
created_at: chrono::DateTime<chrono::Utc>,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
pub enum PgMagModifierDetail {
|
|
|
|
FeedMag(i32),
|
|
|
@ -740,7 +720,6 @@ pub struct PgMagModifier { |
|
|
|
created_at: chrono::DateTime<chrono::Utc>,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, sqlx::FromRow)]
|
|
|
|
pub struct PgItemEntity {
|
|
|
|
pub id: i32,
|
|
|
@ -764,7 +743,6 @@ impl Into<ItemEntity> for PgItemWithLocation { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, sqlx::FromRow)]
|
|
|
|
pub struct PgMagModifierWithParameters {
|
|
|
|
pub mag: i32,
|
|
|
@ -773,7 +751,6 @@ pub struct PgMagModifierWithParameters { |
|
|
|
pub cell: Option<sqlx::types::Json<PgTool>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
|
|
#[serde(untagged)]
|
|
|
|
pub enum PgInventoryItemEntity {
|
|
|
@ -799,11 +776,11 @@ pub struct PgEquipped { |
|
|
|
pchar: i32,
|
|
|
|
weapon: Option<i32>,
|
|
|
|
armor: Option<i32>,
|
|
|
|
shield: Option<i32>,
|
|
|
|
unit0: Option<i32>,
|
|
|
|
unit1: Option<i32>,
|
|
|
|
unit2: Option<i32>,
|
|
|
|
unit3: Option<i32>,
|
|
|
|
shield: Option<i32>,
|
|
|
|
mag: Option<i32>,
|
|
|
|
}
|
|
|
|
|
|
|
@ -812,12 +789,12 @@ impl Into<EquippedEntity> for PgEquipped { |
|
|
|
EquippedEntity {
|
|
|
|
weapon: self.weapon.map(|i| ItemEntityId(i as u32)),
|
|
|
|
armor: self.armor.map(|i| ItemEntityId(i as u32)),
|
|
|
|
shield: self.shield.map(|i| ItemEntityId(i as u32)),
|
|
|
|
unit: [self.unit0.map(|i| ItemEntityId(i as u32)),
|
|
|
|
self.unit1.map(|i| ItemEntityId(i as u32)),
|
|
|
|
self.unit2.map(|i| ItemEntityId(i as u32)),
|
|
|
|
self.unit3.map(|i| ItemEntityId(i as u32)),
|
|
|
|
self.unit1.map(|i| ItemEntityId(i as u32)),
|
|
|
|
self.unit2.map(|i| ItemEntityId(i as u32)),
|
|
|
|
self.unit3.map(|i| ItemEntityId(i as u32)),
|
|
|
|
],
|
|
|
|
shield: self.shield.map(|i| ItemEntityId(i as u32)),
|
|
|
|
mag: self.mag.map(|i| ItemEntityId(i as u32)),
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -829,13 +806,12 @@ impl From<(CharacterEntityId, EquippedEntity)> for PgEquipped { |
|
|
|
pchar: char_equips.0.0 as i32,
|
|
|
|
weapon: char_equips.1.weapon.map(|i| i.0 as i32),
|
|
|
|
armor: char_equips.1.armor.map(|i| i.0 as i32),
|
|
|
|
shield: char_equips.1.shield.map(|i| i.0 as i32),
|
|
|
|
unit0: char_equips.1.unit[0].map(|i| i.0 as i32),
|
|
|
|
unit1: char_equips.1.unit[1].map(|i| i.0 as i32),
|
|
|
|
unit2: char_equips.1.unit[2].map(|i| i.0 as i32),
|
|
|
|
unit3: char_equips.1.unit[3].map(|i| i.0 as i32),
|
|
|
|
shield: char_equips.1.shield.map(|i| i.0 as i32),
|
|
|
|
mag: char_equips.1.mag.map(|i| i.0 as i32),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|