Exemplo n.º 1
0
    def __init__(self, phenny, uid, nick):
        self.game_type = "blackjack"
        self.started = False
        self.deck = False
        self.accept_bets = False
        self.accept_surrender = False
        self.accept_doubledown = False
        self.t = False  # Used for the delay timer so that we can reset it from the !join command
        self.timer_start = 0  # Used for calculating whether or not we should reset the timer on !join
        self.starter_uid = False
        self.turns = False  # The users who have turns, in order, current is at index 0
        self.phenny = phenny

        p.add_player(0, 'Dealer')
        p.players[0].hand.hand_value = MethodType(hand_value,
                                                  p.players[0].hand)
        p.players[0].add_gold(1000000)
        self.starter_uid = uid

        self.phenny.say(
            "A new game of blackjack has begun! Type !enter if you'd like to play. You have 30 seconds to join."
        )
        self.phenny.say(p.add_to_game(self.phenny, uid))
        p.players[uid].hand.hand_value = MethodType(hand_value,
                                                    p.players[uid].hand)
        self.t = Timer(DELAY_TIME, self.begin_game)
        self.timer_start = time.time()
        self.t.start()
Exemplo n.º 2
0
 def ante(self, uid, nick=''):
     if not self.can_join:
         self.phenny.say("%s, this game has already started!" %
                         p.players[uid].name)
         return
     if uid not in p.players.keys():
         player_added = p.add_player(self.phenny, uid, nick)
     if player_added:
         if self.accept_ante == True and self.stakes != "free":
             if uid not in p.in_game:
                 self.join(uid)
             if p.players[uid].ante == True:
                 self.phenny.say("%s, you already ante'd into this game." %
                                 p.players[uid].name)
             elif p.players[uid].gold < self.stakes:
                 self.phenny.say(
                     "%s, you do not have enough gold to ante into this game. Use !buy to transfer more gold from the site."
                     % p.players[uid].name)
             else:
                 p.players[uid].place_bet(self.stakes)
                 p.players[uid].ante = True
                 self.betting_pot += self.stakes
                 self.phenny.say(
                     "%s ante'd in with %d gold. They have %d gold left." %
                     (p.players[uid].name, self.stakes,
                      p.players[uid].gold))
         else:
             self.phenny.say("Ante's are not currently being accepted.")
     else:
         self.phenny.say(
             "There was an error trying to add you into the game. Please try again."
         )
Exemplo n.º 3
0
    def __init__(self, phenny, uid, nick, turbo=False):
        self.game_type = "blackjack"
        self.turbo = turbo
        self.delay_time = 30.0
        self.started = False
        self.deck = False
        self.accept_bets = False
        self.accept_surrender = False
        self.accept_doubledown = False
        self.accept_split = False
        self.t = False  # Used for the delay timer so that we can reset it from the !join command
        self.timer_start = 0  # Used for calculating whether or not we should reset the timer on !join
        self.starter_uid = False
        self.turns = False  # The users who have turns, in order, current is at index 0
        self.phenny = phenny

        p.add_player(phenny, 0, 'Dealer')
        p.players[0].hand.hand_value = MethodType(hand_value,
                                                  p.players[0].hand)
        p.players[0].add_gold(1000000)
        self.starter_uid = uid

        if self.turbo:
            self.phenny.say(
                "A new game of turbo blackjack has begun! This is a sped up version of our normal blackjack. Make sure you are ready to go fast! Type !enter if you'd like to play. You have 10 seconds to join."
            )
            self.delay_time = DELAY_SPEED_TIME
        else:
            self.phenny.say(
                "A new game of blackjack has begun! Type !enter if you'd like to play. You have 30 seconds to join."
            )
            self.delay_time = DELAY_TIME
        self.phenny.say(p.add_to_game(self.phenny, uid))
        p.players[uid].hand.hand_value = MethodType(hand_value,
                                                    p.players[uid].hand)
        self.t = Timer(self.delay_time, self.begin_game)
        self.timer_start = time.time()
        self.t.start()
Exemplo n.º 4
0
def join_casino(input):
    if input.nick not in bots and input.uid not in p.players.keys():
        p.add_player(input.uid, input.nick)
Exemplo n.º 5
0
def add_player_func(playername, word, opponent):
    try:
        add_player(playername, word, opponent)
    except:
        pass
Exemplo n.º 6
0
def join_casino(phenny, input):
    if input.nick not in bots and input.uid not in p.players.keys():
        return p.add_player(phenny, input.uid, input.nick)
    elif input.uid in p.players.keys():
        return True