Esempio n. 1
0
 def sendSync(self, conn):
     packet='\x89\x00\x33\x00'+util.getTickCount(4)
     conn.mapSocket.send(packet);                
Esempio n. 2
0
    def mapConnect(self, conn):
        mapsocket=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        mapsocket.connect(conn.server.mapServer());

        packet='\x9b\x00\x37\x00' + struct.pack('4s', conn.accountID) + '\x00' + struct.pack('I', conn.charID) + '\x65\x32\x39\x00' + struct.pack('4s', conn.sessionID1) + struct.pack('4s', util.getTickCount(3)) + conn.sex
        

        mapsocket.send(packet)

        mapsocket.setblocking(1)
        def initialHandler(socket):
            header = socket.recv(2)
            if header == '\x83\x02':
                #Eat the account ID
                data = socket.recv(4)
                event.setSocketHandler(socket, self.receiveData)
                conn.mapSocket = socket
                conn.addEvent(lambda: self.syncLoop(conn), 0)
                self.connections[socket] = conn
                self.sendMapAck(socket)
                self.eventHandlers[socket] = {}
                conn.startScripts()
            else:
                header = struct.unpack('H', data[0:2])
                socket.close()
                event.removeSocket(socket)
                return
        
        event.addSocket(mapsocket, initialHandler)