This commit is contained in:
SpudGunMan
2024-09-21 01:04:59 -07:00
parent 292ad8bb61
commit 95a978495d
+27 -25
View File
@@ -387,21 +387,20 @@ def start_lemonade(nodeID, message, celsius=False):
if "sugar" in last_cmd:
# Read the number of sugar bags to purchase
newsugar = -1
if "g" not in message.lower():
try:
newsugar = int(message)
if (newsugar > 0):
cost = round(newsugar * sugar.cost, 2)
if (cost > inventory.cash):
return "You do not have enough cash."
inventory.sugar += (newsugar * sugar.count)
inventory.cash -= cost
msg = " Purchased " + str(newsugar) + " bag(s) of 🍚 for " + locale.currency(cost, grouping=True)
msg += ". " + str(inventory.sugar) + f"🥤🍚 in inventory."
else:
msg = "No additional 🍚 was purchased"
except Exception as e:
return "⛔️invalid input, enter the number of 🍚 bags to purchase"
try:
newsugar = int(message)
if (newsugar > 0):
cost = round(newsugar * sugar.cost, 2)
if (cost > inventory.cash):
return "You do not have enough cash."
inventory.sugar += (newsugar * sugar.count)
inventory.cash -= cost
msg = " Purchased " + str(newsugar) + " bag(s) of 🍚 for " + locale.currency(cost, grouping=True)
msg += ". " + str(inventory.sugar) + f"🥤🍚 in inventory."
else:
msg = "No additional 🍚 was purchased"
except Exception as e:
return "⛔️invalid input, enter the number of 🍚 bags to purchase"
msg += f"\nPrice to Sell? Cost of goods is {locale.currency(unit, grouping=True)} \
@@ -412,13 +411,21 @@ def start_lemonade(nodeID, message, celsius=False):
for i in range(len(lemonadeTracker)):
if lemonadeTracker[i]['nodeID'] == nodeID:
lemonadeTracker[i]['cmd'] = "price"
if "g" in message.lower():
lemonadeTracker[i]['cmd'] = "cups"
msg += f"\n#of🥤 to buy? Have {inventory.cups} Cost {locale.currency(cups.cost, grouping=True)} a 📦 of {str(cups.count)}"
saveValues()
return msg
if "price" in last_cmd:
# set the last command to sales in the inventory db
for i in range(len(lemonadeTracker)):
if lemonadeTracker[i]['nodeID'] == nodeID:
lemonadeTracker[i]['cmd'] = "sales"
if "g" in message.lower():
lemonadeTracker[i]['cmd'] = "cups"
msg = f"\n#of🥤 to buy? Have {inventory.cups} Cost {locale.currency(cups.cost, grouping=True)} a 📦 of {str(cups.count)}"
return msg
else:
last_cmd = "sales"
# Read the actual price
price = 0.00
while (price <= 0.00):
@@ -433,13 +440,8 @@ def start_lemonade(nodeID, message, celsius=False):
# this isnt sent to the user, not needed
#msg = " Setting the price at " + locale.currency(price, grouping=True)
# set the last command to sales in the inventory db
for i in range(len(lemonadeTracker)):
if lemonadeTracker[i]['nodeID'] == nodeID:
lemonadeTracker[i]['cmd'] = "sales"
saveValues()
last_cmd = "sales"
if "sales" in last_cmd:
# Calculate the weekly sales based on price and lowest inventory level
@@ -559,7 +561,7 @@ def start_lemonade(nodeID, message, celsius=False):
weeks.current = weeks.current + 1
msg += f"\nPlay another week🥤? 'end' to end game"
msg += f"Play another week🥤? 'end' to end game"
saveValues()
return msg