1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: GBK -*-
# ÔÚÏßËæ»ú˵»°
# author: ifo
# Date: 2011.9.9
# history:  2011.9.9     Created
 
from AI.AIBase import *
from Protocol.PacketsSend import tagCTalkQing
import logging
import random
 
#ÔÚÏߺ°»°¼ä¸ô(Second)
OnlineReplyPeriod = 10
 
randomTalkList = ["ÄãºÃ°¡","ÄãÔÚ¸ÉÂï","ÄãÊÇË­"]
 
class AIRandomTalk(AIBase):
    
    #ËùÓÐAI±ØÐë²ÉÓÃÕâÖй̶¨µÄ³õʼ»¯Ô­ÐÍ£¬ÒÔ±ãAIMgr×Ô¶¯¼ÓÔØ
    def __init__(self, robot ):
        AIBase.__init__(self, robot, OnlineReplyPeriod, True, True )
        
    def _Process( self ):
        if self.robot.GetIsLoginOK() == False:
            return
        curTalkContent = randomTalkList[random.randint(0,len(randomTalkList)-1)]
        talkGong = tagCTalkQing()
        talkGong.Clear()
        talkGong.Len = len(curTalkContent)
        talkGong.Content = curTalkContent
        self.robot.Send( talkGong )
        #logging.debug( "Player%s Talk %s"%(self.robot.GetPlayerInfo().GetPlayerName(),curTalkContent) )