Chore: Rename KEYWORD_* to KEYWORDS_*

This commit is contained in:
LmeSzinc 2024-02-07 05:13:54 +08:00
parent 0cf7700555
commit 98efb031bc
12 changed files with 59 additions and 62 deletions

View File

@ -2,11 +2,9 @@ from datetime import datetime
from module.logger import logger
from tasks.assignment.claim import AssignmentClaim
from tasks.assignment.keywords import (KEYWORDS_ASSIGNMENT_GROUP,
AssignmentEntry, AssignmentEventGroup)
from tasks.assignment.keywords import (AssignmentEntry, AssignmentEventGroup, KEYWORDS_ASSIGNMENT_GROUP)
from tasks.assignment.ui import AssignmentStatus
from tasks.base.page import page_assignment, page_menu
from tasks.battle_pass.keywords import KEYWORD_BATTLE_PASS_QUEST
from tasks.daily.keywords import KEYWORDS_DAILY_QUEST
from tasks.daily.synthesize import SynthesizeUI

View File

@ -30,12 +30,12 @@ class BattlePassTab(Switch):
SWITCH_BATTLE_PASS_TAB = BattlePassTab('BattlePassTab', is_selector=True)
SWITCH_BATTLE_PASS_TAB.add_state(
KEYWORD_BATTLE_PASS_TAB.Rewards,
KEYWORDS_BATTLE_PASS_TAB.Rewards,
check_button=REWARDS_CHECK,
click_button=REWARDS_CLICK
)
SWITCH_BATTLE_PASS_TAB.add_state(
KEYWORD_BATTLE_PASS_TAB.Missions,
KEYWORDS_BATTLE_PASS_TAB.Missions,
check_button=MISSIONS_CHECK,
click_button=MISSIONS_CLICK
)
@ -59,12 +59,12 @@ class BattlePassMissionTab(Switch):
SWITCH_BATTLE_PASS_MISSION_TAB = BattlePassMissionTab('BattlePassMissionTab', is_selector=True)
SWITCH_BATTLE_PASS_MISSION_TAB.add_state(
KEYWORD_BATTLE_PASS_MISSION_TAB.This_Week_Missions,
KEYWORDS_BATTLE_PASS_MISSION_TAB.This_Week_Missions,
check_button=WEEK_MISSION_CLICK,
click_button=WEEK_MISSION_CLICK
)
SWITCH_BATTLE_PASS_MISSION_TAB.add_state(
KEYWORD_BATTLE_PASS_MISSION_TAB.This_Period_Missions,
KEYWORDS_BATTLE_PASS_MISSION_TAB.This_Period_Missions,
check_button=PERIOD_MISSION_CLICK,
click_button=PERIOD_MISSION_CLICK
)
@ -89,7 +89,7 @@ class DataBattlePassQuest:
@property
def is_incomplete(self) -> bool:
return self.state == KEYWORD_BATTLE_PASS_QUEST_STATE.Navigate
return self.state == KEYWORDS_BATTLE_PASS_QUEST_STATE.Navigate
class BattlePassUI(UI):
@ -129,7 +129,7 @@ class BattlePassUI(UI):
logger.info('Missions tab loaded')
break
def battle_pass_goto(self, state: KEYWORD_BATTLE_PASS_TAB):
def battle_pass_goto(self, state: KEYWORDS_BATTLE_PASS_TAB):
"""
Args:
state:
@ -143,18 +143,18 @@ class BattlePassUI(UI):
self.ui_ensure(page_battle_pass)
if SWITCH_BATTLE_PASS_TAB.set(state, main=self):
logger.info(f'Tab goto {state}, wait until loaded')
if state == KEYWORD_BATTLE_PASS_TAB.Missions:
if state == KEYWORDS_BATTLE_PASS_TAB.Missions:
self._battle_pass_wait_missions_loaded()
if state == KEYWORD_BATTLE_PASS_TAB.Rewards:
if state == KEYWORDS_BATTLE_PASS_TAB.Rewards:
self._battle_pass_wait_rewards_loaded()
def battle_pass_mission_tab_goto(self, state: KEYWORD_BATTLE_PASS_MISSION_TAB):
self.battle_pass_goto(KEYWORD_BATTLE_PASS_TAB.Missions)
def battle_pass_mission_tab_goto(self, state: KEYWORDS_BATTLE_PASS_MISSION_TAB):
self.battle_pass_goto(KEYWORDS_BATTLE_PASS_TAB.Missions)
if SWITCH_BATTLE_PASS_MISSION_TAB.set(state, main=self):
logger.info(f'Tab goto {state}, wait until loaded')
if state == KEYWORD_BATTLE_PASS_MISSION_TAB.This_Week_Missions:
if state == KEYWORDS_BATTLE_PASS_MISSION_TAB.This_Week_Missions:
self._battle_pass_wait_missions_loaded()
if state == KEYWORD_BATTLE_PASS_MISSION_TAB.This_Period_Missions:
if state == KEYWORDS_BATTLE_PASS_MISSION_TAB.This_Period_Missions:
self._battle_pass_wait_missions_loaded()
def handle_choose_gifts(self, interval=5):
@ -174,7 +174,7 @@ class BattlePassUI(UI):
def _claim_exp(self, skip_first_screenshot=True):
logger.hr('Claim EXP', level=1)
self.battle_pass_goto(KEYWORD_BATTLE_PASS_TAB.Missions)
self.battle_pass_goto(KEYWORDS_BATTLE_PASS_TAB.Missions)
claimed = False
while 1:
if skip_first_screenshot:
@ -195,7 +195,7 @@ class BattlePassUI(UI):
def _claim_rewards(self, skip_first_screenshot=True):
logger.hr('Claim rewards', level=1)
self.battle_pass_goto(KEYWORD_BATTLE_PASS_TAB.Rewards)
self.battle_pass_goto(KEYWORDS_BATTLE_PASS_TAB.Rewards)
timeout = Timer(5, count=15).start()
while 1:
if skip_first_screenshot:
@ -305,11 +305,11 @@ class BattlePassUI(UI):
def battle_pass_quests_recognition(self):
"""
Pages:
in: page_battle_pass, KEYWORD_BATTLE_PASS_TAB.Missions, weekly or period
in: page_battle_pass, KEYWORDS_BATTLE_PASS_TAB.Missions, weekly or period
"""
logger.hr('Quest recognise', level=1)
self.battle_pass_mission_tab_goto(
KEYWORD_BATTLE_PASS_MISSION_TAB.This_Week_Missions)
KEYWORDS_BATTLE_PASS_MISSION_TAB.This_Week_Missions)
scroll = Scroll(MISSION_PAGE_SCROLL, color=(198, 198, 198))
scroll.set_top(main=self)
@ -327,19 +327,19 @@ class BattlePassUI(UI):
# Convert quest keyword to stored object
dic_quest_to_stored = {
KEYWORD_BATTLE_PASS_QUEST.Complete_Simulated_Universe_1_times:
KEYWORDS_BATTLE_PASS_QUEST.Complete_Simulated_Universe_1_times:
self.config.stored.BattlePassSimulatedUniverse,
KEYWORD_BATTLE_PASS_QUEST.Clear_Calyx_1_times:
KEYWORDS_BATTLE_PASS_QUEST.Clear_Calyx_1_times:
self.config.stored.BattlePassQuestCalyx,
KEYWORD_BATTLE_PASS_QUEST.Complete_Echo_of_War_1_times:
KEYWORDS_BATTLE_PASS_QUEST.Complete_Echo_of_War_1_times:
self.config.stored.BattlePassQuestEchoOfWar,
KEYWORD_BATTLE_PASS_QUEST.Use_300000_credits:
KEYWORDS_BATTLE_PASS_QUEST.Use_300000_credits:
self.config.stored.BattlePassQuestCredits,
KEYWORD_BATTLE_PASS_QUEST.Synthesize_Consumables_1_times:
KEYWORDS_BATTLE_PASS_QUEST.Synthesize_Consumables_1_times:
self.config.stored.BattlePassQuestSynthesizeConsumables,
KEYWORD_BATTLE_PASS_QUEST.Clear_Cavern_of_Corrosion_1_times:
KEYWORDS_BATTLE_PASS_QUEST.Clear_Cavern_of_Corrosion_1_times:
self.config.stored.BattlePassQuestCavernOfCorrosion,
KEYWORD_BATTLE_PASS_QUEST.Consume_a_total_of_1_Trailblaze_Power_1400_Trailblazer_Power_max:
KEYWORDS_BATTLE_PASS_QUEST.Consume_a_total_of_1_Trailblaze_Power_1400_Trailblazer_Power_max:
self.config.stored.BattlePassQuestTrailblazePower,
}
with self.config.multi_set():

View File

@ -1,6 +1,6 @@
import tasks.battle_pass.keywords.mission_tab as KEYWORD_BATTLE_PASS_MISSION_TAB
import tasks.battle_pass.keywords.quest as KEYWORD_BATTLE_PASS_QUEST
import tasks.battle_pass.keywords.quest_state as KEYWORD_BATTLE_PASS_QUEST_STATE
import tasks.battle_pass.keywords.tab as KEYWORD_BATTLE_PASS_TAB
import tasks.battle_pass.keywords.mission_tab as KEYWORDS_BATTLE_PASS_MISSION_TAB
import tasks.battle_pass.keywords.quest as KEYWORDS_BATTLE_PASS_QUEST
import tasks.battle_pass.keywords.quest_state as KEYWORDS_BATTLE_PASS_QUEST_STATE
import tasks.battle_pass.keywords.tab as KEYWORDS_BATTLE_PASS_TAB
from tasks.battle_pass.keywords.classes import BattlePassTab, BattlePassMissionTab, BattlePassQuest, \
BattlePassQuestState

View File

@ -1,4 +1,4 @@
import tasks.character.keywords.character_list as KEYWORD_CHARACTER_LIST
import tasks.character.keywords.character_list as KEYWORDS_CHARACTER_LIST
import tasks.character.keywords.combat_type as KEYWORDS_COMBAT_TYPE
from tasks.character.keywords.character_list import *
from tasks.character.keywords.classes import CharacterList, CombatType

View File

@ -11,7 +11,7 @@ from module.logger import logger
from module.ocr.ocr import BoxedResult, OcrResultButton, OcrWhiteLetterOnComplexBackground
from tasks.base.ui import UI
from tasks.character.assets.assets_character_switch import *
from tasks.character.keywords import CharacterList, DICT_SORTED_RANGES, KEYWORD_CHARACTER_LIST
from tasks.character.keywords import CharacterList, DICT_SORTED_RANGES, KEYWORDS_CHARACTER_LIST
class OcrCharacterName(OcrWhiteLetterOnComplexBackground):
@ -86,16 +86,16 @@ class CharacterSwitch(UI):
Detect characters that can't be found by OCR
"""
dict_template = {
KEYWORD_CHARACTER_LIST.TrailblazerDestruction: [
KEYWORDS_CHARACTER_LIST.TrailblazerDestruction: [
TrailblazerDestructionMale,
TrailblazerDestructionFemale,
],
KEYWORD_CHARACTER_LIST.TrailblazerPreservation: [
KEYWORDS_CHARACTER_LIST.TrailblazerPreservation: [
TrailblazerPreservationMale,
TrailblazerPreservationFemale,
],
KEYWORD_CHARACTER_LIST.Huohuo: [
KEYWORDS_CHARACTER_LIST.Huohuo: [
Huohuo,
],
}

View File

@ -6,7 +6,6 @@ from module.base.utils import crop
from module.logger import logger
from module.ocr.ocr import Ocr, OcrResultButton
from module.ocr.utils import split_and_pair_buttons
from tasks.battle_pass.keywords import KEYWORD_BATTLE_PASS_QUEST
from tasks.daily.assets.assets_daily_reward import *
from tasks.daily.camera import CameraUI
from tasks.daily.keywords import (
@ -337,7 +336,7 @@ class DailyQuestUI(DungeonUI, RouteLoader):
# but battle pass quests need synthesizing consumables.
# if self.synthesized_material:
# quests = self.config.stored.BattlePassWeeklyQuest.load_quests()
# if KEYWORD_BATTLE_PASS_QUEST.Synthesize_Consumables_1_times in quests:
# if KEYWORDS_BATTLE_PASS_QUEST.Synthesize_Consumables_1_times in quests:
# logger.info('Done weekly quest Synthesize_Consumables_1_times once')
# self.config.stored.BattlePassQuestSynthesizeConsumables.add()
# if self.config.stored.BattlePassQuestSynthesizeConsumables.is_full():

View File

@ -1,6 +1,6 @@
from module.base.utils import area_offset
from module.logger import logger
from tasks.battle_pass.keywords import KEYWORD_BATTLE_PASS_QUEST
from tasks.battle_pass.keywords import KEYWORDS_BATTLE_PASS_QUEST
from tasks.combat.combat import Combat
from tasks.daily.keywords import KEYWORDS_DAILY_QUEST
from tasks.dungeon.event import DungeonEvent
@ -84,7 +84,7 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat):
if KEYWORDS_DAILY_QUEST.Clear_Calyx_Golden_1_times in self.daily_quests:
logger.info('Achieved daily quest Clear_Calyx_Golden_1_times')
self.achieved_daily_quest = True
if KEYWORD_BATTLE_PASS_QUEST.Clear_Calyx_1_times in self.weekly_quests:
if KEYWORDS_BATTLE_PASS_QUEST.Clear_Calyx_1_times in self.weekly_quests:
logger.info('Done weekly quest Clear_Calyx_1_times once')
self.config.stored.BattlePassQuestCalyx.add()
if self.config.stored.BattlePassQuestCalyx.is_full():
@ -95,7 +95,7 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat):
if KEYWORDS_DAILY_QUEST.Clear_Calyx_Crimson_1_times in self.daily_quests:
logger.info('Achieve daily quest Clear_Calyx_Crimson_1_times')
self.achieved_daily_quest = True
if KEYWORD_BATTLE_PASS_QUEST.Clear_Calyx_1_times in self.weekly_quests:
if KEYWORDS_BATTLE_PASS_QUEST.Clear_Calyx_1_times in self.weekly_quests:
logger.info('Done weekly quest Clear_Calyx_1_times once')
self.config.stored.BattlePassQuestCalyx.add()
if self.config.stored.BattlePassQuestCalyx.is_full():
@ -111,7 +111,7 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat):
if KEYWORDS_DAILY_QUEST.Clear_Cavern_of_Corrosion_1_times in self.daily_quests:
logger.info('Achieve daily quest Clear_Cavern_of_Corrosion_1_times')
self.achieved_daily_quest = True
if KEYWORD_BATTLE_PASS_QUEST.Clear_Cavern_of_Corrosion_1_times in self.weekly_quests:
if KEYWORDS_BATTLE_PASS_QUEST.Clear_Cavern_of_Corrosion_1_times in self.weekly_quests:
logger.info('Done weekly quest Clear_Cavern_of_Corrosion_1_times once')
self.config.stored.BattlePassQuestCavernOfCorrosion.add()
if self.config.stored.BattlePassQuestCavernOfCorrosion.is_full():
@ -122,7 +122,7 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat):
if KEYWORDS_DAILY_QUEST.Complete_Echo_of_War_1_times in self.daily_quests:
logger.info('Achieve daily quest Complete_Echo_of_War_1_times')
self.achieved_daily_quest = True
if KEYWORD_BATTLE_PASS_QUEST.Complete_Echo_of_War_1_times in self.weekly_quests:
if KEYWORDS_BATTLE_PASS_QUEST.Complete_Echo_of_War_1_times in self.weekly_quests:
logger.info('Done weekly quest Complete_Echo_of_War_1_times once')
self.config.stored.BattlePassQuestEchoOfWar.add()
if self.config.stored.BattlePassQuestEchoOfWar.is_full():
@ -407,7 +407,7 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat):
def check_stamina_quest(self, stamina_used: int):
logger.info(f'Used {stamina_used} stamina')
if KEYWORD_BATTLE_PASS_QUEST.Consume_a_total_of_1_Trailblaze_Power_1400_Trailblazer_Power_max in self.weekly_quests:
if KEYWORDS_BATTLE_PASS_QUEST.Consume_a_total_of_1_Trailblaze_Power_1400_Trailblazer_Power_max in self.weekly_quests:
logger.info(f'Done Consume_a_total_of_1_Trailblaze_Power_1400_Trailblazer_Power_max stamina {stamina_used}')
self.config.stored.BattlePassQuestTrailblazePower.add(stamina_used)
if self.config.stored.BattlePassQuestTrailblazePower.is_full():

