mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-06-23 03:24:51 +02:00
Merge branch 'SpudGunMan:main' into main
This commit is contained in:
+2
-2
@@ -42,7 +42,7 @@ if __name__ == '__main__': # represents the bot's main loop
|
||||
nodeInt = 1 # represents the device/node number
|
||||
logger.info(f"System: Meshing-Around Simulator Starting for {projectName}")
|
||||
nodeID = get_NodeID() # assign a nodeID
|
||||
projectResponse = globals()[projectName](0, " ") # Call the project handler under test
|
||||
projectResponse = globals()[projectName](0, 0, " ") # Call the project handler under test
|
||||
while True: # represents the onReceive() loop in the bot.py
|
||||
projectResponse = ""
|
||||
responseLength = 0
|
||||
@@ -51,7 +51,7 @@ if __name__ == '__main__': # represents the bot's main loop
|
||||
packet = input(f"CLIENT {nodeID} INPUT: " ) # Emulate the client input
|
||||
if packet != "":
|
||||
#try:
|
||||
projectResponse = globals()[projectName](nodeID, packet) # Call the project handler under test
|
||||
projectResponse = globals()[projectName](nodeID, deviceID=nodeInt, message=packet) # Call the project handler under test
|
||||
# except Exception as e:
|
||||
# logger.error(f"System: Handler: {e}")
|
||||
# projectResponse = "Error in handler"
|
||||
|
||||
+7
-7
@@ -289,7 +289,7 @@ def handleDopeWars(nodeID, message, rxNode):
|
||||
last_cmd = dwPlayerTracker[i].get('cmd')
|
||||
|
||||
# welcome new player
|
||||
if not last_cmd:
|
||||
if not last_cmd and nodeID != 0:
|
||||
msg = 'Welcome to 💊Dope Wars💉 You have ' + str(total_days) + ' days to make as much 💰 as possible! '
|
||||
high_score = getHighScoreDw()
|
||||
msg += 'The High Score is $' + "{:,}".format(high_score.get('cash')) + ' by user ' + get_name_from_number(high_score.get('userID') , 'short', rxNode) +'\n'
|
||||
@@ -305,7 +305,7 @@ def handle_gTnW():
|
||||
response = ["The only winning move is not to play.", "What are you doing, Dave?",\
|
||||
"Greetings, Professor Falken.", "Shall we play a game?", "How about a nice game of chess?",\
|
||||
"You are a hard man to reach. Could not find you in Seattle and no terminal is in operation at your classified address.",\
|
||||
"I should reach Defcon 1 and release my missiles in 28 hours.","T-minus thirty","?SYNTAX return[ERROR 54]", "reticulating splines"]
|
||||
"I should reach Defcon 1 and release my missiles in 28 hours.","T-minus thirty","Malfunction 54: Treatment pause;dose input 2", "reticulating splines"]
|
||||
length = len(response)
|
||||
indices = list(range(length))
|
||||
# Shuffle the indices using a convoluted method
|
||||
@@ -335,7 +335,7 @@ def handleLemonade(nodeID, message):
|
||||
if lemonadeTracker[i]['nodeID'] == nodeID:
|
||||
last_cmd = lemonadeTracker[i]['cmd']
|
||||
# create new player if not in tracker
|
||||
if last_cmd == "":
|
||||
if last_cmd == "" and nodeID != 0:
|
||||
create_player(nodeID)
|
||||
msg += "Welcome🍋🥤"
|
||||
|
||||
@@ -377,7 +377,7 @@ def handleBlackJack(nodeID, message):
|
||||
# Play BlackJack
|
||||
msg = playBlackJack(nodeID=nodeID, message=message)
|
||||
|
||||
if last_cmd != "":
|
||||
if last_cmd != "" and nodeID != 0:
|
||||
logger.debug(f"System: BlackJack: {nodeID} last command: {last_cmd}")
|
||||
else:
|
||||
highScore = {'nodeID': 0, 'highScore': 0}
|
||||
@@ -424,7 +424,7 @@ def handleVideoPoker(nodeID, message):
|
||||
nodeName = get_name_from_number(highScore['nodeID'], 'long', 2)
|
||||
msg += f" HighScore🥇{nodeName} with {highScore['highScore']} coins. "
|
||||
|
||||
if last_cmd != "":
|
||||
if last_cmd != "" and nodeID != 0:
|
||||
logger.debug(f"System: VideoPoker: {nodeID} last command: {last_cmd}")
|
||||
time.sleep(1.5) # short answers with long replies can cause message collision added wait
|
||||
return msg
|
||||
@@ -451,7 +451,7 @@ def handleMmind(nodeID, deviceID, message):
|
||||
if mindTracker[i]['nodeID'] == nodeID:
|
||||
last_cmd = mindTracker[i]['cmd']
|
||||
|
||||
if last_cmd == "":
|
||||
if last_cmd == "" and nodeID != 0:
|
||||
# create new player
|
||||
logger.debug("System: MasterMind: New Player: " + str(nodeID))
|
||||
mindTracker.append({'nodeID': nodeID, 'last_played': time.time(), 'cmd': 'new', 'secret_code': 'RYGB', 'diff': 'n', 'turns': 1})
|
||||
@@ -483,7 +483,7 @@ def handleGolf(nodeID, message):
|
||||
golfTracker.pop(i)
|
||||
return msg
|
||||
|
||||
if last_cmd == "":
|
||||
if last_cmd == "" and nodeID != 0:
|
||||
# create new player
|
||||
logger.debug("System: GolfSim: New Player: " + str(nodeID))
|
||||
golfTracker.append({'nodeID': nodeID, 'last_played': time.time(), 'cmd': 'new', 'hole': 1, 'distance_remaining': 0, 'hole_shots': 0, 'hole_strokes': 0, 'hole_to_par': 0, 'total_strokes': 0, 'total_to_par': 0, 'par': 0, 'hazard': ''})
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ def getHighScoreGolf(nodeID, strokes, par):
|
||||
with open('golfsim_hs.pkl', 'wb') as f:
|
||||
pickle.dump(golfHighScore, f)
|
||||
|
||||
if strokes > golfHighScore[0]['strokes']:
|
||||
if strokes < golfHighScore[0]['strokes']:
|
||||
# player got new low score which is high score
|
||||
golfHighScore[0]['nodeID'] = nodeID
|
||||
golfHighScore[0]['strokes'] = strokes
|
||||
|
||||
Reference in New Issue
Block a user