Tool/RobotTest/AI/AIFile/AIOnlineReply.py
@@ -11,25 +11,26 @@
import time
#在线回复间隔(Second)
OnlineReplyPeriod = 15
OnlineReplyPeriod = 30
class AIOnlineReply(AIBase):
    #所有AI必须采用这中固定的初始化原型,以便AIMgr自动加载
    def __init__(self, robot ):
        AIBase.__init__(self, robot, OnlineReplyPeriod, True, True )
        self.lastTime = 0
    def _Process( self ):
        if time.time() - self.lastTime < OnlineReplyPeriod:
            return
        # 清除没有心跳包的机器人
        logging.info("危险超过15秒没有处理心跳包-%s"%self.robot.GetPlayerInfo().GetAccID())
        #self.robot.SetNeedDestroy(True)
        #from Robot import RobotMgr
        #RobotMgr.GetRobotMgr().DisconnectServer(self.robot)
        pass
        return
        #=======================================================================
        # if time.time() - self.lastTime < OnlineReplyPeriod:
        #    return
        #
        # # 清除没有心跳包的机器人
        # logging.info("clear no heart robot")
        # self.robot.SetIsLoginOK(False)
        # from Robot import RobotMgr
        # RobotMgr.GetRobotMgr().DisconnectServer(self.robot)
        # pass
        #=======================================================================
        
    def _RegisterPacket(self, aiMgr):
        #//01 13 服务器心跳包#tagServerHeart
@@ -39,10 +40,8 @@
        
    
    def OnHeart(self, pack):
        nowTime = time.time()
        onlineR = tagCOnlineReturn()
        self.robot.Send( onlineR )
        self.lastTime = time.time()
        #print "------回复0113心跳包"