Esempio n. 1
0
    def __init__(self):
        super(EditLoadoutController, self).__init__()
        self.username = auth_tests.get_auth()
        logging.debug("post get_auth")

        player = auth_tests.get_player_info(self.username)
        self.level = player.player_level
        self.mmr = player.mmr
        self.active_loadout = db_loadout.get_by_id(player.loadout_id)
        logging.debug(self.active_loadout.id)

        self.loadout_id = krait.request.query.get("loadout_id")

        if self.loadout_id == "new":
            self.loadout_id = db_loadout.create(self.username)
        else:
            self.loadout_id = int(self.loadout_id)
            logging.debug("checking owner")

            if not db_loadout.check_owner(self.loadout_id, self.username):
                raise RuntimeError("Not your loadout!")

            logging.debug("checked owner")

        self.current_loadout_name = db_loadout.get_by_id(self.loadout_id).name
Esempio n. 2
0
    def __init__(self):
        self.username = auth_tests.get_auth()
        player = auth_tests.get_player_info(self.username)
        self.level = player.player_level
        self.mmr = player.mmr

        self.active_loadout = db_loadout.get_by_id(player.loadout_id)
Esempio n. 3
0
    def __init__(self):
        self.username = auth_tests.get_auth()
    
        self.loadout_id = int(krait.request.query.get("id"))
        if not db_loadout.check_owner(self.loadout_id, self.username):
            krait.response = krait.ResponseBadRequest()

        logging.debug("---------------" + str(self.loadout_id))
        self.loadout = self.get_in_out_format(db_loadout.get_by_id(self.loadout_id))
Esempio n. 4
0
    def __init__(self):
        super(QueueWaitController, self).__init__(True)
        self.priority = 1
        self.username = auth_tests.get_auth()
        self.player = db_player.get_by_username(self.username)

        self.join_sent = False
        self.queue_obj = None
        self.match_accepted = False
        self.time_since_request_sent = 0
        self.match_id = 0

        logging.debug("Constructed.")
Esempio n. 5
0
    def __init__(self):
        self.username = auth_tests.get_auth()

        self.player = auth_tests.get_player_info(self.username)
        self.level = self.player.player_level
        self.mmr = self.player.mmr
        logging.debug("player loadout id: {}".format(self.player.loadout_id))

        self.active_loadout = db_loadout.get_by_id(self.player.loadout_id)

        logging.debug(self.active_loadout.id)
        self.user_loadouts = db_loadout.get_all_by_id(self.player.id)
        logging.debug(str(self.user_loadouts[0].name))
        self.new_loadout_id = 0
    def __init__(self):
        self.username = auth_tests.get_auth()
        self.loadout_owner = str(krait.request.query.get("which"))

        player = db_player.get_by_username(self.username)

        if self.loadout_owner == "mine":
            self.loadout = self.get_in_out_format(
                db_loadout.get_by_id(player.loadout_id))
        else:
            match = db_match.get_by_player(player)
            if player.id == match.player1_id:
                opponent = db_player.get_by_id(match.player2_id)
            else:
                opponent = db_player.get_by_id(match.player1_id)
            self.loadout = self.get_in_out_format(
                db_loadout.get_by_id(opponent.loadout_id))
Esempio n. 7
0
    def __init__(self, request):
        super(GameWsController, self).__init__(True)
        self.username = auth_tests.get_auth()
        self.match = self.get_match(self.username)

        if self.match is None:
            self.handle_end_game()
            return

        self.this_player = db_player.get_by_username(self.username)
        if self.this_player.id == self.match.player1_id:
            self.player_idx = 1
            self.other_player = db_player.get_by_id(self.match.player2_id)
        else:
            self.player_idx = 2
            self.other_player = db_player.get_by_id(self.match.player1_id)
        flags = db_flag.get_by_match(self.match.id)
        self.this_flag = [f for f in flags if f.flag_idx == self.player_idx][0]
        self.other_flag = [f for f in flags
                           if f.flag_idx != self.player_idx][0]

        self.this_troops, self.other_troops = self.split_match_troops(
            db_match_troop.get_by_match(self.match.id))
Esempio n. 8
0
 def __init__(self):
     self.username = auth_tests.get_auth()