-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
101 lines (81 loc) · 3.79 KB
/
main.py
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
90
91
92
93
94
95
96
97
98
99
100
101
import character, weapon, parse, sys, argparse, prepare
sys.path.append("./py")
from output import Output
# add json if u want
parseList = {
"AvatarCurveExcelConfigData": Output.AvatarCurveExcelConfig,
"AvatarExcelConfigData": Output.AvatarExcelConfig,
"AvatarSkillDepotExcelConfigData": Output.AvatarSkillDepotExcelConfig,
"AvatarSkillExcelConfigData": Output.AvatarSkillExcelConfig,
"FetterInfoExcelConfigData": Output.FetterInfoExcelConfig,
"AvatarTalentExcelConfigData": Output.AvatarTalentExcelConfig,
"AvatarPromoteExcelConfigData": Output.AvatarPromoteExcelConfig,
"ProudSkillExcelConfigData": Output.ProudSkillExcelConfig,
"MaterialExcelConfigData": Output.MaterialExcelConfig,
"EquipAffixExcelConfigData": Output.EquipAffixExcelConfig,
"WeaponExcelConfigData": Output.WeaponExcelConfig,
"WeaponCurveExcelConfigData": Output.WeaponCurveExcelConfig,
"WeaponPromoteExcelConfigData": Output.WeaponPromoteExcelConfig,
"WeaponLevelExcelConfigData": Output.WeaponLevelExcelConfig,
"ReliquarySetExcelConfigData": Output.ReliquarySetExcelConfig,
}
def printUsage():
print("""
usage: main.py [-t] [-e] [-o] [-l LANG] [-i ID] [-s] [-w]
Arguments:
-t --textmap # Dump TextMap (-l argument needed)
-e --excel # Dump ExcelBinOutput
-o --output # Generate character output (-l, -i argument needed)
-l --lang [LANG] # Set language (Example: KR) (ALL available)
-i --id [ID] # Set character id (Example: 10000078)
-s # Xlsx skill short version
-w --weapon # Generate weapon output (-l, -i argument needed)
""")
sys.exit(1)
if __name__ == "__main__":
print("YSRes BLK Parser Tool")
print("Place .blk files in the YSRes/blk folder and run prepare.py first\n")
parser = argparse.ArgumentParser()
parser.add_argument("-t", "--textmap", dest="textmap", action="store_true") # dump textmap
parser.add_argument("-e", "--excel", dest="excel", action="store_true") # dump excel
parser.add_argument("-o", "--output", dest="output", action="store_true") # generate output
parser.add_argument("-l", "--lang", dest="lang", action="store") # set language
parser.add_argument("-i", "--id", type=int, dest="id", action="store") # set character id
parser.add_argument("-s", "--short", dest="short", action="store_true") # skill short
parser.add_argument("-w", "--weapon", dest="weapon", action="store_true")
args = parser.parse_args()
if len(sys.argv) < 2:
printUsage()
if args.textmap:
if args.lang is not None:
if args.lang == "ALL":
for i in prepare.supportLanguage.keys():
parse.GetAllTextmaps(i)
else:
parse.GetAllTextmaps(args.lang)
else:
printUsage()
if args.excel:
for i in parseList.keys():
print("Parsing " + i)
parse.UniversalParse(i, parseList[i])
if args.output:
if args.lang is not None and args.id is not None:
print("Generating res...")
if args.lang == "ALL":
for i in prepare.supportLanguage.keys():
character.GenerateRes(args.id, i, args.short)
else:
character.GenerateRes(args.id, args.lang, args.short)
else:
printUsage()
if args.weapon:
if args.lang is not None and args.id is not None:
print("Generating weapon res...")
if args.lang == "ALL":
for i in prepare.supportLanguage.keys():
weapon.GenerateRes(args.id, i)
else:
weapon.GenerateRes(args.id, args.lang)
else:
printUsage()