This commit is contained in:
NikolajDanger
2020-08-20 15:28:43 +02:00
parent f9cfe77d86
commit 0e4bdea3c7
3 changed files with 49 additions and 24 deletions

View File

@ -24,10 +24,10 @@ class Monopoly():
self.bot.database["monopoly games"].insert_one(newGame)
try:
self.draw.drawImage(channel)
except:
logThis("Error drawing board (error code 1640)")
#try:
self.draw.drawImage(channel)
#except:
# logThis("Error drawing board (error code 1640)")
return "Started a monopoly game. Use \"!monopoly join\" to join within the next minute.", True, False, True, True
else:
@ -73,6 +73,8 @@ class Monopoly():
return self.monopolyRoll(channel,user)
except:
logThis("Error rolling (error code 1650)")
elif commands[0] == "stop":
return self.monopolyStop(channel)
else:
return "I didn't understand that (error code 1602)", False, False, False, False
@ -95,10 +97,10 @@ class Monopoly():
self.bot.database["monopoly games"].update_one({"_id":channel},{"$set":{"turn":turn}})
playerList = list(game["players"].keys())
try:
self.draw.drawImage(channel)
except:
logThis("Error drawing board (error code 1640)")
#try:
self.draw.drawImage(channel)
#except:
# logThis("Error drawing board (error code 1640)")
if playerList == []:
return "No one joined. Ending game.", False, True, True
@ -112,7 +114,7 @@ class Monopoly():
turn = game["turn"]
currentPlayer = game["player list"][turn]
if user == currentPlayer:
if user == currentPlayer or self.bot.options.testing:
rolls = [random.randint(1,6),random.randint(1,6)]
message = self.bot.funcs.getName(user)+" rolled a "+str(rolls[0])+" and a "+str(rolls[1])+"."
if rolls[0] == rolls[1]:
@ -129,10 +131,14 @@ class Monopoly():
self.bot.database["monopoly games"].update_one({"_id":channel},{"$set":{"players."+user+".position":newPosition}})
self.bot.database["monopoly games"].update_one({"_id":channel},{"$set":{"last roll":rolls}})
try:
self.draw.drawImage(channel)
except:
logThis("Error drawing board (error code 1640)")
#try:
self.draw.drawImage(channel)
#except:
# logThis("Error drawing board (error code 1640)")
return message, True, True, False, True
else: return "", False, False, False, False
def monopolyStop(self,channel):
self.bot.funcs.deleteGame("monopoly games",channel)
return "Stopped game", False, False, False, False