예제 #1
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.')
예제 #2
0
def gamethings(bot, trigger):
    try:
        global gameMode
        global fartList
        global shartList
        global chosen_scenario
        theirResponse = str(trigger.group(0))
        name = str(trigger.nick)
        amount = int(chosen_scenario.giveAmount())
        balance = int(gravecoin.check_balance(name))

        if gameMode == 1:
            if name in fartList:
                fartList.remove(name)
                if theirResponse =='1':
                    return
                if theirResponse =='2':
                    shartList.append(name)
                    fartList.remove(name)
                    return
                    
            if name in shartList:
                if theirResponse =='1':
                    shartlist.append(name)
                    fartList,append(name)
                    return
                if theirResponse =='2':
                    return

            if theirResponse == '1':
                if amount > balance:
                    bot.say("You need %s to play this round, you only have %s" % (amount,balance))
                    return
                fartList.append(name)

            if theirResponse == '2':
                if amount > balance:
                    bot.say("You need %s to play this round, you only have %s" % (amount,balance))
                    return
                shartList.append(name)

            
        else:
            return
    except:
        pass
예제 #3
0
def buy(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 buy, and how many shares.')
            return
    
    if shares < 0:
        bot.say('Enter a valid amount of stocks')
        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)
    if price < 1:
            bot.say('Stock has crashed. Please wait until it is restored')
            return


    price_total = market.get_balance(ticker) * shares
    their_balance = gravecoin.check_balance(name)
    if int(price_total) > int(their_balance):
        max_shares = (int(their_balance) / int(price))
        bot.say('The price for %s shares of %s is ɷ %s. You only have ɷ %s. At most you can buy %s shares' % (shares,ticker,price_total,their_balance,max_shares))
        return
    bot.say('Buying %s shares of %s for ɷ %s ' %(shares,ticker,price_total))
    trade = StockTrade()
    try:
        trade.open_db(saved_stocks)
        trade.buy_stocks(name,ticker,shares,price)
        gravecoin.debit_user(name,price_total)
    except:
        bot.say('Something broken, you have probably not been charged. Probably')