2021-12-23 11:00:37 -05:00
|
|
|
use std::collections::HashMap;
|
|
|
|
|
2021-12-24 10:38:44 -05:00
|
|
|
use ::serde::Deserialize;
|
2021-12-23 11:00:37 -05:00
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct Item {
|
|
|
|
pub name: String,
|
|
|
|
pub renderable: Option<Renderable>,
|
|
|
|
pub consumable: Option<Consumable>,
|
2021-12-23 12:05:56 -05:00
|
|
|
pub weapon: Option<Weapon>,
|
2022-01-04 11:11:38 -05:00
|
|
|
pub wearable: Option<Wearable>,
|
2022-01-13 10:14:13 -05:00
|
|
|
pub initiative_penalty: Option<f32>,
|
|
|
|
pub weight_lbs: Option<f32>,
|
|
|
|
pub base_value: Option<f32>,
|
2022-01-13 11:29:20 -05:00
|
|
|
pub vendor_category: Option<String>,
|
2022-01-19 09:40:21 -05:00
|
|
|
pub magic: Option<MagicItem>,
|
2022-01-24 09:56:42 -05:00
|
|
|
pub attributes: Option<ItemAttributeBonus>,
|
2021-12-23 11:00:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct Renderable {
|
|
|
|
pub glyph: String,
|
|
|
|
pub fg: String,
|
|
|
|
pub bg: String,
|
|
|
|
pub order: i32,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct Consumable {
|
|
|
|
pub effects: HashMap<String, String>,
|
2022-01-24 10:58:37 -05:00
|
|
|
pub charges: Option<i32>,
|
2021-12-23 11:00:37 -05:00
|
|
|
}
|
2021-12-23 12:05:56 -05:00
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct Weapon {
|
|
|
|
pub range: String,
|
2022-01-04 10:08:06 -05:00
|
|
|
pub attribute: String,
|
|
|
|
pub base_damage: String,
|
|
|
|
pub hit_bonus: i32,
|
2022-01-25 14:25:11 -05:00
|
|
|
pub proc_chance: Option<f32>,
|
|
|
|
pub proc_target: Option<String>,
|
|
|
|
pub proc_effects: Option<HashMap<String, String>>,
|
2021-12-23 12:05:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
2022-01-04 11:11:38 -05:00
|
|
|
pub struct Wearable {
|
|
|
|
pub armor_class: f32,
|
|
|
|
pub slot: String,
|
2021-12-23 12:05:56 -05:00
|
|
|
}
|
2022-01-19 09:40:21 -05:00
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct MagicItem {
|
|
|
|
pub class: String,
|
2022-01-19 10:15:51 -05:00
|
|
|
pub naming: String,
|
2022-01-21 11:18:53 -05:00
|
|
|
pub cursed: Option<bool>,
|
2022-01-19 09:40:21 -05:00
|
|
|
}
|
2022-01-24 09:56:42 -05:00
|
|
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
|
|
pub struct ItemAttributeBonus {
|
|
|
|
pub might: Option<i32>,
|
|
|
|
pub fitness: Option<i32>,
|
|
|
|
pub quickness: Option<i32>,
|
|
|
|
pub intelligence: Option<i32>,
|
|
|
|
}
|