import time import sys class BreweryX: def __init__(self): self.debug = 0 # 0 for debug, 1 for no debug self.recipies = { "Beers & Wines": { "Wheatbeer": {"Ingredients": {"Wheat": 3}, "Cauldron": 8, "Distil": 0, "DistilTime": 0, "Age": 2, "Barrel": "Birch"}, "Beer": {"Ingredients": {"Wheat": 6}, "Cauldron": 8, "Distil": 0, "DistilTime": 0, "Age": 3, "Barrel": "Any"}, "Darkbeer": {"Ingredients": {"Wheat": 6}, "Cauldron": 8, "Distil": 0, "DistilTime": 0, "Age": 8, "Barrel": "Dark Oak"}, "Red Wine": {"Ingredients": {"Sweet Berries": 5}, "Cauldron": 5, "Distil": 0, "DistilTime": 0, "Age": 20, "Barrel": "Any"} }, "Meads & Ciders": { "Mead": {"Ingredients": {"Sugar Cane": 6}, "Cauldron": 3, "Distil": 0, "DistilTime": 0, "Age": 4, "Barrel": "Oak"}, "Apple Mead": {"Ingredients": {"Sugar Cane": 6, "Apple": 2}, "Cauldron": 4, "Distil": 0, "DistilTime": 0, "Age": 4, "Barrel": "Oak"}, "Apple Cider": {"Ingredients": {"Apple": 14}, "Cauldron": 7, "Distil": 0, "DistilTime": 0, "Age": 3, "Barrel": "Any"} }, "Whiskies & Rums & Tequila": { "Whiskey": {"Ingredients": {"Wheat": 10}, "Cauldron": 10, "Distil": 2, "DistilTime": 50, "Age": 18, "Barrel": "Spruce"}, "Blazing Whiskey": {"Ingredients": {"Wheat": 10, "Blaze Powder": 2}, "Cauldron": 12, "Distil": 3, "DistilTime": 55, "Age": 18, "Barrel": "Spruce"}, "Rum": {"Ingredients": {"Sugar Cane": 18}, "Cauldron": 6, "Distil": 2, "DistilTime": 30, "Age": 14, "Barrel": "Oak"}, "Tequila": {"Ingredients": {"Cactus": 8}, "Cauldron": 15, "Distil": 2, "DistilTime": 40, "Age": 12, "Barrel": "Birch"} }, "Vodkas & Gin": { "Vodka": {"Ingredients": {"Potato": 10}, "Cauldron": 15, "Distil": 3, "DistilTime": 40, "Age": 0, "Barrel": None}, "Mushroom Vodka": {"Ingredients": {"Potato": 10, "Red Mushroom": 3, "Brown Mushroom": 3}, "Cauldron": 18, "Distil": 5, "DistilTime": 40, "Age": 0, "Barrel": None}, "Golden Vodka": {"Ingredients": {"Potato": 10, "Gold Nugget": 2}, "Cauldron": 18, "Distil": 3, "DistilTime": 40, "Age": 0, "Barrel": None}, "Gin": {"Ingredients": {"Wheat": 9, "Blue Flowers": 6, "Apple": 1}, "Cauldron": 6, "Distil": 2, "DistilTime": 40, "Age": 0, "Barrel": None} }, "Absinthe": { "Absinthe (Grass)": {"Ingredients": {"Grass": 15}, "Cauldron": 3, "Distil": 6, "DistilTime": 80, "Age": 0, "Barrel": None}, "Absinthe (Poisonous Potato)": {"Ingredients": {"Grass": 17, "Poisonous Potato": 2}, "Cauldron": 5, "Distil": 6, "DistilTime": 85, "Age": 0, "Barrel": None} }, "Non-Alcoholic & Mixed": { "Potato Soup": {"Ingredients": {"Potato": 5, "Grass": 3}, "Cauldron": 3, "Distil": 0, "DistilTime": 0, "Age": 0}, "Coffee": {"Ingredients": {"Cocoa Beans": 12, "Milk Bucket": 2}, "Cauldron": 2, "Distil": 0, "DistilTime": 0, "Age": 0}, "Hot Chocolate": {"Ingredients": {"Cookie": 3}, "Cauldron": 2, "Distil": 0, "DistilTime": 0, "Age": 0}, "Iced Coffee": {"Ingredients": {"Cookie": 8, "Snowball": 4, "Milk Bucket": 1}, "Cauldron": 1, "Distil": 0, "DistilTime": 0, "Age": 0} } } while True: print("Choose a category:") pos = 0 for x in self.recipies: pos += 1 print(f" - ({pos}) {x}") print(" - (X) Exit BreweryX") category = input("> ") try: categoryint = int(category) integer = True except: integer = False if integer: if categoryint > len(list(self.recipies)): print("Unknown option, try again.") continue self.category = list(self.recipies)[categoryint-1] print("Selected: " + self.category) self.item_selection() elif category == "X": break else: print("Unknown option, try again.") def item_selection(self): items = self.recipies[self.category] while True: print("Choose an item:") pos = 0 for x in items: pos += 1 print(f" - ({pos}) {x}") print(" - (X) Back") selection = input("> ") try: selectionint = int(selection) integer = True except: integer = False if integer: if selectionint > len(list(items)): print("Unknown option, try again.") continue self.selection = list(items)[selectionint-1] print("Selected: " + self.selection) self.item_execution() elif selection == "X": break else: print("Unknown option, try again.") def item_execution(self): item_data = self.recipies[self.category][self.selection] print(item_data) print("Put the following ingredients in a cauldron:") for x in item_data["Ingredients"]: print(f" - {x} x{item_data['Ingredients'][x]}") input("Press enter for next step...") print(f"Please wait {item_data['Cauldron']} minutes.") self.timer_progress(item_data["Cauldron"]*60) print("\aNow collect it with empty bottles.") if item_data["Distil"] > 0: print("Now place the unfinished drinks in a distilation station.") input("Press enter for next step...") print(f"Please wait {item_data['Distil']*item_data['DistilTime']} seconds.") self.timer_progress(item_data["Distil"]*item_data["DistilTime"]) print("\aNow collect the drinks.") if item_data["Age"] > 0: print(f"Now place the unfinished drinks in a {item_data['Barrel']} barrel.") input("Press enter for next step...") print(f"Please wait {item_data['Age']} minutes.") self.timer_progress(item_data["Age"]*60) print("\aNow collect the drinks.") print("You are done!\n") def timer_progress(self, seconds): if self.debug < 1: return bar_length = 30 for i in range(seconds + 1): progress = i / seconds filled = int(bar_length * progress) bar = "#" * filled + "-" * (bar_length - filled) sys.stdout.write(f"\r[{bar}] {i}/{seconds}s") sys.stdout.flush() time.sleep(1) while True: print("Choose a tool:\n - (1) BreweryX\n - (X) Exit Program") tool = input("> ") if tool == "1": try: bx = BreweryX() except Exception as e: print(f"BreweryX: {e}") elif tool == "X": exit() else: print("Unknown option, try again.")