| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #---------------------------------------------------------------------  | 
| #  | 
| #---------------------------------------------------------------------  | 
| ##@package QuestManager  | 
| #Íæ¼ÒÈÎÎñ¹ÜÀíÆ÷  | 
| #  | 
| # @author eggxp  | 
| # @date 2010-4-26ÏÂÎç02:07:26  | 
| # @version 2.8  | 
|   | 
| #---------------------------------------------------------------------  | 
| """Version = 2015-03-31 02:50"""  | 
| #---------------------------------------------------------------------  | 
| import IPY_GameWorld  | 
| import GameWorld  | 
| import ChConfig  | 
| import os  | 
| import QuestCommon  | 
| import SubjectLib  | 
| import zipfile  | 
| import ReadChConfig  | 
| #import traceback  | 
| #import EventShell  | 
| #---------------------------------------------------------------------  | 
| ZipFile = None  | 
| ZipFileTree = None  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñÈ¡ZIPÊý¾Ý  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµ, ZIPÊý¾Ý  | 
| # @remarks »ñÈ¡ZIPÊý¾Ý  | 
| def __GetZipFile():  | 
|     return ZipFile  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñÈ¡ZIPÊý¾ÝÊ÷  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµ, ZIPÊý¾ÝÊ÷  | 
| # @remarks »ñÈ¡ZIPÊý¾ÝÊ÷  | 
| def __GetZipFileTree():  | 
|     return ZipFileTree  | 
|   | 
| ## ZIPÊý¾ÝÀàÐÍÈÝÆ÷  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.  | 
| class ZipFileType:  | 
|     ## ÈÝÆ÷Êý¾Ý°üº¬, FileName = '', FileType = 0, SubDir = {}  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ÈÝÆ÷Êý¾Ý°üº¬, FileName = '', FileType = 0, SubDir = {}  | 
|     def __init__(self):  | 
|         self.FileName = ''  | 
|         self.FileType = 0        #0: File    1: Dir  | 
|         self.SubDir = {}  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñµÃÎļþÊ÷  | 
| # @param curZipFile ZIPÎļþ°ü  | 
| # @return ·µ»ØÖµ, ÎļþÊ÷  | 
| # @remarks »ñµÃÎļþÊ÷  | 
| def __GetFileTree(curZipFile):  | 
|     fileDict = ZipFileType()  | 
|     nameList = curZipFile.namelist()  | 
|     for name in nameList:  | 
|         name = name.upper()  | 
|         curFileSplit = name.split('/')  | 
|         fileSplitLen = len(curFileSplit)  | 
|           | 
|         fileName = curFileSplit[fileSplitLen-1]  | 
|         if fileName == '':  | 
|             #No File  | 
|             #print name  | 
|             continue  | 
|           | 
|         del curFileSplit[fileSplitLen-1]  | 
|         curEnterDir = fileDict  | 
|         for dir in curFileSplit:  | 
|             if curEnterDir.SubDir.has_key(dir) == False:  | 
|                 curZipFileType = ZipFileType()  | 
|                 curZipFileType.FileName = dir  | 
|                 curZipFileType.FileType = 1  | 
|                 curEnterDir.SubDir[dir] = curZipFileType  | 
|               | 
|             curEnterDir = curEnterDir.SubDir[dir]  | 
|   | 
|         curFile = ZipFileType()  | 
|         curFile.FileName = fileName  | 
|         curFile.FileType = 0  | 
|         curFile.SubDir = None  | 
|         curEnterDir.SubDir[fileName] = curFile  | 
|           | 
|     return fileDict  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñµÃÎļþ½Úµã  | 
| # @param inputDir ÊäÈë·¾¶  | 
| # @return ·µ»ØÖµ, Îļþ½Úµã  | 
| # @remarks »ñµÃÎļþ½Úµã  | 
| def __GetZipFileNode(inputDir):  | 
|     curFileDir = inputDir.split('\\')  | 
|     lencurFileDir = len(curFileDir)  | 
|     if lencurFileDir == 0:  | 
|         return  | 
|       | 
|     fileTree = __GetZipFileTree()  | 
|     curFileNode = fileTree  | 
|       | 
|     if curFileDir[lencurFileDir - 1].strip() == '':  | 
|         del curFileDir[lencurFileDir - 1]  | 
|       | 
|     for file in curFileDir:  | 
|         if not curFileNode.SubDir.has_key(file):  | 
|             return   | 
|         curFileNode = curFileNode.SubDir[file]  | 
|       | 
|     return curFileNode  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##ÅжÏ·¾¶ÊÇ·ñÊÇĿ¼  | 
| # @param inputDir ÊäÈë·¾¶  | 
| # @return ·µ»ØÖµÕæ, ÊÇĿ¼  | 
| # @remarks ÅжÏ·¾¶ÊÇ·ñÊÇĿ¼  | 
| def ZipFile_IsDir(inputDir):  | 
|     inputDir = inputDir.upper()  | 
|     result = __GetZipFileNode(inputDir)  | 
|     if result == None:  | 
|         return False  | 
|       | 
|     if result.FileType != 1:  | 
|         return False  | 
|       | 
|     return True  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##ÅжÏ·¾¶ÊÇ·ñÊÇÎļþ  | 
| # @param inputDir ÊäÈë·¾¶  | 
| # @return ·µ»ØÖµÕæ, ÊÇÎļþ  | 
| # @remarks ÅжÏ·¾¶ÊÇ·ñÊÇÎļþ  | 
| def ZipFile_IsFile(inputDir):  | 
|     inputDir = inputDir.upper()  | 
|     result = __GetZipFileNode(inputDir)  | 
|     if result == None:  | 
|         return False  | 
|       | 
|     if result.FileType != 0:  | 
|         return False  | 
|       | 
|     return True  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñȡĿ¼ÁÐ±í  | 
| # @param inputDir ÊäÈë·¾¶  | 
| # @return ·µ»ØÖµ, Ä¿Â¼ÁÐ±í  | 
| # @remarks »ñȡĿ¼ÁÐ±í  | 
| def ZipFile_ListDir(inputDir):  | 
|     inputDir = inputDir.upper()  | 
|     resultNode = __GetZipFileNode(inputDir)  | 
|     curDir = []  | 
|     if resultNode == None:  | 
|         return curDir  | 
|     for key in resultNode.SubDir.keys():  | 
|         if resultNode.SubDir[key].FileType != 1:  | 
|             continue  | 
|         curDir.append(resultNode.SubDir[key].FileName)  | 
|     return curDir  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñÈ¡ÎļþÁÐ±í  | 
| # @param inputDir ÊäÈë·¾¶  | 
| # @return ·µ»ØÖµ, ÎļþÁÐ±í  | 
| # @remarks »ñÈ¡ÎļþÁÐ±í  | 
| def ZipFile_ListFile(inputDir):  | 
|     inputDir = inputDir.upper()  | 
|     resultNode = __GetZipFileNode(inputDir)  | 
|     curDir = []  | 
|     if resultNode == None:  | 
|         return curDir  | 
|     for key in resultNode.SubDir.keys():  | 
|         if resultNode.SubDir[key].FileType != 0:  | 
|             continue  | 
|         curDir.append(resultNode.SubDir[key].FileName)  | 
|     return curDir  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñÈ¡ÎļþÁÐ±í  | 
| # @param result ÎļþÁÐ±í  | 
| # @param curNode µ±Ç°½Úµã  | 
| # @param fileSource Îļþ·¾¶  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks »ñÈ¡ÎļþÁÐ±í  | 
| def __GetZipFileList(result, curNode, fileSource):  | 
|     for key in curNode.SubDir.keys():  | 
|         curFileName = os.path.join(fileSource, curNode.SubDir[key].FileName)  | 
|         if curNode.SubDir[key].FileType != 0:  | 
|             __GetZipFileList(result, curNode.SubDir[key], curFileName)  | 
|             continue  | 
|         result.append(curFileName.lower())  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñȡ·¾¶ÏµÄÎļþÁÐ±í  | 
| # @param inputDir ÊäÈëµÄ·¾¶  | 
| # @return ·µ»ØÖµ,ÎļþÁÐ±í  | 
| # @remarks »ñȡ·¾¶ÏµÄÎļþÁÐ±í  | 
| def ZipFile_Walk(inputDir):  | 
|     inputDir = inputDir.upper()  | 
|     resultNode = __GetZipFileNode(inputDir)  | 
|     result = []  | 
|     if resultNode == None:  | 
|         return result  | 
|     __GetZipFileList(result, resultNode, inputDir)  | 
|     return result  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##ÎļþÊý¾Ý  | 
| # @param inputDir ÊäÈëµÄ·¾¶  | 
| # @return ·µ»ØÖµ, ÎļþÊý¾Ý  | 
| # @remarks ÎļþÊý¾Ý  | 
| def ZipFile_GetData(inputDir):  | 
|     inputDir = inputDir.upper()  | 
|     zipFile = __GetZipFile()  | 
|     inputDir = inputDir.replace('\\', '/')  | 
|     #GameWorld.Log('read : %s'%inputDir)  | 
| #    try:  | 
|     data = zipFile.read(inputDir)  | 
|     return data  | 
| #    except BaseException:  | 
| #        GameWorld.Log("Can't Find Dir : %s"%inputDir)  | 
| #        GameWorld.Log(traceback.format_exc())  | 
| #        raise ("Read Error")  | 
|       | 
|   | 
| #---------------------------------------------------------------------  | 
|   | 
| #Ŀ¼  | 
| #-QuestData  | 
| # -Quests  | 
| #  +on_visit  | 
| #  +on_kill  | 
|   | 
| #ÈÎÎñÊý¾Ý  | 
| Quests = {}     #Type = MainQuestData  | 
| DefaultTalk = {} #Type = DefaultTalkData        Ä¬È϶Ի°Êý¾Ý Type = IPY_GameWorld.IPY_XMLLoader()  | 
| AllQuestsEvents={}   #Type = list()             list type = (missID, MainQuestEventData)       | 
| FunctionNPCTalk = {}    #Type = FunctionNPCTalkData  | 
| QuestTrig = {}  #Type = list()          listÖеÄType = QuestTrigData           ÈÎÎñ´¥·¢Êý¾Ý  | 
| QuestDescriptions = {}          #Type = QuestDescriptionsData  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##°´°æ±¾»ñµÃÈÎÎñ¶ÁÈ¡µÄÃû×Ö  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµ, ÈÎÎñ°æ±¾Ãû  | 
| # @remarks °´°æ±¾»ñµÃÈÎÎñ¶ÁÈ¡µÄÃû×Ö  | 
| def GetQuestDataName():  | 
|     return "QuestData"  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñÈ¡ÈÎÎñ·¾¶  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµ, ÈÎÎñ·¾¶  | 
| # @remarks »ñÈ¡ÈÎÎñ·¾¶  | 
| def GetQuestPath():  | 
|     return "%s\\Quests"%GetQuestDataName()  | 
|   | 
| #Ŀǰ²»ÄÜ×ö»º´æ, ÔÒò:  | 
| #¶Ô»°ÖлáÓÐSetCurrentQuestNode²Ù×÷, Èç¹ûÊÍ·ÅÁË, »áµ¼Ö¿¨×¡  | 
| LoadQuestLen = 5000      #×î´ó¶ÁÈ¡µÄxmlÎļþ¸öÊý  | 
| FreeQuestCount = 10     #Ò»´ÎÊÍ·Å10¸öxml  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##²éÕÒNPCĬÈ϶Ի°  | 
| # @param npcID NPCID  | 
| # @return ·µ»ØÖµ, XMLÊý¾Ý  | 
| # @remarks ²éÕÒNPCĬÈ϶Ի°  | 
| def FindDefaultTalk(npcID):  | 
|     global DefaultTalk  | 
|     if DefaultTalk.has_key(npcID):  | 
|         return DefaultTalk[npcID]  | 
|       | 
|     filePath = "%s\\default_talk"%GetQuestDataName()  | 
|     #µ¼ÈëÕâ¸öÈÎÎñµÄËùÓÐXMLÊý¾Ý      | 
|     filePath = os.path.join(filePath, '%s.xml'%npcID)  | 
|       | 
|     if not ZipFile_IsFile(filePath):  | 
|         return  | 
|       | 
|     xmlLoader = IPY_GameWorld.IPY_XMLLoader()  | 
|     #xmlLoader.LoadFromFile(filePath)  | 
|     xmlLoader.LoadFromXML(filePath, ZipFile_GetData(filePath))  | 
|     DefaultTalk[npcID] = xmlLoader  | 
|     return xmlLoader  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##ÈÎÎñ×ÖµäÅÅÐò¹æÔò  | 
| # @param key1 ×Öµä1  | 
| # @param key2 ×Öµä2  | 
| # @return ·µ»ØÖµ, ÓÅÏȼ¶  | 
| # @remarks ÈÎÎñ×ÖµäÅÅÐò¹æÔò  | 
| def QuestKeyCmp(key1, key2):  | 
|     if key1[1] < key2[1]:  | 
|         return 1  | 
|     elif key1[1] > key2[1]:  | 
|         return -1  | 
|     else:  | 
|         return 0  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##²éÕÒÈÎÎñÊý¾Ý  | 
| # @param questID ÈÎÎñID  | 
| # @return ·µ»ØÖµ, ÈÎÎñÊý¾Ý  | 
| # @remarks ²éÕÒÈÎÎñÊý¾Ý  | 
| def FindQuest(questID):  | 
|     #GameWorld.Log(str(questID))  | 
|     global Quests  | 
|     if Quests.has_key(questID):  | 
|         #ÃüÖÐÁË, °ÑÕâ¸öÈÎÎñÌáǰ  | 
|         curQuest = Quests[questID]  | 
|         curQuest.UseCount += 1  | 
|         return curQuest  | 
|       | 
| #    if len(Quests) > LoadQuestLen:  | 
| #        #ÊÍ·ÅxmlÎļþ  | 
| #        curList = []  | 
| #        for key in Quests.keys():  | 
| #            curList.append((key, Quests[key].UseCount))  | 
| #              | 
| #        curList.sort(QuestKeyCmp)  | 
| #          | 
| #        for i in range(0, min(FreeQuestCount, len(curList))):  | 
| #            #ɾ³ýǰ10¸ökey  | 
| #            Quests.pop(curList[i][0])  | 
|           | 
|        | 
|     curQuest = MainQuestData()  | 
|     LoadQuest(os.path.join(GetQuestPath(), str(questID)), questID, curQuest)  | 
|     if curQuest.ID == 0:  | 
|         return None  | 
|       | 
|     Quests[questID] = curQuest  | 
|     return  curQuest  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñÈ¡ÈÎÎñÊý¾Ý  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµ, ÈÎÎñÊý¾Ý  | 
| # @remarks »ñÈ¡ÈÎÎñÊý¾Ý  | 
| def GetQuests():  | 
|     return Quests  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñÈ¡¹¦ÄÜNPC¶Ô»°Êý¾Ý  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµ, ¶Ô»°Êý¾Ý  | 
| # @remarks »ñÈ¡¹¦ÄÜNPC¶Ô»°Êý¾Ý  | 
| def GetFunctionNPCTalk():  | 
|     return FunctionNPCTalk  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñÈ¡ËùÓÐÈÎÎñÊý¾Ý  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµ, ÈÎÎñÊý¾Ý  | 
| # @remarks »ñÈ¡ËùÓÐÈÎÎñÊý¾Ý  | 
| def GetAllQuestsEvents():  | 
|     return AllQuestsEvents  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñÈ¡NPCĬÈ϶Ի°  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµ, NPCĬÈ϶Ի°  | 
| # @remarks »ñÈ¡NPCĬÈ϶Ի°  | 
| def GetDefaultTalk():  | 
|     return DefaultTalk  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñÈ¡ÈÎÎñÌø×ªÊý¾Ý  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµ, ÈÎÎñÌø×ªÊý¾Ý  | 
| # @remarks »ñÈ¡ÈÎÎñÌø×ªÊý¾Ý  | 
| def GetQuestTrig():  | 
|     return QuestTrig  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##»ñÈ¡ÈÎÎñÃèÊö  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµ, ÈÎÎñÃèÊö  | 
| # @remarks »ñÈ¡ÈÎÎñÃèÊö  | 
| def GetQuestDescriptions():  | 
|     return QuestDescriptions  | 
|   | 
| ## ÈÎÎñÃèÊöÊý¾ÝÀà  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.  | 
| class QuestDescriptionsData:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬, Code = '', ShowReward = 0  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬, Code = '', ShowReward = 0  | 
|     def __init__(self):  | 
|         self.Code = ''  | 
|         self.ShowReward = 0  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ÈÎÎñË÷ÒýÖеÄÒ»¸öʼþ  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.  | 
| class MainQuestEventData:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬, Type = "",Source = "",FileSource = "",XMLEventLoader = None  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬, Type = "",Source = "",FileSource = "",XMLEventLoader = None  | 
|     def __init__(self):  | 
|         self.XMLEventLoader = None  | 
|         self.Type = ""  | 
|         self.Source = ""  | 
|         self.FileSource = ""  | 
|       | 
|     #---------------------------------------------------------------------  | 
|     ## ¼ÓÔØXMLÊý¾Ý  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ¼ÓÔØXMLÊý¾Ý  | 
|     def GetXMLEventLoader(self):  | 
|         if self.XMLEventLoader:  | 
|             return self.XMLEventLoader  | 
|           | 
|         #GameWorld.Log("¶ÁÈ¡ÈÎÎñ´¥·¢: %s, %s"%(self.Type, self.Source))  | 
|         self.XMLEventLoader = IPY_GameWorld.IPY_XMLLoader()   | 
|         #self.XMLEventLoader.LoadFromFile(self.FileSource)  | 
|         self.XMLEventLoader.LoadFromXML(self.FileSource, ZipFile_GetData(self.FileSource))  | 
|         return self.XMLEventLoader  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ÈÎÎñµÆµÄ¶¨Òå  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.      | 
| class QuestLight:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬, NPCID = 0, Type = 0  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬, NPCID = 0, Type = 0  | 
|     def __init__(self):  | 
|         self.NPCID = 0  | 
|         self.Type = 0  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ÈÎÎñÃèÊöÀà  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.  | 
| class QuestDescription:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬, Msg = "", Info = None, Lights = None, Rewards = None,   | 
|     #                        IsRewardNode = 0, MsgNode = None  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬, Msg = "", Info = None, Lights = None, Rewards = None,   | 
|     #                                IsRewardNode = 0, MsgNode = None  | 
|     def __init__(self):  | 
|         self.Msg = ""  | 
|         self.Info = list()      #Type = str()  | 
|         self.Lights = list()    #Type = QuestLight  | 
|         self.Rewards = None     #Type = list , listType = IPY_XMLNode  | 
|         self.IsRewardNode = 0   #ÊÇ·ñÊǽ±Àø½Úµã, (ÈÎÎñÏÔʾΪÍê³É״̬)  | 
|         self.MsgNode = None  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ÍÚ±¦µØµã¶¨Òå  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.  | 
| class TreasurePos:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬, MapID = 0, PosX = 0, PosY = 0  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬, MapID = 0, PosX = 0, PosY = 0  | 
|     def __init__(self):  | 
|         self.MapID = 0  | 
|         self.PosX = 0  | 
|         self.PosY = 0  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ÍÚ±¦Ê¼þÊý¾Ý  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.  | 
| class TreasureData:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬, Normal = None, Week = None  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬, Normal = None, Week = None  | 
|     def __init__(self):  | 
|         self.Normal = None  #Type = list()     list Type = TreasurePos  | 
|         self.Week = None    #Type = dict() key = µÈ¼¶ dictType = dict() key = ÐÇÆÚ      | 
|                             # dict Type = list()   list Type = TreasurePos  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## Ã¿ÈÕÈÎÎñ½±ÀøÊý¾ÝÀà  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.    | 
| class DayEventRewardData:  | 
|     ## ³õʼ»¯  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯  | 
|     def __init__(self):  | 
|         self.Exp = 0             #¾Ñé²ÎÊý  | 
|         self.AddExp = 0          #¾Ñé  | 
|         self.Money = 0           #¸øÇ®  | 
|         self.Soul = 0            #¸øÄ§»ê  | 
|         self.TruckMoney = 0      #æô³µÑº½ð  | 
|         self.Item = ""            #ÎïÆ·½±Àø  | 
|         self.PlayerFamilyHornor = 0    #¼Ò×å¹±Ï×  | 
|         self.PlayerFamilyActiveValue = 0 #¼Ò×å»îÔ¾¶È  | 
|         self.FamilyHomeExp = 0      #¼Ò×å¼ÒÔ°¾Ñé  | 
|         self.FamilyMoney = 0     #¼Ò×å×ʽð  | 
|         self.FamilyHornor = 0    #¼Ò×åÈÙÓþ  | 
|         self.PetExp = 0    # ³èÎï¾Ñé  | 
|         self.Prestige = 0    # ÍþÍû½±Àø  | 
|         self.GoldPaper = 0    # °óÓñ/Áéʯ  | 
|           | 
| #---------------------------------------------------------------------  | 
| ## Ã¿ÈÕÈÎÎñ½±ÀøÊý¾ÝÀ༯ºÏ  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.    | 
| class AllDayEventRewardData:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬, MinLV, MaxLV, MoneyType, Rewards  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬, MinLV, MaxLV, MoneyType, Rewards  | 
|     def __init__(self):  | 
|         self.MinLV = 0  | 
|         self.MaxLV = 0  | 
|         self.MoneyType = 0  | 
|         self.Rewards = {}        #Type = dict{}       ÀàÐÍ: DayEventRewardData  | 
|           | 
| #---------------------------------------------------------------------  | 
| ## ÅÜ»·ÈÎÎñ½±ÀøÊý¾ÝÀà  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.   | 
| class RunAroundRewardData(DayEventRewardData):  | 
|     ## ³õʼ»¯  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯  | 
|     def __init__(self):  | 
|         DayEventRewardData.__init__(self)  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ÅÜ»·ÈÎÎñ½±ÀøÊý¾ÝÀ༯ºÏ  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.    | 
| class AllRunAroundRewardData:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬, MinLV, MaxLV, MoneyType, Rewards  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬, MinLV, MaxLV, MoneyType, Rewards  | 
|     def __init__(self):  | 
|         self.MinLV = 0  | 
|         self.MaxLV = 0  | 
|         self.MoneyType = 0  | 
|         self.Rewards = {}        #Type = dict{}       ÀàÐÍ: RunAroundRewardData  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ÈÎÎñË÷ÒýÊý¾Ý, ¶ÔÓ¦ÓÚquests.xml  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.    | 
| class MainQuestData:  | 
|     ## ³õʼ»¯  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯  | 
|     def __init__(self):  | 
|         self.ID = 0                           #ÈÎÎñID  | 
|         self.Name = ""                        #ÈÎÎñÃû³Æ  | 
|         self.Type = 0                         #ÈÎÎñÀàÐÍ  | 
|         self.QuestDescriptionList = list()    #Type = QuestDescription ÈÎÎñÃèÊö  | 
|         self.NPCID = 0                        #ÆðʼNPCID  | 
|         self.LV = 0                           #¿É½ÓµÈ¼¶  | 
|         self.MapID = 0                        #µØÍ¼ID  | 
|         self.DayCurCount = ""                 #µ±Ç°ÈÎÎñ´ÎÊý  | 
|         self.DayMaxCount = ""                 #ÿÈÕÈÎÎñ×î´ó´ÎÊý  | 
|         self.Day_Count = ""                   #ÿÈÕÈÎÎñµÄÃèÊö  | 
|         self.QuestsEvent = {}                 #Type = MainQuestEventData  ÈÎÎñÐÅÏ¢,key = ("on_visit", 1111)  | 
|         self.DayEvent = {}                    #Type = dict() Ã¿ÈÕÈÎÎñÐÅÏ¢ DayEventData  | 
|         self.Treasure = None                  #Type = ÍÚ±¦µØµã, TreasureDataÀà  | 
|         self.DayEventReward = None            #Type = Ã¿ÈÕ½±Àø£¬AllDayEventRewardDataÀà  | 
|         self.Invisible = 0                    #²»ÏÔʾÔÚ¿Í»§¶Ë  | 
|         self.Code = ""                          | 
|         self.NameCode = ""                    #ÈÎÎñ´úÂë  | 
|         self.UseCount = 0                     #ÃüÖдÎÊý  | 
|         self.Color_lv = 0                     #ÈÎÎñÑÕÉ«  | 
|         self.CanDel = 0                       #ÈÎÎñ¿É·ñɾ³ý  | 
|         self.RunAroundReward = None             #ÅÜ»·ÈÎÎñ½±Àø  AllRunAroundRewardData  | 
|         self.ResetCurCountDictName = ''               #ÈÎÎñµ±Ç°ÖØÖôÎÊý×ÖµäÃû  | 
|         self.ResetMaxCount = 0                #ÈÎÎñÖØÖÃ×î´ó´ÎÊý  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ¹¦ÄÜNPC¶Ô»°Êý¾Ý  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.    | 
| class FunctionNPCTalkData:  | 
|     #---------------------------------------------------------------------  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬ID, Name, Menus  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬ID, Name, Menus  | 
|     def __init__(self):  | 
|         self.ID = 0  | 
|         self.Name = ""  | 
|         self.Menus = list()  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ¹¦Äܲ˵¥Àà  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.    | 
| class FunctionMenu:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬Check, Menu  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬Check, Menu  | 
|     def __init__(self):  | 
|         self.Check = ""  | 
|         self.Menu = ""  | 
|         self.Code = ""  | 
|         self.CheckArgs = ""  | 
|           | 
| #---------------------------------------------------------------------  | 
| ## ÌØÊâÈÎÎñÊý¾Ý  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.    | 
| class SpecialQuestData:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬ID, Type, Name, LV, MapID, NPCID  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬ID, Type, Name, LV, MapID, NPCID  | 
|     def __init__(self):  | 
|         self.ID = 0  | 
|         self.Type = 0  | 
|         self.Name = ""  | 
|         self.LV = 0  | 
|         self.MapID = 0  | 
|         self.NPCID = 0  | 
|           | 
| #---------------------------------------------------------------------  | 
| ## ÈÎÎñ°´ÕÕIDɱNPC  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷£ºÄ¿Ç°ÅÜ»·ºÍÿÈÕÓà  | 
| class Day_KillNPC_By_ID:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬ID, Count, NPCData  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬ID, Count, NPCData  | 
|     def __init__(self):  | 
|         self.ID = 0  | 
|         self.Count = 0  | 
|         self.NPCData = None  | 
|         self.MapID = 0   | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ÈÎÎñ°´Õյȼ¶É±NPC  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷£ºÄ¿Ç°ÅÜ»·ºÍÿÈÕÓà  | 
| class Day_KillNPC_By_LV:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬LV, Count, Country  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬LV, Count, Country  | 
|     def __init__(self):  | 
|         self.LV = 0  | 
|         self.Count = 0  | 
|         self.Country = 0  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ÈÎÎñÊÕ¼¯ÎïÆ·  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷£ºÄ¿Ç°ÅÜ»·ºÍÿÈÕÓà  | 
| class Day_GetItem_By_ID:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬ID, Count  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬ID, Count  | 
|     def __init__(self):  | 
|         self.ID = 0  | 
|         self.Count = 0  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ·ÃÎÊNPC  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷£ºÄ¿Ç°ÅÜ»·ºÍÿÈÕÓà  | 
| class Day_VisitNPC:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬ID  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬ID  | 
|     def __init__(self):  | 
|         self.ID = 0  | 
|         self.MapID = 0  | 
|         self.NPCData = None  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## Ëæ»úÈÎÎñ  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷£ºÄ¿Ç°ÅÜ»·Óà  | 
| class Day_Mission:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬ID  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬ID  | 
|     def __init__(self):  | 
|         self.ID = 0  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## Ëæ»ú²É¼¯  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷£ºÄ¿Ç°ÅÜ»·Óà  | 
| class Day_CollectNPC:  | 
|     ## ³õʼ»¯, ÈÝÆ÷°üº¬ID  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ÈÝÆ÷°üº¬ID  | 
|     def __init__(self):  | 
|         self.ID = 0  | 
|         self.Count = 0  | 
|         self.MapID = 0  | 
| #---------------------------------------------------------------------  | 
| ## Ã¿ÈÕʼþÊý¾Ý  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.  | 
| #===============================================================================  | 
| # class DayEventData:  | 
| #    ## ³õʼ»¯  | 
| #    #  @param self ÀàʵÀý  | 
| #    #  @return ·µ»ØÖµÎÞÒâÒå  | 
| #    #  @remarks ³õʼ»¯  | 
| #    def __init__(self):  | 
| #        self.LV = 0  | 
| #        self.Day_KillNPC_By_ID_List = list()    #Type = Day_KillNPC_By_ID  | 
| #        self.Day_KillNPC_By_LV_List = list()    #Type = Day_KillNPC_By_LV  | 
| #        self.Day_GetItem_By_ID = list()         #Type = Day_GetItem_By_ID  | 
| #        self.Day_VisitNPCList = list()          #Type = Day_VisitNPC  | 
| #        self.Day_MissionList = list()           #Type = Day_Mission  | 
| #        self.Day_CollectNPCList = list()           #Type = Day_CollectNPC_By_ID  | 
| #===============================================================================  | 
|   | 
| #---------------------------------------------------------------------  | 
| ## ÈÎÎñÌø×ªÀà  | 
| #  | 
| #  PyClassÀàµÄÏêϸ˵Ã÷.         | 
| class QuestTrigData:  | 
|     ## ³õʼ»¯, ID,Next,Continue,CheckJob  | 
|     #  @param self ÀàʵÀý  | 
|     #  @return ·µ»ØÖµÎÞÒâÒå  | 
|     #  @remarks ³õʼ»¯, ID,Next,Continue,CheckJob  | 
|     def __init__( self ):  | 
|         self.ID = 0  | 
|         self.Next = 0  | 
|         self.Continue = 0  | 
|         self.CheckJob = ''  | 
|   | 
|   | 
|   | 
| #---------------------------------------------------------------------  | 
| ##¼ÓÔØÈÎÎñÊý¾Ý  | 
| # @param filePath Îļþ·¾¶  | 
| # @param questID ÈÎÎñID  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ¼ÓÔØÈÎÎñÊý¾Ý  | 
| def LoadQuestEvents(filePath, questID):  | 
|     #global Quests  | 
|     global AllQuestsEvents  | 
|     filePath = filePath + "\\"  | 
|       | 
|     #GameWorld.Log('LoadQuestEvents filePath = %s'%filePath)  | 
| #    questXMLName = '%s.xml'%questID  | 
| #    #GameWorld.Log("¶ÁÈ¡ÈÎÎñ: %s"%questXMLName)  | 
| #    mainQuest = filePath + questXMLName  | 
| #    mainQuestLoader = IPY_GameWorld.IPY_XMLLoader()  | 
| #  | 
| #    mainQuestLoader.LoadFromFile(mainQuest)  | 
| #    #³õʼ»¯ÈÎÎñË÷Òý  | 
| #    mainQuestList = mainQuestLoader.GetNodeList()  | 
| #    #µ±Ç°ÈÎÎñµÄÈÎÎñÊý¾Ý  | 
|       | 
|     #µ¼ÈëÕâ¸öÈÎÎñµÄËùÓÐXMLÊý¾Ý  | 
| #    for root, dirs, files in ZipFile_Walk(filePath):  | 
| #        for file in files:  | 
| #            fileName = os.path.join(root, file)  | 
| #            fileName = fileName.replace(filePath, "")  | 
|   | 
|     #GameWorld.Log(filePath)  | 
|     filePath = filePath.lower()  | 
|     for fileName in ZipFile_Walk(filePath):  | 
|         fileName = fileName.replace(filePath, "")  | 
|         if fileName.find("__init__") >= 0:  | 
|             continue  | 
|           | 
|         #GameWorld.Log(fileName)  | 
|         curFileList = fileName.split(".")  | 
|           | 
|         ext = curFileList[1]  | 
|         if ext != "xml":  | 
|             continue  | 
|         fileSplit = fileName.split("\\")  | 
|           | 
|           | 
|         if len(fileSplit) <= 1:  | 
|             continue  | 
|         xmlType = fileSplit[0]  | 
|           | 
|           | 
|         xmlSource = fileName.replace("%s\\"%fileSplit[0], "")  | 
|         xmlType = xmlType.lower()  | 
|         key = (xmlType, xmlSource)  | 
|   | 
|         curEvent = MainQuestEventData()  | 
|         curEvent.Type = xmlType  | 
|         curEvent.Source = xmlSource  | 
|           | 
|         #ÕÒµ½²¢ÇÒ¶ÁÈ¡Õâ¸öÎļþ  | 
|         curEvent.FileSource = filePath + xmlType + "\\" + xmlSource  | 
|         if ChConfig.DelayLoadXML == False:  | 
|             curEvent.GetXMLEventLoader()  | 
|             #curEvent.XMLEventLoader.LoadFromFile(filePath + xmlType + "\\" + xmlSource)  | 
|   | 
|         #°Ñµ±Ç°Ê¼þÌí¼Óµ½ËùÓÐÈÎÎñË÷ÒýÖÐ  | 
|         if AllQuestsEvents.has_key(key) != True:  | 
|             AllQuestsEvents[key] = list()  | 
|           | 
|         #GameWorld.Log(key)  | 
|         AllQuestsEvents[key].append((questID, curEvent))  | 
|               | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##¼ÓÔØÈÎÎñÊý¾Ý  | 
| # @param filePath Îļþ·¾¶  | 
| # @param questID ÈÎÎñID  | 
| # @param curQuest ÈÎÎñÈÝÆ÷  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ¼ÓÔØÈÎÎñÊý¾Ý  | 
| def LoadQuest(filePath, questID, curQuest):  | 
|     curMapID = GameWorld.GetMap().GetMapID()  | 
|     #²»¼ÓÔØ²»ÊôÓÚ±¾µØÍ¼µÄXML  | 
|     if not CheckMapCanLoadXML( curMapID, questID ):  | 
|         #µ÷ÊÔÐÅÏ¢, ÕýʽÉÏÏßɾ³ý  | 
|         #GameWorld.Log( 'LoadQuest, ²»¼ÓÔØ²»ÊôÓÚ±¾µØÍ¼µÄXML mapID = %s, questID = %s, filePath = %s'%( curMapID, questID, filePath ) )  | 
|         return  | 
|       | 
|     #GameWorld.Log(GameWorld.GetScript().OutputTrace())  | 
|     #global Quests  | 
|     #global AllQuestsEvents  | 
|     questXMLName = '%s.xml'%questID  | 
|     filePath = filePath + "\\"  | 
|       | 
|     mainQuestList = None  | 
|     if questID != 0:  | 
|         #GameWorld.Log("¶ÁÈ¡ÈÎÎñÏêϸ: %s"%questXMLName)  | 
|         mainQuest = filePath + questXMLName  | 
|       | 
|         mainQuestLoader = IPY_GameWorld.IPY_XMLLoader()  | 
|           | 
|         if not ZipFile_IsFile(mainQuest):  | 
|             GameWorld.Log("Zip : %d Ã»ÓÐÈÎÎñÊý¾Ý : %s"%(questID, mainQuest))  | 
|             return  | 
|         #mainQuestLoader.LoadFromFile(mainQuest)  | 
|         mainQuestLoader.LoadFromXML(mainQuest, ZipFile_GetData(mainQuest))  | 
|         #³õʼ»¯ÈÎÎñË÷Òý  | 
|         mainQuestList = mainQuestLoader.GetNodeList()  | 
| #    #µ±Ç°ÈÎÎñµÄÈÎÎñÊý¾Ý  | 
| #    curQuest = MainQuestData()  | 
|       | 
|     #µ¼ÈëÕâ¸öÈÎÎñµÄËùÓÐXMLÊý¾Ý  | 
| #    for root, dirs, files in os.walk(filePath):  | 
| #        for file in files:  | 
| #            fileName = os.path.join(root, file)  | 
| #            fileName = fileName.replace(filePath, "")  | 
|   | 
|     filePath = filePath.lower()  | 
|     for fileName in ZipFile_Walk(filePath):  | 
|         fileName = fileName.replace(filePath, "")  | 
|         if fileName.find("__init__") >= 0:  | 
|             continue  | 
|           | 
|         curFileList = fileName.split(".")  | 
|           | 
|         ext = curFileList[1]  | 
|         if ext != "xml":  | 
|             continue  | 
|         fileSplit = fileName.split("\\")  | 
|           | 
|         #GameWorld.Log(fileName)  | 
|         if len(fileSplit) <= 1:  | 
|             continue  | 
|         xmlType = fileSplit[0]  | 
|           | 
|           | 
|         xmlSource = fileName.replace("%s\\"%fileSplit[0], "")  | 
|         key = (xmlType, xmlSource)  | 
|         if curQuest.QuestsEvent.has_key(key) != True:  | 
|             curEvent = MainQuestEventData()  | 
|             curEvent.Type = xmlType  | 
|             curEvent.Source = xmlSource  | 
|               | 
|             curEvent.FileSource = filePath + xmlType + "\\" + xmlSource  | 
|             #ÕÒµ½²¢ÇÒ¶ÁÈ¡Õâ¸öÎļþ  | 
|             #curEvent.XMLEventLoader.LoadFromFile(filePath + xmlType + "\\" + xmlSource)  | 
|             curQuest.QuestsEvent[(xmlType,xmlSource)] = curEvent  | 
| #                  | 
| #                #°Ñµ±Ç°Ê¼þÌí¼Óµ½ËùÓÐÈÎÎñË÷ÒýÖÐ  | 
| #                if AllQuestsEvents.has_key(key) != True:  | 
| #                    AllQuestsEvents[key] = list()  | 
| #                try:  | 
| #                    AllQuestsEvents[key].append((questID, curEvent))  | 
| #                except Exception:  | 
| #                    GameWorld.Log("ÈÎÎñ¶ÁÈ¡´íÎó£º%s"%fileName)  | 
| #                    raise Exception("ÈÎÎñ¶ÁÈ¡´íÎó£º%s"%fileName)  | 
|                   | 
|                   | 
|     if mainQuestList == None or mainQuestList.IsEmpty():  | 
|         #ûÓÐÈÎÎñÊý¾Ý  | 
|         if questID != 0:  | 
|             GameWorld.Log("%d Ã»ÓÐÈÎÎñÊý¾Ý : %s"%(questID, mainQuest))  | 
|         return  | 
|       | 
|     questList = mainQuestList.FindNode("quests").ChildNodes()  | 
|       | 
|     if questList.GetCount() != 1:  | 
|         GameWorld.Log("ÈÎÎñÊý¾Ý²»Îª1")  | 
|         return  | 
|       | 
|     curQuestLoader = questList.Get(0)  | 
|       | 
|     #idStr = curQuestLoader.GetAttribute("id")  | 
|     curQuest.ID = questID  | 
|     curQuest.Name = curQuestLoader.GetAttribute("name")  | 
|     curQuest.NameCode = curQuestLoader.GetAttribute("ms_code")  | 
|     curQuest.Code = curQuestLoader.GetAttribute("code")  | 
|     curQuest.Type = int(curQuestLoader.GetAttribute("type"))  | 
|     curQuest.NPCID = GameWorld.ToIntDef(curQuestLoader.GetAttribute("npc"), 0)  | 
|     curQuest.LV = GameWorld.ToIntDef(curQuestLoader.GetAttribute("lv"), 0)  | 
|     curQuest.MapID = GameWorld.ToIntDef(curQuestLoader.GetAttribute("map"), 0)  | 
|     curQuest.Day_Count = curQuestLoader.GetAttribute("day_count")  | 
|     curQuest.Color_lv = GameWorld.ToIntDef(curQuestLoader.GetAttribute("color_lv"), 0)  | 
|     curQuest.CanDel = GameWorld.ToIntDef(curQuestLoader.GetAttribute("can_del"), 0)  | 
|       | 
|     if curQuest.Day_Count != '':  | 
|         #Õâ¸öÈÎÎñÓдÎÊýÌõ¼þ  | 
|         curList = curQuest.Day_Count.split('/')  | 
|         try:  | 
|             curQuest.DayCurCount = QuestCommon.DealWithInPut(curList[0], '!')[0]  #µ±Ç°ÈÎÎñ´ÎÊý  | 
|         except BaseException:  | 
|             GameWorld.ErrLog("ÈÎÎñ: %s ¸ñʽ´íÎó! curQuest.Day_Count = %s"%(questID, curQuest.Day_Count))  | 
|             raise ("DD")  | 
|       | 
|         maxCountList = QuestCommon.DealWithInPut(curList[1], '!')  | 
|         if len(maxCountList) == 0:  | 
|             curQuest.DayMaxCount = curList[1]  | 
|         else:  | 
|             curQuest.DayMaxCount = maxCountList[0]  #ÿÈÕÈÎÎñ×î´ó´ÎÊý  | 
|       | 
|     #---ÈÎÎñ´ÎÊýÖØÖÃ---  | 
|     resetCountStr = curQuestLoader.GetAttribute("reset_count")  | 
|     if resetCountStr != '':  | 
|         #Õâ¸öÈÎÎñÓдÎÊýÌõ¼þ  | 
|         curList = resetCountStr.split('/')  | 
|         try:  | 
|             curQuest.ResetCurCountDictName = QuestCommon.DealWithInPut(curList[0], '!')[0]  #µ±Ç°ÈÎÎñÖØÖôÎÊý  | 
|         except BaseException:  | 
|             GameWorld.ErrLog("ÈÎÎñ: %s ¸ñʽ´íÎó! curQuest.ResetCurCountDictName = %s"%(questID,   | 
|                                                 curQuest.ResetCurCountDictName))  | 
|             raise ("DD")  | 
|   | 
|         curQuest.ResetMaxCount = int(curList[1])  | 
|   | 
|       | 
|     #Õâ¸öÈÎÎñÊÇ·ñ²»ÔÚÈÎÎñÁбíÖÐÏÔʾ  | 
|     curQuest.Invisible = GameWorld.ToIntDef(curQuestLoader.GetAttribute("invisible"), 0)  | 
|               | 
|     descriptionsNode = curQuestLoader.FindChildNode("descriptions")  | 
|       | 
| #    if not Quests.has_key(curQuest.ID) :  | 
| #        #Ìí¼ÓÈÎÎñ  | 
| #        Quests[curQuest.ID] = curQuest  | 
|           | 
|     if descriptionsNode == None or descriptionsNode.IsEmpty():  | 
|         return  | 
|       | 
|     for i in range(0,descriptionsNode.GetChildCount()):  | 
|         questDescription = QuestDescription()  | 
|         curDescription = descriptionsNode.GetChild(i)       #description  | 
|           | 
|         questDescription.IsRewardNode = GameWorld.ToIntDef(curDescription.GetAttribute("reward"), 0)  | 
|   | 
|         curMsg = curDescription.FindChildNode("msg")  | 
|         curMissionInfo = curDescription.FindChildNode("mission_info")  | 
|         curLight = curDescription.FindChildNode("lights")  | 
|         questDescription.Rewards = curDescription.FindChildNode("rewards")  | 
|         questDescription.MsgNode = curMsg  | 
|         if curMsg != None and (not curMsg.IsEmpty()):  | 
|             #questDescription.Msg = curMsg.GetXML()  | 
|             questDescription.Msg = curMsg.GetAttribute("code")  | 
|               | 
|         if curMissionInfo != None and (not curMissionInfo.IsEmpty()):  | 
|             for i in range(0, curMissionInfo.GetChildCount()):  | 
|                 curNode = curMissionInfo.GetChild(i)  | 
|                 curContent = curNode.GetAttribute("code")  | 
|                 #curContent = curNode.GetXML()  | 
|                 questDescription.Info.append(curContent)  | 
|                   | 
| #===============================================================================  | 
| #        if curLight != None and (not curLight.IsEmpty()):  | 
| #            for i in range(0, curLight.GetChildCount()):  | 
| #                questLight = QuestLight()  | 
| #                curNode = curLight.GetChild(i)  | 
| #                #GameWorld.Log("curQuest.ID = %s, NPCID = %s"%(curQuest.ID, curNode.GetAttribute("npcid")))  | 
| #                questLight.NPCID = int(curNode.GetAttribute("npcid"))  | 
| #                questLight.Type = int(curNode.GetAttribute("type"))  | 
| #                questDescription.Lights.append(questLight)  | 
| #===============================================================================  | 
|         try:  | 
|             #¹¹³ÉÈÎÎñÃèÊöÁÐ±í  | 
|             curQuest.QuestDescriptionList.append(questDescription)  | 
|         except Exception:  | 
|             GameWorld.Log("ÈÎÎñ¶ÁÈ¡´íÎó£º%s"%str(curQuest.ID))  | 
|             raise Exception("ÈÎÎñÃèÊö´íÎó£º%s"%str(curQuest.ID))  | 
|       | 
|     #¶ÁÈ¡ÈÎÎñʼþËæ»úÊý¾Ý  | 
|     curQuest.DayEvent = LoadLevityEventData(filePath)  | 
|       | 
|     #¶ÁÈ¡ÍÚ±¦µØµã¶¨Òå  | 
|     #===========================================================================  | 
|     # treasurePath = filePath + "treasure.xml"  | 
|     # if ZipFile_IsFile(treasurePath):  | 
|     #    try:  | 
|     #        curQuest.Treasure = LoadTreasureData(treasurePath)  | 
|     #          | 
|     #    except Exception:  | 
|     #        GameWorld.Log("¶ÁÈ¡ÍÚ±¦µØµã´íÎó:%s"%treasurePath)  | 
|     #        raise Exception("¶ÁÈ¡ÍÚ±¦µØµã´íÎó:%s"%treasurePath)  | 
|     #===========================================================================  | 
|           | 
|     #¶ÁȡÿÈÕÈÎÎñ½±Àø ÔÝʱ¹Ø±ÕÿÈÕÈÎÎñµÄ½±Àø¼ÓÔØ£¬¿ªÆôÐ迼ÂÇminlvºÍmaxlv´æ´¢µÄ´úÂë²»ÒªÓ°ÏìÐÔÄܺÍÄÚ´æ  | 
|     #===========================================================================  | 
|     # rewardPath = filePath + "reward.xml"  | 
|     # if ZipFile_IsFile(rewardPath):  | 
|     #    try:  | 
|     #        curQuest.DayEventReward = LoadDayEventRewardData(rewardPath)  | 
|     #    except Exception:  | 
|     #        GameWorld.Log("¶ÁȡÿÈÕÈÎÎñ½±Àø´íÎó:%s"%rewardPath)  | 
|     #        raise Exception("¶ÁȡÿÈÕÈÎÎñ½±Àø´íÎó:%s"%rewardPath)  | 
|     #===========================================================================  | 
|           | 
|     #¶ÁÈ¡ÅÜ»·ÈÎÎñ½±Àø  | 
|     rewardPath = filePath + "run_reward.xml"  | 
|     if ZipFile_IsFile(rewardPath):  | 
|         try:  | 
|             curQuest.RunAroundReward = LoadRunAroundRewardData(rewardPath)  | 
|         except Exception:  | 
|             GameWorld.Log("¶ÁÈ¡ÅÜ»·ÈÎÎñ½±Àø´íÎó:%s"%rewardPath)  | 
|             raise Exception("¶ÁÈ¡ÅÜ»·ÈÎÎñ½±Àø´íÎó:%s"%rewardPath)  | 
|   | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##¼ÓÔØËùÓÐÈÎÎñÊý¾Ý  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ¼ÓÔØËùÓÐÈÎÎñÊý¾Ý  | 
| def LoadQuestData():  | 
|     global Quests  | 
|     questPath = "%s\\Quests"%GetQuestDataName()  | 
|     GameWorld.Log("Quests Initing... path = %s"%questPath)  | 
|       | 
| #    LoadQuest(os.path.join(questPath, '0'), 0, MainQuestData())  | 
|     if ZipFile_IsDir(questPath)!= True:  | 
|         GameWorld.Log("Can't Find Path = %s"%questPath)  | 
|         return  | 
|       | 
|     dirs = ZipFile_ListDir(questPath)  | 
|     #ÈÎÎñ¼ÆÊýÆ÷  | 
|     cnt = 0  | 
|     #±¾µØÍ¼ID  | 
|     curMapID = GameWorld.GetMap().GetMapID()  | 
|       | 
|     for curDir in dirs:  | 
|         curPath = os.path.join(questPath, curDir)  | 
|         #questXMLName = "%s.xml"%curDir  | 
|         try:  | 
|             questID = GameWorld.ToIntDef(curDir, 0)  | 
|             if questID == 0 and curDir != '0':  | 
|                 GameWorld.Log("questID = 0 : %s, ¸ñʽ²»¶Ô, ²»¶ÁÈ¡´Ëxml"%curDir)  | 
|                 continue  | 
|               | 
|             #²»¼ÓÔØ²»ÊôÓÚ±¾µØÍ¼µÄXML  | 
|             if not CheckMapCanLoadXML( curMapID, questID ):  | 
|                 continue  | 
|               | 
|             cnt += 1  | 
|             LoadQuestEvents(curPath, questID)  | 
|               | 
|         except Exception:  | 
|             GameWorld.Log('ÈÎÎñ¶ÁÈ¡´íÎó£º%s'%curPath)  | 
|             raise Exception('ÈÎÎñ¶ÁÈ¡´íÎó£º%s'%curPath)  | 
|           | 
|     GameWorld.Log("Quests Init OK, Quest = %d"%cnt)          | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##Ö»¼ÓÔØ±¾µØÍ¼µÄXMLÎļþ  | 
| # @param curMapID µ±Ç°µØÍ¼ID  | 
| # @param questID ÈÎÎñID  | 
| # @return ·µ»ØÖµÕæ, ¿ÉÒÔ¼ÓÔØ  | 
| # @remarks Ö»¼ÓÔØ±¾µØÍ¼µÄXMLÎļþ  | 
| def CheckMapCanLoadXML( curMapID, questID ):  | 
|     #Õâ¸öÈÎÎñÊÇÓÃÀ´¼Ç¼ÈÎÎñDZ¹æÔòµÄ, ¶¼Òª¼ÓÔØ  | 
|     if questID == ChConfig.Def_MissionID_FirstLogin:  | 
|         return True  | 
|       | 
|     readDict = ReadChConfig.GetEvalChConfig('MissionAcceptMapID')  | 
|       | 
|     accecpMapID = readDict.get( questID )  | 
|     #Õâ¸öÈÎÎñÎÞÏÞÖÆ  | 
|     if not accecpMapID:  | 
|         return True  | 
|       | 
|     #È«µØÍ¼¼ÓÔØ  | 
|     if -1 in accecpMapID:  | 
|         return True  | 
|       | 
|     return ( curMapID in accecpMapID )   | 
| #---------------------------------------------------------------------  | 
| ##¼ÓÔØ¹¦ÄÜNPCÊý¾Ý  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ¼ÓÔØ¹¦ÄÜNPCÊý¾Ý  | 
| def LoadFunctionData():  | 
|     global FunctionNPCTalk  | 
|     #===========================================================  | 
|     #³õʼ»¯¹¦ÄÜNPCµÄ¶Ô»°ÁÐ±í  | 
|     functionPath = "%s\\FunctionNPC.xml"%GetQuestDataName()  | 
|     functionLoader = IPY_GameWorld.IPY_XMLLoader()  | 
|     #functionLoader.LoadFromFile(functionPath)  | 
|     functionLoader.LoadFromXML(functionPath, ZipFile_GetData(functionPath))  | 
|       | 
|     functionList = functionLoader.GetNodeList().FindNode("functions").ChildNodes()  | 
|     for i in range(0, functionList.GetCount()):  | 
|         curFunctionLoader = functionList.Get(i)  | 
|         id = int(curFunctionLoader.GetAttribute("id"))  | 
|         funcData = FunctionNPCTalkData()  | 
|         funcData.ID = id  | 
|         funcData.Name = curFunctionLoader.GetAttribute("name")  | 
|         for i in range(0, curFunctionLoader.GetChildCount()):  | 
|             funcMenu = FunctionMenu()  | 
|             curMenu = curFunctionLoader.GetChild(i)  | 
|             funcMenu.Menu = curMenu.GetAttribute("menu")  | 
|             funcMenu.Code = curMenu.GetAttribute("code")  | 
|             funcMenu.Check = curMenu.GetAttribute("check")  | 
|             if funcMenu.Check == None:  | 
|                 continue  | 
|               | 
|             funcMenu.CheckArgs = curMenu.GetAttribute("args")  | 
|             funcData.Menus.append(funcMenu)  | 
|         FunctionNPCTalk[id] = funcData  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##¼ÓÔØ´«Ë͵ãÊý¾Ý  | 
| # @param treasurePath Îļþ·¾¶  | 
| # @return ·µ»ØÖµ£¬ ÈÝÆ÷ TreasureData()  | 
| # @remarks ¼ÓÔØ´«Ë͵ãÊý¾Ý  | 
| def LoadTreasureData(treasurePath):  | 
|     treasureLoader = IPY_GameWorld.IPY_XMLLoader()  | 
|     #treasureLoader.LoadFromFile(treasurePath)  | 
|     treasureLoader.LoadFromXML(treasurePath, ZipFile_GetData(treasurePath))  | 
|     nodeList = treasureLoader.GetNodeList()  | 
|     if nodeList == None or nodeList.IsEmpty():  | 
|         return None  | 
|       | 
|     #GameWorld.Log("Load Treasure : %s"%treasurePath)  | 
|     treasureData = TreasureData()  | 
|     treasureList = nodeList.FindNode("treasure").ChildNodes()  | 
|       | 
|     #¶ÁÈ¡ÆÕͨÍÚ±¦µØµã  | 
|     normalList = treasureList.FindNode("treasure_normal")  | 
|     if normalList != None and (not normalList.IsEmpty()):  | 
|         treasureNormalList = list()  | 
|         for i in range(normalList.GetChildCount()):  | 
|             curNode = normalList.GetChild(i)  | 
|             treasurePos = TreasurePos()  | 
|             treasurePos.MapID = int(curNode.GetAttribute("mapid"))  | 
|             treasurePos.PosX = int(curNode.GetAttribute("posx"))  | 
|             treasurePos.PosY = int(curNode.GetAttribute("posy"))  | 
|             treasureNormalList.append(treasurePos)  | 
|         treasureData.Normal = treasureNormalList  | 
|       | 
|     weekList = treasureList.FindNode("treasure_weeks")  | 
|     if weekList != None and (not weekList.IsEmpty()):  | 
|         treasureByLV = dict()  | 
|         for i in range(weekList.GetChildCount()):  | 
|             curLVData = weekList.GetChild(i)        #treasure_week½Úµã  | 
|               | 
|             minLV = GameWorld.ToIntDef(curLVData.GetAttribute("minlv"), 0)  | 
|             maxLV = GameWorld.ToIntDef(curLVData.GetAttribute("maxlv"), 0)  | 
|             lv = GameWorld.ToIntDef(curLVData.GetAttribute("lv"), 0)  | 
|           | 
|             treasureWeekList = dict()  | 
|             if curLVData.GetChildCount() == 1:  | 
|                 #иñʽ:Èç¹û<week>½ÚµãÖ»ÓÐÒ»¸ö, ×Ô¶¯À©³äΪ7¸ö  | 
|                 curWeekData = curLVData.GetChild(0)  | 
|                 curPosData = curWeekData.GetChild(0)  | 
|                 curData = list()  | 
|                 treasurePos = TreasurePos()  | 
|                 treasurePos.MapID = int(curPosData.GetAttribute("mapid"))  | 
|                 treasurePos.PosX = int(curPosData.GetAttribute("posx"))  | 
|                 treasurePos.PosY = int(curPosData.GetAttribute("posy"))  | 
|                 curData.append(treasurePos)  | 
|                 for curDay in range(1, 8):  | 
|                     #7Ìì  | 
|                     treasureWeekList[curDay] = curData  | 
|                     #GameWorld.Log(GameWorld.Log('---curDay---%s'%str(curData)))  | 
|                   | 
|                 treasureByLV[lv] = treasureWeekList  | 
|                 continue  | 
|               | 
|             for i in range(curLVData.GetChildCount()):  | 
|                 curWeekData = curLVData.GetChild(i)  | 
|                 curWeek = int(curWeekData.GetAttribute("day"))  | 
|                 treasureWeekList[curWeek] = list()  | 
|                 for i in range(curWeekData.GetChildCount()):  | 
|                     curPosData = curWeekData.GetChild(i)  | 
|                     treasurePos = TreasurePos()  | 
|                     treasurePos.MapID = int(curPosData.GetAttribute("mapid"))  | 
|                     treasurePos.PosX = int(curPosData.GetAttribute("posx"))  | 
|                     treasurePos.PosY = int(curPosData.GetAttribute("posy"))  | 
|                     treasureWeekList[curWeek].append(treasurePos)  | 
|                       | 
|             if lv != 0:  | 
|                 treasureByLV[lv] = treasureWeekList  | 
|                 #GameWorld.Log('---lv---%s'%str(treasureWeekList))  | 
|             else:  | 
| #                GameWorld.Log(treasurePath)  | 
| #                GameWorld.Log('---minLV %s, maxLV %s---%s'%(minLV, maxLV, str(treasureWeekList)))  | 
|                 for curLV in range(minLV, maxLV):  | 
|                     treasureByLV[curLV] = treasureWeekList  | 
|                       | 
|                       | 
|         treasureData.Week = treasureByLV  | 
|         #GameWorld.Log(str(treasureData.Week))  | 
|     return treasureData  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##¼ÓÔØÅÜ»·ÈÎÎñ½±ÀøÊý¾Ý  | 
| # @param runAroundRewardPath Îļþ·¾¶  | 
| # @return ·µ»ØÖµ, ÈÝÆ÷AllRunAroundRewardData()  | 
| # @remarks ¼ÓÔØÅÜ»·ÈÎÎñ½±ÀøÊý¾Ý  | 
| def LoadRunAroundRewardData(runAroundRewardPath):  | 
|     allRunAround = AllRunAroundRewardData()  | 
|       | 
|     dayEventRewardLoader = IPY_GameWorld.IPY_XMLLoader()  | 
|     dayEventRewardLoader.LoadFromXML(runAroundRewardPath, ZipFile_GetData(runAroundRewardPath))  | 
|       | 
|     nodeList = dayEventRewardLoader.GetNodeList()  | 
|       | 
|     if nodeList == None or nodeList.IsEmpty():  | 
|         GameWorld.Log("ûÓÐÕâ¸öÎļþ %s"%runAroundRewardPath)  | 
|         return None  | 
|     rewardsNode = nodeList.FindNode("rewards")  | 
|       | 
|     allRunAround.MoneyType = int(rewardsNode.GetAttribute("moneytype"))  | 
|     allRunAround.MinLV = 1000  | 
|     allRunAround.MaxLV = 0  | 
|     runAroundRewardList = rewardsNode.ChildNodes()  | 
|     for i in xrange(runAroundRewardList.GetCount()):  | 
|         curRunAroundRewardNode = runAroundRewardList.Get(i)  | 
|         Exp = GameWorld.ToIntDef(curRunAroundRewardNode.GetAttribute("exp"), 0)  | 
|         addExp = GameWorld.ToIntDef(curRunAroundRewardNode.GetAttribute("addexp"), 0)  | 
|         Money = GameWorld.ToIntDef(curRunAroundRewardNode.GetAttribute("money"), 0)  | 
|         Item = curRunAroundRewardNode.GetAttribute("item")  | 
|         minLV = GameWorld.ToIntDef(curRunAroundRewardNode.GetAttribute("minlv"), 0)  | 
|         maxLV = GameWorld.ToIntDef(curRunAroundRewardNode.GetAttribute("maxlv"), 0)  | 
|         familyHornor = GameWorld.ToIntDef(curRunAroundRewardNode.GetAttribute("familyhornor"), 0)  | 
|         goldPaper = GameWorld.ToIntDef(curRunAroundRewardNode.GetAttribute("goldpaper"), 0)  | 
|         #¼Ì³ÐÿÈÕ½±Àø£¬²Î¿¼ÉèÖà  | 
|         dayEventRewardData = RunAroundRewardData()  | 
|         dayEventRewardData.Exp = Exp  | 
|         dayEventRewardData.AddExp = addExp  | 
|         dayEventRewardData.Money = Money  | 
|         dayEventRewardData.Item = Item  | 
|         dayEventRewardData.PlayerFamilyHornor = familyHornor  | 
|         dayEventRewardData.GoldPaper = goldPaper  | 
|         allRunAround.Rewards[(minLV, maxLV)] = dayEventRewardData  | 
|         if minLV < allRunAround.MinLV:  | 
|             allRunAround.MinLV = minLV  | 
|         if maxLV > allRunAround.MaxLV:  | 
|             allRunAround.MaxLV = maxLV  | 
|            | 
|     return allRunAround  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##¼ÓÔØÃ¿ÈÕÈÎÎñ½±ÀøÊý¾Ý  | 
| # @param treasurePath Îļþ·¾¶  | 
| # @return ·µ»ØÖµ, ÈÝÆ÷AllDayEventRewardData()  | 
| # @remarks ¼ÓÔØÃ¿ÈÕÈÎÎñ½±ÀøÊý¾Ý  | 
| def LoadDayEventRewardData(dayEventRewardPath):  | 
|     allDayEvent = AllDayEventRewardData()  | 
|       | 
|     dayEventRewardLoader = IPY_GameWorld.IPY_XMLLoader()  | 
|     #dayEventRewardLoader.LoadFromFile(dayEventRewardPath)  | 
|     dayEventRewardLoader.LoadFromXML(dayEventRewardPath, ZipFile_GetData(dayEventRewardPath))  | 
|       | 
|     nodeList = dayEventRewardLoader.GetNodeList()  | 
|       | 
|     if nodeList == None or nodeList.IsEmpty():  | 
|         #ûÓÐÕâ¸öÎļþ  | 
|         return None  | 
|       | 
|     rewardsNode = nodeList.FindNode("rewards")  | 
|       | 
|     allDayEvent.MinLV = int(rewardsNode.GetAttribute("minlv"))  | 
|     allDayEvent.MaxLV = int(rewardsNode.GetAttribute("maxlv"))  | 
|     allDayEvent.MoneyType = int(rewardsNode.GetAttribute("moneytype"))  | 
|       | 
|     dayEventRewardList = rewardsNode.ChildNodes()  | 
|     for i in range(0, dayEventRewardList.GetCount()):  | 
|         curDayEventRewardNode = dayEventRewardList.Get(i)  | 
|         lv = int(curDayEventRewardNode.GetAttribute("lv"))  | 
|         dayEventRewardData = DayEventRewardData()  | 
|           | 
|         dayEventRewardData.Exp = GameWorld.ToIntDef(curDayEventRewardNode.GetAttribute("exp"), 0)  | 
|         dayEventRewardData.Money = GameWorld.ToIntDef(curDayEventRewardNode.GetAttribute("money"), 0)  | 
|         dayEventRewardData.TruckMoney = GameWorld.ToIntDef(curDayEventRewardNode.\  | 
|                                                            GetAttribute("truck_money"), 0)  | 
|         dayEventRewardData.Item = curDayEventRewardNode.GetAttribute("item")  | 
|           | 
|         #¼Ò×å¹±Ï×  | 
|         dayEventRewardData.PlayerFamilyHornor = GameWorld.ToIntDef(curDayEventRewardNode.\  | 
|                                                 GetAttribute("player_family_hornor"), 0)  | 
|         #¼Ò×å»îÔ¾¶È  | 
|         dayEventRewardData.PlayerFamilyActiveValue = GameWorld.ToIntDef(curDayEventRewardNode.\  | 
|                                                     GetAttribute("player_family_active_value"), 0)  | 
|         #¼ÒÔ°¾Ñé  | 
|         dayEventRewardData.FamilyHomeExp = GameWorld.ToIntDef(curDayEventRewardNode.\  | 
|                                                     GetAttribute("family_home_exp"), 0)  | 
|         #¼Ò×å×Ê½ð   | 
|         dayEventRewardData.FamilyMoney = GameWorld.ToIntDef(curDayEventRewardNode.\  | 
|                                          GetAttribute("family_money"), 0)  | 
|         #¼Ò×åÈÙÓþ  | 
|         dayEventRewardData.FamilyHornor = GameWorld.ToIntDef(curDayEventRewardNode.\  | 
|                                           GetAttribute("family_hornor"), 0)  | 
|         #³èÎï¾Ñé  | 
|         dayEventRewardData.PetExp = GameWorld.ToIntDef(curDayEventRewardNode.\  | 
|                                     GetAttribute("pet_exp"), 0)  | 
|         #ÍþÍû  | 
|         dayEventRewardData.Prestige = GameWorld.ToIntDef(curDayEventRewardNode.\  | 
|                                       GetAttribute("prestige"), 0)  | 
|           | 
|         allDayEvent.Rewards[lv] = dayEventRewardData    | 
|               | 
|     return allDayEvent  | 
|   | 
|   | 
| #===============================================================================  | 
| ## °´ÕÕIDÀ´É±¹Ö  | 
| # @param curNode ½Úµã  | 
| # @param funcData ÈÎÎñÈÝÆ÷DayEvent  | 
| # @return ÎÞ  | 
| # @remarks °´ÕÕIDÀ´É±¹Ö  | 
| def LoadKillByID(curNode):  | 
|     killNPC = Day_KillNPC_By_ID()  | 
|     killNPC.ID = int(curNode.GetAttribute("id"))   | 
|     #killNPC.Count = int(curNode.GetAttribute("count"))  | 
|     killNPC.NPCData = GameWorld.GetGameData().FindNPCDataByID(killNPC.ID)  | 
|     killNPC.MapID = GameWorld.ToIntDef(curNode.GetAttribute("mapid"), 0)  | 
|     return killNPC  | 
|   | 
| ## °´Õյȼ¶À´É±¹Ö  | 
| # @param curNode ½Úµã  | 
| # @param funcData ÈÎÎñÈÝÆ÷DayEvent  | 
| # @return ÎÞ  | 
| # @remarks °´Õյȼ¶À´É±¹Ö  | 
| def LoadKillByLV(curNode):  | 
|     killLV = Day_KillNPC_By_LV()  | 
|     killLV.LV = int(curNode.GetAttribute("lv"))  | 
|     killLV.Count = int(curNode.GetAttribute("count"))  | 
|     killLV.Country = int(curNode.GetAttribute("country"))  | 
|     return killLV  | 
|   | 
| ## °´ÕÕIDÀ´ÊÕ¼¯ÎïÆ·  | 
| # @param curNode ½Úµã  | 
| # @param funcData ÈÎÎñÈÝÆ÷DayEvent  | 
| # @return ÎÞ  | 
| # @remarks °´ÕÕIDÀ´ÊÕ¼¯ÎïÆ·  | 
| def LoadItemByID(curNode):  | 
|     getItem = Day_GetItem_By_ID()  | 
|     getItem.ID = int(curNode.GetAttribute("id"))  | 
|     getItem.Count = int(curNode.GetAttribute("count"))  | 
|     return getItem  | 
|   | 
| ## Ëæ»ú·ÃÎÊNPCÊý¾Ý  | 
| # @param curNode ½Úµã  | 
| # @param funcData ÈÎÎñÈÝÆ÷DayEvent  | 
| # @return ÎÞ  | 
| # @remarks Ëæ»ú·ÃÎÊNPCÊý¾Ý  | 
| def LoadVisitNpcByID(curNode):  | 
|     visitNPC = Day_VisitNPC()  | 
|     visitNPC.ID = int(curNode.GetAttribute("id"))  | 
|     visitNPC.MapID = GameWorld.ToIntDef(curNode.GetAttribute("mapid"), 0)  | 
|     visitNPC.NPCData = GameWorld.GetGameData().FindNPCDataByID(visitNPC.ID)  | 
|     return visitNPC  | 
|   | 
| ## Ëæ»úÈÎÎñÊý¾Ý  | 
| # @param curNode ½Úµã  | 
| # @param funcData ÈÎÎñÈÝÆ÷DayEvent  | 
| # @return ÎÞ  | 
| # @remarks Ëæ»úÈÎÎñÊý¾Ý  | 
| def LoadMissionByID(curNode):  | 
|     #mission = Day_Mission()  | 
|     missionID = int(curNode.GetAttribute("id"))  | 
|     rate = int(curNode.GetAttribute("rate"))  | 
|   | 
|     return rate, missionID  | 
|       | 
| ## Ëæ»ú²É¼¯Êý¾Ý  | 
| # @param curNode ½Úµã  | 
| # @param funcData ÈÎÎñÈÝÆ÷DayEvent  | 
| # @return ÎÞ  | 
| # @remarks Ëæ»ú²É¼¯Êý¾Ý  | 
| def LoadCollectNPCByID(curNode):  | 
|     collectNPC = Day_CollectNPC()  | 
|     collectNPC.ID = int(curNode.GetAttribute("id"))  | 
|     collectNPC.Count = int(curNode.GetAttribute("count"))  | 
|     collectNPC.MapID = GameWorld.ToIntDef(curNode.GetAttribute("mapid"), 0)  | 
|       | 
|     return collectNPC  | 
|   | 
| ## ¶Á±í¸ü¸Ä×ÖµäÖµ,´Ëº¯ÊýÍâ²ãÐ迼ÂÇÊÇ·ñ±éÀúµ÷Ó㬠»áÒòÖØ¸´µ¼ÖÂÄÚ´æºÍÐÔÄÜÎÊÌâ  | 
| # ²ÎÊý lvInfo ¿ÉÒÔÊÇÊý×ֵȼ¶£¬ºÍÔª×飨×îС£¬×î´óµÈ¼¶£©  | 
| # @remarks Ëæ»ú²É¼¯Êý¾Ý  | 
| def LoadXMLDict(eventXMLData, lvInfo, curEventNode, loadFunc, dayEventType):  | 
|     if dayEventType not in eventXMLData:  | 
|         eventXMLData[dayEventType] = {}  | 
|       | 
|     if lvInfo not in eventXMLData[dayEventType]:  | 
|         eventXMLData[dayEventType][lvInfo] = []  | 
|           | 
|     for i in range(0, curEventNode.GetChildCount()):  | 
|         curNode = curEventNode.GetChild(i)  | 
|         eventXMLData[dayEventType][lvInfo].append(loadFunc(curNode))  | 
|   | 
|   | 
|       | 
| #==============================================================================  | 
| ## Ëæ»úʱ¼ä¶ÁÈ¡Æ÷  | 
| # @param eventPath XML·¾¶  | 
| # @param funcData ÈÎÎñÈÝÆ÷DayEvent  | 
| # @param eventXMLData ÈÎÎñ×ÜÈÝÆ÷  | 
| # @param loadFunc º¯ÊýÃû  | 
| # @return ÎÞ  | 
| # @remarks Ëæ»úʱ¼ä¶ÁÈ¡Æ÷  | 
| def LoadEvent(eventPath, eventXMLData, loadFunc, dayEventType):  | 
|     eventLoader = IPY_GameWorld.IPY_XMLLoader()  | 
|     eventLoader.LoadFromXML(eventPath, ZipFile_GetData(eventPath))  | 
|       | 
|     nodeList = eventLoader.GetNodeList()  | 
|       | 
|     if nodeList == None or nodeList.IsEmpty():  | 
|         #ûÓÐÕâ¸öÎļþ  | 
|         return None  | 
|   | 
|     #---¶ÁÈ¡½ÚµãÊý¾Ý---  | 
|     eventList = nodeList.FindNode("task_event").ChildNodes()  | 
|     for i in range(0, eventList.GetCount()):  | 
|         curEventNode = eventList.Get(i)  | 
|         lv = GameWorld.ToIntDef(curEventNode.GetAttribute("lv"), 0)  | 
|   | 
|         if lv != 0:  | 
|             LoadXMLDict(eventXMLData, lv, curEventNode, loadFunc, dayEventType)  | 
|             continue  | 
|           | 
|         #иñʽ: <event minlv="25" maxlv="45">  | 
|         minlv = int(curEventNode.GetAttribute("minlv"))  | 
|         maxlv = int(curEventNode.GetAttribute("maxlv"))   | 
|   | 
|         LoadXMLDict(eventXMLData, (minlv, maxlv), curEventNode, loadFunc, dayEventType)  | 
|   | 
|   | 
| ## ¶ÁÈ¡ÈÎÎñʼþ  | 
| # @param filePath XML·¾¶  | 
| # @return ÎÞ  | 
| # @remarks ¶ÁÈ¡ÈÎÎñʼþ  | 
| def LoadLevityEventData(filePath):  | 
|     eventXMLData = {}  | 
|   | 
|     #---¶Áȡɱ¹Ö£¨ID£©ÈÎÎñÊý¾Ý---  | 
|     eventPath = filePath + "event_kill_by_id.xml"  | 
|     if ZipFile_IsFile(eventPath):  | 
|         try:  | 
|             LoadEvent(eventPath, eventXMLData, LoadKillByID, QuestCommon.Day_KillNPC_By_ID_List)  | 
|         except Exception, e:  | 
|             GameWorld.Log("¶ÁÈ¡Ëæ»úÊÕ¼¯É±¹Ö£¨ID£©:%s"%e)  | 
|             raise Exception("¶ÁÈ¡Ëæ»úÊÕ¼¯É±¹Ö£¨ID£©:%s"%eventPath)   | 
|   | 
|   | 
|     #---¶Áȡɱ¹Ö£¨LV£©ÈÎÎñÊý¾Ý---  | 
|     eventPath = filePath + "event_kill_by_lv.xml"  | 
|     if ZipFile_IsFile(eventPath):  | 
|         try:  | 
|             LoadEvent(eventPath, eventXMLData, LoadKillByLV, QuestCommon.Day_KillNPC_By_LV_List)  | 
|         except Exception, e:  | 
|             GameWorld.Log("¶ÁÈ¡Ëæ»úÊÕ¼¯É±¹Ö£¨LV£©:%s"%e)  | 
|             raise Exception("¶ÁÈ¡Ëæ»úÊÕ¼¯É±¹Ö£¨LV£©:%s"%eventPath)   | 
|           | 
|   | 
|     #---ÊÕ¼¯ÎïÆ·£¨ID£©ÈÎÎñÊý¾Ý---  | 
|     eventPath = filePath + "event_item_by_id.xml"  | 
|     if ZipFile_IsFile(eventPath):  | 
|         try:  | 
|             LoadEvent(eventPath, eventXMLData, LoadItemByID, QuestCommon.Day_GetItem_By_ID)  | 
|         except Exception, e:  | 
|             GameWorld.Log("¶ÁÈ¡Ëæ»úÊÕ¼¯ÎïÆ·£¨ID£©:%s"%e)  | 
|             raise Exception("¶ÁÈ¡Ëæ»úÊÕ¼¯ÎïÆ·£¨ID£©:%s"%eventPath)  | 
|   | 
|   | 
|     #---·ÃÎÊNPC£¨ID£©ÈÎÎñÊý¾Ý---  | 
|     eventPath = filePath + "event_visit_by_id.xml"  | 
|     if ZipFile_IsFile(eventPath):  | 
|         try:  | 
|             LoadEvent(eventPath, eventXMLData, LoadVisitNpcByID, QuestCommon.Day_VisitNPCList)  | 
|         except Exception, e:  | 
|             GameWorld.Log("¶ÁÈ¡Ëæ»ú·ÃÎÊNPC£¨ID£©:%s"%e)  | 
|             raise Exception("¶ÁÈ¡Ëæ»ú·ÃÎÊNPC£¨ID£©:%s"%eventPath)   | 
|           | 
|           | 
|     #---Ëæ»ú½ÓÈÎÎñ£¨ID£©ÈÎÎñÊý¾Ý---  | 
|     eventPath = filePath + "event_mission_by_id.xml"  | 
|     if ZipFile_IsFile(eventPath):  | 
|         try:  | 
|             LoadEvent(eventPath, eventXMLData, LoadMissionByID, QuestCommon.Day_MissionList)  | 
|         except Exception, e:  | 
|             GameWorld.Log("¶ÁÈ¡Ëæ»úÈÎÎñ£¨ID£©:%s"%(e))  | 
|             raise Exception("¶ÁÈ¡Ëæ»úÈÎÎñ£¨ID£©:%s"%eventPath)   | 
|           | 
|     #---Ëæ»ú²É¼¯£¨ID£©ÈÎÎñÊý¾Ý---  | 
|     eventPath = filePath + "event_collect_by_id.xml"  | 
|     if ZipFile_IsFile(eventPath):  | 
|         try:  | 
|             LoadEvent(eventPath, eventXMLData, LoadCollectNPCByID, QuestCommon.Day_CollectNPCList)  | 
|         except Exception, e:  | 
|             GameWorld.Log("¶ÁÈ¡Ëæ»ú²É¼¯£¨ID£©:%s"%(e))  | 
|             raise Exception("¶ÁÈ¡Ëæ»ú²É¼¯£¨ID£©:%s"%eventPath)   | 
|       | 
|     return eventXMLData  | 
|   | 
|   | 
| #def LoadSpecialQuestData():  | 
| #    global Special_Quests  | 
| #    questPath = ChConfig.GetAppPath() + "QuestData\\"  | 
| #      | 
| #    mainQuest = questPath + "special_quests.xml"  | 
| #    mainQuestLoader = IPY_GameWorld.IPY_XMLLoader()  | 
| #    mainQuestLoader.LoadFromFile(mainQuest)  | 
| #                  | 
| #                  | 
| #    #==============================================  | 
| #    #³õʼ»¯ÈÎÎñË÷Òý  | 
| #    mainQuestList = mainQuestLoader.GetNodeList()  | 
| #    if mainQuestList == None:  | 
| #        #ûÓÐÈÎÎñÊý¾Ý  | 
| #        return  | 
| #    questList = mainQuestList.FindNode("quests").ChildNodes()  | 
| #      | 
| #    for i in range(0, questList.GetCount()):  | 
| #        curQuestLoader = questList.Get(i)  | 
| #        idStr = curQuestLoader.GetAttribute("id")  | 
| #        curQuest = SpecialQuestData()  | 
| #        curQuest.ID = int(idStr)  | 
| #        curQuest.Name = curQuestLoader.GetAttribute("name")  | 
| #        curQuest.Type = int(curQuestLoader.GetAttribute("type"))  | 
| #        curQuest.LV = int(curQuestLoader.GetAttribute("lv"))  | 
| #        curQuest.MapID = int(curQuestLoader.GetAttribute("mapid"))  | 
| #        curQuest.NPCID = int(curQuestLoader.GetAttribute("npcid"))  | 
| #        Special_Quests[curQuest.ID] = curQuest  | 
| #          | 
| #    return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##¶ÁȡĬÈ϶Ի°Êý¾Ý(Ôݲ»Ê¹ÓÃ)  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ¶ÁȡĬÈ϶Ի°Êý¾Ý(Ôݲ»Ê¹ÓÃ)  | 
| def LoadDefaultTalkData():  | 
|     #¸ü¸ÄΪ¶¯Ì¬¶ÁÈ¡, ÓÃFindDefaultTalk¶ÁÈ¡  | 
| #    global DefaultTalk  | 
| #    filePath = ChConfig.GetAppPath() + "QuestDataGb\\default_talk"  | 
| #    #µ¼ÈëÕâ¸öÈÎÎñµÄËùÓÐXMLÊý¾Ý  | 
| #    files=os.listdir(filePath)  | 
| #    for file in files:  | 
| #        fileName = file.split(".")[0]  | 
| #        if fileName.find("__init__") >= 0:  | 
| #            continue  | 
| #        ext = file.split(".")[1]  | 
| #        if ext != "xml":  | 
| #            continue  | 
| #        npcID = int(fileName)  | 
| #        xmlLoader = IPY_GameWorld.IPY_XMLLoader()  | 
| #        xmlLoader.LoadFromFile(filePath+"\\"+file)  | 
| #        DefaultTalk[npcID] = xmlLoader  | 
|         #GameWorld.Log("¶ÁȡĬÈ϶Ի° : %d"%npcID)  | 
|               | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##¼ÓÔØÈÎÎñÌø×ª  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ¼ÓÔØÈÎÎñÌø×ª  | 
| def LoadQuestTrig():  | 
|     global QuestTrig  | 
|     filePath = "%s\quest_map.xml"%GetQuestDataName()  | 
|     trigLoader = IPY_GameWorld.IPY_XMLLoader()  | 
|     #trigLoader.LoadFromFile(filePath)  | 
|     trigLoader.LoadFromXML( filePath, ZipFile_GetData( filePath ) )  | 
|     questTrig = trigLoader.GetNodeList().FindNode( "quest_trig" )  | 
|       | 
|     for i in range( 0, questTrig.GetChildCount() ):  | 
|         curTrig = questTrig.GetChild(i)  | 
|           | 
|         tridData = QuestTrigData()  | 
|         #Ö°ÒµÑéÖ¤ÔÊÐíΪ¿Õ  | 
|         tridData.CheckJob = curTrig.GetAttribute( "job" )  | 
|         tridData.ID = int( curTrig.GetAttribute( "id" ) )  | 
|         tridData.Next = int( curTrig.GetAttribute( "next" ) )  | 
|         tridData.Continue = int( curTrig.GetAttribute( "continue" ) )  | 
|           | 
|         if not QuestTrig.has_key( tridData.ID ):  | 
|             QuestTrig[ tridData.ID ] = list()  | 
|           | 
|         QuestTrig[ tridData.ID ].append( tridData )  | 
|           | 
|         #GameWorld.Log("add Trig ID = %d"%tridData.ID)  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##¼ÓÔØÈÎÎñ¼òÒªÐÅÏ¢  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ¼ÓÔØÈÎÎñ¼òÒªÐÅÏ¢  | 
| def LoadMissionDescription():  | 
|     global QuestDescriptions  | 
|       | 
|     questPath = os.path.join(GetQuestDataName(), "MissionDescription.xml")  | 
|     questLoader = IPY_GameWorld.IPY_XMLLoader()  | 
|     #questLoader.LoadFromFile(questPath)  | 
|     questLoader.LoadFromXML(questPath, ZipFile_GetData(questPath))  | 
|       | 
|     questsNode = questLoader.GetNodeList().FindNode('quests')   | 
|     for i in range(questsNode.GetChildCount()):  | 
|         questNode = questsNode.GetChild(i)  | 
|         msgNode = questNode.FindChildNode('msg')  | 
|         code = msgNode.GetAttribute('code')  | 
|         questID = int(questNode.GetAttribute('id'))  | 
|         curQuestDescriptionsData = QuestDescriptionsData()  | 
|         curQuestDescriptionsData.Code = code  | 
|         curQuestDescriptionsData.ShowReward = GameWorld.ToIntDef(  | 
|                                               questNode.GetAttribute('have_reward'), 0)  | 
|         QuestDescriptions[questID] = curQuestDescriptionsData  | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##¼ÓÔØÈÎÎñÌâ¿â  | 
| # @param ÎÞ  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks ¼ÓÔØÈÎÎñÌâ¿â  | 
| def ReadSubjectLib():  | 
|     mapID = GameWorld.GetMap().GetMapID()  | 
|     #²»ÐèÒªÖØ¶ÁµÄµØÍ¼  | 
|     if mapID not in ChConfig.Def_Subject_Map:  | 
|         return  | 
|       | 
|     curPath = "%s\\SubjectLib"%GetQuestDataName()  | 
|     curPath = curPath.upper()  | 
|       | 
|     if not ZipFile_IsDir(curPath):  | 
|         GameWorld.Log("·¾¶ = %s , ÎÞ·¨²éÕÒµ½´ðÌâÌâ¿â!"%(curPath))  | 
|         return  | 
|       | 
|       | 
|     files = ZipFile_ListFile(curPath)  | 
|     for file in files:  | 
|         file = file.lower()  | 
|         ext = os.path.splitext(file)  | 
|         postfix = ext[1]  | 
|         if postfix != ".txt":  | 
|             continue  | 
|           | 
|         fileName = ext[0]  | 
|         fileData = ZipFile_GetData(os.path.join(curPath, file))  | 
|         SubjectLib.ReadSubjectData(fileData, fileName)  | 
|       | 
|     return  | 
|   | 
| #---------------------------------------------------------------------  | 
| ##C++´¥·¢, Ö´ÐÐËùÓÐÈÎÎñÂß¼  | 
| # @param tick Ê±¼ä´Á  | 
| # @return ·µ»ØÖµÎÞÒâÒå  | 
| # @remarks C++´¥·¢, Ö´ÐÐËùÓÐÈÎÎñÂß¼  | 
| def ReloadQuests(tick):  | 
|     global ZipFile  | 
|     global ZipFileTree  | 
|     global Quests  | 
|     global AllQuestsEvents  | 
|       | 
|     #Ìí¼Ó¸ß¾«¶È¼ÆÊýÆ÷  | 
|     gameWorldMgr = GameWorld.GetGameWorld()   | 
|     saveTick = gameWorldMgr.GetHighResolutionTick()  | 
|       | 
|     #---¿ªÊ¼¼ÓÔØ---  | 
|     questPath = ChConfig.GetAppPath() + "QuestData.zip"  | 
|     ZipFile = zipfile.ZipFile(questPath)  | 
|     ZipFileTree = __GetFileTree(ZipFile)  | 
|       | 
|     #currentLoader = IPY_GameWorld.IPY_XMLLoader()  | 
|     #currentLoader.ClearLoader()  | 
|     IPY_GameWorld.ClearXML()  | 
|       | 
|     Quests.clear()  | 
|       | 
|     AllQuestsEvents.clear()  | 
|       | 
|     LoadQuestData()  | 
|       | 
|     #¶ÁÈ¡¹¦ÄÜNPCÊý¾Ý  | 
|     LoadFunctionData()  | 
|       | 
|     #¶ÁȡĬÈ϶Ի°Êý¾Ý  | 
|     LoadDefaultTalkData()  | 
|       | 
|     #¶ÁÈ¡ÈÎÎñ´¥·¢Êý¾Ý  | 
|     LoadQuestTrig()  | 
|       | 
|     #¶ÁÈ¡ËùÓеÄÌâ¿â  | 
|     #SubjectLib.ReadData()  | 
|       | 
|     ReadSubjectLib()  | 
|       | 
|     #¶ÁÈ¡ËùÓÐÈÎÎñÈÎÎñÃèÊöÊý¾Ý  | 
|     LoadMissionDescription()  | 
|       | 
|     #---¼ÓÔØ½áÊø---  | 
|     GameWorld.Log('Reload Quests. path = %s, lastTick = %s'%(  | 
|                             questPath, gameWorldMgr.GetHighResolutionTick() - saveTick))  | 
|     return  | 
|       |