initiative_core/world/place/building/business/
mod.rs

1mod inn;
2mod theater;
3
4use super::BuildingType;
5use crate::world::place::{PlaceData, PlaceType};
6use crate::world::Demographics;
7use initiative_macros::WordList;
8use rand::prelude::*;
9use serde::{Deserialize, Serialize};
10
11#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, WordList)]
12#[serde(into = "&'static str", try_from = "&str")]
13pub enum BusinessType {
14    #[term = "business"]
15    #[alias = "shop"]
16    #[alias = "store"]
17    Any,
18
19    Arena,
20    Armorer,
21    Bakery,
22    Bank,
23    #[alias = "nightclub"]
24    #[alias = "pub"]
25    Bar,
26    Bathhouse,
27    #[alias = "smithy"]
28    Blacksmith,
29    Brewery,
30    #[alias = "gambling-hall"]
31    Casino,
32    Club,
33    Distillery,
34    FightingPit,
35    FoodCounter,
36    Forge,
37    FurnitureShop,
38    Furrier,
39    GeneralStore,
40    GuildHall,
41    ImportsShop,
42    #[alias = "caravansary"]
43    #[alias = "hotel"]
44    #[alias = "lodge"]
45    #[alias = "tavern"]
46    Inn,
47    Jeweller,
48    Lumberyard,
49    MagicShop,
50    Mill,
51    PetStore,
52    Restaurant,
53    SpecialtyShop,
54    SpiritsShop,
55    Stable,
56    TextilesShop,
57    Theater,
58    TradingPost,
59    Vault,
60    Wainwright,
61    Warehouse,
62    Weaponsmith,
63    Woodshop,
64}
65
66impl BusinessType {
67    pub const fn get_emoji(&self) -> Option<&'static str> {
68        match self {
69            Self::Arena => Some("🏛"),
70            Self::Armorer => Some("🛡"),
71            Self::Bakery => Some("🍞"),
72            Self::Bank | Self::Vault => Some("🏦"),
73            Self::Bar => Some("🍻"),
74            Self::Bathhouse => Some("🛁"),
75            Self::Blacksmith | Self::Weaponsmith => Some("🗡"),
76            Self::Brewery => Some("🍻"),
77            Self::Casino => Some("🃏"),
78            Self::Club => Some(""),
79            Self::Distillery => Some("🥃"),
80            Self::FightingPit => Some("⚔"),
81            Self::FoodCounter => Some("🍲"),
82            Self::Forge => Some("🔥"),
83            Self::FurnitureShop => Some("🪑"),
84            Self::Furrier => Some("🦊"),
85            Self::Inn => Some("🏨"),
86            Self::Jeweller => Some("💍"),
87            Self::Lumberyard => Some("🪵"),
88            Self::MagicShop => Some("🪄"),
89            Self::Mill => Some("🌾"),
90            Self::PetStore => Some("🐶"),
91            Self::Restaurant => Some("🍽"),
92            Self::SpiritsShop => Some("🥃"),
93            Self::Stable => Some("🐎"),
94            Self::Theater => Some("🎭"),
95            Self::Warehouse => Some("📦"),
96            Self::Woodshop => Some("🪚"),
97
98            Self::Any
99            | Self::GeneralStore
100            | Self::GuildHall
101            | Self::ImportsShop
102            | Self::SpecialtyShop
103            | Self::TextilesShop
104            | Self::TradingPost
105            | Self::Wainwright => Some("🪙"),
106        }
107    }
108}
109
110pub fn generate(place: &mut PlaceData, rng: &mut impl Rng, demographics: &Demographics) {
111    if let Some(PlaceType::Building(BuildingType::Business(subtype))) = place.subtype.value() {
112        match subtype {
113            BusinessType::Inn => inn::generate(place, rng, demographics),
114            BusinessType::Theater => theater::generate(place, rng, demographics),
115            _ => {}
116        }
117    }
118}