Last active
August 18, 2018 17:12
-
-
Save Aareon/e4a577b9f0b54bfe0537 to your computer and use it in GitHub Desktop.
Edit: Indented too far in tip()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from util.hook import * | |
import random | |
import math | |
import time | |
from collections import Counter | |
bJ = 'blackjack' | |
doGamble = 0 | |
tipbotName = 'LDoge-Tipbot' | |
dice = [] | |
notCasinoChan = ["#doge-coin","#ldoge-casino","#litedoge"] | |
casbalFile = open('balance.txt', 'r+') | |
casinobal = casbalFile.readlines() | |
kittyBal = float(casinobal[0]) | |
betNick = "" | |
betAmt = 0 | |
bombSerial = "" | |
bombColors = [] | |
@hook(cmds=['tipshare']) | |
def tipshare(code, input): | |
if input.nick in ['Aareon']: | |
#Do kittyBal | |
casbalFile = open('balance.txt', 'r+') | |
casinobal = casbalFile.readlines() | |
kittyBal = float(casinobal[0]) | |
#End kittyBal | |
share = input.split('!tipshare ') | |
shareAmt = share.split(' ') | |
kittyBal -= float(shareAmt[1]) | |
code.say('!tip '+share[1]) | |
else: | |
return() | |
@hook(cmds=["disable"]) | |
def disable(code, input): | |
if input.admin == True: | |
doChan = input.split(' ') | |
doChanNum = len(doChan) | |
print(doChanNum) | |
if input.channel not in notCasinoChan: | |
if doChanNum == 1: | |
notCasinoChan.append = input.channel | |
code.say('Gambling in this channel has been disabled by '+input.nick+'.') | |
elif doChanNum == 2: | |
if doChan[1] in notCasinoChan: | |
code.msg(input.nick,'Gambling in '+input.channel+' has already been disabled.') | |
if doChan[1] in ['list']: | |
for i in notCasinoChan[i]: | |
i = doChanNum | |
code.msg(input.nick,notCasinoChan[i]) | |
else: | |
notCasinoChan.append = doChan[1] | |
elif doChanNum == 3: | |
if doChan[2] in ['remove']: | |
if doChan[1] in notCasinoChan: | |
notCasinoChan.remove(doChan[1]) | |
else: | |
code.msg(input.nick,"Gambling in that channel wasn't disabled.") | |
else: | |
return() | |
else: | |
code.msg(input.nick,'Gambling in '+input.channel+' has already been disabled.') | |
@hook(cmds=["kitty"]) | |
def kitty(code,input): | |
code.say("Casino Balance is: "+str(kittyBal)+" {green}LDoge.") | |
return() | |
@hook(rule=r'.*tipped') | |
def tip(code,input): | |
##Begin new verify | |
me = code.nick.lower() | |
doInput = input.split('tipped') | |
doNewInput = input.split(' ') | |
if me == doNewInput[2].lower(): | |
if input.channel not in notCasinoChan: | |
if tipbotName == input.nick: | |
try: | |
#Do kittyBal | |
casbalFile = open('balance.txt', 'r+') | |
casinobal = casbalFile.readlines() | |
kittyBal = float(casinobal[0]) | |
#End kittyBal | |
inp = input.split(' ') | |
betReal = float(inp[3]) | |
kittyBal += betReal | |
betAmt = int(math.floor(betReal)) | |
betNick = inp[8] | |
if betNick.lower() in me: | |
return() | |
betNickLog = code.chan["#litedoge-casino"][betNick] | |
checkMsg = [i['message'] for i in betNickLog['messages']][-1] | |
msg = checkMsg.split(' ') | |
if msg[3].lower() in ['flip','coin','toss','cointoss','coin-toss']: | |
betFace = msg[4] | |
if betAmt <= 1000: | |
flip(code,betNick,betAmt,betFace,kittyBal) | |
return() | |
else: | |
kittyBal -= betReal | |
code.say("!tip "+betNick+" "+str(betAmt)+ ' Maximum bet is 1000') | |
return() | |
elif msg[3].lower() in ['donate','donation']: | |
code.say('{red}'+betNick+': Thanks for the donation!') | |
elif msg[3].lower() in ['dice','roll']: | |
betDice = int(math.floor(float(msg[4]))) | |
if betAmt <= 3000: | |
dice(code,betNick,betAmt,betDice,kittyBal) | |
else: | |
kittyBal -= betReal | |
code.say("!tip "+betNick+" "+str(betAmt)+ ' Maximum bet is 3000') | |
return() | |
elif msg[3].lower() in ['two','two-up','twoup']: | |
if betAmt >= 1: | |
if betAmt <= 10000: | |
twoup(code,betNick,betAmt,kittyBal) | |
else: | |
kittyBal -= betReal | |
code.say(betNick+": You must bet at least 1, and a maximum of 10000") | |
code.say('!tip '+betNick+' '+str(betAmt)) | |
else: | |
kittyBal -= betReal | |
code.say(betNick+": You must bet at least 1, and a maximum of 10000") | |
code.say('!tip '+betNick+' '+str(betAmt)) | |
else: | |
kittyBal -= betReal | |
code.say("{red}"+betNick+": That's not a game, silly.") | |
code.say("!tip "+betNick+" "+str(betAmt)) | |
return() | |
except ValueError: | |
kittyBal -= betReal | |
code.say("{red}"+betNick+": Looks like you're missing something. Try !games") | |
code.say('!tip '+betNick+' '+str(betAmt)) | |
except IndexError: | |
kittyBal -= betReal | |
code.say("{red}"+betNick+": Looks like you're missing something. Try !games") | |
code.say('!tip '+betNick+' '+str(betAmt)) | |
#game is [3], last param is [4] | |
#Get value of tip and sender | |
#Set chanlog to a variable | |
#Get last message of sender (i) | |
#If last message of sender contains tip value then | |
#Get bet parameters (flip, blackjack, bomb, etc.) | |
#Else check last message (i) -1 | |
#If input.nick is not tipbotName, return() | |
###End new verify | |
def flip(code,betNick,betAmt,betFace,betReal): | |
try: | |
if betFace.lower() in ["heads","tails"]: | |
coin = random.randint(1,2) | |
if coin == 1: | |
landFace = "heads" | |
else: | |
landFace = "tails" | |
toWin = (betAmt*.3)*.97 | |
betTotal = betAmt+toWin | |
if betFace in landFace: | |
kittyBal -= float(betTotal) | |
code.say("You bet "+str(betAmt)+" ldoge on "+betFace+". The coin landed on "+landFace+". You win "+str(toWin)+"!") | |
code.say("!tip "+betNick+' '+str(betTotal)) | |
return() | |
else: | |
code.say("You bet "+str(betAmt)+" ldoge on "+betFace+". The coin landed on "+landFace+'. You lose.') | |
return() | |
else: | |
kittyBal -= betAmt | |
code.say(betNick+": Looks like you're missing something. Try !flip <Amount> <Heads/Tails>") | |
code.say("!tip "+betNick+" "+str(betAmt)) | |
return() | |
except ValueError: | |
kittyBal -= betAmt | |
code.say(betNick+": Looks like you're missing something. Try !flip <Amount> <Heads/Tails>") | |
code.say('!tip '+betNick+' '+betAmt) | |
def dice(code,betNick,betAmt,betDice,kittyBal): | |
dice = [] | |
try: | |
if betDice > 6 or betDice < 1: | |
kittyBal -= betAmt | |
code.say(betNick+': You must bet on a number between 1-6.') | |
code.say('!tip '+betNick+' '+str(betAmt)) | |
return() | |
else: | |
dice.append(random.randint(1, 6)), dice.append(random.randint(1, 6)), dice.append(random.randint(1, 6)), dice.append(random.randint(1, 6)) | |
dieTotal = dice.count(betDice) | |
if dieTotal > 0: | |
dieWin = (betAmt*(.25*dieTotal))-.97 | |
dieWinTotal = dieWin+betAmt | |
kittyBal -= dieWinTotal | |
code.say(betNick+': You bet on '+str(betDice)+'. Out of 4 dice, '+str(dieTotal)+' landed on '+str(betDice)+'. You win '+str(dieWin)+'!') | |
code.say('!tip '+betNick+' '+str(dieWinTotal)) | |
else: | |
code.say(betNick+': You bet on '+str(betDice)+'. Out of 4 dice, '+str(dieTotal)+' landed on '+str(betDice)+'. You lost.') | |
return() | |
except IndexError: | |
kittyBal -= betAmt | |
code.say("{red}"+betNick+": Looks like you're missing something. Try !games") | |
code.say('!tip '+betNick+' '+str(betAmt)) | |
except ValueError: | |
kittyBal -= betAmt | |
code.say("{red}"+betNick+": Looks like you're missing something. Try !games") | |
code.say('!tip '+betNick+' '+str(betAmt)) | |
def twoup(code,betNick,betAmt,kittyBal): | |
twoFace = [] | |
try: | |
code.say('{blue}Ladies and gents! If I may have your attention, please. If you will, turn your head to '+betNick+', they have begun a game of TWO-UP!!! Let the games begin!') | |
twoFace.append(random.choice(["heads","tails"])),twoFace.append(random.choice(["heads","tails"])) | |
code.say('{blue}The first set is... '+twoFace[0]+' & '+twoFace[1]) | |
if twoFace[0] == twoFace[1]: | |
if twoFace[0] == 'heads': | |
betWin = betAmt+(betAmt*.5)-.97 | |
kittyBal -= betWin | |
code.say("{blue}We've got a winner! "+betNick+" wins "+str(betWin)+'!') | |
code.say('!tip '+betNick+' '+str(betWin)) | |
if twoFace[0] == 'tails': | |
code.say('{blue}Aww, two tails. Better luck next time, pal.') | |
else: | |
code.say('{blue}Oooh, odds. Let me roll for you again. The goal is to get 2 more odds for the double or nothing.') | |
##Second Roll | |
twoFace = [] | |
twoFace.append(random.choice(['heads','tails'])), twoFace.append(random.choice(['heads','tails'])) | |
code.say('{blue}The second set is... '+twoFace[0]+' & '+twoFace[1]) | |
if twoFace[0] == twoFace[1]: | |
if twoFace[0] == 'heads': | |
betWin = betAmt+(betAmt*.75)-.97 | |
kittyBal -= betWin | |
code.say("{blue}We've got a winner! "+betNick+" wins "+str(betWin)+'!') | |
code.say('!tip '+betNick+' '+str(betWin)) | |
return() | |
if twoFace[0] == 'tails': | |
code.say('{blue}Aww, two tails. Better luck next time, pal.') | |
return() | |
else: | |
code.say('{blue}Oooh, another odds. This is gotta be a record or something. Let me roll for you again.') | |
##Third Roll | |
twoFace = [] | |
twoFace.append(random.choice(['heads','tails'])), twoFace.append(random.choice(['heads','tails'])) | |
code.say('{blue}The third set is... '+twoFace[0]+' & '+twoFace[1]) | |
if twoFace[0] == twoFace[1]: | |
if twoFace[0] == 'heads': | |
betWin = betAmt+(betAmt*.85)-.97 | |
kittyBal -= betWin | |
code.say("{blue}We've got a winner! "+betNick+" wins "+str(betWin)+'!') | |
code.say('!tip '+betNick+' '+str(betWin)) | |
return() | |
if twoFace[0] == 'tails': | |
code.say('{blue}Aww, two tails. Better luck next time, pal.') | |
return() | |
else: | |
code.say('{blue}Oooh, another odds! This time we roll for double or nothing :D') | |
twoFace = [] | |
twoFace.append(random.choice(['heads','tails'])), twoFace.append(random.choice(['heads','tails'])) | |
code.say('{blue}The third set is... '+twoFace[0]+' & '+twoFace[1]) | |
if twoFace[0] == twoFace[1]: | |
if twoFace[0] == 'heads': | |
betWin = betAmt+(betAmt)-.97 | |
kittyBal -= betWin | |
code.say("{blue}We've got a winner! "+betNick+" wins "+str(betWin)+'!') | |
code.say('!tip '+betNick+' '+str(betWin)) | |
return() | |
if twoFace[0] == 'tails': | |
code.say('{blue}Aww, two tails. Better luck next time, pal.') | |
return() | |
else: | |
betWin = betAmt+(betAmt*.95) | |
kittyBal -= betWin | |
code.say("{blue}Another odds? Look. Here's what I'll do for you. I'll give you .95 times whatever you bet. Plus, I won't even take house edge. Sound good? Awesome. Here ya' go.") | |
code.say('!tip '+betNick+' '+str(betWin)) | |
return() | |
except IndexError: | |
kittyBal -= betAmt | |
code.say("IndexError: Looks like something went wrong :(") | |
code.say('!tip '+betNick+' '+betAmt) | |
except ValueError: | |
kittyBal -= betAmt | |
code.say("ValueError: Looks like something went wrong :(") | |
code.say('!tip '+betNick+' '+betAmt) | |
#def bomb(code,betNick,betAmt): | |
# if input.channel in notCasinoChan: | |
# code.say("You can't do that here!") | |
# else: | |
# betNick = input.nick | |
# splitNick = input.split(' ') | |
# try: | |
# betAmt = int(math.floor(float(splitNick[1]))) | |
# bombSerial = [] | |
# bombColors = [] | |
# code.say(betNick+": Try !tip "+code.nick+" <Amount> bomb, then follow the prompts.") | |
# alpha =["Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel","India", | |
# "Juliet","Kilo","Lima","Mike","November","Oscar","P","Quebec","Romeo", | |
# "Sierra","Tango","Uniform","Victor","Whiskey","X-ray","Yankee","Zulu"] | |
# | |
# wireColor = ['Red','Blue','Green','Yellow','Orange','Black','White','Violet'] | |
# i = random.randint(0, 25) | |
# bombSerial.append(alpha[i]) | |
# bombSerial.append(str(random.randint(1, 36))) | |
# code.say(betNick+ ': The bomb nicknamed '+bombSerial[0]+'-'+bombSerial[1]+' has been activated! Your job is to disable this bomb; be it temporarily or permanently. Cut two wires to disable it temporarily, or cut all four to disable it forever.') | |
# for x in range(0,5): | |
# i = random.choice(wireColor) | |
# if i not in bombColors: | |
# bombColors.append(i) | |
# else: | |
# wireColor.remove(i) | |
# bombColors.append(random.choice(wireColor)) | |
# bombWiresText = (bombColors[0]+", "+bombColors[1]+", "+bombColors[2]+", "+bombColors[3]+".") | |
# code.say("Bomb Wire Colors are; "+bombWiresText) | |
# code.say(betNick+": Use !cutwire to cut a wire. Choose wisely.") | |
# cutwire(code,betNick) | |
# | |
# except IndexError: | |
# code.say(betNick+": Looks like you're missing something. Try '!bomb <Amount>'.") | |
# #cutwire(code,betNick,betAmt,bombSerial,bombColors) | |
# #Get phonic nickname, make 4 wires. Cut two wires temporarily disables the bomb. Cut all four to permenantly disable it. | |
# | |
#def cutwire(code, input): | |
# if betNick == input.nick: | |
# splitInp = input.split(' ') | |
# wireToCut = input.strip(input.nick) | |
# code.say(wireToCut) | |
# else: | |
# code.say("You're not "+betNick+"!") | |
#def blackjack(code,betNick,betAmt): | |
# if input.channel not in notCasinoChan: | |
# code.say(betNick+": Try !tip "+code.nick+" <Amount> blackjack, then follow the prompts.") | |
# else: | |
# code.reply("I'm working on it!") | |
# #cardFace = ['K':10, 'Q':10, 'J':10, 'A':1] | |
# ##Deal two cards at random, from cardFace and 2-10. Card Face has 16/52 chance to deal K-J, and a 4/52 chance to deal and Ace |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment