Compare commits
8 Commits
7b36c588e1
...
master
Author | SHA1 | Date | |
---|---|---|---|
4a54cac500 | |||
2ccbaaeca5 | |||
04042cedc5 | |||
d17dabbb85 | |||
d6495202a6 | |||
365c6359bc | |||
0dfcca72e2 | |||
0f54e2533b |
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
1
README.md
Normal file → Executable file
1
README.md
Normal file → Executable file
@@ -12,3 +12,4 @@ I used to play this game when I was like 7 and it's off the play store so I thou
|
||||
# Additional functionality:
|
||||
* randomly get fined based on threat level
|
||||
* permanent saves
|
||||
* businesses·lose·10%·of·their·value·upon·purchase
|
||||
|
204
data.py
Normal file → Executable file
204
data.py
Normal file → Executable file
@@ -1,90 +1,126 @@
|
||||
businesses = [
|
||||
{"pretty_name":"Paper Round","cost":10,"earning":0.11,"threat":0},
|
||||
{"pretty_name":"Car Boot Sale","cost":20,"earning":0.22,"threat":15},
|
||||
{"pretty_name":"Lemonade Stand","cost":60,"earning":0.69,"threat":0},
|
||||
{"pretty_name":"Online Reseller","cost":105,"earning":1.30,"threat":4},
|
||||
{"pretty_name":"Open Source Maintainer","cost":110,"earning":0.01,"threat":-0.01},# Positive affect
|
||||
{"pretty_name":"Weed Dealer","cost":120,"earning":10,"threat":30},# High risk
|
||||
{"pretty_name":"Pizza Delivery","cost":130,"earning":2,"threat":1},
|
||||
{"pretty_name":"Lawn Mower","cost":250,"earning":1.5,"threat":-0.03},
|
||||
{"pretty_name":"Cocaine Smuggler","cost":550,"earning":48,"threat":50},# High risk
|
||||
{"pretty_name":"Photo Booth","cost":2180,"earning":30,"threat":2},
|
||||
{"pretty_name":"Car Wash","cost":3000,"earning":40,"threat":4},
|
||||
{"pretty_name":"Charity Cake Sale","cost":3900,"earning":0,"threat":-0.4},
|
||||
{"pretty_name":"Hotdog Stand","cost":5700,"earning":80,"threat":2},
|
||||
{"pretty_name":"Shoe Shop","cost":9800,"earning":140,"threat":5},
|
||||
{"pretty_name":"Cake Shop","cost":15000,"earning":215,"threat":1},
|
||||
{"pretty_name":"Pub","cost":22000,"earning":360,"threat":18},
|
||||
{"pretty_name":"Charity Shop","cost":27500,"earning":2.5,"threat":-2.75},# Positive affect
|
||||
{"pretty_name":"Corner Shop","cost":32500,"earning":460,"threat":5},
|
||||
{"pretty_name":"Casino","cost":47500,"earning":5120,"threat":40},# High risk
|
||||
{"pretty_name":"Petrol Station","cost":90000,"earning":1350,"threat":8},
|
||||
{"pretty_name":"Community Space","cost":125875,"earning":0.5,"threat":-15},# Positive affect
|
||||
{"pretty_name":"Fast Food Chain","cost":280000,"earning":4500,"threat":5},
|
||||
{"pretty_name":"Tech Startup","cost":565000,"earning":9100,"threat":12},
|
||||
{"pretty_name":"Advertising Agency","cost":875000,"earning":14500,"threat":6},
|
||||
{"pretty_name":"Mini Golf Course","cost":900000,"earning":17000,"threat":2},
|
||||
{"pretty_name":"Botanical Garden","cost":1000000,"earning":20,"threat":-130},# Positive affect
|
||||
{"pretty_name":"Golf Course","cost":5000000,"earning":89500,"threat":4},
|
||||
{"pretty_name":"Bank","cost":12500000,"earning":231600,"threat":1},
|
||||
{"pretty_name":"Gold Mine","cost":1200000000,"earning":28512500,"threat":12},
|
||||
{"pretty_name":"Paper Round", "cost":10,"earning":0.11,"threat":0},
|
||||
{"pretty_name":"Car Boot Sale", "cost":20,"earning":0.22,"threat":15},
|
||||
{"pretty_name":"Lemonade Stand", "cost":60,"earning":0.69,"threat":0},
|
||||
{"pretty_name":"Online Reseller", "cost":105,"earning":1.30,"threat":4},
|
||||
{"pretty_name":"Open Source Maintainer", "cost":110,"earning":0.01,"threat":-0.01},# Positive affect
|
||||
{"pretty_name":"Weed Dealer", "cost":120,"earning":10,"threat":30},# High risk
|
||||
{"pretty_name":"Pizza Delivery", "cost":130,"earning":2,"threat":1},
|
||||
{"pretty_name":"Lawn Mower", "cost":250,"earning":1.5,"threat":-0.03},
|
||||
{"pretty_name":"Cocaine Smuggler", "cost":550,"earning":48,"threat":50},# High risk
|
||||
{"pretty_name":"Photo Booth", "cost":2180,"earning":30,"threat":2},
|
||||
{"pretty_name":"Car Wash", "cost":3000,"earning":40,"threat":4},
|
||||
{"pretty_name":"Charity Cake Sale", "cost":3900,"earning":0,"threat":-0.4},
|
||||
{"pretty_name":"Hotdog Stand", "cost":5700,"earning":80,"threat":2},
|
||||
{"pretty_name":"Shoe Shop", "cost":9800,"earning":140,"threat":5},
|
||||
{"pretty_name":"Cake Shop", "cost":15000,"earning":215,"threat":1},
|
||||
{"pretty_name":"Pub", "cost":22000,"earning":360,"threat":18},
|
||||
{"pretty_name":"Charity Shop", "cost":27500,"earning":2.5,"threat":-2.75},# Positive affect
|
||||
{"pretty_name":"Corner Shop", "cost":32500,"earning":460,"threat":5},
|
||||
{"pretty_name":"Casino", "cost":47500,"earning":5120,"threat":40},# High risk
|
||||
{"pretty_name":"Travel Agent", "cost":75000,"earning":1100,"threat":1},
|
||||
{"pretty_name":"Petrol Station", "cost":90000,"earning":1350,"threat":8},
|
||||
{"pretty_name":"Community Space", "cost":125875,"earning":0.5,"threat":-15},# Positive affect
|
||||
{"pretty_name":"Fancy Restaurant", "cost":147000,"earning":2300,"threat":1},
|
||||
{"pretty_name":"Car Dealership", "cost":184000,"earning":2900,"threat":8},
|
||||
{"pretty_name":"Fast Food Chain", "cost":280000,"earning":4500,"threat":5},
|
||||
{"pretty_name":"Tech Startup", "cost":565000,"earning":9100,"threat":12},
|
||||
{"pretty_name":"Advertising Agency", "cost":875000,"earning":14500,"threat":6},
|
||||
{"pretty_name":"Mini Golf Course", "cost":900000,"earning":17000,"threat":2},
|
||||
{"pretty_name":"Botanical Garden", "cost":1000000,"earning":20,"threat":-130},# Positive affect
|
||||
{"pretty_name":"Fancy Hotel", "cost":1710569,"earning":28933,"threat":4},
|
||||
{"pretty_name":"Golf Course", "cost":5000000,"earning":89500,"threat":4},
|
||||
{"pretty_name":"Drug Empire", "cost":6730000,"earning":828240,"threat":80},# High Risk
|
||||
{"pretty_name":"Bank", "cost":12500000,"earning":231600,"threat":1},
|
||||
{"pretty_name":"Hogwarts", "cost":38890000,"earning":690000,"threat":12},
|
||||
{"pretty_name":"Car Manufacturer", "cost":95000000,"earning":1853838,"threat":6},
|
||||
{"pretty_name":"Stark Industries", "cost":148368246,"earning":2943154,"threat":48},# High Risk
|
||||
{"pretty_name":"World Heritage Site", "cost":273812672,"earning":-100,"threat":-42000},# Positive affect
|
||||
{"pretty_name":"Gold Mine", "cost":1200000000,"earning":28512500,"threat":12},
|
||||
{"pretty_name":"Record Label", "cost":16086117467,"earning":377219792,"threat":4},
|
||||
{"pretty_name":"North Korean Hackers", "cost":49090934652,"earning":1197973460,"threat":390},# High Risk
|
||||
{"pretty_name":"Royal Mint", "cost":31418198177,"earning":754581418,"threat":0},
|
||||
{"pretty_name":"HS2", "cost":80265000000,"earning":50,"threat":2000},# Joke inclusion, High Risk
|
||||
{"pretty_name":"Nuclear Power Plant", "cost":149813643350,"earning":3804520446,"threat":12},
|
||||
{"pretty_name":"Mithril Mine", "cost":187267054187,"earning":4793695763,"threat":24},# High Risk
|
||||
{"pretty_name":"Asgardian Bank", "cost":2730000000000,"earning":76800000000,"threat":2},
|
||||
{"pretty_name":"Atlantis", "cost":39655341208057,"earning":1229033018189.84,"threat":14},
|
||||
{"pretty_name":"Galactic Empire", "cost":577061163611609,"earning":19679320186973,"threat":80},# High Risk
|
||||
{"pretty_name":"McDuck Enterprises", "cost":1752500000000000,"earning":62497524783840,"threat":4},
|
||||
{"pretty_name":"Silmaril Factory", "cost":40000000000000000,"earning":1588731290169286,"threat":84},# High Risk
|
||||
{"pretty_name":"Death Star I", "cost":850000000000000000,"earning":37600000000000000,"threat":110}, # High Risk
|
||||
{"pretty_name":"Death Star II", "cost":1130000000000000000,"earning":50890000000000000,"threat":110}, # High Risk
|
||||
{"pretty_name":"Starkiller Base", "cost":9315000000000000000,"earning":480000000000000000,"threat":200}, #High Risk
|
||||
{"pretty_name":"Duplication Exploiter", "cost":32300000000000000000,"earning":1630000000000000000,"threat":128},# High Risk
|
||||
{"pretty_name":"Midas Touch Factory", "cost":470000000000000000000,"earning":26000000000000000000,"threat":1400},#High Risk
|
||||
]
|
||||
leaderboard = [
|
||||
["Scrooge McDuck", 18921600000000000000],
|
||||
["Thor", 15000000000000000],
|
||||
["Namor", 800000000000000],
|
||||
["Plutus", 662000000000000],
|
||||
["Aquaman", 150000000000000],
|
||||
["Blackpanter", 90720000000000],
|
||||
["Bruce Wayne", 30900000000000],
|
||||
["Tony Stark", 30000000000000],
|
||||
["Augustus Caesar", 4600000000000],
|
||||
["King Solomon", 2200000000000],
|
||||
["Genghis Khan", 1300000000000],
|
||||
["Mansa Musa", 415000000000],
|
||||
["Elon Musk", 342000000000],
|
||||
["Jakob Fugger", 277000000000],
|
||||
["William The Conqueror", 228000000000],
|
||||
["Mark Zuckerburg", 216000000000],
|
||||
["Jeff Bezos", 215000000000],
|
||||
["Alan Rufus", 195000000000],
|
||||
["Larry Ellison", 192000000000],
|
||||
["Bernard Arnault", 178000000000],
|
||||
["Marcus Lucinius Crassus",169800000000],
|
||||
["Basil II", 169400000000],
|
||||
["Warren Buffet", 154000000000],
|
||||
["Frodo Baggins", 145400000000],
|
||||
["Larry Page", 144000000000],
|
||||
["Sergey Brin", 138000000000],
|
||||
["Cosimo De'Medici", 129000000000],
|
||||
["Amancio Ortega", 124000000000],
|
||||
["Steve Ballmer", 118000000000],
|
||||
["Smaug", 61600000000],
|
||||
["Princess Leia", 32125000000],
|
||||
["Charles Foster Kane", 11200000000],
|
||||
["Steve Jobs", 10200000000],
|
||||
["Donald Trump", 10000000000],
|
||||
["George Lucas", 5500000000],
|
||||
["Montgomery Burns", 1800037022],
|
||||
["Taylor Swift", 1600000000],
|
||||
["Notch", 1300000000],
|
||||
["J.K. Rowling", 1000000000],
|
||||
["Rishi Sunak", 830000000],
|
||||
["Harry Styles", 120000000],
|
||||
["Pewdiepie", 45000000],
|
||||
["Harry Potter", 33000000],
|
||||
["Joe Biden", 10000000],
|
||||
["Sir Keir Starmer", 7700000],
|
||||
["Jeremy Corbyn", 1000000],
|
||||
["Bernie Sanders", 513513],
|
||||
["Greta Thunberg", 100000],
|
||||
["Luke Skywalker", 93000],
|
||||
["Samwise Gamgee", 47100],
|
||||
["Uncle Ben", 25400],
|
||||
["Arthur and Molly Weasley", 12250],
|
||||
["Gandalf", 8102.14],
|
||||
["DeaDvey", 1012.12],
|
||||
["Peter Parker", 103.47],
|
||||
["King Midas", 641990000000000000000000000],
|
||||
["Caishen", 742000000000000000000000],
|
||||
["Emperor Palpatine",9840000000000000000000],
|
||||
["Scrooge McDuck", 18921600000000000000],
|
||||
["Rumpelstiltskin", 2910000000000000000],
|
||||
["The Dark Lord Sauron", 247500000000000000],
|
||||
["Thor", 15000000000000000],
|
||||
["Durin the Deathless", 4206900000000000],
|
||||
["Namor", 800000000000000],
|
||||
["Plutus", 662000000000000],
|
||||
["Aquaman", 150000000000000],
|
||||
["Blackpanter", 90720000000000],
|
||||
["Bruce Wayne", 30900000000000],
|
||||
["Tony Stark", 30000000000000],
|
||||
["Augustus Caesar", 4600000000000],
|
||||
["King Solomon", 2200000000000],
|
||||
["The House of Saud", 1400000000000],
|
||||
["Genghis Khan", 1300000000000],
|
||||
["Prince Ali", 893000000000],
|
||||
["Dain II Ironfoot", 750000000000],
|
||||
["Mansa Musa", 415000000000],
|
||||
["Elon Musk", 342000000000],
|
||||
["Jakob Fugger", 277000000000],
|
||||
["William The Conqueror", 228000000000],
|
||||
["Mark Zuckerburg", 216000000000],
|
||||
["Jeff Bezos", 215000000000],
|
||||
["Alan Rufus", 195000000000],
|
||||
["Larry Ellison", 192000000000],
|
||||
["Bernard Arnault", 178000000000],
|
||||
["Marcus Lucinius Crassus", 169800000000],
|
||||
["Basil II", 169400000000],
|
||||
["Warren Buffet", 154000000000],
|
||||
["Frodo Baggins", 145400000000],
|
||||
["Larry Page", 144000000000],
|
||||
["Sergey Brin", 138000000000],
|
||||
["Cosimo De'Medici", 129000000000],
|
||||
["Amancio Ortega", 124000000000],
|
||||
["Steve Ballmer", 118000000000],
|
||||
["Smaug", 61600000000],
|
||||
["Princess Leia", 32125000000],
|
||||
["Charles Foster Kane", 11200000000],
|
||||
["Steve Jobs", 10200000000],
|
||||
["Donald Trump", 10000000000],
|
||||
["George Lucas", 5500000000],
|
||||
["Montgomery Burns", 1800037022],
|
||||
["Taylor Swift", 1600000000],
|
||||
["Notch", 1300000000],
|
||||
["J.K. Rowling", 1000000000],
|
||||
["Rishi Sunak", 830000000],
|
||||
["King Charles III", 747000000],
|
||||
["Harry Styles", 120000000],
|
||||
["Pewdiepie", 45000000],
|
||||
["Harry Potter", 33000000],
|
||||
["Joe Biden", 10000000],
|
||||
["Sir Keir Starmer", 7700000],
|
||||
["Frank Abagnale Jr.", 2500000],
|
||||
["Jeremy Corbyn", 925000],
|
||||
["Bernie Sanders", 513513],
|
||||
["Greta Thunberg", 100000],
|
||||
["Luke Skywalker", 93000],
|
||||
["Samwise Gamgee", 47100],
|
||||
["Uncle Ben", 25400],
|
||||
["Arthur and Molly Weasley", 12250],
|
||||
["Gandalf", 8102.14],
|
||||
["DeaDvey", 1012.12],
|
||||
["Peter Parker", 103.47],
|
||||
]
|
||||
# Doesn't affect anything non visual
|
||||
currency = "€"
|
||||
|
160
main.py
Normal file → Executable file
160
main.py
Normal file → Executable file
@@ -1,55 +1,79 @@
|
||||
#TODO comments explaining stuff
|
||||
import data # Import data.py which contains the businesses and leaderboards
|
||||
from datetime import datetime
|
||||
import math
|
||||
try:
|
||||
import save # TODO saving functionality
|
||||
# If the save file doesn't exist, create one
|
||||
except:
|
||||
with open("save.py", "w") as file:
|
||||
content = f"businesses = []\nmoney = 100\ndatetime = {datetime.now().strftime('%s')}\nfine_count = 0"
|
||||
# Commands
|
||||
# TODO help: help's the user
|
||||
# status: output's networth, available money, TL, your businesses and earning/hour
|
||||
# shop/buy: lists available businesses
|
||||
# sell: sells that business
|
||||
# leaderboard: shows the wealth leaderboard
|
||||
# quit: exit's game
|
||||
file.write(content)
|
||||
import save
|
||||
help_text = '''# Commands:
|
||||
* help: help's the user
|
||||
* status: output's networth, available money, TL, your businesses and earning/hour
|
||||
* shop/buy: lists available businesses
|
||||
* sell: sells one of your businesses
|
||||
* leaderboard: shows the wealth leaderboard
|
||||
* quit: exit's game
|
||||
* TODO upgrade (?): upgrades some stats about a business for some money
|
||||
|
||||
# Additional functionality:
|
||||
# randomly get sent to get fined based on threat level, more than 5 fines means next time is prision and that's 2 years ingame
|
||||
# permanent saves
|
||||
* randomly get sent to get fined based on threat level, more than 5 fines means next time is prision and that's 2 years ingame
|
||||
* permanent saves
|
||||
* businesses lose 10% of their value upon purchase'''
|
||||
|
||||
# https://stackoverflow.com/questions/3154460/python-human-readable-large-numbers
|
||||
|
||||
# This function accepts a number and returns the value millified
|
||||
# For example 1000 becomes 1K
|
||||
# 135220 becomes 135.22K
|
||||
# 25012345 becomes 25.01M etc
|
||||
# millnames can be redefined in data.py
|
||||
def millify(n):
|
||||
n = float(n)
|
||||
millidx = max(
|
||||
0,
|
||||
min(
|
||||
len(data.millnames)-1,
|
||||
int(math.floor(0 if n == 0 else math.log10(abs(n))/3))
|
||||
)
|
||||
)
|
||||
return '{:.0f}{}'.format(n / 10**(3 * millidx), data.millnames[millidx])
|
||||
exponent = len(str(round(n))) - 1 # n = 1,000 return 3, n = 300,000 returns 5
|
||||
millvalue = exponent//3 # millvalue = how many sets of 3 zero's there are after the mill, 1000 -> 999999 all equals 3, 1million -> 999 million all equal 6, etc
|
||||
millname = data.millnames[millvalue] # exponent = 3 returns K (thousand), exponent = 7 returns M (million)
|
||||
return f"{round((n/(10**(millvalue*3))),2)}{millname}" # Returns the formatted value
|
||||
|
||||
# Returns a random bool based on a percentage, 100 or more always returns True
|
||||
def rand_bool(percent):
|
||||
return random.randrange(100) < percent
|
||||
|
||||
def try_arrest():
|
||||
# Every day there is a chance that you will be fined based on the threat level
|
||||
# This function checks if the day has changed, if it has then it uses your threat level to
|
||||
# randomly fine you or not, eg a threat level of 100% or more (threat level MIDNIGHT) will always
|
||||
# result in an arrest and a threat level of 5% will result in a fine 1/20 of the time
|
||||
# Every time you get a fine the value increases based on the fine values in data.fines
|
||||
# If all fines have been received then each fine results in the highest fine in data.fines
|
||||
def try_fine():
|
||||
current_day = datetime.now().strftime("%d")
|
||||
current_month = datetime.now().strftime("%m")
|
||||
current_year = datetime.now().strftime("%Y")
|
||||
if datetime.fromtimestamp(int(save.datetime)).strftime("%d") != current_day or datetime.fromtimestamp(int(save.datetime)).strftime("%m") != current_month or datetime.fromtimestamp(int(save.datetime)).strftime("%Y") != current_year:
|
||||
previous_date = datetime.fromtimestamp(int(save.datetime))
|
||||
# Checks if the day, month or year has changed
|
||||
if previous_date.strftime("%d") != current_day or previous_date.strftime("%m") != current_month or previous_date.strftime("%Y") != current_year:
|
||||
# Work out the current threat level
|
||||
for biz in save.businesses:
|
||||
threat += biz['cost']
|
||||
# Randomly decide to fine or not based on threat level
|
||||
if rand_bool(threat):
|
||||
# If the user has been fined more times than there are fines in data.fines, fine them the last fine in that list
|
||||
if save.fine_count >= len(data.fines):
|
||||
save.money -= data.fines[len(data.fines)-1]
|
||||
print(f"You've been fined {data.currency}{data.fines[len(data.fines)-1]}")
|
||||
# Else just fine them the amount at the current fine index
|
||||
else:
|
||||
save.money -= data.fines[save.fine_count]
|
||||
print(f"You've been fined {data.currency}{data.fines[save.fine_count]}")
|
||||
save.fine_count += 1
|
||||
save.fine_count += 1 # Increase the amount of times you've been fined
|
||||
save_game()
|
||||
|
||||
def input_command():
|
||||
user_input = input()
|
||||
user_input = user_input.strip()
|
||||
return user_input
|
||||
|
||||
def add_new_money():
|
||||
current_time = datetime.now().strftime("%s")
|
||||
time_difference = int(current_time) - int(save.datetime)
|
||||
@@ -59,7 +83,7 @@ def add_new_money():
|
||||
save.money += (earning / 3600) * time_passed
|
||||
|
||||
def display_leaderboard():
|
||||
leaderboard = data.leaderboard
|
||||
leaderboard = data.leaderboard[:]
|
||||
networth = save.money
|
||||
for biz in save.businesses:
|
||||
networth += biz['cost']
|
||||
@@ -79,10 +103,12 @@ def main():
|
||||
game_loop = True
|
||||
while game_loop:
|
||||
save.datetime = datetime.now().strftime("%s")
|
||||
print(f"{data.currency}{round(save.money,2)} > ", end="")
|
||||
user_input = input()
|
||||
print(f"{data.currency}{millify(save.money)} > ", end="")
|
||||
user_input = input_command()
|
||||
# TODO make this a match case?
|
||||
if user_input.lower() == "quit" or user_input.lower() == "exit":
|
||||
if user_input == "" or user_input is None:
|
||||
print("",end="")
|
||||
elif user_input.lower() == "quit" or user_input.lower() == "exit":
|
||||
save.datetime = datetime.now().strftime("%s")
|
||||
add_new_money()
|
||||
save_game()
|
||||
@@ -92,51 +118,53 @@ def main():
|
||||
elif user_input.lower() == "buy" or user_input.lower() == "shop":
|
||||
print(" 0: cancel")
|
||||
for i in range(len(data.businesses)):
|
||||
if data.businesses[i]['cost'] <= save.money:
|
||||
print(f" {i+1}: {data.businesses[i]['pretty_name']}: {data.currency}{data.businesses[i]['cost']}, Earning: {data.currency}{data.businesses[i]['earning']}/hour, Threat: {data.businesses[i]['threat']}%")
|
||||
user_input = input()
|
||||
try:
|
||||
user_input_int = int(user_input) - 1
|
||||
if user_input_int == -1:
|
||||
continue
|
||||
elif user_input_int < len(data.businesses) and save.money >= data.businesses[user_input_int]['cost']:
|
||||
if save.money >= data.businesses[i]['cost']:
|
||||
print(" * ",end="")
|
||||
else:
|
||||
print(" ",end="")
|
||||
print(f"{i+1}: {data.businesses[i]['pretty_name']}: {data.currency}{millify(data.businesses[i]['cost'])}, Earning: {data.currency}{millify(data.businesses[i]['earning'])}/hour, Threat: {data.businesses[i]['threat']}%")
|
||||
user_input = input_command()
|
||||
user_input_int = int(user_input) - 1
|
||||
if user_input_int == -1:
|
||||
continue
|
||||
elif user_input_int < len(data.businesses):
|
||||
if save.money >= data.businesses[user_input_int]['cost']:
|
||||
print(f"Buying {data.businesses[user_input_int]['pretty_name']}")
|
||||
save.businesses.append(data.businesses[user_input_int])
|
||||
save.businesses.append(data.businesses[user_input_int].copy())
|
||||
save.businesses[len(save.businesses)-1]['cost'] *= 0.9 # Remove 10% of it's value so the sell price is slightly less
|
||||
save.money -= data.businesses[user_input_int]['cost']
|
||||
else:
|
||||
print("Invalid number")
|
||||
except:
|
||||
print("Didn't input a number")
|
||||
print("You can't afford that!")
|
||||
else:
|
||||
print("Invalid number")
|
||||
|
||||
### Sell an owned business
|
||||
elif user_input.lower() == "sell":
|
||||
print(" 0: cancel")
|
||||
for i in range(len(save.businesses)):
|
||||
print(f" {i+1}: {save.businesses[i]['pretty_name']}: {data.currency}{save.businesses[i]['cost']}")
|
||||
user_input = input()
|
||||
try:
|
||||
user_input_int = int(user_input) - 1
|
||||
if user_input_int == -1:
|
||||
continue
|
||||
elif user_input_int < len(data.businesses):
|
||||
print(f"Selling {data.businesses[user_input_int]['pretty_name']}")
|
||||
save.businesses.pop(user_input_int)
|
||||
save.money += data.businesses[user_input_int]['cost']
|
||||
else:
|
||||
print("Invalid number")
|
||||
except:
|
||||
print("Didn't input a number")
|
||||
print(f" {i+1}: {save.businesses[i]['pretty_name']}: {data.currency}{millify(save.businesses[i]['cost'])}")
|
||||
user_input = input_command()
|
||||
|
||||
user_input_int = int(user_input) - 1
|
||||
if user_input_int == -1:
|
||||
continue
|
||||
elif user_input_int < len(data.businesses):
|
||||
print(f"Selling {save.businesses[user_input_int]['pretty_name']}")
|
||||
save.money += save.businesses[user_input_int]['cost']
|
||||
save.businesses.pop(user_input_int)
|
||||
else:
|
||||
print("Invalid number")
|
||||
|
||||
### Display info relavent to your enterprise
|
||||
elif user_input.lower() == "status":
|
||||
print("------------- STATUS -------------")
|
||||
print(f"Money Available: {data.currency}{round(save.money,2)}")
|
||||
print(f"Money Available: {data.currency}{millify(save.money)}")
|
||||
print("Your businesses:")
|
||||
total_earning = 0
|
||||
networth = save.money
|
||||
threat = 0
|
||||
for biz in save.businesses:
|
||||
print(f" {biz['pretty_name']}: {data.currency}{biz['earning']}/hour")
|
||||
print(f" {biz['pretty_name']}: {data.currency}{millify(biz['earning'])}/hour")
|
||||
total_earning += biz['earning']
|
||||
networth += biz['cost']
|
||||
threat += biz['threat']
|
||||
@@ -145,8 +173,8 @@ def main():
|
||||
print(f"Threat Level: {threat}%")
|
||||
else:
|
||||
print("Threat Level: MIDNIGHT")
|
||||
print(f"Total earning: {data.currency}{total_earning}/hour")
|
||||
print(f"Networth: {data.currency}{round(networth,2)}")
|
||||
print(f"Total earning: {data.currency}{millify(total_earning)}/hour")
|
||||
print(f"Networth: {data.currency}{millify(networth)}")
|
||||
print("----------------------------------")
|
||||
|
||||
### Display leaderboard
|
||||
@@ -154,27 +182,13 @@ def main():
|
||||
display_leaderboard()
|
||||
|
||||
elif user_input.lower() == "help":
|
||||
print('''
|
||||
Commands
|
||||
help: help's the user
|
||||
status: output's networth, available money, threat level, your businesses and earning/hour
|
||||
shop/buy: lists available businesses
|
||||
sell: sells that business
|
||||
leaderboard: shows the wealth leaderboard
|
||||
quit: exit's game
|
||||
|
||||
Additional functionality:
|
||||
randomly get fined based on threat level
|
||||
permanent saves
|
||||
''')
|
||||
elif user_input == "" or user_input == undefined:
|
||||
print("",end="")
|
||||
print(help_text)
|
||||
else:
|
||||
print("Error: Invalid command")
|
||||
print(f"Error: Invalid command: '{user_input}'")
|
||||
|
||||
### End of loop
|
||||
add_new_money()
|
||||
try_arrest()
|
||||
try_fine()
|
||||
save_game()
|
||||
|
||||
main()
|
||||
|
Reference in New Issue
Block a user