Skip to content

Commit

Permalink
fix(ocochi): quit as captain when you're done
Browse files Browse the repository at this point in the history
  • Loading branch information
runhey committed Jul 4, 2023
1 parent 217a68f commit 1403ccf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion script.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def loop(self):
if success:
del_cached_property(self, 'config')
continue
elif self.config.error.handle.error:
elif self.config.script.error.handle_error:
# self.config.task_delay(success=False)
del_cached_property(self, 'config')
self.checker.check_now()
Expand Down
12 changes: 6 additions & 6 deletions tasks/Component/GeneralInvite/general_invite.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This Python file uses the following encoding: utf-8
# @author runhey
# github https://github.com/runhey
import time
from time import sleep
import numpy as np

from enum import Enum
Expand Down Expand Up @@ -397,11 +397,11 @@ def invite_friend(self, name: str = None, find_mode: FindMode = None) -> bool:
continue

logger.info(f'Now find friend in ”最近“')
time.sleep(1)
sleep(1)
if not is_select:
if self.detect_select(name):
is_select = True
time.sleep(1)
sleep(1)
if not is_select:
if self.detect_select(name):
is_select = True
Expand Down Expand Up @@ -442,11 +442,11 @@ def invite_friend(self, name: str = None, find_mode: FindMode = None) -> bool:
# 选中好友, 在这里游戏获取在线的好友并不是很快,根据不同的设备会有不同的时间,而且没有什么元素提供我们来判断
# 所以这里就直接等待一段时间
logger.info(f'Now find friend in {friend_class[index]}')
time.sleep(1)
sleep(1)
if not is_select:
if self.detect_select(name):
is_select = True
time.sleep(1)
sleep(1)
if not is_select:
if self.detect_select(name):
is_select = True
Expand Down Expand Up @@ -483,7 +483,7 @@ def invite_friends(self, config: InviteConfig) -> bool:
success = self.invite_friend(config.friend_2, config.find_mode)
if not success:
logger.warning('Invite friend 2 failed')
time.sleep(0.5)
sleep(0.5)

def invite_again(self, default_invite: bool=True) -> bool:
"""
Expand Down
4 changes: 4 additions & 0 deletions tasks/Orochi/script_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from tasks.Orochi.assets import OrochiAssets
from tasks.Orochi.config import Orochi, UserStatus
from module.logger import logger
from module.exception import TaskEnd

class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi, OrochiAssets):

Expand Down Expand Up @@ -51,6 +52,8 @@ def run(self) -> bool:
else:
self.set_next_run('Orochi', finish=False, success=False)

raise TaskEnd



def orochi_enter(self) -> bool:
Expand Down Expand Up @@ -137,6 +140,7 @@ def run_leader(self):
is_first = True
# 这个时候我已经进入房间了哦
while 1:
self.screenshot()
# 无论胜利与否, 都会出现是否邀请一次队友
# 区别在于,失败的话不会出现那个勾选默认邀请的框
if self.check_and_invite(self.config.orochi.invite_config.default_invite):
Expand Down

0 comments on commit 1403ccf

Please sign in to comment.