Ejemplo n.º 1
0
    def get(self, fleet_id):

        data = {
            "fleet_id": fleet_id,
            "ships": game_data['ships'],
            "weapons": game_data['weapons']
        }
        self.write(render('build_fleet.html', data))
Ejemplo n.º 2
0
    def post(self):
        username = self.get_argument('username')
        session_id = self.get_cookie("session_id")

        if username == "":
            self.write(render('create_account.html', {
                "silly_header": silly_header(),
                "message": "Don't be silly. You can think of a "
                           "better name than nothing."
            }))

        elif (len(username) > 20):
            self.write(render('create_account.html', {
                "silly_header": silly_header(),
                "message": "That's way too epic. Try a shorter nickname "
                           "(20 characters or less)."
            }))
        else:
            user = yield async(get_user_by_username, username)
            if user is None:
                user_id = mc_client().get("temp:{0}".format(session_id))
                user = yield async(add_user, user_id, username)

                user_info = {
                    "username": username,
                    "user_id": user_id
                }
                mc_client().set(session_id, user_info, time=60*60*24*7)
                self.redirect(self.get_argument("next", "/lobby"))
            else:
                self.write(render(
                    'create_account.html',
                    {
                        "silly_header": silly_header(),
                        "message": "You're not special - someone else already "
                                   " has that username. Try again."
                    }
                ))

        self.finish()
Ejemplo n.º 3
0
 def get(self):
     self.write(render('create_account.html', {
         "silly_header": silly_header(),
         "message": "While we do so, why don't you create an"
                    "amazingly epic username."
     }))
Ejemplo n.º 4
0
 def get(self):
     self.write(render('index.html'))
Ejemplo n.º 5
0
 def get(self):
     fleets = yield async(fleet.get_fleets, self.current_user()['user_id'])
     self.write(render('hq.html', {"fleets": fleets}))
     self.finish()
Ejemplo n.º 6
0
 def get(self):
     self.write(render('lobby.html'))