View File

@ -8,7 +8,7 @@ from tasks.daily.assets.assets_daily_synthesize_consumable import \
from tasks.daily.synthesize import SynthesizeConsumablesUI
from tasks.item.assets.assets_item_consumable_usage import *
from tasks.item.assets.assets_item_ui import CONSUMABLE_CHECK
from tasks.item.keywords import KEYWORD_ITEM_TAB
from tasks.item.keywords import KEYWORDS_ITEM_TAB
from tasks.item.ui import ItemUI
@ -28,7 +28,7 @@ class ConsumableUsageUI(ItemUI):
"""
logger.hr('Use consumable', level=2)
self.ui_ensure(page_item)
self.item_goto(KEYWORD_ITEM_TAB.Consumables)
self.item_goto(KEYWORDS_ITEM_TAB.Consumables)
if self._search_and_select_consumable():
self._click_use()
self._confirm_use()
@ -50,7 +50,7 @@ class ConsumableUsageUI(ItemUI):
# 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
# self._switch_tag_to_consumables(False)
self.item_goto(KEYWORD_ITEM_TAB.Consumables)
self.item_goto(KEYWORDS_ITEM_TAB.Consumables)
# Determine if there is a scroll bar. If there is a scroll bar,
# pull it down and check if the consumable to be used can be found

View File

@ -1,2 +1,2 @@
import tasks.item.keywords.tab as KEYWORD_ITEM_TAB
import tasks.item.keywords.tab as KEYWORDS_ITEM_TAB
from tasks.item.keywords.classes import ItemTab

View File

@ -2,7 +2,7 @@ from module.base.timer import Timer
from module.logger import logger
from tasks.base.assets.assets_base_page import CLOSE
from tasks.item.assets.assets_item_relics import *
from tasks.item.keywords import KEYWORD_ITEM_TAB
from tasks.item.keywords import KEYWORDS_ITEM_TAB
from tasks.item.ui import ItemUI
@ -48,7 +48,7 @@ class RelicsUI(ItemUI):
out: page_item, GOTO_SALVAGE
"""
logger.hr('Salvage Relic', level=2)
self.item_goto(KEYWORD_ITEM_TAB.Relics, wait_until_stable=False)
self.item_goto(KEYWORDS_ITEM_TAB.Relics, wait_until_stable=False)
while 1: # relic tab -> salvage
if skip_first_screenshot:
skip_first_screenshot = False

