-
Notifications
You must be signed in to change notification settings - Fork 1
/
gen_skill.py
60 lines (44 loc) · 1.95 KB
/
gen_skill.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
from src.output import OutputFiles
from src.baidu.appBuilder import AppBuilderKnowledgeBase
from src.utils import *
knowledge_base = AppBuilderKnowledgeBase('skill')
book_store = OutputFiles(
'skills',
single_file=argv('single_file', bool),
separator='\n\n===separator===\n\n',
)
def main():
operator_list = JsonData.get_json_data('character_table')
skill_data = JsonData.get_json_data('skill_table')
for char_id, char in progress(operator_list.items(), '干员技能'):
if char['profession'] in Game.token_classes:
continue
char_name = char['name']
contents = []
for index, item in enumerate(char['skills']):
code = item['skillId']
if code not in skill_data:
continue
detail = skill_data[code]
if bool(detail) is False:
continue
skill_desc = f'{char_name}{index + 1}技能:%s,%s,%s,' % (
detail['levels'][0]['name'],
Game.skill_type[detail['levels'][0]['skillType']],
Game.sp_type[detail['levels'][0]['spData']['spType']],
)
for desc in [detail['levels'][-1]]:
description = parse_template(desc['blackboard'], desc['description'])
skill_desc += '初始SP:%d,SP消耗:%d,技能持续时间:%d秒,最大充能次数:%d,技能效果:%s;' % (
desc['spData']['initSp'],
desc['spData']['spCost'],
integer(desc['duration']),
desc['spData']['maxChargeTime'],
description.replace('\\n', '\n').replace('\n', '。'),
)
contents.append(skill_desc)
book_store.create(char['name'], char['name'], contents)
book_store.done()
knowledge_base.compare_files_and_update(book_store.result, separator=book_store.separator)
if __name__ == '__main__':
main()