Compare commits

..

5 commits

3 changed files with 89 additions and 120 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
dev-database.db

162
game.py
View file

@ -1,4 +1,4 @@
from firepup650 import clear, randint, sql, e, menu from firepup650 import clear, randint, sql, e, menu, gp, gh, cur, flushPrint
import random as r import random as r
from fkeycapture import get, getnum, getchars from fkeycapture import get, getnum, getchars
import os, time, sys, re import os, time, sys, re
@ -6,66 +6,38 @@ from time import sleep
db = sql("dev-database.db") db = sql("dev-database.db")
alphanum = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" alphanum = list("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
def multipleOf(num: int, mult: int = 5) -> bool: def multipleOf(num: int, mult: int = 5) -> bool:
return num%mult == 0 return num%mult == 0
# TODO: Add some sleeps to make this seem like it's doing something cur.hide()
clear()
print("Loading Loge City v 0.0.1...") print("Loading Loge City v 0.0.1...")
print("Checking system compatibility...") sleep(1)
print("OK.") # TODO: This should beep or something flushPrint("Checking system compatibility...")
print("Checking imports...") sleep(1)
print("import ID UcO80qfR7o2BW3owpAQRsD6Q") print(" \aOK.")
print("OK.") sleep(1)
flushPrint("Checking data...")
sleep(1)
print(" \aOK.")
sleep(1)
print("Loaded successfully") print("Loaded successfully")
print("Starting...") print("Starting...")
sleep(2)
cur.show()
log = menu({"Yes": 1, "No": 0, "Exit": "E"}, "Welcome to the city!\nDo you have an existing account?")
clear() clear()
print("Welcome to the city!")
print("Do you have an existing account?\n1. Yes\n2. No")
log = menu({"Yes": 1, "No": 0}, "Welcome to the city!\nDo you have an existing account?")
un = "" un = ""
if log == "E":
exit(0)
if log: if log:
pw = "" print("Login")
while 1: print("Username: ", end="")
clear() un = gp(5, alphanum, allowDelete=True)
print("Please enter your 5 character username") print("Password: ", end="")
print(un, end="") pw = gh(5, alphanum, allowDelete=True)
match len(un):
case 0:
print("-----")
case 1:
print("----")
case 2:
print("---")
case 3:
print("--")
case 4:
print("-")
case _:
pass
if len(un) == 5:
break
un += getchars(1, alphanum)
while 1:
clear()
print("Please enter your 5 character password")
match len(pw):
case 0:
print("-----")
case 1:
print("*----")
case 2:
print("**---")
case 3:
print("***--")
case 4:
print("****-")
case _:
print("*****")
if len(pw) == 5:
break
pw += getchars(1, alphanum)
uData = db.get(un) uData = db.get(un)
if not uData: if not uData:
print("Sorry, that username is not recognized.") print("Sorry, that username is not recognized.")
@ -76,46 +48,11 @@ if log:
else: else:
print("Logged in.") print("Logged in.")
else: else:
pw = "" print("Signup")
while 1: print("Username (alphanumeric): ", end="")
clear() un = gp(5, alphanum, allowDelete=True)
print("Please enter a 5 character (alphanumeric) username") print("Password (alphanumeric):", end="")
print(un, end="") pw = gh(5, alphanum, allowDelete=True)
match len(un):
case 0:
print("-----")
case 1:
print("----")
case 2:
print("---")
case 3:
print("--")
case 4:
print("-")
case _:
pass
if len(un) == 5:
break
un += getchars(1, alphanum)
while 1:
clear()
print("Please enter a 5 character (alphanumeric) password")
match len(pw):
case 0:
print("-----")
case 1:
print("*----")
case 2:
print("**---")
case 3:
print("***--")
case 4:
print("****-")
case _:
print("*****")
if len(pw) == 5:
break
pw += getchars(1, alphanum)
uData = db.get(un) uData = db.get(un)
if uData: if uData:
print("Sorry, that username is already registered, please log in instead.") print("Sorry, that username is already registered, please log in instead.")
@ -170,33 +107,11 @@ while 1:
print("Press any key to exit") print("Press any key to exit")
get() get()
case 2: case 2:
bet = menu({"5": 5, "10": 10, "20": 20, "30": 30, "40": 40, "50": 50, "60": 60, "70": 70, "80": 80, "90": 90, "100": 100, "1000": 1000, "Exit": "E"}, "How many studs would you like to bet?") print("Calculating avaliable bets, this shouldn't take long...")
betHigh = 0 bets = {str(i): i for i in range(5, min(uData["studs"], 50000000), 5)}
match bet: bets["Exit"] = "E"
case 10: bet = menu(bets, "How many studs would you like to bet?")
betHigh = 20 betHigh = 0 if type(bet) != int else bet*2
case 20:
betHigh = 40
case 30:
betHigh = 60
case 40:
betHigh = 80
case 50:
betHigh = 100
case 60:
betHigh = 120
case 70:
betHigh = 140
case 80:
betHigh = 160
case 90:
betHigh = 180
case 100:
betHigh = 200
case 1000:
betHigh = 2000
case _:
betHigh = 0
winnings = 0 winnings = 0
betLow = -bet if betHigh else 0 betLow = -bet if betHigh else 0
while betHigh: while betHigh:
@ -233,7 +148,11 @@ while 1:
print("TODO: Rare Parts Shop") print("TODO: Rare Parts Shop")
sleep(1) sleep(1)
case 6: case 6:
print("TODO: Energy Tank Shop") price1 = 10 + (5 * uData["energyTanks"])
price5 = 5 * price1
price10 = 2 * price5
count = menu({f"1 ({price1} studs)": 1, "5 ({price5} studs)": 5, "10 ({price10} studs)": 10}, "How many energy tanks do you want?")
print("TODO: Energy Tank Shop Functionality")
sleep(1) sleep(1)
case 7: case 7:
print("TODO: Resturant") print("TODO: Resturant")
@ -245,7 +164,10 @@ while 1:
deb = menu({"Dump User Data": 1, "Reset Studs": 2, "Full data reset": 3, "Exit": "E"}, "[DEBUG MENU]") deb = menu({"Dump User Data": 1, "Reset Studs": 2, "Full data reset": 3, "Exit": "E"}, "[DEBUG MENU]")
match deb: match deb:
case 1: case 1:
print(f"User Data dump: {uData}") print("User Data dump: {")
for k in uData:
print(f' "{k}": {str(uData[k])}')
print("}")
case 2: case 2:
uData["studs"] = 20 uData["studs"] = 20
uData["studsLost"] = 0 uData["studsLost"] = 0

