Skip to content

Commit

Permalink
尝试修复刷声骸跳出战斗
Browse files Browse the repository at this point in the history
  • Loading branch information
ok-oldking committed Jul 18, 2024
1 parent 52b2f92 commit 974ac33
Show file tree
Hide file tree
Showing 9 changed files with 690 additions and 37 deletions.
661 changes: 661 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@ def calculate_pc_exe_path(running_path):
<p>Report a BUG <a href="https://github.com/ok-oldking/ok-wuthering-waves/issues/new?assignees=ok-oldking&labels=bug&projects=&template=%E6%8A%A5%E5%91%8Abug-.md&title=%5BBUG%5D">https://github.com/ok-oldking/ok-wuthering-waves/issues/new?assignees=ok-oldking&labels=bug&projects=&template=%E6%8A%A5%E5%91%8Abug-.md&title=%5BBUG%5D</></p>
<p>QQ群:<a href="https://qm.qq.com/q/qMezq2IDGU">970523295</a></p>
<p>QQ频道:<a href="https://pd.qq.com/s/75758wrmp">OK-WW</a></p>
<p>本软件免费, 如果你被收费请立即退款, 请到QQ频道或者GitHub下载最新官方版</p>
<p style="color:red;">
<strong>本软件是免费开源的。</strong> 如果你被收费,请立即退款。请访问QQ频道或GitHub下载最新的官方版本。
</p>
<p style="color:red;">
<strong>本软件仅供个人使用,用于学习Python编程、计算机视觉、UI自动化等。</strong> 请勿将其用于任何营利性或商业用途。
</p>
<p style="color:red;">
<strong>使用本软件可能会导致账号被封。</strong> 请在了解风险后再使用。
</p>
""",
'supported_screen_ratio': '16:9',
'screenshots_folder': "screenshots",
Expand Down
Binary file modified i18n/zh_CN/LC_MESSAGES/ok.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions i18n/zh_CN/LC_MESSAGES/ok.po
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ msgid "Inferno Rider"
msgstr "摩托车"

msgid "Lampylumen Myriad"
msgstr "冰猴子"
msgstr "辉萤军势"

msgid "Mech Abomination"
msgstr "机器人"

msgid "Mourning Aix"
msgstr "光鸟"
msgstr "哀声鸷"

msgid "N/A"
msgstr "不刷"
Expand Down
20 changes: 12 additions & 8 deletions src/char/BaseChar.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, task, index, res_cd=0, echo_cd=0):
self.white_off_threshold = 0.01
self.echo_cd = echo_cd
self.task = task
self.sleep_adjust = 0.001
self.sleep_adjust = 0
self.index = index
self.last_switch_time = -1
self.last_res = -1
Expand Down Expand Up @@ -138,9 +138,9 @@ def switch_next_char(self, post_action=None, free_intro=False, target_low_con=Fa
self.last_switch_time = self.task.switch_next_char(self, post_action=post_action, free_intro=free_intro,
target_low_con=target_low_con)

def sleep(self, sec):
def sleep(self, sec, check_combat=True):
if sec > 0:
self.task.sleep_check_combat(sec + self.sleep_adjust)
self.task.sleep_check_combat(sec + self.sleep_adjust, check_combat=check_combat)

def click_resonance(self, post_sleep=0, has_animation=False, send_click=True):
clicked = False
Expand All @@ -150,20 +150,21 @@ def click_resonance(self, post_sleep=0, has_animation=False, send_click=True):
resonance_click_time = 0
animated = False
while True:
if resonance_click_time != 0 and time.time() - resonance_click_time > 10:
if resonance_click_time != 0 and time.time() - resonance_click_time > 8:
self.logger.error(f'click_resonance too long, breaking {time.time() - resonance_click_time}')
self.task.screenshot('click_resonance too long, breaking')
break
if has_animation:
if not self.task.in_team()[0]:
self.task.in_liberation = True
animated = True
if time.time() - resonance_click_time > 6:
self.task.in_liberation = False
self.logger.error(f'resonance animation too long, breaking')
self.check_combat()
self.task.next_frame()
self.check_combat()
continue
else:
self.check_combat()
self.check_combat()
current_resonance = self.current_resonance()
if not self.resonance_available(current_resonance):
self.logger.debug(f'click_resonance not available break')
Expand All @@ -182,12 +183,15 @@ def click_resonance(self, post_sleep=0, has_animation=False, send_click=True):
self.update_res_cd()
last_op = 'resonance'
self.send_resonance_key()
if has_animation: # sleep if there will be an animation like Jinhsi
self.sleep(0.2, check_combat=False)
last_click = now
self.task.next_frame()
self.task.in_liberation = False
if clicked:
self.sleep(post_sleep)
duration = time.time() - resonance_click_time if resonance_click_time != 0 else 0
self.logger.debug(f'click_resonance end clicked {clicked} duration {duration} animated {animated}')
self.logger.info(f'click_resonance end clicked {clicked} duration {duration} animated {animated}')
return clicked, duration, animated

def send_resonance_key(self, post_sleep=0, interval=-1):
Expand Down
6 changes: 0 additions & 6 deletions src/char/Jinhsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,9 @@ def handle_incarnation(self):
# self.task.screenshot(f'handle_incarnation e available')
break
self.task.click(interval=0.1)
# if time.time() - start > 1.8 and not liberated:
# liberated = True
# if self.click_liberation():
# self.task.click()
# continue
if not liberated or not self.task.in_team()[0]:
self.check_combat()

# self.task.screenshot(f'handle_incarnation click_resonance start')
self.click_resonance(has_animation=True, send_click=True)
if not self.click_echo():
self.task.click()
Expand Down
1 change: 1 addition & 0 deletions src/combat/CombatCheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def find_target_enemy(self):

def in_combat(self, rechecked=False):
if self.in_liberation:
self.last_combat_check = time.time()
logger.debug('in liberation return True')
return True
if self._in_combat:
Expand Down
9 changes: 5 additions & 4 deletions src/task/BaseCombatTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def combat_once(self, wait_combat_time=180, wait_before=2):
self.get_current_char().perform()
except NotInCombatException as e:
logger.info(f'combat_once out of combat break {e}')
self.screenshot(f'out of combat break {self.out_of_combat_reason}')
if self.debug:
self.screenshot(f'out of combat break {self.out_of_combat_reason}')
break

def run_in_circle_to_find_echo(self, circle_count=3):
Expand Down Expand Up @@ -187,11 +188,11 @@ def get_current_char(self):
self.load_chars()
return self.get_current_char()

def sleep_check_combat(self, timeout):
def sleep_check_combat(self, timeout, check_combat=True):
start = time.time()
if not self.in_combat():
if not self.in_combat() and check_combat:
self.raise_not_in_combat('sleep check not in combat')
super().sleep(timeout - (time.time() - start))
self.sleep(timeout - (time.time() - start))

def check_combat(self):
if not self.in_combat():
Expand Down
16 changes: 0 additions & 16 deletions src/task/FarmEchoTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,9 @@ def __init__(self):
def run(self):
# return self.run_in_circle_to_find_echo()
self.handler.post(self.mouse_reset, 0.01)
# self.find_echo_drop()
# return
if not self.in_team()[0]:
self.log_error('must be in game world and in teams', notify=True)
return
if self.config.get('Teleport'):
# book = self.find_one('gray_book_button', use_gray_scale=True)
# if not book:
# self.log_error("can't find the book button")
# return
self.sleep(2)
self.log_info('click f2 to open the book')
self.send_key('f2')
self.wait_click_feature('gray_book_forgery', raise_if_not_found=True, use_gray_scale=True, threshold=0.8)
self.wait_click_feature('gray_book_weekly_boss', raise_if_not_found=True, use_gray_scale=True,
threshold=0.8)
self.sleep(1)
self.click_relative(self.crownless_pos[0], self.crownless_pos[1])
self.wait_click_feature('gray_teleport', raise_if_not_found=True, use_gray_scale=True)

# loop here
count = 0
Expand Down

0 comments on commit 974ac33

Please sign in to comment.