mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-25 10:01:10 +00:00
commit
0c2b748f65
@ -206,7 +206,8 @@
|
|||||||
},
|
},
|
||||||
"Daemon": {
|
"Daemon": {
|
||||||
"Daemon": {
|
"Daemon": {
|
||||||
"Enable": true
|
"Enable": true,
|
||||||
|
"AimClicker": "do_not_click"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1374,6 +1374,16 @@
|
|||||||
"option_bold": [
|
"option_bold": [
|
||||||
true
|
true
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"AimClicker": {
|
||||||
|
"type": "select",
|
||||||
|
"value": "do_not_click",
|
||||||
|
"option": [
|
||||||
|
"item_enemy",
|
||||||
|
"item",
|
||||||
|
"enemy",
|
||||||
|
"do_not_click"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,4 +277,6 @@ Daemon:
|
|||||||
value: true
|
value: true
|
||||||
option: [ true ]
|
option: [ true ]
|
||||||
option_bold: [ true, ]
|
option_bold: [ true, ]
|
||||||
|
AimClicker:
|
||||||
|
value: do_not_click
|
||||||
|
option: [ item_enemy, item, enemy, do_not_click ]
|
||||||
|
@ -148,3 +148,4 @@ class GeneratedConfig:
|
|||||||
|
|
||||||
# Group `Daemon`
|
# Group `Daemon`
|
||||||
Daemon_Enable = True # True
|
Daemon_Enable = True # True
|
||||||
|
Daemon_AimClicker = 'do_not_click' # item_enemy, item, enemy, do_not_click
|
||||||
|
@ -950,6 +950,14 @@
|
|||||||
"name": "Dialogue Clicker",
|
"name": "Dialogue Clicker",
|
||||||
"help": "Monitor game, automatically click dialogue, phone chatting, and blessing in simulated universe (follow the simulated universe task settings)",
|
"help": "Monitor game, automatically click dialogue, phone chatting, and blessing in simulated universe (follow the simulated universe task settings)",
|
||||||
"True": "Enabled"
|
"True": "Enabled"
|
||||||
|
},
|
||||||
|
"AimClicker": {
|
||||||
|
"name": "Click Aimed Items and Enemies",
|
||||||
|
"help": "",
|
||||||
|
"item_enemy": "Click items and enemies",
|
||||||
|
"item": "Click items only",
|
||||||
|
"enemy": "Click enemies only",
|
||||||
|
"do_not_click": "Don't click"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Gui": {
|
"Gui": {
|
||||||
|
@ -950,6 +950,14 @@
|
|||||||
"name": "Clic de diálogo",
|
"name": "Clic de diálogo",
|
||||||
"help": "Monitorear el juego, hacer clic automáticamente en el diálogo, chatear por teléfono y bendecir en el universo simulado (sigue la configuración de tareas del universo simulado)",
|
"help": "Monitorear el juego, hacer clic automáticamente en el diálogo, chatear por teléfono y bendecir en el universo simulado (sigue la configuración de tareas del universo simulado)",
|
||||||
"True": "Activado"
|
"True": "Activado"
|
||||||
|
},
|
||||||
|
"AimClicker": {
|
||||||
|
"name": "Haz clic en Objetos y enemigos apuntados",
|
||||||
|
"help": "",
|
||||||
|
"item_enemy": "Haz clic en elementos y enemigos",
|
||||||
|
"item": "Haz clic solo en elementos",
|
||||||
|
"enemy": "Haz clic solo en enemigos",
|
||||||
|
"do_not_click": "No hacer clic"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Gui": {
|
"Gui": {
|
||||||
|
@ -950,6 +950,14 @@
|
|||||||
"name": "Daemon.Enable.name",
|
"name": "Daemon.Enable.name",
|
||||||
"help": "Daemon.Enable.help",
|
"help": "Daemon.Enable.help",
|
||||||
"True": "True"
|
"True": "True"
|
||||||
|
},
|
||||||
|
"AimClicker": {
|
||||||
|
"name": "Daemon.AimClicker.name",
|
||||||
|
"help": "Daemon.AimClicker.help",
|
||||||
|
"item_enemy": "item_enemy",
|
||||||
|
"item": "item",
|
||||||
|
"enemy": "enemy",
|
||||||
|
"do_not_click": "do_not_click"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Gui": {
|
"Gui": {
|
||||||
|
@ -950,6 +950,14 @@
|
|||||||
"name": "剧情连点器",
|
"name": "剧情连点器",
|
||||||
"help": "监听画面自动点击剧情、手机聊天、模拟宇宙祝福(遵循模拟宇宙任务设置)",
|
"help": "监听画面自动点击剧情、手机聊天、模拟宇宙祝福(遵循模拟宇宙任务设置)",
|
||||||
"True": "已启用"
|
"True": "已启用"
|
||||||
|
},
|
||||||
|
"AimClicker": {
|
||||||
|
"name": "点击被瞄准破坏物和敌人",
|
||||||
|
"help": "",
|
||||||
|
"item_enemy": "点击破坏物和敌人",
|
||||||
|
"item": "仅点击破坏物",
|
||||||
|
"enemy": "仅点击敌人",
|
||||||
|
"do_not_click": "不点击"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Gui": {
|
"Gui": {
|
||||||
|
@ -950,6 +950,14 @@
|
|||||||
"name": "劇情連點器",
|
"name": "劇情連點器",
|
||||||
"help": "監聽畫面自動點擊劇情、手機聊天、模擬宇宙祝福(遵循模擬宇宙任務設定)",
|
"help": "監聽畫面自動點擊劇情、手機聊天、模擬宇宙祝福(遵循模擬宇宙任務設定)",
|
||||||
"True": "已啟用"
|
"True": "已啟用"
|
||||||
|
},
|
||||||
|
"AimClicker": {
|
||||||
|
"name": "點擊被瞄準破壞物和敵人",
|
||||||
|
"help": "",
|
||||||
|
"item_enemy": "點擊破壞物和敵人",
|
||||||
|
"item": "僅點擊破壞物",
|
||||||
|
"enemy": "僅點擊敵人",
|
||||||
|
"do_not_click": "不點擊"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Gui": {
|
"Gui": {
|
||||||
|
@ -1,18 +1,63 @@
|
|||||||
from module.base.timer import Timer
|
from module.base.timer import Timer
|
||||||
|
from module.daemon.daemon_base import DaemonBase
|
||||||
|
from module.device.method import maatouch
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
from tasks.base.assets.assets_base_daemon import *
|
from tasks.base.assets.assets_base_daemon import *
|
||||||
from tasks.base.main_page import MainPage
|
from tasks.base.main_page import MainPage
|
||||||
from tasks.base.page import page_main, page_rogue
|
from tasks.base.page import page_main, page_rogue
|
||||||
from tasks.daily.assets.assets_daily_camera import PICTURE_TAKEN
|
from tasks.daily.assets.assets_daily_camera import PICTURE_TAKEN
|
||||||
from tasks.map.assets.assets_map_bigmap import TELEPORT_RIGHT
|
from tasks.map.assets.assets_map_bigmap import TELEPORT_RIGHT
|
||||||
|
from tasks.map.interact.aim import AimDetectorMixin
|
||||||
from tasks.rogue.route.base import RouteBase
|
from tasks.rogue.route.base import RouteBase
|
||||||
|
|
||||||
|
|
||||||
class Daemon(RouteBase):
|
class SecondaryMaatouchBuilder(maatouch.MaatouchBuilder):
|
||||||
|
def __init__(self, device, contact=0, handle_orientation=False):
|
||||||
|
"""
|
||||||
|
Click on secondary contact to avoid interruption of real-person contact
|
||||||
|
"""
|
||||||
|
super().__init__(device, contact=1, handle_orientation=handle_orientation)
|
||||||
|
|
||||||
|
|
||||||
|
maatouch.MaatouchBuilder = SecondaryMaatouchBuilder
|
||||||
|
|
||||||
|
|
||||||
|
class Daemon(RouteBase, DaemonBase, AimDetectorMixin):
|
||||||
|
aim_interval = Timer(0.3, count=1)
|
||||||
|
|
||||||
|
def handle_aim_click(self, item=True, enemy=True):
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
item:
|
||||||
|
enemy:
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
bool: If clicked
|
||||||
|
"""
|
||||||
|
if not item and not enemy:
|
||||||
|
return False
|
||||||
|
if not self.is_in_main():
|
||||||
|
return False
|
||||||
|
|
||||||
|
if self.aim_interval.reached_and_reset():
|
||||||
|
self.aim.predict(self.device.image, item=item, enemy=enemy)
|
||||||
|
if self.aim.aimed_enemy:
|
||||||
|
if self.handle_map_A():
|
||||||
|
return True
|
||||||
|
if self.aim.aimed_item:
|
||||||
|
if self.handle_map_A():
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# Rebind daemon settings along with rogue settings
|
# Rebind daemon settings along with rogue settings
|
||||||
self.config.bind('Daemon', func_list=['Rogue'])
|
self.config.bind('Daemon', func_list=['Rogue'])
|
||||||
self.device.disable_stuck_detection()
|
# Check contact
|
||||||
|
builder = self.device.maatouch_builder
|
||||||
|
if builder.contact >= 1:
|
||||||
|
logger.info(f'Maatouch contact on {builder.contact}')
|
||||||
|
else:
|
||||||
|
logger.warning(f'Maatouch contact on {builder.contact}, may cause interruptions')
|
||||||
|
|
||||||
teleport_confirm = Timer(1, count=5)
|
teleport_confirm = Timer(1, count=5)
|
||||||
while 1:
|
while 1:
|
||||||
@ -65,3 +110,9 @@ class Daemon(RouteBase):
|
|||||||
continue
|
continue
|
||||||
if self.handle_event_option():
|
if self.handle_event_option():
|
||||||
continue
|
continue
|
||||||
|
# Aim click
|
||||||
|
if self.handle_aim_click(
|
||||||
|
item='item' in self.config.Daemon_AimClicker,
|
||||||
|
enemy='enemy' in self.config.Daemon_AimClicker,
|
||||||
|
):
|
||||||
|
continue
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from module.base.decorator import run_once
|
from module.base.decorator import run_once
|
||||||
|
from module.exception import RequestHumanTakeover
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
from tasks.combat.assets.assets_combat_finish import COMBAT_AGAIN, COMBAT_EXIT
|
from tasks.combat.assets.assets_combat_finish import COMBAT_AGAIN, COMBAT_EXIT
|
||||||
from tasks.combat.assets.assets_combat_prepare import COMBAT_PREPARE
|
from tasks.combat.assets.assets_combat_prepare import COMBAT_PREPARE
|
||||||
@ -81,6 +82,7 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo
|
|||||||
logger.hr('Combat prepare')
|
logger.hr('Combat prepare')
|
||||||
skip_first_screenshot = True
|
skip_first_screenshot = True
|
||||||
pre_set_team = bool(support_character)
|
pre_set_team = bool(support_character)
|
||||||
|
trial = 0
|
||||||
while 1:
|
while 1:
|
||||||
if skip_first_screenshot:
|
if skip_first_screenshot:
|
||||||
skip_first_screenshot = False
|
skip_first_screenshot = False
|
||||||
@ -90,6 +92,11 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo
|
|||||||
# End
|
# End
|
||||||
if self.is_combat_executing():
|
if self.is_combat_executing():
|
||||||
return True
|
return True
|
||||||
|
# Relics full
|
||||||
|
# Clicking between COMBAT_PREPARE and COMBAT_TEAM_PREPARE
|
||||||
|
if trial > 3:
|
||||||
|
logger.critical('Failed to enter dungeon after 3 trial, probably because relics are full')
|
||||||
|
raise RequestHumanTakeover
|
||||||
|
|
||||||
# Click
|
# Click
|
||||||
if self.appear(COMBAT_TEAM_SUPPORT) and support_character:
|
if self.appear(COMBAT_TEAM_SUPPORT) and support_character:
|
||||||
@ -112,6 +119,7 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo
|
|||||||
return False
|
return False
|
||||||
self.device.click(COMBAT_PREPARE)
|
self.device.click(COMBAT_PREPARE)
|
||||||
self.interval_reset(COMBAT_PREPARE)
|
self.interval_reset(COMBAT_PREPARE)
|
||||||
|
trial += 1
|
||||||
continue
|
continue
|
||||||
if self.handle_combat_interact():
|
if self.handle_combat_interact():
|
||||||
continue
|
continue
|
||||||
@ -308,6 +316,9 @@ class Combat(CombatInteract, CombatPrepare, CombatState, CombatTeam, CombatSuppo
|
|||||||
Returns:
|
Returns:
|
||||||
int: Run count
|
int: Run count
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
RequestHumanTakeover: If relics are full
|
||||||
|
|
||||||
Pages:
|
Pages:
|
||||||
in: COMBAT_PREPARE
|
in: COMBAT_PREPARE
|
||||||
or page_main with DUNGEON_COMBAT_INTERACT
|
or page_main with DUNGEON_COMBAT_INTERACT
|
||||||
|
@ -405,11 +405,15 @@ class Dungeon(DungeonStamina, DungeonEvent, Combat):
|
|||||||
return require
|
return require
|
||||||
|
|
||||||
def check_stamina_quest(self, stamina_used: int):
|
def check_stamina_quest(self, stamina_used: int):
|
||||||
if KEYWORD_BATTLE_PASS_QUEST.Consume_a_total_of_1_Trailblaze_Power_1400_Trailblazer_Power_max not in self.weekly_quests:
|
logger.info(f'Used {stamina_used} stamina')
|
||||||
return
|
|
||||||
|
|
||||||
|
if KEYWORD_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}')
|
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)
|
self.config.stored.BattlePassQuestTrailblazePower.add(stamina_used)
|
||||||
if self.config.stored.BattlePassQuestTrailblazePower.is_full():
|
if self.config.stored.BattlePassQuestTrailblazePower.is_full():
|
||||||
logger.info('Achieved weekly quest Consume_a_total_of_1_Trailblaze_Power_1400_Trailblazer_Power_max')
|
logger.info('Achieved weekly quest Consume_a_total_of_1_Trailblaze_Power_1400_Trailblazer_Power_max')
|
||||||
self.achieved_weekly_quest = True
|
self.achieved_weekly_quest = True
|
||||||
|
|
||||||
|
if KEYWORDS_DAILY_QUEST.Consume_120_Trailblaze_Power in self.daily_quests:
|
||||||
|
logger.info(f'Done Consume_120_Trailblaze_Power stamina {stamina_used}')
|
||||||
|
self.achieved_daily_quest = True
|
||||||
|
Loading…
Reference in New Issue
Block a user