Пример #1
0
    def _send_basic_infos(self):
        '''
        Send the basic informations, friends, ...
        '''
        self._send_connected_friends()
        self._send_ship()

        # script
        script = DataBase.get_script(self.username)
        self._send_script(script)
        self.send(Message('sc', None), pickling=True)

        # script status
        script_status = DataBase.get_script_status(self.username)
        self.send(Message('scst', script_status), pickling=True)

        # friend demands
        dfrs = DataBase.get_friend_demands(self.username)

        for sender in dfrs:

            if sender == '':
                continue

            Interaction.send_demand_friend(self.username, sender)
Пример #2
0
    def send_enter_game(self, opp_client, team):
        '''
        Send to client that he's entering in a game.  
        team specify the starting position of the ship.
        '''
        # send script
        script = DataBase.get_script(self.username)
        self._send_script(script)
        self.send(Message('sc', None), pickling=True)

        # send opp ship grid
        arr = DataBase.get_ship(opp_client.username)
        self.send(Message('igsh', arr), pickling=True)

        # send own ship grid
        arr = DataBase.get_ship(self.username)
        self.send(Message('sh', arr), pickling=True)

        # notify in game | opponent username, the position id of the ship
        self.send(Message('ign', [opp_client.username, team]), pickling=True)