def get_free_chips(self): if self.free_chips_available(): self.last_free_chip_date = datetime.date.today() self.save() deposit_chips(self.bcc_id, 500, dbconf.FRONTEND_USER, dbconf.FRONTEND_PASS) else: message = "You only get free chips once per day!" send_user_message(self.bcc_id, "ERROR", message)
def remove_user(self, bcc_id): """Remove a user from the table Arguments: bcc_id -- a string representing the bcc ID of the player to be removed from the table. Return True if the user is removed and False if the user isn't at the table """ self.logger.info('Attempting to remove %s from table', bcc_id) for i in range(self.num_seats): if (self.seats[i] is not None and self.seats[i].bcc_id == bcc_id): user = self.seats[i] self.logger.info('Found user to be removed') self.seats[i] = None self.remove_user_from_round(bcc_id) self.logger.info('Removed %s from table', bcc_id) deposited, message = vault.deposit_chips(user.bcc_id, user.chips, self.dbuser, self.dbpass) self.logger.info('Attempted to add user\'s chips to table') if deposited is False: # Note: This message can't be sent directly to the user. # A player can be removed from the table automatically, so # it can't be guaranteed that the user will receive the # error if it's returned from this function. It must be # sent a different way. user.send_account_error(message) return True self.logger.info('Failed to remove %s from table', bcc_id) return False