Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加专武等级识别 #498

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions automator_mixins/_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,10 +865,12 @@ def output_dict(d):
os.makedirs(path)
sd = sorted(d)
with open(os.path.join(path, self.account + ".txt"), "w", encoding="utf-8") as f:
f.write("\t".join(["名称", "星级", "Rank", "等级", "左上", "右上", "左中", "右中", "左下", "右下", "好感", "更新时间"]) + "\n")
f.write("\t".join(["名称", "星级", "Rank", "等级", "左上", "右上", "左中", "右中", "左下", "右下", "好感", "专武是否已解锁", "专武",
"更新时间"]) + "\n")
for k in sd:
v = d[k]
f.write("\t".join([str(s) for s in [k, v["star"], v["rank"], v["dengji"], *v["zb"], v["haogan"],
v["zhuanwu_isEquip"], v["zhuanwu"],
get_time_str(v["last_update"])]]) + "\n")

mv.regflag("count", 0)
Expand All @@ -888,13 +890,28 @@ def output_dict(d):
D["dengji"] = S.get_level(sc)
D["rank"] = S.get_rank(sc)
D["zb"] = S.get_six_clothes(sc)
S = S.goto_zhuanwu()
zhuanwu_isEquip = S.get_zhuanwu_isEquip()
#print(f'zhuanwu_isEquip:{zhuanwu_isEquip}')

if zhuanwu_isEquip:
sc = self.getscreen()
D["zhuanwu_isEquip"] = True
D["zhuanwu"] = S.get_zhuanwu(sc)
else:
D["zhuanwu_isEquip"] = False
D["zhuanwu"] = 0

S = S.goto_kaihua()
sc = self.getscreen()
NAME = S.get_name(sc)
if NAME == FIRST_NAME and var["count"] != 0:
break
D["star"] = S.get_stars(sc)
D["last_update"] = time.time()
# print(f'※{NAME}:\n')
# for i in D:
# print(f'\t{i}:{D[i]}')
if NAME not in data:
data[NAME] = {}
data[NAME].update(D)
Expand Down Expand Up @@ -1017,7 +1034,7 @@ def check_color(self, fc, bc, xcor, ycor, color_type="gbr", screen=None):
else:
return False

def clear_and_save_team(self, cnamelst: list, slot: str, replace: bool, prefer=None):
def clear_and_save_team(self, cnamelst: list, slot: str, replace: bool, prefer=None):
self.lock_home()
cm = self.get_zhuye().goto_juese()
ct = cm.goto_wodeduiwu()
Expand All @@ -1028,4 +1045,3 @@ def clear_and_save_team(self, cnamelst: list, slot: str, replace: bool, prefer=
cbz.save_team()
self.fclick(1, 1)
self.lock_home()

Binary file added img/juese/zhuanwu_isEquip.bmp
Binary file not shown.
14 changes: 12 additions & 2 deletions scenes/root/juese.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,6 @@ def save_team(self) -> "CharTeam":
self.click_btn(JUESE_BTN["save_team"])




class CharBase(SevenBTNMixin):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down Expand Up @@ -338,6 +336,11 @@ def get_haogan(self, screen=None):
at = (271, 390, 291, 405)
return self.ocr_int(*at, screen)

def get_zhuanwu(self, screen=None):
if screen is None: screen = self.getscreen()
at = (260, 135, 286, 148)
return self.ocr_int(*at, screen)

def next_char(self, screen=None):
# at = (483, 119, 760, 141)
at = (180, 75, 314, 97)
Expand Down Expand Up @@ -674,6 +677,13 @@ def get_zhuanwu_status(self, screen=None):
else:
return 1

def get_zhuanwu_isEquip(self, screen=None):
if self.is_exists(img="img/juese/zhuanwu_isEquip.bmp", at=(876, 127, 886, 137), screen=screen, method="sq",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议这边把img="img/juese/zhuanwu_isEquip.bmp", at=(876, 127, 886, 137) 打包成PCRElement放到core/constant.py中。这样有利于资源缺失检测以及代码复用。调用时直接self.is_exists(PCRElement)即可。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这只是抽空写的一点,没有看太多源码。临近新年比较忙,后续有空的话我在看一下改一下。

threshold=0.95):
return True
else:
return False

def wear_zhuanwu(self):
self.click_btn(JUESE_BTN["wear"], until_appear=JUESE_BTN["wear_confirm"])
self.click_btn(JUESE_BTN["wear_confirm"])
Expand Down