update Note entity; re-generate mock data

This commit is contained in:
YK 2025-09-12 00:44:31 +03:00
parent b09dcb5fc1
commit 6d6956592d
2 changed files with 46 additions and 257 deletions

View File

@ -39,21 +39,7 @@ impl Dashboard {
Quest { title: "Guard the Temple".to_string(), location_taken: Some("Suzail".to_string()), location_task: Some("Temple of Lathander".to_string()), date_taken: None, date_by: None, description: Some("Protect the shrine.".to_string()), from: Some("Clerics of Lathander".to_string()), reward: Some(Balance { platinum: 0, gold: 50, electrum: 0, silver: 0, copper: 0 }) }, Quest { title: "Guard the Temple".to_string(), location_taken: Some("Suzail".to_string()), location_task: Some("Temple of Lathander".to_string()), date_taken: None, date_by: None, description: Some("Protect the shrine.".to_string()), from: Some("Clerics of Lathander".to_string()), reward: Some(Balance { platinum: 0, gold: 50, electrum: 0, silver: 0, copper: 0 }) },
Quest { title: "Explore the Ruins".to_string(), location_taken: Some("Cormyr".to_string()), location_task: Some("Netherese Ruins".to_string()), date_taken: Some(NaiveDate::from_ymd_opt(1481, 9, 1).unwrap()), date_by: Some(NaiveDate::from_ymd_opt(1481, 10, 1).unwrap()), description: None, from: None, reward: None }, Quest { title: "Explore the Ruins".to_string(), location_taken: Some("Cormyr".to_string()), location_task: Some("Netherese Ruins".to_string()), date_taken: Some(NaiveDate::from_ymd_opt(1481, 9, 1).unwrap()), date_by: Some(NaiveDate::from_ymd_opt(1481, 10, 1).unwrap()), description: None, from: None, reward: None },
]), ]),
notes: NoteBook( notes: generate_mock_notebook(),
vec![
Note("Met Elminster in Waterdeep; he hinted at a Netherese ruin nearby.".to_string()),
Note("Avoid Zhentarim agents in Baldur's Gate; they're watching the tavern.".to_string()),
Note("Phandalin: Redbrand thugs extorting locals, hideout in manor basement.".to_string()),
Note("Neverwinter's Lord Neverember offering 100gp for bandit leader's head.".to_string()),
Note("Found a strange rune in Underdark; ask Candlekeep scholars about it.".to_string()),
Note("Luskan pirates smuggling in the docks; check crates for clues.".to_string()),
Note("Silverymoon's wards flicker at midnight; possible arcane sabotage?".to_string()),
Note("Daggerford militia needs help with goblin raids from Cragmaw.".to_string()),
Note("Temple of Lathander in Suzail requests guards for festival.".to_string()),
Note("Heard rumors of a dragon in Evermoors; prepare fire resistance.".to_string()),
Note("Harpers want Zhentarim plans stolen from Zhentil Keep by next tenday.".to_string()),
Note("Keep an eye on that shady merchant in Cormyr; might be a doppelganger.".to_string()),
]),
people: generate_mock_contact_book(), people: generate_mock_contact_book(),
} }
} }
@ -61,246 +47,26 @@ impl Dashboard {
fn generate_mock_inventory() -> Inventory { fn generate_mock_inventory() -> Inventory {
let items = vec![ let items = vec![
InventoryEntry { InventoryEntry { quantity: 1, item: InventoryItem::Custom(CustomInventoryItem { name: "Vorpal Sword".to_string(), weight: Some(4.0), description: Some("A blade that severs heads with a single swing.".to_string()), tags: HashMap::from([ ("type".to_string(), "weapon".to_string()), ("rarity".to_string(), "legendary".to_string()), ]), }), },
quantity: 1, InventoryEntry { quantity: 3, item: InventoryItem::Custom(CustomInventoryItem { name: "Potion of Healing".to_string(), weight: Some(0.5), description: Some("A vial of red liquid that restores vitality.".to_string()), tags: HashMap::from([ ("type".to_string(), "potion".to_string()), ("rarity".to_string(), "common".to_string()), ]), }), },
item: InventoryItem::Custom(CustomInventoryItem { InventoryEntry { quantity: 1, item: InventoryItem::Custom(CustomInventoryItem { name: "Cloak of Elvenkind".to_string(), weight: Some(1.0), description: Some("A cloak that blends into shadows.".to_string()), tags: HashMap::from([ ("type".to_string(), "wondrous".to_string()), ("rarity".to_string(), "uncommon".to_string()), ]), }), },
name: "Vorpal Sword".to_string(), InventoryEntry { quantity: 2, item: InventoryItem::Custom(CustomInventoryItem { name: "Bag of Holding".to_string(), weight: Some(15.0), description: Some("A small bag with vast internal space.".to_string()), tags: HashMap::from([ ("type".to_string(), "wondrous".to_string()), ("rarity".to_string(), "uncommon".to_string()), ]), }), },
weight: Some(4.0), InventoryEntry { quantity: 1, item: InventoryItem::Custom(CustomInventoryItem { name: "Mithril Chainmail".to_string(), weight: Some(20.0), description: Some("Lightweight armor that gleams like silver.".to_string()), tags: HashMap::from([ ("type".to_string(), "armor".to_string()), ("rarity".to_string(), "rare".to_string()), ]), }), },
description: Some("A blade that severs heads with a single swing.".to_string()), InventoryEntry { quantity: 1, item: InventoryItem::Custom(CustomInventoryItem { name: "Wand of Fireballs".to_string(), weight: Some(0.2), description: Some("A wand that unleashes fiery explosions.".to_string()), tags: HashMap::from([ ("type".to_string(), "wand".to_string()), ("rarity".to_string(), "rare".to_string()), ]), }), },
tags: HashMap::from([ InventoryEntry { quantity: 1, item: InventoryItem::Custom(CustomInventoryItem { name: "Ring of Invisibility".to_string(), weight: Some(0.1), description: Some("Grants the wearer invisibility.".to_string()), tags: HashMap::from([ ("type".to_string(), "ring".to_string()), ("rarity".to_string(), "legendary".to_string()), ]), }), },
("type".to_string(), "weapon".to_string()), InventoryEntry { quantity: 2, item: InventoryItem::Custom(CustomInventoryItem { name: "Boots of Speed".to_string(), weight: Some(1.5), description: Some("Boots that enhance the wearer's speed.".to_string()), tags: HashMap::from([ ("type".to_string(), "wondrous".to_string()), ("rarity".to_string(), "rare".to_string()), ]), }), },
("rarity".to_string(), "legendary".to_string()), InventoryEntry { quantity: 1, item: InventoryItem::Custom(CustomInventoryItem { name: "Dagger of Venom".to_string(), weight: Some(1.0), description: Some("A dagger coated with deadly poison.".to_string()), tags: HashMap::from([ ("type".to_string(), "weapon".to_string()), ("rarity".to_string(), "rare".to_string()), ]), }), },
]), InventoryEntry { quantity: 1, item: InventoryItem::Custom(CustomInventoryItem { name: "Staff of Power".to_string(), weight: Some(5.0), description: Some("A staff pulsing with arcane might.".to_string()), tags: HashMap::from([ ("type".to_string(), "staff".to_string()), ("rarity".to_string(), "very rare".to_string()), ]), }), },
}), InventoryEntry { quantity: 4, item: InventoryItem::Custom(CustomInventoryItem { name: "Torch".to_string(), weight: Some(1.0), description: Some("A simple torch for illumination.".to_string()), tags: HashMap::from([ ("type".to_string(), "tool".to_string()), ("rarity".to_string(), "common".to_string()), ]), }), },
}, InventoryEntry { quantity: 1, item: InventoryItem::Custom(CustomInventoryItem { name: "Amulet of Health".to_string(), weight: Some(0.3), description: Some("Boosts the wearer's vitality.".to_string()), tags: HashMap::from([ ("type".to_string(), "wondrous".to_string()), ("rarity".to_string(), "rare".to_string()), ]), }), },
InventoryEntry { InventoryEntry { quantity: 1, item: InventoryItem::Custom(CustomInventoryItem { name: "Flame Tongue".to_string(), weight: Some(3.0), description: Some("A sword that ignites on command.".to_string()), tags: HashMap::from([ ("type".to_string(), "weapon".to_string()), ("rarity".to_string(), "rare".to_string()), ]), }), },
quantity: 3, InventoryEntry { quantity: 5, item: InventoryItem::Custom(CustomInventoryItem { name: "Arrow of Slaying".to_string(), weight: Some(0.1), description: Some("An arrow designed to kill a specific foe.".to_string()), tags: HashMap::from([ ("type".to_string(), "ammunition".to_string()), ("rarity".to_string(), "very rare".to_string()), ]), }), },
item: InventoryItem::Custom(CustomInventoryItem { InventoryEntry { quantity: 1, item: InventoryItem::Custom(CustomInventoryItem { name: "Cloak of Displacement".to_string(), weight: Some(1.0), description: Some("Makes the wearer hard to hit.".to_string()), tags: HashMap::from([ ("type".to_string(), "wondrous".to_string()), ("rarity".to_string(), "rare".to_string()), ]), }), },
name: "Potion of Healing".to_string(), InventoryEntry { quantity: 1, item: InventoryItem::Custom(CustomInventoryItem { name: "Helm of Teleportation".to_string(), weight: Some(3.0), description: Some("Allows teleportation to known locations.".to_string()), tags: HashMap::from([ ("type".to_string(), "wondrous".to_string()), ("rarity".to_string(), "rare".to_string()), ]), }), },
weight: Some(0.5), InventoryEntry { quantity: 1, item: InventoryItem::Custom(CustomInventoryItem { name: "Crystal Ball".to_string(), weight: Some(7.0), description: Some("A magical orb for scrying.".to_string()), tags: HashMap::from([ ("type".to_string(), "wondrous".to_string()), ("rarity".to_string(), "very rare".to_string()), ]), }), },
description: Some("A vial of red liquid that restores vitality.".to_string()), InventoryEntry { quantity: 1, item: InventoryItem::Custom(CustomInventoryItem { name: "Gauntlets of Ogre Power".to_string(), weight: Some(2.0), description: Some("Grants the strength of an ogre.".to_string()), tags: HashMap::from([ ("type".to_string(), "wondrous".to_string()), ("rarity".to_string(), "uncommon".to_string()), ]), }), },
tags: HashMap::from([ InventoryEntry { quantity: 1, item: InventoryItem::Custom(CustomInventoryItem { name: "Robe of the Archmagi".to_string(), weight: Some(1.0), description: Some("Enhances a wizard's spellcasting.".to_string()), tags: HashMap::from([ ("type".to_string(), "wondrous".to_string()), ("rarity".to_string(), "legendary".to_string()), ]), }), },
("type".to_string(), "potion".to_string()), InventoryEntry { quantity: 1, item: InventoryItem::Custom(CustomInventoryItem { name: "Horn of Blasting".to_string(), weight: Some(2.0), description: Some("Emits a destructive sonic blast.".to_string()), tags: HashMap::from([ ("type".to_string(), "wondrous".to_string()), ("rarity".to_string(), "rare".to_string()), ]), }), },
("rarity".to_string(), "common".to_string()),
]),
}),
},
InventoryEntry {
quantity: 1,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Cloak of Elvenkind".to_string(),
weight: Some(1.0),
description: Some("A cloak that blends into shadows.".to_string()),
tags: HashMap::from([
("type".to_string(), "wondrous".to_string()),
("rarity".to_string(), "uncommon".to_string()),
]),
}),
},
InventoryEntry {
quantity: 2,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Bag of Holding".to_string(),
weight: Some(15.0),
description: Some("A small bag with vast internal space.".to_string()),
tags: HashMap::from([
("type".to_string(), "wondrous".to_string()),
("rarity".to_string(), "uncommon".to_string()),
]),
}),
},
InventoryEntry {
quantity: 1,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Mithril Chainmail".to_string(),
weight: Some(20.0),
description: Some("Lightweight armor that gleams like silver.".to_string()),
tags: HashMap::from([
("type".to_string(), "armor".to_string()),
("rarity".to_string(), "rare".to_string()),
]),
}),
},
InventoryEntry {
quantity: 1,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Wand of Fireballs".to_string(),
weight: Some(0.2),
description: Some("A wand that unleashes fiery explosions.".to_string()),
tags: HashMap::from([
("type".to_string(), "wand".to_string()),
("rarity".to_string(), "rare".to_string()),
]),
}),
},
InventoryEntry {
quantity: 1,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Ring of Invisibility".to_string(),
weight: Some(0.1),
description: Some("Grants the wearer invisibility.".to_string()),
tags: HashMap::from([
("type".to_string(), "ring".to_string()),
("rarity".to_string(), "legendary".to_string()),
]),
}),
},
InventoryEntry {
quantity: 2,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Boots of Speed".to_string(),
weight: Some(1.5),
description: Some("Boots that enhance the wearer's speed.".to_string()),
tags: HashMap::from([
("type".to_string(), "wondrous".to_string()),
("rarity".to_string(), "rare".to_string()),
]),
}),
},
InventoryEntry {
quantity: 1,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Dagger of Venom".to_string(),
weight: Some(1.0),
description: Some("A dagger coated with deadly poison.".to_string()),
tags: HashMap::from([
("type".to_string(), "weapon".to_string()),
("rarity".to_string(), "rare".to_string()),
]),
}),
},
InventoryEntry {
quantity: 1,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Staff of Power".to_string(),
weight: Some(5.0),
description: Some("A staff pulsing with arcane might.".to_string()),
tags: HashMap::from([
("type".to_string(), "staff".to_string()),
("rarity".to_string(), "very rare".to_string()),
]),
}),
},
InventoryEntry {
quantity: 4,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Torch".to_string(),
weight: Some(1.0),
description: Some("A simple torch for illumination.".to_string()),
tags: HashMap::from([
("type".to_string(), "tool".to_string()),
("rarity".to_string(), "common".to_string()),
]),
}),
},
InventoryEntry {
quantity: 1,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Amulet of Health".to_string(),
weight: Some(0.3),
description: Some("Boosts the wearer's vitality.".to_string()),
tags: HashMap::from([
("type".to_string(), "wondrous".to_string()),
("rarity".to_string(), "rare".to_string()),
]),
}),
},
InventoryEntry {
quantity: 1,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Flame Tongue".to_string(),
weight: Some(3.0),
description: Some("A sword that ignites on command.".to_string()),
tags: HashMap::from([
("type".to_string(), "weapon".to_string()),
("rarity".to_string(), "rare".to_string()),
]),
}),
},
InventoryEntry {
quantity: 5,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Arrow of Slaying".to_string(),
weight: Some(0.1),
description: Some("An arrow designed to kill a specific foe.".to_string()),
tags: HashMap::from([
("type".to_string(), "ammunition".to_string()),
("rarity".to_string(), "very rare".to_string()),
]),
}),
},
InventoryEntry {
quantity: 1,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Cloak of Displacement".to_string(),
weight: Some(1.0),
description: Some("Makes the wearer hard to hit.".to_string()),
tags: HashMap::from([
("type".to_string(), "wondrous".to_string()),
("rarity".to_string(), "rare".to_string()),
]),
}),
},
InventoryEntry {
quantity: 1,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Helm of Teleportation".to_string(),
weight: Some(3.0),
description: Some("Allows teleportation to known locations.".to_string()),
tags: HashMap::from([
("type".to_string(), "wondrous".to_string()),
("rarity".to_string(), "rare".to_string()),
]),
}),
},
InventoryEntry {
quantity: 1,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Crystal Ball".to_string(),
weight: Some(7.0),
description: Some("A magical orb for scrying.".to_string()),
tags: HashMap::from([
("type".to_string(), "wondrous".to_string()),
("rarity".to_string(), "very rare".to_string()),
]),
}),
},
InventoryEntry {
quantity: 1,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Gauntlets of Ogre Power".to_string(),
weight: Some(2.0),
description: Some("Grants the strength of an ogre.".to_string()),
tags: HashMap::from([
("type".to_string(), "wondrous".to_string()),
("rarity".to_string(), "uncommon".to_string()),
]),
}),
},
InventoryEntry {
quantity: 1,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Robe of the Archmagi".to_string(),
weight: Some(1.0),
description: Some("Enhances a wizard's spellcasting.".to_string()),
tags: HashMap::from([
("type".to_string(), "wondrous".to_string()),
("rarity".to_string(), "legendary".to_string()),
]),
}),
},
InventoryEntry {
quantity: 1,
item: InventoryItem::Custom(CustomInventoryItem {
name: "Horn of Blasting".to_string(),
weight: Some(2.0),
description: Some("Emits a destructive sonic blast.".to_string()),
tags: HashMap::from([
("type".to_string(), "wondrous".to_string()),
("rarity".to_string(), "rare".to_string()),
]),
}),
},
]; ];
Inventory(items) Inventory(items)
@ -366,3 +132,21 @@ fn generate_mock_contact_book() -> ContactBook {
ContactBook(contacts) ContactBook(contacts)
} }
fn generate_mock_notebook() -> NoteBook {
NoteBook(vec![
Note { content: "Met Elminster in Waterdeep; hinted at Netherese ruin.".to_string(), date_ingame: NaiveDate::from_ymd_opt(1481, 4, 15).unwrap(), date_real: NaiveDateTime::parse_from_str("2025-09-01 14:30:00", "%Y-%m-%d %H:%M:%S").unwrap(), tags: HashSet::from_iter(vec!["Elminster".to_string(), "Waterdeep".to_string()]) },
Note { content: "Zhentarim agents watching Baldur's Gate tavern.".to_string(), date_ingame: NaiveDate::from_ymd_opt(1481, 4, 16).unwrap(), date_real: NaiveDateTime::parse_from_str("2025-09-02 09:15:00", "%Y-%m-%d %H:%M:%S").unwrap(), tags: HashSet::from_iter(vec!["Zhentarim".to_string()]) },
Note { content: "Phandalin: Redbrands extorting locals, hideout in manor.".to_string(), date_ingame: NaiveDate::from_ymd_opt(1481, 4, 20).unwrap(), date_real: NaiveDateTime::parse_from_str("2025-09-03 18:45:00", "%Y-%m-%d %H:%M:%S").unwrap(), tags: HashSet::from_iter(vec!["Phandalin".to_string(), "Redbrands".to_string()]) },
Note { content: "Neverember offers 100gp for bandit leader's head.".to_string(), date_ingame: NaiveDate::from_ymd_opt(1481, 4, 22).unwrap(), date_real: NaiveDateTime::parse_from_str("2025-09-04 11:20:00", "%Y-%m-%d %H:%M:%S").unwrap(), tags: HashSet::from_iter(vec!["Neverwinter".to_string()]) },
Note { content: "Strange rune in Underdark; ask Candlekeep scholars.".to_string(), date_ingame: NaiveDate::from_ymd_opt(1481, 5, 1).unwrap(), date_real: NaiveDateTime::parse_from_str("2025-09-05 20:10:00", "%Y-%m-%d %H:%M:%S").unwrap(), tags: HashSet::from_iter(vec!["Underdark".to_string(), "Candlekeep".to_string()]) },
Note { content: "Luskan pirates smuggling at docks; check crates.".to_string(), date_ingame: NaiveDate::from_ymd_opt(1481, 5, 3).unwrap(), date_real: NaiveDateTime::parse_from_str("2025-09-06 15:30:00", "%Y-%m-%d %H:%M:%S").unwrap(), tags: HashSet::from_iter(vec!["Luskan".to_string()]) },
Note { content: "Silverymoon wards flicker at midnight; sabotage?".to_string(), date_ingame: NaiveDate::from_ymd_opt(1481, 5, 5).unwrap(), date_real: NaiveDateTime::parse_from_str("2025-09-07 22:00:00", "%Y-%m-%d %H:%M:%S").unwrap(), tags: HashSet::from_iter(vec!["Silverymoon".to_string(), "Arcane".to_string()]) },
Note { content: "Daggerford militia needs help with Cragmaw goblins.".to_string(), date_ingame: NaiveDate::from_ymd_opt(1481, 5, 7).unwrap(), date_real: NaiveDateTime::parse_from_str("2025-09-08 12:45:00", "%Y-%m-%d %H:%M:%S").unwrap(), tags: HashSet::from_iter(vec!["Daggerford".to_string()]) },
Note { content: "Suzail's Lathander temple requests festival guards.".to_string(), date_ingame: NaiveDate::from_ymd_opt(1481, 5, 10).unwrap(), date_real: NaiveDateTime::parse_from_str("2025-09-09 10:00:00", "%Y-%m-%d %H:%M:%S").unwrap(), tags: HashSet::from_iter(vec!["Suzail".to_string(), "Lathander".to_string()]) },
Note { content: "Rumors of dragon in Evermoors; need fire resistance.".to_string(), date_ingame: NaiveDate::from_ymd_opt(1481, 5, 12).unwrap(), date_real: NaiveDateTime::parse_from_str("2025-09-10 17:25:00", "%Y-%m-%d %H:%M:%S").unwrap(), tags: HashSet::from_iter(vec!["Evermoors".to_string()]) },
Note { content: "Harpers want Zhentarim plans from Zhentil Keep.".to_string(), date_ingame: NaiveDate::from_ymd_opt(1481, 5, 15).unwrap(), date_real: NaiveDateTime::parse_from_str("2025-09-11 08:50:00", "%Y-%m-%d %H:%M:%S").unwrap(), tags: HashSet::from_iter(vec!["Harpers".to_string(), "Zhentarim".to_string()]) },
Note { content: "Shady Cormyr merchant; possible doppelganger.".to_string(), date_ingame: NaiveDate::from_ymd_opt(1481, 5, 17).unwrap(), date_real: NaiveDateTime::parse_from_str("2025-09-11 14:00:00", "%Y-%m-%d %H:%M:%S").unwrap(), tags: HashSet::new() },
])
}

View File

@ -1,4 +1,4 @@
use chrono::NaiveDate; use chrono::{ NaiveDate, NaiveDateTime };
use reactive_stores::Store; use reactive_stores::Store;
use crate::prelude::*; use crate::prelude::*;
@ -125,7 +125,12 @@ pub struct Quest {
pub struct NoteBook (pub Vec<Note>); pub struct NoteBook (pub Vec<Note>);
#[derive(Clone, Debug, Store)] #[derive(Clone, Debug, Store)]
pub struct Note (pub String); pub struct Note {
pub content: String,
pub date_ingame: NaiveDate,
pub date_real: NaiveDateTime,
pub tags: HashSet<String>,
}
#[derive(Clone, Debug, Store)] #[derive(Clone, Debug, Store)]
pub struct SpellSlots (pub [SpellSlotLevel; 9]); pub struct SpellSlots (pub [SpellSlotLevel; 9]);