Refactored spells import, working on level_1

This commit is contained in:
Benjamin Sherriff
2023-10-05 14:26:02 -04:00
parent 1b41849115
commit 49b3a38543
9 changed files with 3044 additions and 145 deletions

View File

@@ -4,7 +4,7 @@ use siren::ServiceError;
use crate::db::{schema::spells::{self}, classes::AbilityType, conditions::ConditionType};
use super::{SchoolType, CastingTime, CastingType, SpellAttackType, SpellDamageType, Range, Area, Components, Duration, Source, Description, DurationType};
use super::{SchoolType, CastingTime, SpellAttackType, SpellDamageType, Range, Area, Components, Duration, Source, Description, DurationType, Effect};
#[derive(Queryable, QueryableByName, Serialize, Deserialize)]
#[diesel(table_name = spells)]
@@ -198,6 +198,8 @@ pub struct Spell {
pub ritual: bool,
pub casting_time: CastingTime,
#[serde(skip_serializing_if = "Option::is_none")]
pub effect: Option<Effect>,
#[serde(skip_serializing_if = "Option::is_none")]
pub saving_throw: Option<Vec<AbilityType>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub attack_type: Option<SpellAttackType>,
@@ -232,7 +234,8 @@ impl From<QuerySpell> for Spell {
school: SchoolType::Abjuration,
level: 0,
ritual: false,
casting_time: CastingTime { value: 0, casting_type: CastingType::Action },
casting_time: CastingTime { value: 0, casting_type: "".to_string(), note: None },
effect: None,
saving_throw: None,
attack_type: None,
damage_inflict: None,