Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
af6d1bc
fix(Exploration): 修复特定UP类型找怪提前退出及滑屏边缘检测问题
VanityHuang Oct 10, 2026
c8f93d1
fix(Exploration): address review feedback on timer reset and swipe ed…
VanityHuang Oct 10, 2026
2bc21f5
refactor(Exploration): 根据Review建议抽取滑屏与重置辅助方法,消除重复代码
VanityHuang Oct 11, 2026
7f0728b
点击御魂溢出的提示
davidyangkunlong Oct 11, 2026
69a0fc4
perf(Exploration): 按UP类型自适应滑屏找怪策略与死代码精简
VanityHuang Oct 11, 2026
2f5c306
fix(invite_friends):sleep(3) before invite_friend
llbai Oct 12, 2026
aaac78b
change(open_expect_level): reverse swipe
llbai Oct 12, 2026
7ce0bb4
Merge branch 'dev' into master
llbai Oct 12, 2026
372ef8f
add S_SWIPE_LEVEL_DOWN_PRO
llbai Oct 12, 2026
d6c42be
fix(GeneralBattle): Log battle start in strategy-based wait
runhey Oct 12, 2026
5b556e9
fix(Restart): Reuse global UI assets for login and mail dialogs
runhey Oct 12, 2026
92578cd
fix(Exploration): Correct realm raid ticket OCR region #1926
runhey Oct 12, 2026
54803c5
delete S_SWIPE_LEVEL_DOWN_PRO
llbai Oct 13, 2026
614b6b8
Revert "delete S_SWIPE_LEVEL_DOWN_PRO"
llbai Oct 13, 2026
e56482c
Revert "add S_SWIPE_LEVEL_DOWN_PRO"
llbai Oct 13, 2026
bedff71
fix(Duel): 开战前等待增加超时与点击上限
Enough1122 Oct 13, 2026
b4258ef
Merge branch 'dev' of https://github.com/davidyangkunlong/OnmyojiAuto…
davidyangkunlong Oct 13, 2026
c291deb
Merge pull request #1933 from llbai/master
runhey Oct 13, 2026
985ac26
refactor(Duel): reuse ui_click for pre-battle setup wait
Enough1122 Oct 13, 2026
5770f91
Refactor script_task.py by cleaning up comments
runhey Oct 13, 2026
124acb6
Merge pull request #1934 from Enough1122/fix/duel-setup-spin
runhey Oct 13, 2026
4c68886
Merge pull request #1905 from VanityHuang/fix/exploration-up-search
runhey Oct 13, 2026
60117f1
处理御魂溢出
davidyangkunlong Oct 14, 2026
84366fc
fix(Delegation): avoid jade confirm misclick and back-button dead loop
kunkun008 Oct 15, 2026
12048ca
Merge pull request #1937 from davidyangkunlong/YuhunOverflow
runhey Oct 15, 2026
68122b3
Merge pull request #1940 from kunkun008/fix/delegation-dead-loop
runhey Oct 15, 2026
9afe3d3
fix(WantedQuests): Detect selected friends when inviting #1939
runhey Oct 15, 2026
4e039cf
Merge remote-tracking branch 'origin/dev' into dev
runhey Oct 15, 2026
7e506bc
fix(BaseTask): Skip task name mismatch validation
runhey Oct 15, 2026
43c84c8
fix(GeneralBattle): Close buff panel and start battle preparation
runhey Oct 15, 2026
c202347
fix(GeneralBattle): Close buff panel and start battle preparation
runhey Oct 15, 2026
911e996
fix(workflow): Correct auto-merge schedule comment
runhey Oct 15, 2026
d8677dc
Revert "fix(GeneralBattle): Close buff panel and start battle prepara…
runhey Oct 15, 2026
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
4 changes: 2 additions & 2 deletions .github/workflows/auto-merge-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Auto Merge Sync PR

on:
schedule:
# 每周五北京时间12点触发(UTC时间4点)
- cron: '0 4 * * 5'
# 每周五北京时间2点07分触发(UTC时间周四18点07分)
- cron: '7 18 * * 4'
workflow_dispatch:

