Exemple #1
0
 def _trigger_played_match(self, match_type):
     if MatchSoloQueue.query(MatchSoloQueue.type == match_type).count() >= 2:
         match_solo_queues = [match_queue for match_queue in MatchSoloQueue.query(MatchSoloQueue.type == match_type).fetch(10)]
         players = [match_queue.player.get() for match_queue in match_solo_queues]
         match = Match(type=match_type)
         match.setup_soloqueue_match(players)
         ndb.delete_multi([queue.key for queue in match_solo_queues])
         for player in players:
             player.doing = match.key
             player.put()
             websocket_notify_player("Player_MatchFound", player.key, None, match.get_data())
Exemple #2
0
    def post(self):
        player = current_user_player()

        if player.doing:
            error_400(self.response, "ERROR_PLAYER_BUSY", "Player is busy.")
            return

        bot_match = Match(type="Bot")
        bot_match.setup_bot_match(player)

        player.doing = bot_match.key
        player.put()

        set_json_response(self.response, bot_match.get_data("full"))