示例#1
0
def playGame(bot, trigger):
    global gameMode
    global fartList
    global shartList
    global chosen_scenario
  
    chosen_scenario = random.choice(scenarios)
    chosen_outcome = chosen_scenario.chooseOutcome()
    sayScenario = str(chosen_scenario.giveScenario())
    bot.say(sayScenario)
    bot.say('Press 1 for Fart. Press 2 for Shart.')
    time.sleep(10)
    
    fartlist = str(', '.join(fartList))
    shartlist = str(', '.join(shartList))
    bot.say(chosen_outcome)
    if chosen_scenario.outcome == chosen_scenario.fart:
        bot.say('Winners: %s ' %(fartlist))
        for winner in fartList:
            gravecoin.credit_user(winner,chosen_scenario.amount)
        for loser in shartList:
            gravecoin.debit_user(loser,chosen_scenario.amount)

    if chosen_scenario.outcome == chosen_scenario.shart:
        bot.say('Winners: %s ' %(shartlist))
        for winner in shartList:
            gravecoin.credit_user(winner,chosen_scenario.amount)
        for loser in fartList:
            gravecoin.debit_user(loser,chosen_scenario.amount)
        
    time.sleep(1)
    gameMode = 0
    fartList = []
    shartList = []
示例#2
0
def sell(bot, trigger):
    name = trigger.nick
    try:
        shares = int(trigger.group(3))
        ticker = str(trigger.group(4).upper())
        
    except:
        try:
            shares = int(trigger.group(4))
            ticker = str(trigger.group(3).upper())
            
        except:
            bot.say('Enter which stock you\'d like to sell, and how many shares.')
            return
    if ticker not in stocks:
        bot.say('%s is not a valid stock.' % (ticker))
        return


    market = StockMarket()
    market.open_db(file_Name)
    price = market.get_balance(ticker)
    price_total = market.get_balance(ticker) * shares
    
    trade = StockTrade()
    trade.open_db(saved_stocks)
    try:
        trade.sell_stocks(name,ticker,int(shares),int(price))
        bot.say('Selling %s shares of %s for ɷ %s' %(shares,ticker,price_total))
        gravecoin.credit_user(name,price_total)

    except ValueError:
        bot.say('You don\'t have %s shares of %s.' % (shares,ticker))
示例#3
0
def gamethings(bot, trigger):
	global chosenClue
	global chosenAnswer
	global filler
	global maxLet
	global curLet
	global gameMode
	global quitCheck
	theirGuess = trigger.group(0)
	if gameMode == 0:
		return
	if gameMode == 1:
		if chosenAnswer.upper() in theirGuess.upper():
			bot.say((trigger.nick).upper() + " GOT IT!")
			chosenClue = random.choice(clues.keys())
			chosenAnswer = clues[chosenClue]
			gameMode = 0
			gravecoinmg.credit_user(trigger.nick,25)
			bot.say("Depositing 25 GraveCoins into " + trigger.nick + "'s account.")
		else:
			return
示例#4
0
def gamble(bot, trigger):
    name = trigger.nick
    if not trigger.group(3):
        bot.say('Specify how much you\'d like to wager')
        return
#        bot.say(trigger.group(2))#EVERYTHING
#        bot.say(trigger.group(3))#FIRST WORD (NAME)
#        bot.say(trigger.group(4))#SECOND WORD (MONEY)
    amount = int(trigger.group(3))
    balance = int(gravecoin.check_balance(name))
    if amount > balance:
        bot.say("You only have %s to spend." %(balance))
        return
    gravecoin.debit_user(name,amount)
    first_item = random.choice(items)
    second_item = random.choice(items)
    third_item = random.choice(items)
    chosen_items = [first_item,second_item,third_item]
    
    bot.say('| %s | %s | %s |' % (first_item, second_item, third_item))
    if sorted(trifecta) == sorted(chosen_items):
        winnings = (amount * 2)
        bot.say('You got the Trifecta! You win %s!' % (winnings))
        winnings = winnings + amount
        gravecoin.credit_user(name,winnings)

    elif sorted(cockandballs) == sorted(chosen_items):
        winnings = (amount * 3)
        bot.say('You got the C**k And Balls! You win %s!' % (winnings))
        winnings = winnings + amount
        gravecoin.credit_user(name,winnings)
        
    elif sorted(santorum) == sorted(chosen_items):
        winnings = (amount * 2)
        bot.say('You got a Santorum! You win %s!' % (winnings))
        winnings = winnings + amount
        gravecoin.credit_user(name,winnings)

    elif sorted(snakeEyes) == sorted(chosen_items):
        winnings = (amount * 3)
        bot.say('You got Snake Eyes! You win %s!' % (winnings))
        winnings = winnings + amount
        gravecoin.credit_user(name,winnings)
        
    elif first_item == second_item == third_item:
        winnings = (amount * 4)
        bot.say('You got three matches! You win %s!' % (winnings))
        winnings = winnings + amount
        gravecoin.credit_user(name,winnings)

    elif first_item == second_item or second_item == third_item or first_item == third_item:
        winnings = amount * 2
        bot.say('You got two matches! You win %s!' % (winnings))
        gravecoin.credit_user(name,winnings)
        
    else:
        bot.say('You lose.')