authserver.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:mmoserver 作者: kukfa 项目源码 文件源码
def serverList(self):
        data = b'\x04'                  # packet ID
        data += bytes([AUTH_NUMGATEWAYS])     # total num game servers available
        data += b'\x01'                 # last game server used

        # the following is repeated for each server:
        data += bytes([GATEWAY_ID])       # ID of each server (starting at 1)
        # gameserver IP, packed in big-endian order
        data += ipaddress.IPv4Address(GATEWAY_IP).packed
        # gameserver port, little-endian order
        data += struct.pack("<I", GATEWAY_PORT)
        data += bytes([GATEWAY_AGELIMIT])       # unsure what this is used for
        data += bytes([GATEWAY_PVP])            # 1 if GATEWAY_PVP server, otherwise 0
        data += struct.pack("<H", GATEWAY_NUMPLAYERS)   # current # of players
        data += struct.pack("<H", GATEWAY_MAXPLAYERS)   # max # of players
        data += bytes([GATEWAY_ONLINE])     # 1 if server should be listed, otherwise 0
        if (GATEWAY_ONLINE == 1):
            data += b'\x04\x00\x00\x00\x00'
        else:
            # TODO doesn't list server if it isn't a test server
            data += b'\x00\x00\x00\x00\x00'
        self.sendPacket(data)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号