🐛
This commit is contained in:
28
Gwendolyn.py
28
Gwendolyn.py
@ -21,7 +21,7 @@ blackjackDecks = 4
|
|||||||
meanWords = ["stupid", "bitch", "fuck", "dumb", "idiot"]
|
meanWords = ["stupid", "bitch", "fuck", "dumb", "idiot"]
|
||||||
|
|
||||||
# Loop of game rounds
|
# Loop of game rounds
|
||||||
async def blackjackLoop(channel,gameRound):
|
async def blackjackLoop(channel,gameRound,gameID):
|
||||||
logThis("Loop "+str(gameRound))
|
logThis("Loop "+str(gameRound))
|
||||||
|
|
||||||
with open("resources/games/oldImages/blackjack"+str(channel), "r") as f:
|
with open("resources/games/oldImages/blackjack"+str(channel), "r") as f:
|
||||||
@ -46,11 +46,12 @@ async def blackjackLoop(channel,gameRound):
|
|||||||
|
|
||||||
if str(channel) in data["blackjack games"]:
|
if str(channel) in data["blackjack games"]:
|
||||||
realRound = data["blackjack games"][str(channel)]["round"]
|
realRound = data["blackjack games"][str(channel)]["round"]
|
||||||
|
realGameID = data["blackjack games"][str(channel)]["id"]
|
||||||
|
|
||||||
if gameRound == realRound:
|
if gameRound == realRound and realGameID == gameID:
|
||||||
if gamedone == False:
|
if gamedone == False:
|
||||||
logThis("Loop "+str(gameRound)+" calling blackjackLoop()")
|
logThis("Loop "+str(gameRound)+" calling blackjackLoop()")
|
||||||
await blackjackLoop(channel,gameRound+1)
|
await blackjackLoop(channel,gameRound+1,gameID)
|
||||||
else:
|
else:
|
||||||
new_message = blackjackFinish(str(channel))
|
new_message = blackjackFinish(str(channel))
|
||||||
await channel.send(new_message)
|
await channel.send(new_message)
|
||||||
@ -442,11 +443,12 @@ async def parseCommands(message,content):
|
|||||||
if len(data["blackjack games"][str(message.channel)]["user hands"]) == 0:
|
if len(data["blackjack games"][str(message.channel)]["user hands"]) == 0:
|
||||||
gamedone = True
|
gamedone = True
|
||||||
await message.channel.send("No one entered the game. Ending the game.")
|
await message.channel.send("No one entered the game. Ending the game.")
|
||||||
|
gameID = data["blackjack games"][str(message.channel)]["id"]
|
||||||
|
|
||||||
# Loop of game rounds
|
# Loop of game rounds
|
||||||
if gamedone == False:
|
if gamedone == False:
|
||||||
logThis("!blackjack calling blackjackLoop()")
|
logThis("!blackjack calling blackjackLoop()")
|
||||||
await blackjackLoop(message.channel,1)
|
await blackjackLoop(message.channel,1,gameID)
|
||||||
else:
|
else:
|
||||||
new_message = blackjackFinish(str(message.channel))
|
new_message = blackjackFinish(str(message.channel))
|
||||||
await message.channel.send(new_message)
|
await message.channel.send(new_message)
|
||||||
@ -468,7 +470,7 @@ async def parseCommands(message,content):
|
|||||||
# Hitting
|
# Hitting
|
||||||
elif content.startswith("blackjack hit"):
|
elif content.startswith("blackjack hit"):
|
||||||
if content == "blackjack hit" or content == "blackjack hit ":
|
if content == "blackjack hit" or content == "blackjack hit ":
|
||||||
response= blackjackHit(str(message.channel),message.author.display_name)
|
response = blackjackHit(str(message.channel),message.author.display_name)
|
||||||
else:
|
else:
|
||||||
commands = content.split(" ")
|
commands = content.split(" ")
|
||||||
try:
|
try:
|
||||||
@ -481,8 +483,10 @@ async def parseCommands(message,content):
|
|||||||
await message.add_reaction("👍")
|
await message.add_reaction("👍")
|
||||||
try:
|
try:
|
||||||
if response[6] == "T":
|
if response[6] == "T":
|
||||||
|
with open("resources/games/games.json", "r") as f:
|
||||||
|
gameID = json.load(f)["blackjack games"][str(message.channel)]["id"]
|
||||||
logThis("Hit calling blackjackLoop()")
|
logThis("Hit calling blackjackLoop()")
|
||||||
await blackjackLoop(message.channel,int(response[7:])+1)
|
await blackjackLoop(message.channel,int(response[7:])+1,gameID)
|
||||||
except:
|
except:
|
||||||
logThis("Something fucked up")
|
logThis("Something fucked up")
|
||||||
await message.channel.send("something fucked up")
|
await message.channel.send("something fucked up")
|
||||||
@ -498,8 +502,10 @@ async def parseCommands(message,content):
|
|||||||
await message.add_reaction("👍")
|
await message.add_reaction("👍")
|
||||||
try:
|
try:
|
||||||
if response[6] == "T":
|
if response[6] == "T":
|
||||||
|
with open("resources/games/games.json", "r") as f:
|
||||||
|
gameID = json.load(f)["blackjack games"][str(message.channel)]["id"]
|
||||||
logThis("Stand calling blackjackLoop()")
|
logThis("Stand calling blackjackLoop()")
|
||||||
await blackjackLoop(message.channel,int(response[7:])+1)
|
await blackjackLoop(message.channel,int(response[7:])+1,gameID)
|
||||||
except:
|
except:
|
||||||
logThis("Something fucked up")
|
logThis("Something fucked up")
|
||||||
await message.channel.send("something fucked up")
|
await message.channel.send("something fucked up")
|
||||||
@ -519,8 +525,10 @@ async def parseCommands(message,content):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if roundDone[0] == "T":
|
if roundDone[0] == "T":
|
||||||
|
with open("resources/games/games.json", "r") as f:
|
||||||
|
gameID = json.load(f)["blackjack games"][str(message.channel)]["id"]
|
||||||
logThis("Double calling blackjackLoop()")
|
logThis("Double calling blackjackLoop()")
|
||||||
await blackjackLoop(message.channel,int(roundDone[1:])+1)
|
await blackjackLoop(message.channel,int(roundDone[1:])+1,gameID)
|
||||||
except:
|
except:
|
||||||
logThis("Something fucked up")
|
logThis("Something fucked up")
|
||||||
await message.channel.send("something fucked up")
|
await message.channel.send("something fucked up")
|
||||||
@ -533,8 +541,10 @@ async def parseCommands(message,content):
|
|||||||
|
|
||||||
#try:
|
#try:
|
||||||
if roundDone[0] == "T":
|
if roundDone[0] == "T":
|
||||||
|
with open("resources/games/games.json", "r") as f:
|
||||||
|
gameID = json.load(f)["blackjack games"][str(message.channel)]["id"]
|
||||||
logThis("Split calling blackjackLoop()")
|
logThis("Split calling blackjackLoop()")
|
||||||
await blackjackLoop(message.channel,int(roundDone[1:])+1)
|
await blackjackLoop(message.channel,int(roundDone[1:])+1,gameID)
|
||||||
#except:
|
#except:
|
||||||
# logThis("Something fucked up")
|
# logThis("Something fucked up")
|
||||||
# await message.channel.send("something fucked up")
|
# await message.channel.send("something fucked up")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import random
|
import random
|
||||||
import json
|
import json
|
||||||
import math
|
import math
|
||||||
|
import datetime
|
||||||
|
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
|
|
||||||
@ -517,8 +518,9 @@ def blackjackStart(channel:str):
|
|||||||
if channel not in data["blackjack games"]:
|
if channel not in data["blackjack games"]:
|
||||||
|
|
||||||
dealerHand = [drawCard(),drawCard()]
|
dealerHand = [drawCard(),drawCard()]
|
||||||
|
gameID = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
|
||||||
|
|
||||||
data["blackjack games"][channel] = {"dealer hand": dealerHand,"dealer busted":False,"dealer blackjack":False,"user hands": {},"all standing":False,"round":0}
|
data["blackjack games"][channel] = {"dealer hand": dealerHand,"dealer busted":False,"dealer blackjack":False,"user hands": {},"all standing":False,"round":0,"id":gameID}
|
||||||
|
|
||||||
if calcHandValue(dealerHand) == 21:
|
if calcHandValue(dealerHand) == 21:
|
||||||
data["blackjack games"][channel]["dealer blackjack"] = True
|
data["blackjack games"][channel]["dealer blackjack"] = True
|
||||||
|
Reference in New Issue
Block a user