예제 #1
0
def suspense(sb):
    speakonomy = Speakonomy()
    if speakonomy.is_active():
        if not speakonomy.check_affordability(cost=20):
            return "Not enough speakerbucks for drumroll"
        speakonomy.withdraw_funds(20)

    sb._play("drumroll")

    sound = choice(sb.sounds.keys())

    sb._play(sound)
예제 #2
0
def suspense(sb):
    speakonomy = Speakonomy()
    if speakonomy.is_active():
        if not speakonomy.check_affordability(cost=20):
            return "Not enough speakerbucks for drumroll"
        speakonomy.withdraw_funds(20)

    sb._play("drumroll")
    
    sound = choice(sb.sounds.keys())

    sb._play(sound)
예제 #3
0
def spin(sb, wager):

    lost_it_all = False
    win_multiplier = 20
    outstr = None
    silent = False
    double_or_nothing = False
    cheated_death = 0
    added_message = ""

    wager_list = wager.split(" ")
    wager = wager_list[0]

    if len(wager_list) > 1 and wager_list[1] == "silent" and choice(
            range(1, 15)) != 4:
        silent = True

    speakonomy = Speakonomy()
    if wager.upper() == 'MAX':
        wager = speakonomy.get_speakerbuck_balance()
    elif wager.upper() == 'MAX69':
        wager = speakonomy.get_speakerbuck_balance()
        wager = wager - wager % 69
    elif wager.upper() == 'DON':
        double_or_nothing = True
        wager = speakonomy.get_speakerbuck_balance()
    try:
        wager = int(wager)
    except:
        return "Fuckstick, you can't wager %s" % " ".join(wager_list)

    if wager <= 0:
        return "Nice try wiseguy"
    if speakonomy.is_active():
        if not speakonomy.check_affordability(cost=wager):
            return "Not enough speakerbucks to spin"
        speakonomy.withdraw_funds(wager)
    win_sounds = [
        "price-come-on-down-1.mp3", "price-come-on-down-2.mp3",
        "price-is-right.mp3", "price-big-wheel-win.mp3"
    ]
    lose_sounds = [
        "you-lose.mp3", "good-grief.mp3", "priceisright-horns.mp3",
        "pacman-die.mp3", "sad-trombone.mp3", "wet-fart.mp3"
    ]

    rng = range(1, 20)

    if wager % 69 == 0:

        rng = range(12, 20)

        win_multiplier = choice(range(2, 20) * 2 + [69, 69, 6900])

        if choice(range(1, 20)) == 7:
            lost_it_all = True

    lucky_number = choice(rng)
    chosen_number = choice(rng)

    if chosen_number == lucky_number or wager == lucky_number:
        if wager == lucky_number:
            new_win_multiplier = choice(
                range(6, 20) + [200, 400, 600, 800, 1000, 10000])
            added_message = "And your wager matched the lucky number, you sly dog."

            if chosen_number == wager and win_multiplier == wager:
                new_win_multiplier = new_win_multiplier * 1000000
                added_message = "The wager, chosen number, lucky number and win multiplier all matched. It's a megabucks bonanza!"
            elif chosen_number == wager:
                #Triply lucky
                new_win_multiplier = new_win_multiplier * 300
                added_message += "And the chosen number matched too! You are thirty times as lucky!"

            win_multiplier = new_win_multiplier

        winner = True
    else:
        winner = False

    if double_or_nothing:
        chosen_number = randrange(1, 100)
        if chosen_number < 60:
            winner = True
            win_multiplier = 2
            added_message = "You went double or nothing and won. "
        else:
            winner = False
            added_message = "You went double or nothing and lost. "

    sp = sb.sound_player

    if winner or not silent: sp.play_sound("sounds/price-big-wheel.mp3")

    if winner:
        outcome = wager * win_multiplier
        prizes = [
            "a new car", "a european vacation", "a deluxe horse trailer",
            "new jet skis", "a trip to the moon", "a large fry",
            "a bucket of golden nuggets", "gender neutral servant robots",
            "Abraham Lincoln's death mask"
        ]
        sp.play_sound("sounds/" + choice(win_sounds))
        if speakonomy.is_active():
            speakonomy.deposit_funds(outcome)
        outstr = "You win {prize}. And {outcome} speakerbucks!".format(
            outcome=outcome, prize=choice(prizes))
        if lost_it_all:
            outstr += "You also cheated death."
            cheated_death = 1
    else:
        outstr = ""
        outcome = wager * -1
        if not silent: sp.play_sound("sounds/" + choice(lose_sounds))
        if lost_it_all:
            outcome = speakonomy.get_speakerbuck_balance() * -1
            speakonomy.withdraw_funds(speakonomy.get_speakerbuck_balance())
            outstr = "You risked it all for sexy times. And lost."

    outstr += added_message

    db.record_wager(lucky_number, wager, outcome, chosen_number,
                    win_multiplier, cheated_death)

    return outstr
