From 248977c5b587a1756a96ff7a6e8f57e50fc3d6e5 Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Fri, 27 Sep 2024 18:06:11 -0700 Subject: [PATCH] enhance * replay hand with H or R --- etc/db_admin.py | 2 +- mesh_bot.py | 4 ++-- modules/blackjack.py | 20 +++++++++++++------- modules/videopoker.py | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/etc/db_admin.py b/etc/db_admin.py index bb6a807..f482e8e 100644 --- a/etc/db_admin.py +++ b/etc/db_admin.py @@ -67,7 +67,7 @@ except Exception as e: print ("\n Meshing-Around Database Admin Tool\n") print ("System: bbs_messages") print (bbs_messages) -print ("System: bbs_dm") +print ("\nSystem: bbs_dm") print (bbs_dm) print (f"\n\nGame HS tables\n") print (f"lemon:{lemon_score}") diff --git a/mesh_bot.py b/mesh_bot.py index c3b7128..a03b90b 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -373,7 +373,7 @@ def handleBlackJack(nodeID, message): highScore = loadHSJack() if highScore != 0: if highScore['nodeID'] != 0: - msg += f" Ranking🥇:{get_name_from_number(highScore['nodeID'])} with {highScore['highScore']} chips. " + msg += f" HighScore🥇:{get_name_from_number(highScore['nodeID'])} with {highScore['highScore']} chips. " time.sleep(1) return msg @@ -405,7 +405,7 @@ def handleVideoPoker(nodeID, message): highScore = loadHSVp() if highScore != 0: if highScore['nodeID'] != 0: - msg += f" Ranking🥇:{get_name_from_number(highScore['nodeID'])} with {highScore['highScore']} chips. " + msg += f" HighScore🥇:{get_name_from_number(highScore['nodeID'])} with {highScore['highScore']} chips. " if last_cmd != "": logger.debug(f"System: VideoPoker: {nodeID} last command: {last_cmd}") diff --git a/modules/blackjack.py b/modules/blackjack.py index 9652915..f563662 100644 --- a/modules/blackjack.py +++ b/modules/blackjack.py @@ -280,6 +280,10 @@ def playBlackJack(nodeID, message): if message.lower() == "b": if bet_money == 0: bet_money = 5 + elif message.lower() == "r": + #resend the hand + msg += show_some(p_cards, d_cards, p_hand) + return msg else: try: bet_money = int(message) @@ -314,7 +318,7 @@ def playBlackJack(nodeID, message): if getLastCmdJack(nodeID) == "betPlaced": setLastCmdJack(nodeID, "playing") - msg += "(H)it,(S)tand,(F)orfit,(D)ouble" + msg += "(H)it,(S)tand,(F)orfit,(D)ouble,(R)esend,(L)eave table" # save the game state for i in range(len(jackTracker)): @@ -356,18 +360,20 @@ def playBlackJack(nodeID, message): setLastCmdJack(nodeID, "dealerTurn") else: return "You can't Double Down, dont have enough chips" + elif choice == "resend" or choice == "r": + msg += show_some(p_hand.cards, d_cards, p_hand) else: - return "Invalid Choice please choose [H,S,F,D]" + return "(H)it,(S)tand,(F)orfit,(D)ouble,(R)esend,(L)eave table" # Check if player bust if player_bust(p_hand, p_chips): d_win += 1 - msg += "Player:BUST💥" + msg += "💥PlayerBUST💥" setLastCmdJack(nodeID, "dealerTurn") if getLastCmdJack(nodeID) == "playing": msg += stats - msg += "[H,S,F,D,L]" + msg += "[H,S,F,D]" # Save the game state for i in range(len(jackTracker)): @@ -412,7 +418,7 @@ def playBlackJack(nodeID, message): d_hand.add_cards(d_card) if dealer_bust(d_hand, p_hand, p_chips): p_win += 1 - msg += "Dealer:BUST💥" + msg += "💰DealerBUST💥" break # Show all cards msg += show_all(p_hand.cards, d_hand.cards, p_hand, d_hand) @@ -444,12 +450,12 @@ def playBlackJack(nodeID, message): # check high score highScore = loadHSJack() if highScore != 0 and p_chips.total > highScore['highScore']: - msg += f"🎉New High Score! {p_chips.total} " + msg += f"💰💰High Score{p_chips.total} " saveHSJack(nodeID, p_chips.total) else: msg += f"💰You have {p_chips.total} chips " - msg += "(B)et or (L)eave table." + msg += "place a bet?" # Reset the game setLastCmdJack(nodeID, "new") diff --git a/modules/videopoker.py b/modules/videopoker.py index 5d03a59..ecc914f 100644 --- a/modules/videopoker.py +++ b/modules/videopoker.py @@ -369,7 +369,7 @@ def playVideoPoker(nodeID, message): vpTracker[i]['deck'] = deck vpTracker[i]['drawCount'] = drawCount - msg += f"\nDeal new card? \nex: 1,3,4 or (N)o,(A)ll" + msg += f"\nDeal new card? \nex: 1,3,4 or (N)o,(A)ll (H)and" setLastCmdVp(nodeID, "redraw") return msg