Files
dcalc/backend/generate/equ.py
T
2025-04-01 14:35:29 +08:00

60 lines
1.2 KiB
Python

from database.connect import get_db_engine as get_engine
from database.models import Session, EquData, SuitData
engine = get_engine('0')
with Session(engine) as session:
db_list = session.query(EquData).all()
res = ''
curPart = ''
# for i in db_list:
# if i.itemType == '武器' and i.itemType != curPart:
# curPart = i.itemType
# res += f'''
# # endregion
# # region {curPart}
# '''
# if i.itemType != '武器' and i.categorize != curPart:
# curPart = i.categorize
# res += f'''
# # endregion
# # region {curPart}
# '''
# res += f'''
# def equ_{i.id}(char: Character):
# \'''
# {i.name}
# {i.rarity} {i.itemType} {i.itemDetailType}
# {i.detail}
# \'''
# pass
# '''
for i in db_list:
if i.id <= 414:
continue
count = 373 + (i.id - 414 - 1) % 42
if i.itemType != '武器' and i.categorize != curPart:
curPart = i.categorize
res += f'''
# endregion
# region {curPart}
'''
res += f'''
def equ_{i.id}(char: Character):
\'''
{i.name}
{i.rarity} {i.itemType} {i.itemDetailType}
{i.detail}
\'''
equ_{count}(char)
pass
'''
with open('/Users/imelon/Desktop/Code/dnf/dcalc/backend/output.py', 'w') as file:
file.write(res)