diff options
author | Olivier Gayot <duskcoder@gmail.com> | 2015-06-04 01:26:00 +0100 |
---|---|---|
committer | Olivier Gayot <duskcoder@gmail.com> | 2015-06-04 01:34:45 +0100 |
commit | 22f12bdd64bc9417bc9af29844213e7735080144 (patch) | |
tree | d004d93f80311e83fe85acc9c5054eba5ff6915d /CAO_Client.py | |
parent | 0d87016f206b9dab6c7a0d694db160dd07156499 (diff) |
generate proper json to send to the clients
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'CAO_Client.py')
-rw-r--r-- | CAO_Client.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/CAO_Client.py b/CAO_Client.py index daf6f7e..3132e57 100644 --- a/CAO_Client.py +++ b/CAO_Client.py @@ -1,3 +1,4 @@ +from CAO_Status import cao_error from CAO_Game import CAO_Game class CAO_Client(): @@ -9,7 +10,7 @@ class CAO_Client(): def join_game(self, game_name): if self.game is not None: - return ('ERR', 'You are already in a game') + return cao_error('You are already in a game') self.game = self.game_manager.join_game(game_name) return self.game.try_join(self) @@ -19,30 +20,30 @@ class CAO_Client(): def play_white_card(self, card_id): if self.game is None: - return ('ERR', 'You have to join a game first') + return cao_error('You have to join a game first') return self.game.try_play_card(self.player, card_id) def pick_black_card(self): if self.game is None: - return ('ERR', 'You have to join a game first') + return cao_error('You have to join a game first') return self.game.try_become_judge(self.player) def collect_cards(self): if self.game is None: - return ('ERR', 'You have to join a game first') + cao_error('You have to join a game first') return self.game.try_collect_cards(self.player) def designate_card(self, card_id): if self.game is None: - return ('ERR', 'You have to join a game first') + return cao_error('You have to join a game first') return self.game.try_designate_card(self.player, card_id) def view_player_cards(self): if self.game is None: - return ('ERR', 'You have to join a game first') + return cao_error('You have to join a game first') return self.game.try_view_player_cards(self.player) def view_played_cards(self): if self.game is None: - return ('ERR', 'You have to join a game first') + return cao_error('You have to join a game first') return self.game.try_view_played_cards(self.player) |