Skip to content

Commit

Permalink
Fix: cn server event quest recognize QUEST button
Browse files Browse the repository at this point in the history
  • Loading branch information
sanmusen214 committed Jan 7, 2024
1 parent 16b15ce commit 19059af
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 9 deletions.
Binary file added assets/BUTTON/BUTTON_EVENT_QUEST_SELLECTED.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion assets/ButtonName.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ class ButtonName:
BUTTON_MOMOTALK_REPLY = "BUTTON_MOMOTALK_REPLY"
BUTTON_MOMOTALK_PARTNER = "BUTTON_MOMOTALK_PARTNER"
BUTTON_GO_PARTNER_STORY = "BUTTON_GO_PARTNER_STORY"
BUTTON_SHOP_REFRESH = "BUTTON_SHOP_REFRESH"
BUTTON_SHOP_REFRESH = "BUTTON_SHOP_REFRESH"
BUTTON_EVENT_QUEST_SELLECTED = "BUTTON_EVENT_QUEST_SELLECTED"
Binary file added assets_cn/BUTTON/BUTTON_EVENT_QUEST_SELLECTED.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets_jp/BUTTON/BUTTON_EVENT_QUEST_SELLECTED.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 23 additions & 7 deletions modules/AllTask/InEvent/InEvent.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,37 @@ def judge_whether_available_event(self):
return False
# 判断这个活动是否有Quest
res = ocr_area((901, 88), (989, 123))
print("Tab栏识别结果: ", res)
if res[0] != "Quest" and res[0] != "任务":
logging.info(f"Tab栏识别结果: {res}, {'Quest' in res[0] or '任' in res[0]}")
# 图片匹配深色的QUEST标签
matchres = self.run_until(
lambda: click((965, 98)),
lambda: match(button_pic(ButtonName.BUTTON_EVENT_QUEST_SELLECTED)),
times=2
)
logging.info(f"QUEST按钮匹配结果: {matchres}")
if res[0] != "Quest" and "任" not in res[0] and not matchres:
logging.warn("此页面不存在活动Quest")
return False
# 判断左下角时间
time_res = ocr_area((175, 566), (552, 593))
if len(time_res[0])==0:
return False
# '2023-12-2603:00~2024-01-0902:59'
logging.info(f"检测到活动时间: {time_res}")
logging.info(f"识别活动时间: {time_res}")
# 分割出结束时间
time_split = time_res[0].split("~")
if len(time_res)==0 or len(time_split) == 1:
return False
if "~" in time_res[0]:
time_split = time_res[0].split("~")
else:
# 如果没有识别出~分隔符,就直接取最后15个字符
if len(time_res[0]) < 15:
logging.error("活动时间字符串长度不足15")
return False
time_split = [time_res[0][-15:]]

# 判断活动是否已结束
end_time = time_split[1]
end_time = time_split[-1]
if len(end_time) != 15:
logging.error("活动时间字符串长度不足15")
return False
# 将这个时间转成时间对象
try:
Expand Down
2 changes: 1 addition & 1 deletion modules/utils/MyConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class MyConfigger:
file_path: config.json的路径
"""
NOWVERSION="1.1.13"
NOWVERSION="1.1.14"
# 读取config这个py里面的配置
def __init__(self, file_path=""):
if file_path != "":
Expand Down

0 comments on commit 19059af

Please sign in to comment.