permissions:
Expand Down
4 changes: 4 additions & 0 deletions tasks/ActivityShikigami/script_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ def _run_pass(self):
break
if self.appear(self.I_CHECK_BATTLE_MAIN) and self.appear_then_click(self.I_UI_BACK_YELLOW, interval=2.5):
continue
if self.appear_then_click(self.I_UI_BACK_CIRCLE, interval=2.5):
continue
if self.appear_then_click(self.I_UI_BACK_RED, interval=1.5):
continue

def _run_ap(self):
"""
Expand Down
2 changes: 2 additions & 0 deletions tasks/Component/GeneralBattle/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ class GeneralBattleAssets:
C_END_FRIENDS_32 = RuleClick(roi_front=(0,0,100,100), roi_back=(0,0,100,100), name="end_friends_32")
# description
C_END_FRIENDS_23 = RuleClick(roi_front=(0,0,100,100), roi_back=(0,0,100,100), name="end_friends_23")
# 御魂过多的【去清理】按钮
C_OVERFLOW_GHOST = RuleClick(roi_front=(456, 381, 160, 82), roi_back=(456, 381, 160, 82), name="overflow_ghost")


# Click Rule Assets
Expand Down
12 changes: 12 additions & 0 deletions tasks/Component/GeneralBattle/battle.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import random
from functools import wraps

from module.logger import logger
from module.atom.image import RuleImage
Expand All @@ -12,6 +13,16 @@
from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig, GreenMarkType



def log_battle_start(func):
@wraps(func)
def wrapper(owner, *args, **kwargs):
logger.hr("General battle start", 2)
return func(owner, *args, **kwargs)

return wrapper


class Battle(BattleWait):

def start_fire(self, buttons: list[RuleOcr | RuleImage], checks: list[RuleImage]) -> bool:
Expand Down Expand Up @@ -47,6 +58,7 @@ def start_fire(self, buttons: list[RuleOcr | RuleImage], checks: list[RuleImage]
continue
return True

@log_battle_start
@battle_wait_strategy()
def battle_wait(self, *args, **kwargs):
return self.battle_wait_with_strategy(*args, **kwargs)
Expand Down
14 changes: 13 additions & 1 deletion tasks/Component/GeneralBattle/battle_wait.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class OptionSuccessDefault:
'C_END_MESSAGE_RIGHT_TOP', 'C_END_BUFF_AREA_1',
'C_END_BUFF_AREA_2', 'C_END_SOUL_RECORD', 'C_END_SOUL_DETAILS',
'C_END_1_1', 'C_END_1_2', 'C_END_1_3', 'C_END_1_4',
'C_END_1_5', 'C_END_1_6',
'C_END_1_5', 'C_END_1_6', "C_OVERFLOW_GHOST",
])


Expand Down Expand Up @@ -1152,6 +1152,10 @@ def _bw_completion_default(self, pub: PublicContext, pri: PrivateContext) -> Hoo

def _bw_interrupt_default(self, pub: PublicContext, pri: PrivateContext) -> HookSignal:
# 比如 御魂溢出

# 结算的时候御魂溢出提示,点击【知道了】
self.appear_then_click(self.I_OVER_GHOST)

return HookSignal.CONTINUE

def _bw_success_default(self, pub: PublicContext, pri: PrivateContext) -> HookSignal:
Expand Down Expand Up @@ -1180,6 +1184,14 @@ def _bw_success_default(self, pub: PublicContext, pri: PrivateContext) -> HookSi
while 1:
self.screenshot()

# 发现御魂溢出,直接跳出,在interupt里面处理
if self.appear(self.I_OVER_GHOST):
return HookSignal.CONTINUE

# 结算的时候御魂溢出提示,点击【知道了】
if self.appear(self.I_OVER_GHOST):
self.click(self.I_OVER_GHOST)

# 不小心点到了具体的奖励,他会弹出这个物品的详细描述 里面必定包含有“获取途径”
if self.appear(self.I_END_FIX_1) or self.appear(self.I_END_FIX_2):
self.click(self.C_REWARD_2, interval=1.5)
Expand Down
1 change: 1 addition & 0 deletions tasks/Component/GeneralBattle/general_battle.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ def check_and_open_buff(self, buff: BuffClass or list[BuffClass] = None):
break
if self.appear_then_click(self.I_BUFF, interval=1):
continue
self.ui_click_until_disappear(self.I_PREPARE_HIGHLIGHT, interval=0.8)

def boss_mark(self, enable=True) -> bool:
if not enable or self._boss_mark_flag:
Expand Down
2 changes: 2 additions & 0 deletions tasks/Component/GeneralInvite/general_invite.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ def invite_friends(self, config: InviteConfig) -> bool:
logger.warning('Invite friend 1 failed')
# 如果是邀请第二个人
if config.invite_number == InviteNumber.TWO:
# 确定邀请前等待一段时间,避免游戏弹出邀请过快
sleep(3)
success = self.invite_friend(config.friend_2, config.find_mode)
if not success:
logger.warning('Invite friend 2 failed')
Expand Down
32 changes: 29 additions & 3 deletions tasks/Delegation/script_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,44 @@ def ui_click(click, stop):
if not self.ocr_appear(self.O_D_NAME):
logger.warning(f'Delegation: {name} not found')
return False
enter_timer = Timer(15).start()
while 1:
self.screenshot()
if self.appear(self.I_D_START):
break
if enter_timer.reached():
logger.warning(f'Delegation: {name} enter timeout')
return False

# 检测到弹出的勾玉确认框,优先点击取消保护勾玉
if self.appear_then_click(self.I_UI_CANCEL, interval=1):
continue

# 如果出现’召回‘ ’返回‘ 说明这个是现在委派中
# 需要退出
if self.appear(self.I_D_BACK):
logger.warning(f'Delegation: {name} is in delegation')
self.ui_click_until_disappear(self.I_D_BACK)
self.wait_until_appear(self.I_REWARDS_MIN)
back_timer = Timer(6).start()
while 1:
self.screenshot()
if not self.appear(self.I_D_BACK):
break
if back_timer.reached():
logger.warning('Exit delegation detail timeout')
break
# 若此时被取消弹窗遮挡返回,优先点取消
if self.appear_then_click(self.I_UI_CANCEL, interval=1):
continue
if self.appear_then_click(self.I_D_BACK, interval=1.2):
continue
self.wait_until_appear(self.I_REWARDS_MIN, wait_time=3)
return False
if self.appear_then_click(self.I_D_SKIP, interval=0.8):
continue
if self.appear_then_click(self.I_D_CONFIRM, interval=0.8):
continue
if self.ocr_appear_click(self.O_D_NAME, interval=1):
# 点击委派任务名:防抖由 1s 提升至 3s,杜绝跨页面过渡时误触右上角"完成(30勾玉)"
if self.ocr_appear_click(self.O_D_NAME, interval=3):
continue
# 进入委派 fefe e fe
logger.info(f'Enter Delegation: {name}')
Expand All @@ -81,10 +103,14 @@ def ui_click(click, stop):
ui_click(self.C_D_4, self.I_D_SELECT_4)
# 委派开始
logger.info(f'Delegation: {name} start')
start_timer = Timer(10).start()
while 1:
self.screenshot()
if not self.appear(self.I_D_START):
break
if start_timer.reached():
logger.warning(f'Delegation: {name} start timeout')
break
if self.click(self.C_D_5, interval=0.8):
continue
if self.appear_then_click(self.I_D_START, interval=1.8):
Expand Down
3 changes: 2 additions & 1 deletion tasks/Duel/script_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ def wait_battle(self) -> bool:
self.duel_exit_battle()
continue
if ret is None and not battle_operated: # 进行战斗前的操作
self.ui_click(self.O_D_HAND, self.O_D_AUTO, interval=0.8)
# https://github.com/runhey/OnmyojiAutoScript/pull/1934
self.ui_click(self.O_D_HAND, self.O_D_AUTO, interval=6, timeout=45)
self.green_mark(self.conf.duel_config.green_enable, self.conf.duel_config.green_mark)
battle_operated = True
self.reset_device('BATTLE_STATUS_S')
Expand Down
2 changes: 1 addition & 1 deletion tasks/Exploration/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class ExplorationAssets:
# 探索右上角 突破卷的数量
O_REALM_RAID_NUMBER = RuleOcr(roi=(739,11,78,37), area=(739,11,78,37), mode="DigitCounter", method="Default", keyword="", name="realm_raid_number")
# (点出困难28时候)探索右上角 突破卷的数量
O_REALM_RAID_NUMBER1 = RuleOcr(roi=(936,10,82,36), area=(936,10,82,36), mode="DigitCounter", method="Default", keyword="", name="realm_raid_number1")
O_REALM_RAID_NUMBER1 = RuleOcr(roi=(920,12,78,30), area=(919,12,80,30), mode="DigitCounter", method="Default", keyword="", name="realm_raid_number1")


# Swipe Rule Assets
Expand Down
15 changes: 8 additions & 7 deletions tasks/Exploration/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ def _config(self):
def _match_end(self):
return RuleAnimate(self.I_SWIPE_END)

def is_swipe_unchanged(self, before_image, after_image, threshold: float = 20) -> bool:
# 对比滑屏前后同一块区域,变化很小说明地图大概率没有移动,已经滑到尽头。
swipe_check_roi = (1216, 86, 64, 225)
def is_swipe_unchanged(self, before_image, after_image, threshold: float = 15) -> bool:
# 对比滑屏前后中上部背景区域(避开顶部跑马灯、下方小怪挑战图标及最右侧浮动鬼火),变化很小说明地图已滑到尽头。
swipe_check_roi = (250, 140, 800, 90)
before = self.I_SWIPE_END.corp(before_image, swipe_check_roi)
after = self.I_SWIPE_END.corp(after_image, swipe_check_roi)
diff = np.mean(np.abs(before.astype(np.int16) - after.astype(np.int16)))
Expand Down Expand Up @@ -162,7 +162,7 @@ def open_expect_level(self):
if self.appear_then_click(self.I_UI_CONFIRM_SAMLL, interval=1):
continue
self.device.click_record_clear()
self.swipe(self.S_SWIPE_LEVEL_UP)
self.swipe(self.S_SWIPE_LEVEL_DOWN)
swipeCount += 1
debug_info = f"Swiped {swipeCount} times, current exploration level: {text1}"
logger.info(debug_info)
Expand Down Expand Up @@ -329,11 +329,11 @@ def search_up_fight(self, up_type: UpType = None):
self.I_NORMAL_BATTLE_BUTTON.roi_front = roi_front
logger.info(f"Target locked: sword at {roi_front} (aligned with UP icon)")
return self.I_NORMAL_BATTLE_BUTTON
else:
# 没找到 UP 图标,返回 None 让外层逻辑去处理(滑动或退出)
return None
# 没找到 UP 图标或对应战斗图标,返回 None 让外层逻辑去处理(滑动或退出)
return None

# 2. 如果是默认情况 (UpType.ALL),则只要有怪就打
self.I_NORMAL_BATTLE_BUTTON.roi_back = (0, 0, 1279, 719)
if self.appear(self.I_NORMAL_BATTLE_BUTTON):
return self.I_NORMAL_BATTLE_BUTTON

Expand Down Expand Up @@ -389,6 +389,7 @@ def check_exit(self) -> bool:

def quit_explore(self):
logger.info('Quit explore')
self.device.click_record_remove(self.S_SWIPE_BACKGROUND_RIGHT.name)
boss_timer = Timer(15)
boss_timer.start()
# click_yellow_button = 0 #用于保证只点一次左上返回按钮,不要直接触发连点回到主界面
Expand Down
4 changes: 2 additions & 2 deletions tasks/Exploration/res/ocr.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
},
{
"itemName": "realm_raid_number1",
"roiFront": "936,10,82,36",
"roiBack": "936,10,82,36",
"roiFront": "920,12,78,30",
"roiBack": "919,12,80,30",
"mode": "DigitCounter",
"method": "Default",
"keyword": "",
Expand Down
Loading
Loading