hxp
2018-08-10 ccfc87e02e2ae7d153bbab0754639a1a663d34d3
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/python
# -*- coding: GBK -*-
 
##@package GenerateClientTable.py
# Ä£¿éµÄ¼òҪ˵Ã÷:·þÎñ¶Ë\Server\ZoneServerGroup\map1_8G\MapServer\MapServerData\MapServerConfig\QuestMission\LvUpTrigMissionNotAdd.txt µÈ¼¶µ¼È빤¾ß
# @author:hxp
# @date 2017-04-07 10:00
# @version 1.0
#
# ÐÞ¸Äʱ¼ä ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
# VER = "2017-04-07 10:00" hxp ´´½¨±¾py
#
# Ä£¿éÏêϸ˵Ã÷:µ¼ÈëµÈ¼¶Êý¾Ýµ½ \Server\ZoneServerGroup\map1_8G\MapServer\MapServerData\MapServerConfig\QuestMission\LvUpTrigMissionNotAdd.txt
#
#---------------------------------------------------------------------
#µ¼Èë
 
import ConfigParser
import sys
import os
 
CParser = ConfigParser.ConfigParser()
CParser.readfp(open('TaskManager.ini'))
ToolRootPath = os.path.dirname(os.getcwd()) # ¹¤¾ß¸ù·¾¶
ScriptPath = os.getcwd() # ¹¤¾ß½Å±¾Â·¾¶
sys.path.append(ScriptPath + "\PythonLib\lib")
 
import CommFunc
import Log4P
Log4P.SetDebug(CParser.getint('TaskManager', 'Debug'))
 
ServerRootPath = CParser.get('TaskManager', 'ServerRootPath')
LvUpTrigMissionNotAddPath = CParser.get('TaskManager', 'LvUpTrigMissionNotAddPath')
if LvUpTrigMissionNotAddPath.startswith("\\"):
    LvUpTrigMissionNotAddPath = ToolRootPath + LvUpTrigMissionNotAddPath
    
QuestsPath = ToolRootPath + CParser.get('TaskManager', 'QUESTDATAPath') + "\quests"
JobList = [0,1,2,3,4,5,6]
 
#---------------------------------------------------------------------
#È«¾Ö±äÁ¿
#½£Ê¥
 
def main():
    LvUpTrigMissionNotAddServerPath = ServerRootPath + "\\ZoneServerGroup\\map1_8G\\MapServer\\MapServerData\\MapServerConfig\\QuestMission\\LvUpTrigMissionNotAdd.txt"
    if not os.path.isfile(LvUpTrigMissionNotAddServerPath):
        Log4P.Error("ÕÒ²»µ½·þÎñ¶Ë LvUpTrigMissionNotAdd.txt Â·¾¶!", LvUpTrigMissionNotAddServerPath, "ÇëÐ޸ĠTaskManager.ini ÖеÄÅäÖàServerRootPath")
        return
    
    if CommFunc.is_open(LvUpTrigMissionNotAddServerPath):
        Log4P.Error("ÁíÒ»¸ö³ÌÐòÕýÔÚʹÓôËÎļþ£¬½ø³ÌÎÞ·¨·ÃÎÊ¡£", LvUpTrigMissionNotAddServerPath)
        return
    
    lvList = []
    for parent, dirnames, filenames in os.walk(QuestsPath):
        #print "parent=%s, dirnames=%s, filenames=%s" % (parent, dirnames, filenames)
        for filename in filenames:
            if not parent.upper().endswith("ON_LV_UP"):
                continue
            if not filename.upper().endswith(".XML"):
                continue
            xmlLV = filename.split(".")[0]
            if not xmlLV.isdigit():
                continue
            xmlLV = int(xmlLV)
            if xmlLV not in lvList:
                lvList.append(xmlLV)
                
    lvList.sort()
    lvListStr = str(lvList).replace(" ", "")
    # Ð´ÈëÎļþ
    taskFile = open(LvUpTrigMissionNotAddPath, 'w')
    taskFile.write("#Éý¼¶´¥·¢ÈÎÎñ£¬Èç¹ûÈÎÎñ²»´æÔÚÔò²»Ìí¼Ó£¬Ò²²»´¥·¢ÈÎÎñ\n")
    taskFile.write("#{Ö°Òµ:[µÈ¼¶]}\n")
    taskFile.write("(\n")
    taskFile.write("{\n")
    for job in JobList:
        taskFile.write("\t%d:%s,\n" % (job, lvListStr))
    taskFile.write("}\n")    
    taskFile.write(")\n")
    taskFile.close()
    
    os.system("copy %s %s" % (LvUpTrigMissionNotAddPath, LvUpTrigMissionNotAddServerPath)) # Ö±½Ó¿½±´µ½ºó¶ËÅäÖÃ
    Log4P.Info("µ¼³öÉý¼¶µÈ¼¶´¥·¢ÎļþÍê±Ï£¡")
    return
    
if __name__ == '__main__':
    main()