Skip to content

Commit

Permalink
每日任务增加吉闻
Browse files Browse the repository at this point in the history
  • Loading branch information
ljxun authored and yEs1do committed Sep 18, 2024
1 parent 4f5b481 commit 38b1abd
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 2 deletions.
8 changes: 8 additions & 0 deletions tasks/DailyTrifles/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ class DailyTriflesAssets:
I_L_LOVE = RuleImage(roi_front=(123,625,67,72), roi_back=(123,625,67,72), threshold=0.9, method="Template matching", file="./tasks/DailyTrifles/love/love_l_love.png")
# 一键收取
I_L_COLLECT = RuleImage(roi_front=(47,537,129,56), roi_back=(47,537,129,56), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/love_l_collect.png")
# 吉闻
I_LUCK_MSG = RuleImage(roi_front=(22,47,46,27), roi_back=(22,47,46,27), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/Screenshots_luck_msg.png")
# 一键祝福
I_ONE_CLICK_BLESS = RuleImage(roi_front=(1115,500,93,33), roi_back=(1115,500,93,33), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/Screenshots_one_click_bless.png")
# 点击祝福
I_CLICK_BLESS = RuleImage(roi_front=(617,442,92,39), roi_back=(617,442,92,39), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/Screenshots_click_bless.png")
# 吉闻页
I_LUCK_TITLE = RuleImage(roi_front=(600,52,131,67), roi_back=(600,52,131,67), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/Screenshots_luck_title.png")


# Image Rule Assets
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tasks/DailyTrifles/love/Screenshots_luck_msg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions tasks/DailyTrifles/love/image.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,41 @@
"method": "Template matching",
"threshold": 0.8,
"description": "一键收取"
},
{
"itemName": "luck_msg",
"imageName": "Screenshots_luck_msg.png",
"roiFront": "22,47,46,27",
"roiBack": "22,47,46,27",
"method": "Template matching",
"threshold": 0.8,
"description": "吉闻"
},
{
"itemName": "one_click_bless",
"imageName": "Screenshots_one_click_bless.png",
"roiFront": "1115,500,93,33",
"roiBack": "1115,500,93,33",
"method": "Template matching",
"threshold": 0.8,
"description": "一键祝福"
},
{
"itemName": "click_bless",
"imageName": "Screenshots_click_bless.png",
"roiFront": "617,442,92,39",
"roiBack": "617,442,92,39",
"method": "Template matching",
"threshold": 0.8,
"description": "点击祝福"
},
{
"itemName": "luck_title",
"imageName": "Screenshots_luck_title.png",
"roiFront": "600,52,131,67",
"roiBack": "600,52,131,67",
"method": "Template matching",
"threshold": 0.8,
"description": "吉闻页"
}
]
34 changes: 32 additions & 2 deletions tasks/DailyTrifles/script_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def run(self):
pass
if con.friend_love:
self.run_friend_love()
self.run_luck_msg()

if con.store_sign:
self.run_store_sign()
self.set_next_run('DailyTrifles', success=True, finish=False)
Expand All @@ -41,6 +43,34 @@ def run_one_summon(self):
def run_guild_wish(self):
pass

def run_luck_msg(self):
self.ui_get_current_page()
self.ui_goto(page_friends)
while 1:
self.screenshot()
if self.appear(self.I_LUCK_TITLE):
break
if self.appear_then_click(self.I_LUCK_MSG, interval=1):
continue
logger.info('Start luck msg')
check_timer = Timer(2)
check_timer.start()
while 1:
self.screenshot()

if self.appear_then_click(self.I_CLICK_BLESS, interval=1):
continue
if self.appear_then_click(self.I_ONE_CLICK_BLESS, interval=1):
continue
if self.ui_reward_appear_click():
logger.info('Get reward of friend love')
break
if check_timer.reached():
logger.warning('There is no any love')
break

self.ui_click(self.I_UI_BACK_RED, self.I_CHECK_MAIN)

def run_friend_love(self):
self.ui_get_current_page()
self.ui_goto(page_friends)
Expand Down Expand Up @@ -104,10 +134,10 @@ def run_store_sign(self):
from module.config.config import Config
from module.device.device import Device

c = Config('oas1')
c = Config('du')
d = Device(c)
t = ScriptTask(c, d)

# t.run_one_summon()
t.run_store_sign()
t.run_luck_msg()

0 comments on commit 38b1abd

Please sign in to comment.