View File

@ -4,48 +4,48 @@ from tasks.base.page import page_item
from tasks.base.ui import UI
from tasks.item.assets.assets_item_consumable_usage import SIMPLE_PROTECTIVE_GEAR
from tasks.item.assets.assets_item_ui import *
from tasks.item.keywords import KEYWORD_ITEM_TAB
from tasks.item.keywords import KEYWORDS_ITEM_TAB
SWITCH_ITEM_TAB = Switch('ItemTab', is_selector=True)
SWITCH_ITEM_TAB.add_state(
KEYWORD_ITEM_TAB.UpgradeMaterials,
KEYWORDS_ITEM_TAB.UpgradeMaterials,
check_button=UPGRADE_MATERIAL_CHECK,
click_button=UPGRADE_MATERIAL_CLICK
)
SWITCH_ITEM_TAB.add_state(
KEYWORD_ITEM_TAB.LightCone,
KEYWORDS_ITEM_TAB.LightCone,
check_button=LIGHT_CONE_CHECK,
click_button=LIGHT_CONE_CLICK
)
SWITCH_ITEM_TAB.add_state(
KEYWORD_ITEM_TAB.Relics,
KEYWORDS_ITEM_TAB.Relics,
check_button=RELICS_CHECK,
click_button=RELICS_CLICK
)
SWITCH_ITEM_TAB.add_state(
KEYWORD_ITEM_TAB.OtherMaterials,
KEYWORDS_ITEM_TAB.OtherMaterials,
check_button=OTHER_MATERIALS_CHECK,
click_button=OTHER_MATERIALS_CLICK
)
SWITCH_ITEM_TAB.add_state(
KEYWORD_ITEM_TAB.Consumables,
KEYWORDS_ITEM_TAB.Consumables,
check_button=CONSUMABLE_CHECK,
click_button=CONSUMABLE_CLICK,
)
SWITCH_ITEM_TAB.add_state(
KEYWORD_ITEM_TAB.Missions,
KEYWORDS_ITEM_TAB.Missions,
check_button=MISSIONS_CHECK,
click_button=MISSIONS_CLICK
)
SWITCH_ITEM_TAB.add_state(
KEYWORD_ITEM_TAB.Valuables,
KEYWORDS_ITEM_TAB.Valuables,
check_button=VALUABLES_CHECK,
click_button=VALUABLES_CLICK
)
class ItemUI(UI):
def item_goto(self, state: KEYWORD_ITEM_TAB, wait_until_stable=True):
def item_goto(self, state: KEYWORDS_ITEM_TAB, wait_until_stable=True):
"""
Args:
state:
@ -55,8 +55,8 @@ class ItemUI(UI):
Returns:
self = ItemUI('alas')
self.device.screenshot()
self.item_goto(KEYWORD_ITEM_TAB.Relics)
self.item_goto(KEYWORD_ITEM_TAB.Consumables)
self.item_goto(KEYWORDS_ITEM_TAB.Relics)
self.item_goto(KEYWORDS_ITEM_TAB.Consumables)
"""
logger.hr('Item tab goto', level=2)
self.ui_ensure(page_item)

View File

@ -1,5 +1,5 @@
from module.logger import logger
from tasks.battle_pass.keywords import KEYWORD_BATTLE_PASS_QUEST
from tasks.battle_pass.keywords import KEYWORDS_BATTLE_PASS_QUEST
from tasks.daily.keywords import KEYWORDS_DAILY_QUEST
from tasks.rogue.entry.entry import RogueEntry
from tasks.rogue.exception import RogueReachedWeeklyPointLimit, RogueTeamNotPrepared
@ -54,7 +54,7 @@ class Rogue(RouteLoader, RogueEntry):
self.config.task_call('DailyQuest')
self.config.task_stop()
quests = self.config.stored.BattlePassWeeklyQuest.load_quests()
if KEYWORD_BATTLE_PASS_QUEST.Complete_Simulated_Universe_1_times in quests:
if KEYWORDS_BATTLE_PASS_QUEST.Complete_Simulated_Universe_1_times in quests:
logger.info('Achieve battle pass quest Complete_Simulated_Universe_1_times')
self.config.task_call('BattlePass')
self.config.task_stop()