46
poetry.lock generated Normal file
View file

@ -0,0 +1,46 @@
# This file is automatically @generated by Poetry and should not be changed by hand.
[[package]]
name = "firepup650"
version = "1.0.35"
description = "Package containing various shorthand things I use, and a few imports I almost always use"
category = "main"
optional = false
python-versions = ">=3.8,<4.0"
files = [
{file = "firepup650-1.0.35-py3-none-any.whl", hash = "sha256:fb6d326e11ddbc4bb83ffe95b1ec0f2e6937cd7722cdbadd2f3ac31e84bfe3a5"},
{file = "firepup650-1.0.35.tar.gz", hash = "sha256:f128b624b8cee762366ccedf8a75b6e89745d08dd919a2df8433f2cbc090da13"},
]
[package.dependencies]
fkeycapture = ">=1.2.7,<2.0.0"
fpsql = ">=1,<1.0.26 || >1.0.26,<2"
[[package]]
name = "fkeycapture"
version = "1.2.7"
description = "A way to capture keystrokes"
category = "main"
optional = false
python-versions = ">=3.8,<4.0"
files = [
{file = "fkeycapture-1.2.7-py3-none-any.whl", hash = "sha256:c09cb715ccf2b9dfc25ecd39bffaf8fa794bc07410f666ac2ec15ebebebaabef"},
{file = "fkeycapture-1.2.7.tar.gz", hash = "sha256:5ef9c90aec0420a2e462420a2bc8076a50ffd8566a9a022ac171c0e508f1d58d"},
]
[[package]]
name = "fpsql"
version = "1.0.5"
description = "An easy to use SQLite package"
category = "main"
optional = false
python-versions = ">=3.8,<4.0"
files = [
{file = "fpsql-1.0.5-py3-none-any.whl", hash = "sha256:a31f4bf99d44c0095a8246bfd78bd39cf96d9b3591363a3f6538ca40914679a4"},
{file = "fpsql-1.0.5.tar.gz", hash = "sha256:647d148c5a17bca3a147a3bb281cc12dfc36f6f3f3652f22a1b2a1a3b7367c93"},
]
[metadata]
lock-version = "2.0"
python-versions = "^3.11"
content-hash = "9086a1cb67227cc868343ba92e5a0bfd713be45b6a0140e2e225a8b82a21d912"