Ejemplo n.º 1
0
 def handle_playevent(self, *args):
     print("handle_playevent", args)
     playroom = self.get_playroom()
     event_type = args[0]
     event_class = get_event_class(event_type)
     event_args = str(args[1]).split("&")
     return AllGames.register_action(playroom, self.player,
                                     event_class(*event_args))
Ejemplo n.º 2
0
 def handle_seenextinfections(self, *args):
     print("handle_seenextinfections", args)
     playroom = self.get_playroom()
     try:
         nextinfections = AllGames.get_next_infections(playroom,
                                                       self.player,
                                                       n=6)
         self.send_message_to_group('cardList', {
             "type": "infections",
             "cards": nextinfections,
         },
                                    playername=self.player.name)
     except Error as e:
         self.send_message_to_socket('error', str(e))
Ejemplo n.º 3
0
    def handle_setnextinfections(self, *args):
        print("handle_setnextinfections", args)
        playroom = self.get_playroom()
        secret = args[0]
        cards = args[1].split('&')

        try:
            self.check_secret(secret)
            dict_change = AllGames.set_next_infections(playroom, self.player,
                                                       cards)
            self.send_message_to_group('cardList', {
                "type": "infections",
                "cards": cards,
            },
                                       playername=None)
            self.send_message_to_group('game_state', json.dumps(dict_change))
        except Error as e:
            self.send_message_to_socket('error', str(e))
        except AttributeError as e:
            self.send_message_to_socket('error', 'cartes invalides')
Ejemplo n.º 4
0
 def handle_give(self, *args):
     print("handle_give", args)
     playroom = self.get_playroom()
     args = str(args[0]).split('&')
     return AllGames.register_action(playroom, self.player, GiveCard(*args))
Ejemplo n.º 5
0
 def handle_movetoexpert(self, *args):
     print("handle_movetoexpert", args)
     playroom = self.get_playroom()
     return AllGames.register_action(playroom, self.player,
                                     MoveToLocationExpert(*args))
Ejemplo n.º 6
0
 def handle_destroy(self, *args):
     print("handle_build", args)
     playroom = self.get_playroom()
     return AllGames.register_action(playroom, self.player,
                                     DestroyResearchCenter(*args))
Ejemplo n.º 7
0
 def handle_cure(self, *args):
     print("handle_cure", args)
     playroom = self.get_playroom()
     args = str(args[0]).split('&')
     return AllGames.register_action(playroom, self.player,
                                     CureDisease(*args))
Ejemplo n.º 8
0
 def handle_dump(self, *args):
     print("handle_dump", args)
     playroom = self.get_playroom()
     return AllGames.register_action(playroom, self.player, DumpCard(*args))
Ejemplo n.º 9
0
 def handle_movefrom(self, *args):
     print("handle_movefrom", args)
     playroom = self.get_playroom()
     return AllGames.register_action(playroom, self.player,
                                     MoveFromLocation(*args))
Ejemplo n.º 10
0
 def handle_end(self, *args):
     print("handle_end", args)
     playroom = self.get_playroom()
     return AllGames.register_action(playroom, self.player, EndTurn(*args))
Ejemplo n.º 11
0
 def handle_heal(self, *args):
     print("handle_move", args)
     playroom = self.get_playroom()
     return AllGames.register_action(playroom, self.player, Heal(*args))
Ejemplo n.º 12
0
 def handle_cancel(self, *args):
     print("handle_cancel", args)
     playroom = self.get_playroom()
     return AllGames.cancel_last_action(playroom, self.player)
Ejemplo n.º 13
0
 def handle_gamestate(self, *args):
     playroom = self.get_playroom()
     game_state = AllGames.get_game_state(playroom)
     self.send_message_to_group('game_state', json.dumps(game_state))
Ejemplo n.º 14
0
def start_game(playroom):
    return AllGames.start_game(playroom)