unid wand names

This commit is contained in:
Llywelwyn 2023-08-13 22:49:23 +01:00
parent 1ec876a10d
commit 3474a782d7
3 changed files with 57 additions and 16 deletions

View file

@ -114,6 +114,7 @@ pub fn spawn_named_item(raws: &RawMaster, ecs: &mut World, key: &str, pos: Spawn
let dm = ecs.fetch::<crate::map::MasterDungeonMap>();
let scroll_names = dm.scroll_map.clone();
let potion_names = dm.potion_map.clone();
let wand_names = dm.wand_map.clone();
let identified_items = dm.identified_items.clone();
std::mem::drop(dm);
let mut eb = ecs.create_entity().marked::<SimpleMarker<SerializeMe>>();
@ -197,6 +198,12 @@ pub fn spawn_named_item(raws: &RawMaster, ecs: &mut World, key: &str, pos: Spawn
plural += "s";
eb = eb.with(ObfuscatedName { name: singular, plural: plural })
}
"wand" => {
let singular = wand_names[&item_template.name.name].clone();
let mut plural = singular.clone();
plural += "s";
eb = eb.with(ObfuscatedName { name: singular, plural: plural })
}
_ => {
let singular = magic_item.naming.clone();
let mut plural = singular.clone();
@ -686,6 +693,19 @@ pub fn get_potion_tags() -> Vec<String> {
return result;
}
pub fn get_wand_tags() -> Vec<String> {
let raws = &super::RAWS.lock().unwrap();
let mut result = Vec::new();
for item in raws.raws.items.iter() {
if let Some(magic) = &item.magic {
if &magic.naming == "wand" {
result.push(item.name.name.clone());
}
}
}
return result;
}
pub fn get_id_from_name(name: String) -> String {
let raws = &super::RAWS.lock().unwrap();
for item in &raws.raws.items {