mod collection_system; mod drop_system; mod equip_use; mod identification_system; mod remove_system; mod use_system; use ::specs::prelude::*; pub use collection_system::ItemCollectionSystem; pub use drop_system::ItemDropSystem; pub use equip_use::ItemEquipOnUse; pub use identification_system::ItemIdentificationSystem; pub use remove_system::ItemRemoveSystem; pub use use_system::{ItemUseSystem, SpellUseSystem}; use crate::components::{MagicItem, Name, ObfuscatedName}; use crate::MasterDungeonMap; fn obfuscate_name( item: Entity, names: &ReadStorage, magic_items: &ReadStorage, obfuscated_names: &ReadStorage, dm: &MasterDungeonMap, ) -> String { if let Some(name) = names.get(item) { if magic_items.get(item).is_some() { if dm.identified_items.contains(&name.name) { name.name.clone() } else if let Some(obfuscated) = obfuscated_names.get(item) { obfuscated.name.clone() } else { "Unidentified magic item".to_string() } } else { name.name.clone() } } else { "Nameless item (bug)".to_string() } }