mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-08-06 17:03:04 +02:00
fix🍋hs
This commit is contained in:
+3
-4
@@ -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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user