mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 00:35:34 +00:00
Add: Rogue stop condition: weekly_point_reward
This commit is contained in:
parent
0237064dd0
commit
c004af5346
BIN
assets/share/rogue/entry/OCR_WEEKLY_POINT.png
Normal file
BIN
assets/share/rogue/entry/OCR_WEEKLY_POINT.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
@ -178,7 +178,7 @@ class StoredTrailblazePower(StoredCounter):
|
||||
FIXED_TOTAL = 240
|
||||
|
||||
|
||||
class StoredSimulatedUniverse(StoredCounter, StoredExpiredAt0400):
|
||||
class StoredSimulatedUniverse(StoredCounter, StoredExpiredAtMonday0400):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -13,6 +13,16 @@ LEVEL_CONFIRM = ButtonWrapper(
|
||||
button=(990, 638, 1223, 676),
|
||||
),
|
||||
)
|
||||
OCR_WEEKLY_POINT = ButtonWrapper(
|
||||
name='OCR_WEEKLY_POINT',
|
||||
share=Button(
|
||||
file='./assets/share/rogue/entry/OCR_WEEKLY_POINT.png',
|
||||
area=(130, 602, 382, 635),
|
||||
search=(110, 582, 402, 655),
|
||||
color=(54, 51, 50),
|
||||
button=(130, 602, 382, 635),
|
||||
),
|
||||
)
|
||||
OCR_WORLD = ButtonWrapper(
|
||||
name='OCR_WORLD',
|
||||
share=Button(
|
||||
|
@ -1,9 +1,10 @@
|
||||
import re
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from module.base.timer import Timer
|
||||
from module.exception import RequestHumanTakeover
|
||||
from module.logger import logger
|
||||
from module.ocr.ocr import Ocr
|
||||
from module.ocr.ocr import DigitCounter, Ocr
|
||||
from tasks.base.assets.assets_base_main_page import ROGUE_LEAVE_FOR_NOW
|
||||
from tasks.base.assets.assets_base_page import MAP_EXIT
|
||||
from tasks.base.page import page_guide, page_main, page_rogue
|
||||
@ -12,12 +13,20 @@ from tasks.dungeon.keywords.dungeon import Simulated_Universe_World_1
|
||||
from tasks.dungeon.keywords.tab import Survival_Index
|
||||
from tasks.dungeon.ui import DungeonUI
|
||||
from tasks.forgotten_hall.assets.assets_forgotten_hall_ui import TELEPORT
|
||||
from tasks.rogue.assets.assets_rogue_entry import LEVEL_CONFIRM, OCR_WORLD, WORLD_ENTER, WORLD_NEXT, WORLD_PREV
|
||||
from tasks.rogue.assets.assets_rogue_entry import (
|
||||
LEVEL_CONFIRM,
|
||||
OCR_WEEKLY_POINT,
|
||||
OCR_WORLD,
|
||||
WORLD_ENTER,
|
||||
WORLD_NEXT,
|
||||
WORLD_PREV,
|
||||
)
|
||||
from tasks.rogue.assets.assets_rogue_path import CONFIRM_PATH
|
||||
from tasks.rogue.assets.assets_rogue_reward import REWARD_CLOSE, REWARD_ENTER
|
||||
from tasks.rogue.assets.assets_rogue_ui import ROGUE_LAUNCH
|
||||
from tasks.rogue.entry.path import RoguePathHandler
|
||||
from tasks.rogue.entry.reward import RogueRewardHandler
|
||||
from tasks.rogue.exception import RogueReachedWeeklyPointLimit
|
||||
|
||||
|
||||
def chinese_to_arabic(chinese_number: str) -> int:
|
||||
@ -248,6 +257,15 @@ class RogueEntry(DungeonUI, RogueRewardHandler, RoguePathHandler):
|
||||
else:
|
||||
self.goto_rogue()
|
||||
|
||||
# Update rogue points
|
||||
if datetime.now() - self.config.stored.SimulatedUniverse.time > timedelta(minutes=2):
|
||||
ocr = DigitCounter(OCR_WEEKLY_POINT)
|
||||
value, _, total = ocr.ocr_single_line(self.device.image)
|
||||
self.config.stored.SimulatedUniverse.set(value, total)
|
||||
# Check stop condition
|
||||
if self.config.RogueWorld_StopCondition == 'weekly_point_reward':
|
||||
if self.config.stored.SimulatedUniverse.is_full():
|
||||
raise RogueReachedWeeklyPointLimit
|
||||
# Enter
|
||||
self._rogue_world_set(world)
|
||||
self._rogue_world_enter()
|
||||
|
@ -8,3 +8,11 @@ class RogueDomainExitNotFound(Exception):
|
||||
|
||||
class RogueRouteError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class RogueReachedWeeklyPointLimit(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class RogueReached100EliteBossLimit(Exception):
|
||||
pass
|
||||
|
@ -1,6 +1,6 @@
|
||||
from module.logger import logger
|
||||
from tasks.rogue.entry.entry import RogueEntry
|
||||
from tasks.rogue.exception import RogueTeamNotPrepared
|
||||
from tasks.rogue.exception import RogueReachedWeeklyPointLimit, RogueTeamNotPrepared
|
||||
from tasks.rogue.route.loader import RouteLoader
|
||||
|
||||
|
||||
@ -19,13 +19,30 @@ class Rogue(RouteLoader, RogueEntry):
|
||||
logger.error(f'Please prepare your team in {self.config.RogueWorld_World}')
|
||||
self.rogue_world_exit()
|
||||
return False
|
||||
except RogueReachedWeeklyPointLimit:
|
||||
logger.hr('Reached rogue weekly point limit')
|
||||
return False
|
||||
|
||||
self.rogue_run()
|
||||
self.rogue_reward_claim()
|
||||
return True
|
||||
|
||||
def run(self):
|
||||
self.rogue_once()
|
||||
while 1:
|
||||
# Check stop condition
|
||||
if self.config.RogueWorld_StopCondition == 'weekly_point_reward':
|
||||
if self.config.stored.SimulatedUniverse.is_expired():
|
||||
# Expired, do rogue
|
||||
pass
|
||||
elif self.config.stored.SimulatedUniverse.is_full():
|
||||
logger.hr('Reached rogue weekly point limit')
|
||||
break
|
||||
|
||||
# Run
|
||||
success = self.rogue_once()
|
||||
if not success:
|
||||
break
|
||||
|
||||
self.config.task_delay(server_update=True)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user