-
Notifications
You must be signed in to change notification settings - Fork 91
/
mdt_service.py
112 lines (81 loc) · 2.22 KB
/
mdt_service.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
102
103
104
105
106
107
108
109
110
111
112
from threading import Thread
import pyperclip
import mdt as mdt
import mdt_control
import mdt_deck_reader as reader
def start():
mdt_service = Thread(target=mdt.main)
mdt_service.start()
def run():
mdt.status_change(True, False, False)
def exit():
mdt.status_change(False, False, True)
def pause():
mdt.status_change(False, True, False)
def get_cid():
if mdt.cid_show_gui:
return mdt.cid_show_gui
else:
return None
def set_cv_mode():
if mdt.cv_mode == 0:
mdt.cv_mode = 1
else:
mdt.cv_mode = 0
def get_cards_db(locale: str):
if locale == "zh-CN":
if mdt.cards_db_CN:
return mdt.cards_db_CN
else:
return None
elif locale == "zh-TW":
if mdt.cards_db_TW:
return mdt.cards_db_TW
else:
return None
def get_card_tier(cid: str):
if mdt.ur_tier_list and mdt.sr_tier_list:
if cid in mdt.ur_tier_list:
return mdt.ur_tier_list[cid]["tier"]
elif cid in mdt.sr_tier_list:
return mdt.sr_tier_list[cid]["tier"]
else:
return None
else:
return None
def get_break_point(cid: str):
if mdt.break_point:
if cid in mdt.break_point:
return mdt.break_point[cid]["tier"]
else:
return None
def get_bgm(cid: str):
if mdt.bgm_list:
if cid in mdt.bgm_list:
return mdt.bgm_list[cid]["file"]
else:
return None
def get_deck_dict():
return reader.get_deck_dict()
def get_deck_string(locale: str):
return reader.get_deck_string(locale)
def ydk_converter(
ydk_deck: str, window, game_client_locale: str = "en", locale: str = "zh-CN"
):
tmp = reader.ydk_converter(ydk_deck, game_client_locale)
if tmp is None:
window.write_event_value("CARD_NOT_FOUND_ERROR", None)
tmp.sort(key=lambda tup: tup[0])
def ydk_converter_callback():
print(ydk_deck)
pyperclip.copy(ydk_deck)
run()
pause()
# TODO: 防止二次生成
thread = Thread(
target=mdt_control.ydk_converter,
args=(tmp, locale, window, ydk_converter_callback),
)
thread.start()
if __name__ == "__main__":
ydk_converter("", "")