Compare commits

..

No commits in common. "2637c09810ae0c2357ab1418b057d113940eaab8" and "c48724c3b494b204dcf20eb41e1fee68906bbb11" have entirely different histories.

185
game.py
View file

@ -20,9 +20,7 @@ def rreplace(s: str, old: str, new: str, occurrence: int) -> str:
cur.hide()
clear()
print(
"Loading Loge City v 0.0.16..."
) # Finally remebered to bump this... I think v16 is right?
print("Loading Loge City v 0.0.1...")
sleep(1)
flushPrint("Checking system compatibility...")
sleep(1)
@ -89,7 +87,6 @@ else:
"racScore": 0,
"richScore": 0,
"rare": {},
"upgrades": {},
},
)
uData = db.get(un)
@ -102,14 +99,12 @@ if uData["logins"] == 1:
else:
print(f"Welcome back to Loge City {un}, we hope you are enjoying your stay.")
sleep(2)
# LTOP - jump point for me
while 1:
studsAtTop = uData["studs"]
go = menu(
{
"Stats": 1,
"Gamble": 2,
"Upgrades": 3,
"Research": 3,
"Vehicle Shop": 4,
"Rare Parts Shop": 5,
"Energy Tank Shop": 6,
@ -181,10 +176,7 @@ while 1:
Energy Tanks: {uData["energyTanks"]}
Misc Scores:
Raccoon: {uData["racScore"]}
Rich: {uData["richScore"]}
Upgrades:
Luck: {uData["upgrades"].get("luck", 0)}%
Stud Multipiler: {uData["upgrades"].get("studX", 1)}x"""
Rich: {uData["richScore"]}"""
)
if uData["debug"] or uData["permissionLevel"] >= 50:
print(
@ -204,8 +196,6 @@ while 1:
betHigh = 0 if type(bet) != int else bet
winnings = 0
betLow = -2 * bet if betHigh else 0
if betLow:
betLow = min(betLow + (uData["upgrades"].get("luck") * 5), 0)
while betHigh:
winnings = randint(betLow, betHigh)
if multipleOf(winnings):
@ -218,59 +208,21 @@ while 1:
print("You won nothing. (You kept your bet though)")
elif winnings == betLow:
print("You lost your bet!")
uData["studsLost"] += abs(winnings)
elif winnings >= 0:
print(f"You won {winnings} studs!")
uData["studsGained"] += winnings
elif winnings <= 0:
print(f"You lost {abs(winnings)} studs!")
uData["studsLost"] += abs(winnings)
else:
print("This should be impossible. Cue the panic attacks.")
else:
print("You don't have enough studs to bet that much.")
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)
print("TODO: Research Menu")
sleep(1)
case 4:
sel = menu(
{
@ -303,6 +255,7 @@ while 1:
if sel <= uData["studs"] and "bike" not in uData["vehicles"]:
uData["vehicles"].append("bike")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a bike!")
elif "bike" in uData["vehicles"]:
print("Sorry, you already have a bike!")
@ -312,6 +265,7 @@ while 1:
if sel <= uData["studs"] and "4-wheeler" not in uData["vehicles"]:
uData["vehicles"].append("4-wheeler")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a 4-wheeler!")
elif "4-wheeler" in uData["vehicles"]:
print("Sorry, you already have a 4-wheeler!")
@ -324,6 +278,7 @@ while 1:
):
uData["vehicles"].append("old rusty car")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased an old rusty car!")
elif "old rusty car" in uData["vehicles"]:
print("Sorry, you already have an old rusty car!")
@ -333,6 +288,7 @@ while 1:
if sel <= uData["studs"] and "car" not in uData["vehicles"]:
uData["vehicles"].append("car")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a car!")
elif "car" in uData["vehicles"]:
print("Sorry, you already have a car!")
@ -342,6 +298,7 @@ while 1:
if sel <= uData["studs"] and "minivan" not in uData["vehicles"]:
uData["vehicles"].append("minivan")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a minivan!")
elif "minivan" in uData["vehicles"]:
print("Sorry, you already have a minivan!")
@ -351,6 +308,7 @@ while 1:
if sel <= uData["studs"] and "van" not in uData["vehicles"]:
uData["vehicles"].append("van")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a van!")
elif "van" in uData["vehicles"]:
print("Sorry, you already have a van!")
@ -360,6 +318,7 @@ while 1:
if sel <= uData["studs"] and "truck" not in uData["vehicles"]:
uData["vehicles"].append("truck")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a truck!")
elif "truck" in uData["vehicles"]:
print("Sorry, you already have a truck!")
@ -369,6 +328,7 @@ while 1:
if sel <= uData["studs"] and "food truck" not in uData["vehicles"]:
uData["vehicles"].append("food truck")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a food truck!")
elif "food truck" in uData["vehicles"]:
print("Sorry, you already have a food truck!")
@ -378,6 +338,7 @@ while 1:
if sel <= uData["studs"] and "semi-truck" not in uData["vehicles"]:
uData["vehicles"].append("semi-truck")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a semi-truck!")
elif "semi-truck" in uData["vehicles"]:
print("Sorry, you already have a semi-truck!")
@ -387,6 +348,7 @@ while 1:
if sel <= uData["studs"] and "hover bike" not in uData["vehicles"]:
uData["vehicles"].append("hover bike")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a hover bike!")
elif "hover bike" in uData["vehicles"]:
print("Sorry, you already have a hover bike!")
@ -396,6 +358,7 @@ while 1:
if sel <= uData["studs"] and "hover car" not in uData["vehicles"]:
uData["vehicles"].append("hover car")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a hover car!")
elif "hover car" in uData["vehicles"]:
print("Sorry, you already have a hover car!")
@ -405,6 +368,7 @@ while 1:
if sel <= uData["studs"] and "hover truck" not in uData["vehicles"]:
uData["vehicles"].append("hover truck")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a hover truck!")
elif "hover truck" in uData["vehicles"]:
print("Sorry, you already have a hover truck!")
@ -417,6 +381,7 @@ while 1:
):
uData["vehicles"].append("hover semi-truck")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a hover semi-truck!")
elif "hover semi-truck" in uData["vehicles"]:
print("Sorry, you already have a hover semi-truck!")
@ -426,6 +391,7 @@ while 1:
if sel <= uData["studs"] and "pod racer" not in uData["vehicles"]:
uData["vehicles"].append("pod racer")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a pod racer!")
elif "pod racer" in uData["vehicles"]:
print("Sorry, you already have a pod racer!")
@ -435,6 +401,7 @@ while 1:
if sel <= uData["studs"] and "rocketship" not in uData["vehicles"]:
uData["vehicles"].append("rocketship")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a rocketship!")
elif "rocketship" in uData["vehicles"]:
print("Sorry, you already have a rocketship!")
@ -444,6 +411,7 @@ while 1:
if sel <= uData["studs"] and "spaceship" not in uData["vehicles"]:
uData["vehicles"].append("spaceship")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a spaceship!")
elif "spaceship" in uData["vehicles"]:
print("Sorry, you already have a spaceship!")
@ -456,6 +424,7 @@ while 1:
):
uData["vehicles"].append("spaceship with a hyperdrive")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a spaceship with a hyperdrive!")
elif "spaceship with a hyperdrive" in uData["vehicles"]:
print("Sorry, you already have a spaceship with a hyperdrive!")
@ -465,6 +434,7 @@ while 1:
if sel <= uData["studs"] and "yacht" not in uData["vehicles"]:
uData["vehicles"].append("yacht")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a yacht!")
elif "yacht" in uData["vehicles"]:
print("Sorry, you already have a yacht!")
@ -474,6 +444,7 @@ while 1:
if sel <= uData["studs"] and "space yacht" not in uData["vehicles"]:
uData["vehicles"].append("space yacht")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a space yacht!")
elif "space yacht" in uData["vehicles"]:
print("Sorry, you already have a space yacht!")
@ -483,6 +454,7 @@ while 1:
if sel <= uData["studs"] and "teleporter" not in uData["vehicles"]:
uData["vehicles"].append("teleporter")
uData["studs"] -= sel
uData["studsLost"] += sel
print("You purchased a teleporter!")
elif "teleporter" in uData["vehicles"]:
print("Sorry, you already have a teleporter!")
@ -517,6 +489,7 @@ while 1:
case 250:
if sel <= uData["studs"]:
uData["studs"] -= sel
uData["studsLost"] += sel
uData["richScore"] += 1
if "gold bar" in uData["rare"]:
uData["rare"]["gold bar"] += 1
@ -528,6 +501,7 @@ while 1:
case 500:
if sel <= uData["studs"]:
uData["studs"] -= sel
uData["studsLost"] += sel
uData["richScore"] += 2
if "golden cup" in uData["rare"]:
uData["rare"]["golden cup"] += 1
@ -539,6 +513,7 @@ while 1:
case 1000:
if sel <= uData["studs"]:
uData["studs"] -= sel
uData["studsLost"] += sel
uData["richScore"] += 5
if "golden plate" in uData["rare"]:
uData["rare"]["golden plate"] += 1
@ -550,6 +525,7 @@ while 1:
case 5000:
if sel <= uData["studs"]:
uData["studs"] -= sel
uData["studsLost"] += sel
uData["richScore"] += 10
if "golden table" in uData["rare"]:
uData["rare"]["golden table"] += 1
@ -561,6 +537,7 @@ while 1:
case 250000:
if sel <= uData["studs"]:
uData["studs"] -= sel
uData["studsLost"] += sel
uData["richScore"] += 20
if "crystal" in uData["rare"]:
uData["rare"]["crystal"] += 1
@ -572,6 +549,7 @@ while 1:
case 500000:
if sel <= uData["studs"]:
uData["studs"] -= sel
uData["studsLost"] += sel
uData["richScore"] += 25
if "crystal cup" in uData["rare"]:
uData["rare"]["crystal cup"] += 1
@ -583,6 +561,7 @@ while 1:
case 1000000:
if sel <= uData["studs"]:
uData["studs"] -= sel
uData["studsLost"] += sel
uData["richScore"] += 50
if "crystal plate" in uData["rare"]:
uData["rare"]["crystal plate"] += 1
@ -594,6 +573,7 @@ while 1:
case 5000000:
if sel <= uData["studs"]:
uData["studs"] -= sel
uData["studsLost"] += sel
uData["richScore"] += 75
if "crystal table" in uData["rare"]:
uData["rare"]["crystal table"] += 1
@ -605,6 +585,7 @@ while 1:
case 10000000:
if sel <= uData["studs"]:
uData["studs"] -= sel
uData["studsLost"] += sel
uData["richScore"] += 100
if "double studded 1x1 plate" in uData["rare"]:
uData["rare"]["double studded 1x1 plate"] += 1
@ -616,6 +597,7 @@ while 1:
case 50000000:
if sel <= uData["studs"]:
uData["studs"] -= sel
uData["studsLost"] += sel
uData["richScore"] += 125
if "double studded 2x2 plate" in uData["rare"]:
uData["rare"]["double studded 2x2 plate"] += 1
@ -627,6 +609,7 @@ while 1:
case 100000000:
if sel <= uData["studs"]:
uData["studs"] -= sel
uData["studsLost"] += sel
uData["richScore"] += 150
if "hinge joint" in uData["rare"]:
uData["rare"]["hinge joint"] += 1
@ -638,6 +621,7 @@ while 1:
case 500000000:
if sel <= uData["studs"]:
uData["studs"] -= sel
uData["studsLost"] += sel
uData["richScore"] += 200
if "vault door" in uData["rare"]:
uData["rare"]["vault door"] += 1
@ -674,6 +658,7 @@ while 1:
case 1:
if price1 <= uData["studs"]:
uData["studs"] -= price1
uData["studsLost"] += price1
uData["energyTanks"] += 1
print("You bought a single energy tank!")
else:
@ -682,6 +667,7 @@ while 1:
case 5:
if price5 <= uData["studs"]:
uData["studs"] -= price5
uData["studsLost"] += price5
uData["energyTanks"] += 5
print("You bought 5 energy tanks!")
else:
@ -690,6 +676,7 @@ while 1:
case 10:
if price10 <= uData["studs"]:
uData["studs"] -= price10
uData["studsLost"] += price10
uData["energyTanks"] += 10
print("You bought 10 energy tanks!")
else:
@ -721,15 +708,7 @@ while 1:
},
"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,
)
thing, price, message, weird = ("Nothing", 0, "You bought nothing", True)
match sel:
case 1:
thing, price, message, weird = ("a pizza", 5, "delicious!", False)
@ -755,7 +734,7 @@ while 1:
thing = "a can of blueberry"
case 9:
thing = "a can of rain water"
price, message, Weird = (
price, message, weird = (
10,
"tastes just like you remember it!",
False,
@ -775,8 +754,7 @@ while 1:
False,
)
case 5:
# Bugfix here down: Don't redundantly set `weird` to `True` again
thing, price, message, rac = (
thing, price, message, weird = (
" trash",
200,
(
@ -784,51 +762,58 @@ while 1:
if uData["racScore"] < 10
else "You eagerly consume the trash pile! (+1 raccoon score)"
),
1,
True,
)
uData["racScore"] += 1
case 6:
thing, price, message = (
thing, price, message, weird = (
" money",
500,
"You literally just eat money. Disgusting.",
True,
)
case 7:
thing, price, message, rich = (
thing, price, message, weird = (
'a "tip"',
1000,
'You just give the cashier 1000 studs as a "tip". (+1 rich)',
1,
True,
)
uData["richScore"] += 1
case 8:
thing, price, message, rich = (
thing, price, message, weird = (
"a golden pizza",
5000,
"You add the golden pizza to your home. You can't eat it after all. (+1 rich)",
1,
True,
)
uData["richScore"] += 1
case 9:
thing, price, message, rich = (
thing, price, message, weird = (
"liquid gold",
10000,
"You chug the liquid gold. You are in severe pain for at least 20 minutes. (+2 rich)",
2,
True,
)
uData["richScore"] += 2
case 10:
thing, price, message, rich = (
thing, price, message, weird = (
"golden tacos",
20000,
"You add the golden tacos to your home. The box was too poor for them. (+5 rich)",
5,
True,
)
uData["richScore"] += 5
case 11:
thing, price, message, rich = (
thing, price, message, weird = (
"golden doughnuts",
50000,
"You add the golden doughtnuts to your home. Very sophisticated! (+15 rich)",
15,
True,
)
uData["richScore"] += 15
case 12:
thing, price, message, rich, rac = (
thing, price, message, weird = (
"golden trash",
200000,
(
@ -836,23 +821,26 @@ while 1:
if uData["racScore"] < 20
else "You eagerly consume the golden trash pile! (+20 rich, +5 raccoon)"
),
20,
5,
True,
)
uData["richScore"] += 20
uData["racScore"] += 5
case 13:
thing, price, message, rich = (
thing, price, message, weird = (
"5 cubic meters of gold",
500000,
"You EAT 5 cubic meters of gold. I don't even know how you managed that. (+25 rich)",
25,
True,
)
uData["richScore"] += 25
case 14:
thing, price, message, rich = (
thing, price, message, weird = (
'a hefty "tip"',
1000000,
'You "tip" the cashier a million studs. That\'s just not a tip man. (+30 rich)',
30,
True,
)
uData["richScore"] += 30 # Bugfix: Missing rich score increment
case "E":
pass
case _:
@ -860,8 +848,7 @@ while 1:
sleep(5)
if price > 0 and price <= uData["studs"]:
uData["studs"] -= price
uData["richScore"] += rich
uData["racScore"] += rac
uData["studsLost"] += price
if not weird:
print(
f"You {'eat' if sel!=2 else 'drink'} your {thing[2:]}... {message}"
@ -887,7 +874,6 @@ while 1:
"racScore": 0,
"richScore": 0,
"rare": {},
"upgrades": {},
}
fixed = False
for key in migrations:
@ -959,25 +945,6 @@ while 1:
)
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
if uData["studs"] > uData["highestStuds"]:
uData["highestStuds"] = uData["studs"]
db.set(