Beispiel #1
0
 def get(self):
     userid = users.get_current_user().user_id()
     player = Player.from_id(userid)
     if player.gameroom is not None:
         self.template_values.update({"gamekey": player.gameroom})
     clientid_for_channel = player.create_channel()
     token = channel.create_channel(clientid_for_channel)
     self.template_values.update({"token": token, "userid": player.keyname})
     return self.render("index.html")
Beispiel #2
0
 def post(self):
     """
     Processes the req from a client/player to join a gameroom
     """
     user = users.get_current_user()
     if not user:
         return self.redirect(users.create_login_url("/"))
     player = Player.from_id(user.user_id())
     if not player.gameroom:
         return Game.join_latest_or_new(player)
     return Game.continue_tournament(player)
Beispiel #3
0
 def get(self):
     userid = users.get_current_user().user_id()
     Player.from_id(userid).leave_tournament()
     self.redirect("/bye")
Beispiel #4
0
 def post(self):
     userid = users.get_current_user().user_id()
     message = self.request.get("m", "")
     Player.from_id(userid).chat(message)