fix🍋hs

This commit is contained in:
SpudGunMan
2024-09-28 00:45:57 -07:00
parent 3f16158e27
commit aa05c62d94
2 changed files with 4 additions and 7 deletions
+3 -4
View File
@@ -342,11 +342,10 @@ def handleLemonade(nodeID, message):
highScore = getHighScoreLemon()
if highScore != 0:
if highScore['userID'] != 0:
nodeName = get_name_from_number(highScore['nodeID'])
nodeName = get_name_from_number(highScore['userID'])
if nodeName.isnumeric() and interface2_enabled:
nodeName = get_name_from_number(highScore['nodeID'], 'long', 2)
msg += f" HighScore🥇{nodeName} 💰{high_score['cash']}k with %{high_score['success']}"
nodeName = get_name_from_number(highScore['userID'], 'long', 2)
msg += f" HighScore🥇{nodeName} 💰{highScore['cash']}k with %{highScore['success']}"
msg += start_lemonade(nodeID=nodeID, message=message, celsius=False)
# wait a second to keep from message collision
+1 -3
View File
@@ -38,15 +38,13 @@ def get_sales_amount(potential, unit, price):
return math.floor(potential * (unit / (price ** 1.5)))
def getHighScoreLemon():
global high_score
high_score = {"userID": 0, "cash": 0, "success": 0}
# Load high score table
try:
with open('lemonade_hs.pkl', 'rb') as file:
high_score = pickle.load(file)
except FileNotFoundError:
logger.debug("System: Lemonade: No high score table found")
# high score pickle file is a touple of the nodeID and the high score
high_score = ({"userID": 0, "cash": 0, "success": 0})
# write a new high score file if one is not found
with open('lemonade_hs.pkl', 'wb') as file:
pickle.dump(high_score, file)