예제 #4
0
def spin(sb, wager):

    lost_it_all = False
    win_multiplier = 20
    outstr = None
    silent = False
    double_or_nothing = False
    cheated_death = 0
    added_message = ""

    wager_list = wager.split(" ")
    wager = wager_list[0]

    if len(wager_list) > 1 and wager_list[1] == "silent" and choice(range(1,15)) != 4:
        silent = True

    speakonomy = Speakonomy()
    if wager.upper() == 'MAX':
        wager = speakonomy.get_speakerbuck_balance()
    elif wager.upper() == 'MAX69':
        wager = speakonomy.get_speakerbuck_balance()
        wager = wager - wager % 69
    elif wager.upper() == 'DON':
        double_or_nothing = True
        wager = speakonomy.get_speakerbuck_balance()
    try:
        wager = int(wager)
    except:
        return "Fuckstick, you can't wager %s" % " ".join(wager_list)

    if wager <= 0:
        return "Nice try wiseguy"
    if speakonomy.is_active():
        if not speakonomy.check_affordability(cost=wager):
            return "Not enough speakerbucks to spin"
        speakonomy.withdraw_funds(wager)
    win_sounds = ["price-come-on-down-1.mp3", "price-come-on-down-2.mp3", "price-is-right.mp3", "price-big-wheel-win.mp3"]
    lose_sounds = ["you-lose.mp3", "good-grief.mp3","priceisright-horns.mp3", "pacman-die.mp3", "sad-trombone.mp3", "wet-fart.mp3"]

    rng = range(1,20)

    if wager % 69 == 0:

        rng = range(12,20)

        win_multiplier = choice(range(2,20) * 2 + [69, 69, 6900])

        if choice(range(1,20)) == 7:
            lost_it_all = True

    lucky_number = choice(rng)
    chosen_number = choice(rng)

    if chosen_number == lucky_number or wager == lucky_number:
        if wager == lucky_number:
            new_win_multiplier = choice(range(6,20) + [200, 400, 600, 800, 1000, 10000])
            added_message = "And your wager matched the lucky number, you sly dog."

            if chosen_number == wager and win_multiplier == wager:
                new_win_multiplier = new_win_multiplier * 1000000
                added_message = "The wager, chosen number, lucky number and win multiplier all matched. It's a megabucks bonanza!"
            elif chosen_number == wager:
                #Triply lucky
                new_win_multiplier = new_win_multiplier * 300
                added_message += "And the chosen number matched too! You are thirty times as lucky!"

            win_multiplier = new_win_multiplier

        winner = True
    else:
        winner = False

    if double_or_nothing:
        chosen_number = randrange(1,100)
        if chosen_number < 60:
            winner = True
            win_multiplier = 2
            added_message = "You went double or nothing and won. "
        else:
            winner = False
            added_message = "You went double or nothing and lost. "

    sp = sb.sound_player

    if winner or not silent: sp.play_sound("sounds/price-big-wheel.mp3")

    if winner:
        outcome = wager*win_multiplier
        prizes = ["a new car","a european vacation", "a deluxe horse trailer", "new jet skis", "a trip to the moon", "a large fry", "a bucket of golden nuggets", "gender neutral servant robots", "Abraham Lincoln's death mask"]
        sp.play_sound("sounds/"+choice(win_sounds))
        if speakonomy.is_active():
            speakonomy.deposit_funds(outcome)
        outstr = "You win {prize}. And {outcome} speakerbucks!".format(outcome=outcome,prize=choice(prizes))
        if lost_it_all:
            outstr += "You also cheated death."
            cheated_death = 1
    else:
        outstr = ""
        outcome = wager * -1
        if not silent: sp.play_sound("sounds/"+choice(lose_sounds))
        if lost_it_all:
            outcome = speakonomy.get_speakerbuck_balance() * -1
            speakonomy.withdraw_funds(speakonomy.get_speakerbuck_balance())
            outstr = "You risked it all for sexy times. And lost."

    outstr += added_message

    db.record_wager(lucky_number, wager, outcome, chosen_number, win_multiplier, cheated_death)

    return outstr