mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-25 18:05:26 +00:00
Fix: Failed to receive weekly reward if immersifier is full
This commit is contained in:
parent
15c78c5b3a
commit
e1903f0ed4
@ -66,6 +66,7 @@ class RogueRewardHandler(RogueUI):
|
|||||||
logger.info('Rogue reward claim')
|
logger.info('Rogue reward claim')
|
||||||
claimed = False
|
claimed = False
|
||||||
appear = False
|
appear = False
|
||||||
|
click_count = 0
|
||||||
timeout = Timer(2, count=10).start()
|
timeout = Timer(2, count=10).start()
|
||||||
while 1:
|
while 1:
|
||||||
if skip_first_screenshot:
|
if skip_first_screenshot:
|
||||||
@ -76,12 +77,15 @@ class RogueRewardHandler(RogueUI):
|
|||||||
# End
|
# End
|
||||||
if claimed:
|
if claimed:
|
||||||
if self.appear(REWARD_CHECK):
|
if self.appear(REWARD_CHECK):
|
||||||
break
|
return True
|
||||||
if self.is_page_rogue_main():
|
if self.is_page_rogue_main():
|
||||||
break
|
return True
|
||||||
if not appear and timeout.reached():
|
if not appear and timeout.reached():
|
||||||
logger.warning('Rogue reward claim timeout, CLAIM_ALL not found')
|
logger.warning('Rogue reward claim timeout, CLAIM_ALL not found')
|
||||||
break
|
return False
|
||||||
|
if click_count > 3:
|
||||||
|
logger.warning('Failed to claim weekly rewards, probably because immersifier is full')
|
||||||
|
return False
|
||||||
|
|
||||||
if self.handle_reward():
|
if self.handle_reward():
|
||||||
claimed = True
|
claimed = True
|
||||||
@ -91,6 +95,7 @@ class RogueRewardHandler(RogueUI):
|
|||||||
self.device.click(CLAIM_ALL)
|
self.device.click(CLAIM_ALL)
|
||||||
self.interval_reset(CLAIM_ALL, interval=1)
|
self.interval_reset(CLAIM_ALL, interval=1)
|
||||||
appear = True
|
appear = True
|
||||||
|
click_count += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
def rogue_reward_claim(self):
|
def rogue_reward_claim(self):
|
||||||
@ -107,9 +112,9 @@ class RogueRewardHandler(RogueUI):
|
|||||||
logger.hr('Rogue reward claim', level=2)
|
logger.hr('Rogue reward claim', level=2)
|
||||||
if self._rogue_reward_appear():
|
if self._rogue_reward_appear():
|
||||||
self._rogue_reward_enter()
|
self._rogue_reward_enter()
|
||||||
self._rogue_reward_claim()
|
success = self._rogue_reward_claim()
|
||||||
self._rogue_reward_exit()
|
self._rogue_reward_exit()
|
||||||
return True
|
return success
|
||||||
else:
|
else:
|
||||||
logger.info('No rogue reward')
|
logger.info('No rogue reward')
|
||||||
return False
|
return False
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from module.base.timer import Timer
|
from module.base.timer import Timer
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
from module.ocr.ocr import DigitCounter
|
from module.ocr.ocr import DigitCounter
|
||||||
@ -109,9 +111,17 @@ class RogueReward(RogueUI, CombatInteract):
|
|||||||
use_immersifier=True
|
use_immersifier=True
|
||||||
):
|
):
|
||||||
if not use_trailblaze_power and not use_immersifier:
|
if not use_trailblaze_power and not use_immersifier:
|
||||||
|
logger.info('Cannot claim domain reward, as all disabled')
|
||||||
return False
|
return False
|
||||||
if use_immersifier and self.config.stored.Immersifier.value > 0:
|
if use_immersifier:
|
||||||
return True
|
if self.config.stored.Immersifier.value > 0:
|
||||||
|
logger.info(f'Can claim domain reward, got immersifiers')
|
||||||
|
return True
|
||||||
|
if datetime.now() - self.config.stored.Immersifier.time > timedelta(minutes=15):
|
||||||
|
logger.info(f'Can claim domain reward, immersifier record outdated')
|
||||||
|
return True
|
||||||
if use_trailblaze_power and self.config.stored.TrailblazePower.predict_current() >= 40:
|
if use_trailblaze_power and self.config.stored.TrailblazePower.predict_current() >= 40:
|
||||||
|
logger.info(f'Can claim domain reward, got enough trailblaze power')
|
||||||
return True
|
return True
|
||||||
|
logger.info('Cannot claim domain reward, requirements not satisfied')
|
||||||
return False
|
return False
|
||||||
|
@ -184,11 +184,9 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent, RogueReward):
|
|||||||
use_immersifier = 'immersifier' in self.config.RogueWorld_ImmersionReward
|
use_immersifier = 'immersifier' in self.config.RogueWorld_ImmersionReward
|
||||||
|
|
||||||
if self.can_claim_domain_reward(use_trailblaze_power=use_trailblaze_power, use_immersifier=use_immersifier):
|
if self.can_claim_domain_reward(use_trailblaze_power=use_trailblaze_power, use_immersifier=use_immersifier):
|
||||||
logger.info('Can claim domain reward')
|
|
||||||
result = self.goto(*waypoints)
|
result = self.goto(*waypoints)
|
||||||
self.claim_domain_reward(use_trailblaze_power=use_trailblaze_power, use_immersifier=use_immersifier)
|
self.claim_domain_reward(use_trailblaze_power=use_trailblaze_power, use_immersifier=use_immersifier)
|
||||||
else:
|
else:
|
||||||
logger.info('Cannot claim more rewards')
|
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
Loading…
Reference in New Issue
Block a user