tiger_lib/imperator/
scopes.rs

1use crate::everything::Everything;
2use crate::item::Item;
3use crate::scopes::Scopes;
4
5pub fn needs_prefix(arg: &str, data: &Everything, scopes: Scopes) -> Option<&'static str> {
6    // TODO: - imperator - add this when Item::Family exists
7    // if scopes == Scopes::Family && data.item_exists(Item::Family, arg) {
8    //     return Some("fam");
9    // }
10    // TODO: - imperator - add this when Item::Character exists
11    // if scopes == Scopes::Character && data.item_exists(Item::Character, arg) {
12    //     return Some("char");
13    // }
14    if scopes == Scopes::Party && data.item_exists(Item::PartyType, arg) {
15        return Some("party");
16    }
17    if scopes == Scopes::Treasure && data.item_exists(Item::Treasure, arg) {
18        return Some("treasure");
19    }
20    if scopes == Scopes::Region && data.item_exists(Item::Region, arg) {
21        return Some("region");
22    }
23    if scopes == Scopes::Area && data.item_exists(Item::Area, arg) {
24        return Some("area");
25    }
26    if scopes == Scopes::Culture && data.item_exists(Item::Culture, arg) {
27        return Some("culture");
28    }
29    if scopes == Scopes::Deity && data.item_exists(Item::Deity, arg) {
30        return Some("deity");
31    }
32    if scopes == Scopes::Country {
33        return Some("c");
34    }
35    if scopes == Scopes::Religion && data.item_exists(Item::Religion, arg) {
36        return Some("religion");
37    }
38    if scopes == Scopes::Flag {
39        return Some("flag");
40    }
41    if scopes == Scopes::Province && data.item_exists(Item::Province, arg) {
42        return Some("p");
43    }
44    None
45}