lego-game/game.py

986 lines
42 KiB
Python
Raw Normal View History

from firepup650 import clear, randint, sql, e, menu, gp, gh, cur, flushPrint, randint
2024-06-02 03:08:26 +00:00
import random as r
from fkeycapture import get, getnum, getchars
import os, time, sys, re
from time import sleep
db = sql("dev-database.db")
alphanum = list("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
2024-06-02 03:08:26 +00:00
2024-06-02 03:08:26 +00:00
def multipleOf(num: int, mult: int = 5) -> bool:
return num % mult == 0
2024-06-02 03:08:26 +00:00
2024-06-23 17:22:33 +00:00
# Function from https://stackoverflow.com/a/2556252, merged with https://stackoverflow.com/a/59082116
def rreplace(s: str, old: str, new: str, occurrence: int) -> str:
2024-06-24 22:54:53 +00:00
return new.join(s.rsplit(old, occurrence))
2024-06-23 17:22:33 +00:00
2024-06-03 19:42:31 +00:00
cur.hide()
clear()
print(
"Loading Loge City v 0.0.16..."
) # Finally remebered to bump this... I think v16 is right?
sleep(1)
2024-06-03 19:42:31 +00:00
flushPrint("Checking system compatibility...")
sleep(1)
2024-06-03 19:42:31 +00:00
print(" \aOK.")
sleep(1)
2024-06-03 19:42:31 +00:00
flushPrint("Checking data...")
sleep(1)
2024-06-03 19:42:31 +00:00
print(" \aOK.")
sleep(1)
2024-06-02 03:08:26 +00:00
print("Loaded successfully")
print("Starting...")
sleep(2)
2024-06-03 19:42:31 +00:00
cur.show()
log = menu(
{"Yes": 1, "No": 0, "Exit": "E"},
"Welcome to the city!\nDo you have an existing account?",
)
2024-06-03 19:42:31 +00:00
clear()
2024-06-02 03:08:26 +00:00
un = ""
2024-06-24 22:54:53 +00:00
uData = None
if log == "E":
exit(0)
2024-06-02 20:22:42 +00:00
if log:
2024-06-03 19:42:31 +00:00
print("Login")
print("Username: ", end="")
un = gp(5, alphanum, allowDelete=True)
print("Password: ", end="")
pw = gh(5, alphanum, allowDelete=True)
2024-06-02 03:08:26 +00:00
uData = db.get(un)
if not uData:
print("Sorry, that username is not recognized.")
e(3)
elif pw != uData["password"]:
print("Incorrect password")
e(2)
else:
print("Logged in.")
else:
2024-06-03 19:42:31 +00:00
print("Signup")
print("Username (alphanumeric): ", end="")
un = gp(5, alphanum, allowDelete=True)
print("Password (alphanumeric):", end="")
pw = gh(5, alphanum, allowDelete=True)
2024-06-02 03:08:26 +00:00
uData = db.get(un)
if uData:
print("Sorry, that username is already registered, please log in instead.")
e(4)
else:
db.set(
un,
{
"password": pw,
"permissionLevel": 10,
"logins": 0,
"vehicles": [],
"houseLevel": 0,
"energyTanks": 0,
"studsGained": 0,
"studsLost": 0,
"highestStuds": 20,
"studs": 20,
"debug": False,
"o": 0, # I have no clue what this is supposed to be, doesn't seem to be used in the original doc?
"racScore": 0,
"richScore": 0,
2024-06-23 18:31:57 +00:00
"rare": {},
"upgrades": {},
2024-06-02 03:08:26 +00:00
},
)
2024-06-24 22:54:53 +00:00
uData = db.get(un)
2024-06-02 03:08:26 +00:00
print("Account created successfully!")
sleep(1)
clear()
uData["logins"] += 1
if uData["logins"] == 1:
print(f"Welcome {un}, to Loge City!")
else:
2024-06-24 22:54:53 +00:00
print(f"Welcome back to Loge City {un}, we hope you are enjoying your stay.")
2024-06-02 20:22:42 +00:00
sleep(2)
# LTOP - jump point for me
2024-06-02 03:08:26 +00:00
while 1:
studsAtTop = uData["studs"]
go = menu(
{
"Stats": 1,
"Gamble": 2,
"Upgrades": 3,
"Vehicle Shop": 4,
"Rare Parts Shop": 5,
"Energy Tank Shop": 6,
"Resturant": 7,
"Fix my save data": 8,
"[DEBUG]": "D",
"Exit": "E",
},
"What would you like to do?",
)
2024-06-02 20:22:42 +00:00
clear()
2024-06-02 03:08:26 +00:00
match go:
2024-06-02 20:22:42 +00:00
case 1:
2024-06-23 18:31:57 +00:00
rares = ""
2024-06-24 22:54:53 +00:00
rOrder = [
"gold bar",
"golden cup",
"golden plate",
"golden table",
"crystal",
"crystal cup",
"crystal plate",
"crystal table",
"double studded 1x1 plate",
"double studded 2x2 plate",
"hinge joint",
"vault door",
]
rCopy = list(uData["rare"].keys())
rCopy.sort(key=lambda x: rOrder.index(x))
for item in rCopy:
2024-06-23 18:31:57 +00:00
if rares:
rares = f"{rares}, {uData['rare'][item]} {item}{'s' if uData['rare'][item] > 1 else ''}"
else:
rares = f"{uData['rare'][item]} {item}{'s' if uData['rare'][item] > 1 else ''}"
2024-06-24 22:54:53 +00:00
rares = rreplace(rares, ", ", ", and ", 1)
vOrder = [
"bike",
"4-wheeler",
"old rusty car",
"car",
"minivan",
"van",
"truck",
"food truck",
"semi-truck",
"hover bike",
"hover car",
"hover semi-tuck",
"pod racer",
"rocketship",
"spaceship",
"spaceship with a hyperdrive",
"yacht",
"space yacht",
"teleporter",
]
uData["vehicles"].sort(key=lambda x: vOrder.index(x))
print(
f"""Stats:
2024-06-02 03:08:26 +00:00
Studs:
Current: {uData["studs"]}
All-time Highest: {uData["highestStuds"]}
All-time Losses: {uData["studsLost"]}
All-time Gains: {uData["studsGained"]}
2024-06-24 22:54:53 +00:00
Vehicles: {rreplace(", ".join(uData["vehicles"]), ", ", ", and ", 1) if uData["vehicles"] else "None"}
2024-06-23 18:31:57 +00:00
Rare Items: {rares if rares else "None"}
2024-06-02 03:08:26 +00:00
House Level: {uData["houseLevel"]}
Energy Tanks: {uData["energyTanks"]}
2024-06-24 22:54:53 +00:00
Misc Scores:
Raccoon: {uData["racScore"]}
Rich: {uData["richScore"]}
Upgrades:
Luck: {uData["upgrades"].get("luck", 0)}%
Stud Multipiler: {uData["upgrades"].get("studX", 1)}x"""
)
if uData["debug"] or uData["permissionLevel"] >= 50:
print(
f"""Debug Stats:
2024-06-02 03:08:26 +00:00
Bebug bit: {uData["debug"]}
Permission Level: {uData["permissionLevel"]}
Idk what o is: {uData["o"]}"""
)
2024-06-02 03:08:26 +00:00
print("Press any key to exit")
get()
2024-06-02 20:22:42 +00:00
case 2:
print("Calculating avaliable bets, this shouldn't take long...")
bets = {str(i): i for i in range(5, min(uData["studs"], 50000000), 5)}
bets["Exit"] = "E"
2024-06-23 17:22:33 +00:00
bets["5"] = 5 # Bugfix: menu crashes if you have 0 studs
bet = menu(bets, "How many studs would you like to bet?")
betHigh = 0 if type(bet) != int else bet
2024-06-02 03:08:26 +00:00
winnings = 0
betLow = -2 * bet if betHigh else 0
if betLow:
betLow = min(betLow + (uData["upgrades"].get("luck") * 5), 0)
2024-06-02 20:22:42 +00:00
while betHigh:
winnings = randint(betLow, betHigh)
2024-06-02 03:08:26 +00:00
if multipleOf(winnings):
break
2024-06-02 20:22:42 +00:00
if betHigh:
if uData["studs"] >= abs(betLow):
2024-06-02 03:08:26 +00:00
uData["studs"] += winnings
# And this is the end of the old code docs... (basically, this part is modified however)
if winnings == 0:
print("You won nothing. (You kept your bet though)")
2024-06-02 20:22:42 +00:00
elif winnings == betLow:
2024-06-02 03:08:26 +00:00
print("You lost your bet!")
2024-06-02 03:25:06 +00:00
elif winnings >= 0:
print(f"You won {winnings} studs!")
elif winnings <= 0:
2024-06-02 20:22:42 +00:00
print(f"You lost {abs(winnings)} studs!")
2024-06-02 03:25:06 +00:00
else:
2024-06-02 20:22:42 +00:00
print("This should be impossible. Cue the panic attacks.")
2024-06-02 03:25:06 +00:00
else:
print("You don't have enough studs to bet that much.")
2024-06-02 20:22:42 +00:00
sleep(5)
case 3:
prices = {
"studX": 2000000
* pow(10, (uData["upgrades"].get("studX", 1) * 10) - 10),
"houseL": 199 + pow(53 * uData["houseLevel"], uData["houseLevel"]),
"luck": 500 * pow(10, uData["upgrades"].get("luck", 0) * 2),
}
sel = menu(
{
f"Stud multiplier {uData['upgrades'].get('studX', 1)}x -> {uData['upgrades'].get('studX', 1) + 0.1}x ({prices['studX']} studs)": "studX",
f"House level {uData['houseLevel']} -> {uData['houseLevel'] + 1} ({prices['houseL']} studs)": "houseL",
f"Luck (Affects betting) {uData['upgrades'].get('luck', 0)}% -> {uData['upgrades'].get('luck', 0) + 1}% ({prices['luck']} studs)": "luck",
"Exit": "E",
},
"What do you want to upgrade?",
)
match sel:
case "studX":
if uData["studs"] >= prices[sel]:
uData["studs"] -= prices[sel]
uData["upgrades"][sel] = uData["upgrades"].get(sel, 1) + 0.1
print(
f"You've upgraded your stud multipler to {uData['upgrades'][sel]}x!"
)
case "houseL":
if uData["studs"] >= prices[sel]:
uData["studs"] -= prices[sel]
uData["houseLevel"] += 1
print(
f"You've upgraded your house to level {uData['houseLevel']}!"
)
case "luck":
if uData["studs"] >= prices[sel]:
uData["studs"] -= prices[sel]
uData["upgrades"][sel] = uData["upgrades"].get(sel, 0) + 1
print(
f"You've upgraded your luck to {uData['upgrades'][sel]}%!"
)
case "E":
pass
case _:
print("Firepup forgot to add a menu option, smh")
sleep(2)
sleep(2)
2024-06-02 20:22:42 +00:00
case 4:
sel = menu(
{
"A bike (20 studs)": 20,
"A 4-wheeler (50 studs)": 50,
"An old rusty little car (100 studs)": 100,
"A car (200 studs)": 200,
"A minivan (500 studs)": 500,
"A van (750 studs)": 750,
"A truck (1k studs)": 1000,
"A food truck (2k studs)": 2000,
"A semi-truck (5k studs)": 5000,
"A hover bike (10k studs)": 10000,
"A hover car (20k studs)": 20000,
"A hover truck (50k studs)": 50000,
"A hover semi-truck (100k studs)": 100000,
"A pod racer (500k studs)": 500000,
"A rocketship (1m studs)": 1000000,
"A spaceship (5m studs)": 5000000,
2024-06-23 00:26:38 +00:00
"A spaceship with a hyperdrive (10m studs)": 10000000,
"A yacht (50m studs)": 50000000,
"A space yacht (100m studs)": 100000000,
"A teleporter (1b studs)": 1000000000,
"Exit": "E",
},
"Welcome to the Vehicle Shop, please make a selection",
)
2024-06-23 17:22:33 +00:00
match sel: # Bugfix: Accidentally inverted the check for owning a vehicle
case 20:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"] and "bike" not in uData["vehicles"]:
uData["vehicles"].append("bike")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
print("You purchased a bike!")
2024-06-23 17:22:33 +00:00
elif "bike" in uData["vehicles"]:
print("Sorry, you already have a bike!")
else:
print("You're too poor to buy a bike.")
2024-06-23 17:22:33 +00:00
case 50:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"] and "4-wheeler" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("4-wheeler")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a 4-wheeler!")
2024-06-23 17:22:33 +00:00
elif "4-wheeler" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a 4-wheeler!")
else:
2024-06-23 00:26:38 +00:00
print("You're too poor to buy a 4-wheeler.")
2024-06-23 17:22:33 +00:00
case 100:
if (
2024-06-23 18:31:57 +00:00
sel <= uData["studs"]
2024-06-23 17:22:33 +00:00
and "old rusty car" not in uData["vehicles"]
):
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("old rusty car")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased an old rusty car!")
2024-06-23 17:22:33 +00:00
elif "old rusty car" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have an old rusty car!")
else:
2024-06-23 00:26:38 +00:00
print("You're too poor to buy an old rusty car.")
2024-06-23 17:22:33 +00:00
case 200:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"] and "car" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("car")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a car!")
2024-06-23 17:22:33 +00:00
elif "car" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a car!")
else:
2024-06-23 00:26:38 +00:00
print("You're too poor to buy a car.")
2024-06-23 17:22:33 +00:00
case 500:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"] and "minivan" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("minivan")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a minivan!")
2024-06-23 17:22:33 +00:00
elif "minivan" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a minivan!")
else:
2024-06-23 00:26:38 +00:00
print("You're too poor to buy a minivan.")
2024-06-23 17:22:33 +00:00
case 750:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"] and "van" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("van")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a van!")
2024-06-23 17:22:33 +00:00
elif "van" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a van!")
else:
2024-06-23 00:26:38 +00:00
print("You're too poor to buy a van.")
2024-06-23 17:22:33 +00:00
case 1000:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"] and "truck" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("truck")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a truck!")
2024-06-23 17:22:33 +00:00
elif "truck" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a truck!")
else:
2024-06-23 00:26:38 +00:00
print("You're too poor to buy a truck.")
2024-06-23 17:22:33 +00:00
case 2000:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"] and "food truck" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("food truck")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a food truck!")
2024-06-23 17:22:33 +00:00
elif "food truck" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a food truck!")
else:
2024-06-23 00:26:38 +00:00
print("You're too poor to buy a food truck.")
2024-06-23 17:22:33 +00:00
case 5000:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"] and "semi-truck" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("semi-truck")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a semi-truck!")
2024-06-23 17:22:33 +00:00
elif "semi-truck" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a semi-truck!")
else:
2024-06-23 00:26:38 +00:00
print("You're too poor to buy a semi-truck.")
2024-06-23 17:22:33 +00:00
case 10000:
2024-06-24 22:54:53 +00:00
if sel <= uData["studs"] and "hover bike" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("hover bike")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a hover bike!")
2024-06-23 17:22:33 +00:00
elif "hover bike" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a hover bike!")
else:
2024-06-23 00:26:38 +00:00
print("You're too poor to buy a hover bike.")
2024-06-23 17:22:33 +00:00
case 20000:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"] and "hover car" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("hover car")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a hover car!")
2024-06-23 17:22:33 +00:00
elif "hover car" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a hover car!")
else:
print("You're too poor to buy a hover car.")
2024-06-23 17:22:33 +00:00
case 50000:
2024-06-24 22:54:53 +00:00
if sel <= uData["studs"] and "hover truck" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("hover truck")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a hover truck!")
2024-06-23 17:22:33 +00:00
elif "hover truck" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a hover truck!")
else:
print("You're too poor to buy a hover truck.")
2024-06-23 17:22:33 +00:00
case 100000:
if (
2024-06-23 18:31:57 +00:00
sel <= uData["studs"]
2024-06-23 17:22:33 +00:00
and "hover semi-truck" not in uData["vehicles"]
):
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("hover semi-truck")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a hover semi-truck!")
2024-06-23 17:22:33 +00:00
elif "hover semi-truck" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a hover semi-truck!")
else:
print("You're too poor to buy a hover semi-truck.")
2024-06-23 17:22:33 +00:00
case 500000:
2024-06-24 22:54:53 +00:00
if sel <= uData["studs"] and "pod racer" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("pod racer")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a pod racer!")
2024-06-23 17:22:33 +00:00
elif "pod racer" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a pod racer!")
else:
print("You're too poor to buy a pod racer.")
2024-06-23 17:22:33 +00:00
case 1000000:
2024-06-24 22:54:53 +00:00
if sel <= uData["studs"] and "rocketship" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("rocketship")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a rocketship!")
2024-06-23 17:22:33 +00:00
elif "rocketship" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a rocketship!")
else:
print("You're too poor to buy a rocketship.")
2024-06-23 17:22:33 +00:00
case 5000000:
2024-06-24 22:54:53 +00:00
if sel <= uData["studs"] and "spaceship" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("spaceship")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a spaceship!")
2024-06-23 17:22:33 +00:00
elif "spaceship" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a spaceship!")
else:
print("You're too poor to buy a spaceship.")
2024-06-23 17:22:33 +00:00
case 10000000:
if (
2024-06-23 18:31:57 +00:00
sel <= uData["studs"]
2024-06-23 17:22:33 +00:00
and "spaceship with a hyperdrive" not in uData["vehicles"]
):
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("spaceship with a hyperdrive")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a spaceship with a hyperdrive!")
2024-06-23 17:22:33 +00:00
elif "spaceship with a hyperdrive" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a spaceship with a hyperdrive!")
else:
print("You're too poor to buy a spaceship with a hyperdrive.")
2024-06-23 17:22:33 +00:00
case 50000000:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"] and "yacht" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("yacht")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a yacht!")
2024-06-23 17:22:33 +00:00
elif "yacht" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a yacht!")
else:
print("You're too poor to buy a yacht.")
2024-06-23 17:22:33 +00:00
case 100000000:
2024-06-24 22:54:53 +00:00
if sel <= uData["studs"] and "space yacht" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("space yacht")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a space yacht!")
2024-06-23 17:22:33 +00:00
elif "space yacht" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a space yacht!")
else:
print("You're too poor to buy a space yacht.")
2024-06-23 17:22:33 +00:00
case 1000000000:
2024-06-24 22:54:53 +00:00
if sel <= uData["studs"] and "teleporter" not in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
uData["vehicles"].append("teleporter")
2024-06-23 18:31:57 +00:00
uData["studs"] -= sel
2024-06-23 00:26:38 +00:00
print("You purchased a teleporter!")
2024-06-23 17:22:33 +00:00
elif "teleporter" in uData["vehicles"]:
2024-06-23 00:26:38 +00:00
print("Sorry, you already have a teleporter!")
else:
print("You're too poor to buy a teleporter.")
case "E":
pass
case _:
print("Firepup forgot to add a menu option, smh")
sleep(2)
sleep(2)
2024-06-02 20:22:42 +00:00
case 5:
2024-06-23 17:22:33 +00:00
sel = menu(
{
"Gold bar (250 studs)": 250,
"Golden cup (500 studs)": 500,
"Golden plate (1k studs)": 1000,
"Golden table (5k studs)": 5000,
"Crystal (250k studs)": 250000,
"Crystal cup (500k studs)": 500000,
"Crystal plate (1m studs)": 1000000,
"Crystal table (5m studs)": 5000000,
"Double studded 1x1 plate (10m studs)": 10000000,
"Double studded 2x2 plate (50m studs)": 50000000,
"Hinge joint (100m studs)": 100000000,
2024-06-23 18:31:57 +00:00
"Vault door (500m studs)": 500000000,
"Exit": "E",
2024-06-23 17:22:33 +00:00
},
"What rare items do you want to buy today?",
)
match sel:
case 250:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"]:
uData["studs"] -= sel
2024-06-24 22:54:53 +00:00
uData["richScore"] += 1
2024-06-23 18:31:57 +00:00
if "gold bar" in uData["rare"]:
uData["rare"]["gold bar"] += 1
else:
uData["rare"]["gold bar"] = 1
2024-06-24 22:54:53 +00:00
print("You bought a gold bar! (+1 rich)")
2024-06-23 18:31:57 +00:00
else:
print("You're too poor to buy a gold bar.")
2024-06-23 17:22:33 +00:00
case 500:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"]:
uData["studs"] -= sel
2024-06-24 22:54:53 +00:00
uData["richScore"] += 2
2024-06-23 18:31:57 +00:00
if "golden cup" in uData["rare"]:
uData["rare"]["golden cup"] += 1
else:
uData["rare"]["golden cup"] = 1
2024-06-24 22:54:53 +00:00
print("You bought a golden cup! (+2 rich)")
2024-06-23 18:31:57 +00:00
else:
print("You're too poor to buy a golden cup.")
2024-06-23 17:22:33 +00:00
case 1000:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"]:
uData["studs"] -= sel
2024-06-24 22:54:53 +00:00
uData["richScore"] += 5
2024-06-23 18:31:57 +00:00
if "golden plate" in uData["rare"]:
uData["rare"]["golden plate"] += 1
else:
uData["rare"]["golden plate"] = 1
2024-06-24 22:54:53 +00:00
print("You bought a golden plate! (+5 rich)")
2024-06-23 18:31:57 +00:00
else:
print("You're too poor to buy a golden plate.")
2024-06-23 17:22:33 +00:00
case 5000:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"]:
uData["studs"] -= sel
2024-06-24 22:54:53 +00:00
uData["richScore"] += 10
2024-06-23 18:31:57 +00:00
if "golden table" in uData["rare"]:
uData["rare"]["golden table"] += 1
else:
uData["rare"]["golden table"] = 1
2024-06-24 22:54:53 +00:00
print("You bought a golden table! (+10 rich)")
2024-06-23 18:31:57 +00:00
else:
print("You're too poor to buy a golden table.")
2024-06-23 17:22:33 +00:00
case 250000:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"]:
uData["studs"] -= sel
2024-06-24 22:54:53 +00:00
uData["richScore"] += 20
2024-06-23 18:31:57 +00:00
if "crystal" in uData["rare"]:
uData["rare"]["crystal"] += 1
else:
uData["rare"]["crystal"] = 1
2024-06-24 22:54:53 +00:00
print("You bought a crystal! (+20 rich)")
2024-06-23 18:31:57 +00:00
else:
print("You're too poor to buy a crystal.")
2024-06-23 17:22:33 +00:00
case 500000:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"]:
uData["studs"] -= sel
2024-06-24 22:54:53 +00:00
uData["richScore"] += 25
2024-06-23 18:31:57 +00:00
if "crystal cup" in uData["rare"]:
uData["rare"]["crystal cup"] += 1
else:
uData["rare"]["crystal cup"] = 1
2024-06-24 22:54:53 +00:00
print("You bought a crystal cup! (+25 rich)")
2024-06-23 18:31:57 +00:00
else:
print("You're too poor to buy a crystal cup.")
2024-06-23 17:22:33 +00:00
case 1000000:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"]:
uData["studs"] -= sel
2024-06-24 22:54:53 +00:00
uData["richScore"] += 50
2024-06-23 18:31:57 +00:00
if "crystal plate" in uData["rare"]:
uData["rare"]["crystal plate"] += 1
else:
uData["rare"]["crystal plate"] = 1
2024-06-24 22:54:53 +00:00
print("You bought a crystal plate! (+50 rich)")
2024-06-23 18:31:57 +00:00
else:
print("You're too poor to buy a crystal plate.")
2024-06-23 17:22:33 +00:00
case 5000000:
2024-06-23 18:31:57 +00:00
if sel <= uData["studs"]:
uData["studs"] -= sel
2024-06-24 22:54:53 +00:00
uData["richScore"] += 75
2024-06-23 18:31:57 +00:00
if "crystal table" in uData["rare"]:
uData["rare"]["crystal table"] += 1
else:
uData["rare"]["crystal table"] = 1
2024-06-24 22:54:53 +00:00
print("You bought a crystal table! (+75 rich)")
2024-06-23 18:31:57 +00:00
else:
print("You're too poor to buy a crystal table.")
case 10000000:
if sel <= uData["studs"]:
uData["studs"] -= sel
2024-06-24 22:54:53 +00:00
uData["richScore"] += 100
2024-06-23 18:31:57 +00:00
if "double studded 1x1 plate" in uData["rare"]:
uData["rare"]["double studded 1x1 plate"] += 1
else:
uData["rare"]["double studded 1x1 plate"] = 1
2024-06-24 22:54:53 +00:00
print("You bought a double studded 1x1 plate! (+100 rich)")
2024-06-23 18:31:57 +00:00
else:
print("You're too poor to buy a double studded 1x1 plate.")
case 50000000:
if sel <= uData["studs"]:
uData["studs"] -= sel
2024-06-24 22:54:53 +00:00
uData["richScore"] += 125
2024-06-23 18:31:57 +00:00
if "double studded 2x2 plate" in uData["rare"]:
uData["rare"]["double studded 2x2 plate"] += 1
else:
uData["rare"]["double studded 2x2 plate"] = 1
2024-06-24 22:54:53 +00:00
print("You bought a double studded 2x2 plate! (+125 rich)")
2024-06-23 18:31:57 +00:00
else:
print("You're too poor to buy a double studded 2x2 plate.")
case 100000000:
if sel <= uData["studs"]:
uData["studs"] -= sel
2024-06-24 22:54:53 +00:00
uData["richScore"] += 150
2024-06-23 18:31:57 +00:00
if "hinge joint" in uData["rare"]:
uData["rare"]["hinge joint"] += 1
else:
uData["rare"]["hinge joint"] = 1
2024-06-24 22:54:53 +00:00
print("You bought a hinge joint! (+150 rich)")
2024-06-23 18:31:57 +00:00
else:
print("You're too poor to buy a hinge joint.")
case 500000000:
if sel <= uData["studs"]:
uData["studs"] -= sel
2024-06-24 22:54:53 +00:00
uData["richScore"] += 200
2024-06-23 18:31:57 +00:00
if "vault door" in uData["rare"]:
uData["rare"]["vault door"] += 1
else:
uData["rare"]["vault door"] = 1
2024-06-24 22:54:53 +00:00
print("You bought a vault door! (+200 rich)")
2024-06-23 18:31:57 +00:00
else:
print("You're too poor to buy a vault door.")
case "E":
pass
case _:
print("Firepup forgot to add a menu option, smh")
sleep(2)
2024-06-23 17:22:33 +00:00
sleep(2)
2024-06-02 20:22:42 +00:00
case 6:
price1 = 10 + (5 * uData["energyTanks"])
price5 = 0
for i in range(5):
price5 += 10 + (5 * (uData["energyTanks"] + i))
print(price5)
price10 = 0
for i in range(10):
price10 += 10 + (5 * (uData["energyTanks"] + i))
count = menu(
{
f"1 ({price1} studs)": 1,
f"5 ({price5} studs)": 5,
f"10 ({price10} studs)": 10,
"Exit": "E",
},
"How many energy tanks do you want?",
)
match count:
case 1:
if price1 <= uData["studs"]:
uData["studs"] -= price1
uData["energyTanks"] += 1
print("You bought a single energy tank!")
else:
print("You're too poor to buy a single energy tank.")
sleep(2)
case 5:
if price5 <= uData["studs"]:
uData["studs"] -= price5
uData["energyTanks"] += 5
print("You bought 5 energy tanks!")
else:
print("You're too poor to buy 5 energy tanks.")
sleep(2)
case 10:
if price10 <= uData["studs"]:
uData["studs"] -= price10
uData["energyTanks"] += 10
print("You bought 10 energy tanks!")
else:
print("You're too poor to buy 10 energy tanks.")
sleep(2)
case "E":
pass
case _:
print("Firepup forgot to add a menu option, smh.")
sleep(2)
2024-06-02 20:22:42 +00:00
case 7:
sel = menu(
{
"Pizza (5 studs)": 1,
"Drink (10 studs)": 2,
"Box of Tacos (20 studs)": 3,
"Box of doughnuts (50 studs)": 4,
"Trash (What are you, a raccoon? We're not even supposed to sell this...) (200 studs)": 5,
"Money (Excuse me?) (500 studs)": 6,
"Oh actually I don't want to eat anything I just want to waste money (1000 studs)": 7,
"Pure gold pizza (5000 studs)": 8,
"Liquid Gold (10000 studs)": 9,
"Box of golden tacos (20000 studs)": 10,
"Box of golden doughnuts (50000 studs)": 11,
"Golden trash (I... why do we even sell this.) (200000 studs)": 12,
"5 cubic meters of gold (...You know there's better uses of your money right?) (500000 studs)": 13,
"I REALLY want to waste money (1 million studs)": 14,
"Exit": 0,
},
"What would you like to order?",
)
# Bugfix: rich and raccoon would always go up even if you failed to buy the item
thing, price, message, weird, rich, rac = (
"Nothing",
0,
"You bought nothing",
True,
0,
0,
)
match sel:
case 1:
thing, price, message, weird = ("a pizza", 5, "delicious!", False)
case 2:
match randint(0, 9):
case 0:
thing = "a can of strawberry fanta"
case 1:
thing = "a can of liquid death"
case 2:
thing = "a can of water"
case 3:
thing = "a can of generic soda"
case 4:
thing = 'a can of "fresh spring" water'
case 5:
thing = "a paper cup of tap water"
case 6:
thing = "a can of motor oil"
case 7:
thing = "a can of rehyderated water"
case 8:
thing = "a can of blueberry"
case 9:
thing = "a can of rain water"
price, message, Weird = (
10,
"tastes just like you remember it!",
False,
)
case 3:
thing, price, message, weird = (
"a box of tacos",
20,
"there was a good amount of variety in that!",
False,
)
case 4:
thing, price, message, weird = (
"a box of doughnuts",
50,
"you can tell you're gonna reget all that sugar later.",
False,
)
case 5:
# Bugfix here down: Don't redundantly set `weird` to `True` again
thing, price, message, rac = (
" trash",
200,
(
"You... eat the trash? (+1 raccoon score)"
if uData["racScore"] < 10
else "You eagerly consume the trash pile! (+1 raccoon score)"
),
1,
)
case 6:
thing, price, message = (
" money",
500,
"You literally just eat money. Disgusting.",
)
case 7:
thing, price, message, rich = (
'a "tip"',
1000,
'You just give the cashier 1000 studs as a "tip". (+1 rich)',
1,
)
case 8:
thing, price, message, rich = (
"a golden pizza",
5000,
"You add the golden pizza to your home. You can't eat it after all. (+1 rich)",
1,
)
case 9:
thing, price, message, rich = (
"liquid gold",
10000,
2024-06-24 22:54:53 +00:00
"You chug the liquid gold. You are in severe pain for at least 20 minutes. (+2 rich)",
2,
)
case 10:
thing, price, message, rich = (
"golden tacos",
20000,
2024-06-24 22:54:53 +00:00
"You add the golden tacos to your home. The box was too poor for them. (+5 rich)",
5,
)
case 11:
thing, price, message, rich = (
"golden doughnuts",
50000,
2024-06-24 22:54:53 +00:00
"You add the golden doughtnuts to your home. Very sophisticated! (+15 rich)",
15,
)
case 12:
thing, price, message, rich, rac = (
"golden trash",
200000,
(
2024-06-24 22:54:53 +00:00
"You... eat... GOLDEN TRASH. What is worng with you? (+20 rich, +5 raccoon)"
if uData["racScore"] < 20
else "You eagerly consume the golden trash pile! (+20 rich, +5 raccoon)"
),
20,
5,
)
case 13:
thing, price, message, rich = (
"5 cubic meters of gold",
500000,
2024-06-24 22:54:53 +00:00
"You EAT 5 cubic meters of gold. I don't even know how you managed that. (+25 rich)",
25,
)
case 14:
thing, price, message, rich = (
'a hefty "tip"',
1000000,
2024-06-24 22:54:53 +00:00
'You "tip" the cashier a million studs. That\'s just not a tip man. (+30 rich)',
30,
)
2024-06-23 17:22:33 +00:00
case "E":
pass
case _:
print("Firepup forgot to add a menu option, smh.")
sleep(5)
2024-06-23 17:22:33 +00:00
if price > 0 and price <= uData["studs"]:
uData["studs"] -= price
uData["richScore"] += rich
uData["racScore"] += rac
if not weird:
print(
f"You {'eat' if sel!=2 else 'drink'} your {thing[2:]}... {message}"
)
else:
print(message)
2024-06-23 17:22:33 +00:00
elif price > 0:
print(f"You're too poor to buy {thing} right now.")
sleep(2)
case 8:
migrations = {
"permissionLevel": 10,
"logins": 0,
"vehicles": [],
"houseLevel": 0,
"energyTanks": 0,
"studsGained": 0,
"studsLost": 0,
"highestStuds": 20,
"studs": 20,
"debug": False,
"o": 0,
"racScore": 0,
"richScore": 0,
2024-06-24 22:54:53 +00:00
"rare": {},
"upgrades": {},
}
fixed = False
for key in migrations:
if key not in uData:
fixed = True
print(
f'Found missing save data key "{key}"! Resetting to default value...'
)
uData[key] = migrations[key]
print(
"Your save data has been fixed!"
if fixed
else "There was nothing I could find that was wrong with your save data!"
)
sleep(2)
2024-06-02 20:22:42 +00:00
case "E":
exit(0)
case "D":
if uData["debug"]:
deb = menu(
{
"Dump User Data": 1,
"Reset Studs": 2,
"Full data reset": 3,
"Exit": "E",
},
"[DEBUG MENU]",
)
2024-06-02 20:22:42 +00:00
match deb:
case 1:
print("User Data dump: {")
for k in uData:
print(f' "{k}": {str(uData[k])}')
print("}")
2024-06-02 20:22:42 +00:00
case 2:
uData["studs"] = 20
uData["studsLost"] = 0
uData["studsGained"] = 0
uData["highestStuds"] = 20
print("Studs (and related stats) have been reset.")
case 3:
uData["studs"] = 20
uData["studsLost"] = 0
uData["studsGained"] = 0
uData["highestStuds"] = 20
uData["vehicles"] = {}
uData["energyTanks"] = 0
uData["logins"] = 0
uData["houseLevel"] = 0
uData["o"] = 0
uData["racScore"] = 0
uData["richScore"] = 0
2024-06-24 22:54:53 +00:00
uData["rare"] = {}
2024-06-02 20:22:42 +00:00
print("User data has been reset.")
case "E":
print("SLEEP 5")
case _:
print(
"Firepup forgot to implement a debug menu option\nSLEEP 10"
)
2024-06-02 20:22:42 +00:00
sleep(5)
sleep(5)
else:
print("Operation not permitted")
2024-06-24 22:54:53 +00:00
sleep(2)
2024-06-02 20:22:42 +00:00
case _:
2024-06-24 22:54:53 +00:00
print(
"Invalid option, this should have been impossible. Feel free to complain to firepup about this missing MAIN MENU option being missing."
)
2024-06-02 20:22:42 +00:00
sleep(60)
clear()
# Apply stud multipliers to any earned money after the everything else runs
newStuds = studsAtTop - uData["studs"]
if newStuds > 0:
uData["studs"] += newStuds * uData["upgrades"].get("studX", 1)
# If we're gonna have weird stud multipliers, we've gotta round those back to standard increments, and normal rounding isn't enough, since I want the studs to be locked to increments of 5.
if uData["studs"] % 1:
uData["studs"] = round(uData["studs"])
if uData["studs"] % 5:
if (uData["studs"] + (uData["studs"] % 5)) < (
uData["studs"] + (5 - (uData["studs"] % 5))
):
uData["studs"] -= uData["studs"] % 5
else:
uData["studs"] += 5 - (uData["studs"] % 5)
studsDiff = studsAtTop - uData["studs"]
if studsAtTop > 0:
uData["studsGained"] += studsDiff
else: # Yes, this could be caused if studsDiff is 0. However that's not a concern since it'll just subtract 0.
uData["studsLost"] -= studsDiff
2024-06-02 20:22:42 +00:00
if uData["studs"] > uData["highestStuds"]:
uData["highestStuds"] = uData["studs"]
db.set(
un, uData
) # Update user data after each loop so it actually saves changes to the data