id bugfixes
This commit is contained in:
parent
b8d7194f28
commit
1ec876a10d
7 changed files with 122 additions and 45 deletions
|
|
@ -113,6 +113,7 @@ pub fn spawn_named_item(raws: &RawMaster, ecs: &mut World, key: &str, pos: Spawn
|
|||
let item_template = &raws.raws.items[raws.item_index[key]];
|
||||
let dm = ecs.fetch::<crate::map::MasterDungeonMap>();
|
||||
let scroll_names = dm.scroll_map.clone();
|
||||
let potion_names = dm.potion_map.clone();
|
||||
let identified_items = dm.identified_items.clone();
|
||||
std::mem::drop(dm);
|
||||
let mut eb = ecs.create_entity().marked::<SimpleMarker<SerializeMe>>();
|
||||
|
|
@ -190,7 +191,18 @@ pub fn spawn_named_item(raws: &RawMaster, ecs: &mut World, key: &str, pos: Spawn
|
|||
plural: scroll_names[&item_template.name.name].1.clone(),
|
||||
})
|
||||
}
|
||||
_ => {}
|
||||
"potion" => {
|
||||
let singular = potion_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();
|
||||
plural += "s";
|
||||
eb = eb.with(ObfuscatedName { name: singular, plural: plural })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -661,6 +673,19 @@ pub fn get_scroll_tags() -> Vec<String> {
|
|||
return result;
|
||||
}
|
||||
|
||||
pub fn get_potion_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 == "potion" {
|
||||
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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue