mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 00:35:34 +00:00
Add: Use consumables in daily quests
This commit is contained in:
parent
9edd120538
commit
514d81b34f
@ -10,13 +10,14 @@ class ConsumableUsageUI(UI):
|
||||
def use_consumable(self) -> bool:
|
||||
"""
|
||||
Returns:
|
||||
bool:
|
||||
bool: If success
|
||||
|
||||
Examples:
|
||||
self = ConsumableUsageUI('alas')
|
||||
self.device.screenshot()
|
||||
result = self.use_consumable()
|
||||
"""
|
||||
logger.hr('Use consumable', level=2)
|
||||
self.ui_ensure(page_item)
|
||||
self._switch_tag_to_consumables()
|
||||
if self._search_and_select_consumable():
|
||||
@ -43,6 +44,7 @@ class ConsumableUsageUI(UI):
|
||||
continue
|
||||
|
||||
def _search_and_select_consumable(self, skip_first_screenshot=True) -> bool:
|
||||
logger.info('Search consumable')
|
||||
# If the default subpage is the consumables page, it is necessary to screenshot and check subpage again,
|
||||
# because in this scenario, scroll bar delay appears and the previous screenshot was
|
||||
# taken after clicking on the "item" to determine whether to enter the "item", which may be inaccurate
|
||||
|
@ -6,6 +6,7 @@ from module.ocr.ocr import Ocr, OcrResultButton
|
||||
from module.ocr.utils import split_and_pair_buttons
|
||||
from tasks.daily.assets.assets_daily_reward import *
|
||||
from tasks.daily.camera import CameraUI
|
||||
from tasks.daily.consumable_usage import ConsumableUsageUI
|
||||
from tasks.daily.keywords import DailyQuest, DailyQuestState, KEYWORDS_DAILY_QUEST, KEYWORDS_DAILY_QUEST_STATE
|
||||
from tasks.daily.synthesize import SynthesizeConsumablesUI
|
||||
from tasks.dungeon.keywords import KEYWORDS_DUNGEON_TAB
|
||||
@ -179,6 +180,9 @@ class DailyQuestUI(DungeonUI):
|
||||
if KEYWORDS_DAILY_QUEST.Synthesize_Consumable_1_time in quests:
|
||||
SynthesizeConsumablesUI(self.config, self.device).synthesize_consumables()
|
||||
done += 1
|
||||
if KEYWORDS_DAILY_QUEST.Use_Consumables_1_time in quests:
|
||||
if ConsumableUsageUI(self.config, self.device).use_consumable():
|
||||
done += 1
|
||||
|
||||
return done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user