示例#1
0
def loop():
    try:
        while True:
            asyncore.loop(timeout=0.2, count=5)
            logic_manager.tick()
    except KeyboardInterrupt:
        return
示例#2
0
    config.read('manachat.ini')

    if config.getboolean('Other', 'log_network_packets'):
        from loggers import netlog
        netlog.setLevel(logging.INFO)
        fh = logging.FileHandler('/tmp/netlog.txt', mode="w")
        fmt = logging.Formatter("[%(asctime)s] %(message)s",
                                datefmt="%Y-%m-%d %H:%M:%S")
        fh.setFormatter(fmt)
        netlog.addHandler(fh)

    load_itemdb('itemdb.txt')
    read_monster_db('monsterdb.txt')

    plugins.load_plugins(config)

    net.login(host=config.get('Server', 'host'),
              port=config.getint('Server', 'port'),
              username=config.get('Player', 'username'),
              password=config.get('Player', 'password'),
              charname=config.get('Player', 'charname'))

    thread.start_new_thread(input_thread, ())

    try:
        while True:
            asyncore.loop(timeout=0.2, count=5)
            logic_manager.tick()
    except KeyboardInterrupt:
        mapserv.cleanup()
示例#3
0
 def update_loop(self, *l):
     asyncore.loop(timeout=0, count=10)
     logic_manager.tick()
示例#4
0
    dbgh = logging.StreamHandler(sys.stdout)
    dbgh.setFormatter(logging.Formatter("[%(asctime)s] %(message)s",
                                        datefmt="%Y-%m-%d %H:%M:%S"))
    debuglog.addHandler(dbgh)
    debuglog.setLevel(logging.INFO)

    shoplog = logging.getLogger('ManaChat.Shop')
    shoplog.setLevel(logging.INFO)
    shoplog.addHandler(dbgh)

    config = ConfigParser()
    config.read('manachat.ini')

    load_itemdb('itemdb.txt')

    plugins.load_plugins(config)

    net.login(host=config.get('Server', 'host'),
              port=config.getint('Server', 'port'),
              username=config.get('Player', 'username'),
              password=config.get('Player', 'password'),
              charname=config.get('Player', 'charname'))

    try:
        while True:
            asyncore.loop(timeout=0.2, count=5)
            logic_manager.tick()
    except Exception:
        mapserv.cleanup()
示例#5
0
 def update_loop(self, *l):
     asyncore.loop(timeout=0, count=10)
     logic_manager.tick()