Merge pull request #232 from LmeSzinc/dev

Dev
This commit is contained in:
LmeSzinc 2023-12-27 10:23:00 +08:00 committed by GitHub
commit 9a0c231ce7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 289 additions and 26 deletions

View File

@ -376,6 +376,7 @@ pre.rich-traceback-code {
#pywebio-scope-scheduler-bar,
#pywebio-scope-log-bar,
#pywebio-scope-log,
#pywebio-scope-daemon-log-bar,
#pywebio-scope-daemon-overview #pywebio-scope-groups {
font-weight: 500;
margin: 0.3125rem;

View File

@ -133,12 +133,13 @@ pre.rich-traceback-code {
color: #c9d1d9;
}
#pywebio-scope-scheduler-bar,
#pywebio-scope-log-bar,
#pywebio-scope-log,
#pywebio-scope-running,
#pywebio-scope-pending,
#pywebio-scope-waiting,
#pywebio-scope-scheduler-bar,
#pywebio-scope-log-bar,
#pywebio-scope-log,
#pywebio-scope-daemon-log-bar,
#pywebio-scope-daemon-overview #pywebio-scope-groups {
background-color: #2f3136;
border: 1px solid #21262d;

View File

@ -133,12 +133,13 @@ pre.rich-traceback-code {
border: 1px solid lightgrey;
}
#pywebio-scope-scheduler-bar,
#pywebio-scope-log-bar,
#pywebio-scope-log,
#pywebio-scope-running,
#pywebio-scope-pending,
#pywebio-scope-waiting,
#pywebio-scope-scheduler-bar,
#pywebio-scope-log-bar,
#pywebio-scope-log,
#pywebio-scope-daemon-log-bar,
#pywebio-scope-daemon-overview #pywebio-scope-groups {
background-color: white;
border: 1px solid lightgrey;

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -194,5 +194,10 @@
"RogueDebug": {
"DebugMode": false
}
},
"Daemon": {
"Daemon": {
"Enable": true
}
}
}

View File

@ -298,6 +298,9 @@ class ModuleBase:
"""
Add a tracking image, image will be saved
"""
if not self.config.Error_SaveError:
return
logger.info('screenshot_tracking_add')
data = self.device.screenshot_deque[-1]
image = data['image']

View File

@ -1291,5 +1291,19 @@
"value": false
}
}
},
"Daemon": {
"Daemon": {
"Enable": {
"type": "state",
"value": true,
"option": [
true
],
"option_bold": [
true
]
}
}
}
}

View File

@ -252,3 +252,13 @@ RogueBlessing:
RogueDebug:
DebugMode: false
# ==================== Tool ====================
Daemon:
Enable:
type: state
value: true
option: [ true ]
option_bold: [ true, ]

View File

@ -26,5 +26,12 @@
"Weekly",
"Rogue"
]
},
"Tool": {
"menu": "list",
"page": "tool",
"tasks": [
"Daemon"
]
}
}

View File

@ -44,6 +44,7 @@ Daily:
Freebies:
- Scheduler
- SupportReward
# ==================== Weekly ====================
Weekly:
@ -60,3 +61,12 @@ Weekly:
- RogueCurio
- RoguePath
- RogueDebug
# ==================== Tool ====================
Tool:
menu: 'list'
page: 'tool'
tasks:
Daemon:
- Daemon

View File

@ -129,13 +129,17 @@ class AzurLaneConfig(ConfigUpdater, ManualConfig, GeneratedConfig, ConfigWatcher
"""
Args:
func (str, Function): Function to run
func_list (set): Set of tasks to be bound
func_list (list[str]): List of tasks to be bound
"""
if func_list is None:
func_list = ["Alas"]
if isinstance(func, Function):
func = func.command
func_list.append(func)
# func_list: ["Alas", <task>, *func_list]
if func_list is None:
func_list = []
if func not in func_list:
func_list.insert(0, func)
if "Alas" not in func_list:
func_list.insert(0, "Alas")
logger.info(f"Bind task {func_list}")
# Bind arguments

View File

@ -136,3 +136,6 @@ class GeneratedConfig:
# Group `RogueDebug`
RogueDebug_DebugMode = False
# Group `Daemon`
Daemon_Enable = True # True

View File

@ -11,6 +11,10 @@
"Weekly": {
"name": "Weekly",
"help": ""
},
"Tool": {
"name": "Tools",
"help": ""
}
},
"Task": {
@ -53,6 +57,10 @@
"Rogue": {
"name": "Simulated Universe",
"help": ""
},
"Daemon": {
"name": "Dialogue Clicker",
"help": ""
}
},
"Scheduler": {
@ -884,6 +892,17 @@
"help": "No stop conditions, no error handling, stop when encountering an error. Please report errors according to the doc: https://github.com/LmeSzinc/StarRailCopilot/wiki/RogueMap_cn"
}
},
"Daemon": {
"_info": {
"name": "Dialogue Clicker",
"help": "Tools need to stop the scheduler and then run independently"
},
"Enable": {
"name": "Dialogue Clicker",
"help": "Monitor game, automatically click dialogue, phone chatting, and blessing in simulated universe (follow the simulated universe task settings)",
"True": "Enabled"
}
},
"Gui": {
"Aside": {
"Install": "Install",

View File

@ -11,6 +11,10 @@
"Weekly": {
"name": "Semanario",
"help": ""
},
"Tool": {
"name": "útiles",
"help": ""
}
},
"Task": {
@ -53,6 +57,10 @@
"Rogue": {
"name": "Universo Simulado",
"help": ""
},
"Daemon": {
"name": "Clic de diálogo",
"help": ""
}
},
"Scheduler": {
@ -63,7 +71,7 @@
"Enable": {
"name": "Activar tarea",
"help": "Añadir tarea al Planificador.",
"True": "Verdadero",
"True": "Activado",
"False": "Falso"
},
"NextRun": {
@ -884,6 +892,17 @@
"help": "Sin condiciones de parada, sin manejo de errores, deténgase cuando encuentre un error. Informe el error de acuerdo con el documento: https://github.com/LmeSzinc/StarRailCopilot/wiki/RogueMap_cn"
}
},
"Daemon": {
"_info": {
"name": "Clic de diálogo",
"help": "Las herramientas necesitan detener el programador y luego ejecutarlo de forma independiente"
},
"Enable": {
"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)",
"True": "Activado"
}
},
"Gui": {
"Aside": {
"Install": "Instalar",

View File

@ -11,6 +11,10 @@
"Weekly": {
"name": "Menu.Weekly.name",
"help": "Menu.Weekly.help"
},
"Tool": {
"name": "Menu.Tool.name",
"help": "Menu.Tool.help"
}
},
"Task": {
@ -53,6 +57,10 @@
"Rogue": {
"name": "Task.Rogue.name",
"help": "Task.Rogue.help"
},
"Daemon": {
"name": "Task.Daemon.name",
"help": "Task.Daemon.help"
}
},
"Scheduler": {
@ -884,6 +892,17 @@
"help": "RogueDebug.DebugMode.help"
}
},
"Daemon": {
"_info": {
"name": "Daemon._info.name",
"help": "Daemon._info.help"
},
"Enable": {
"name": "Daemon.Enable.name",
"help": "Daemon.Enable.help",
"True": "True"
}
},
"Gui": {
"Aside": {
"Install": "インストール",

View File

@ -11,6 +11,10 @@
"Weekly": {
"name": "每周",
"help": ""
},
"Tool": {
"name": "工具",
"help": ""
}
},
"Task": {
@ -53,6 +57,10 @@
"Rogue": {
"name": "模拟宇宙",
"help": ""
},
"Daemon": {
"name": "剧情连点器",
"help": ""
}
},
"Scheduler": {
@ -884,6 +892,17 @@
"help": "无停止条件无异常处理遇错误即停止请按文档上报异常https://github.com/LmeSzinc/StarRailCopilot/wiki/RogueMap_cn"
}
},
"Daemon": {
"_info": {
"name": "剧情连点器",
"help": "工具需要停止调度器再单独运行"
},
"Enable": {
"name": "剧情连点器",
"help": "监听画面自动点击剧情、手机聊天、模拟宇宙祝福(遵循模拟宇宙任务设置)",
"True": "已启用"
}
},
"Gui": {
"Aside": {
"Install": "安装",

View File

@ -11,6 +11,10 @@
"Weekly": {
"name": "每週",
"help": ""
},
"Tool": {
"name": "工具",
"help": ""
}
},
"Task": {
@ -53,6 +57,10 @@
"Rogue": {
"name": "模擬宇宙",
"help": ""
},
"Daemon": {
"name": "劇情連點器",
"help": ""
}
},
"Scheduler": {
@ -881,7 +889,18 @@
},
"DebugMode": {
"name": "開發模式",
"help": "無停止條件無異常處理遇錯誤即停止請依文件回報異常https://github.com/LmeSzinc/StarRailCopilot/wiki/RogueMap_cn"
"help": "無停止條件無異常處理遇錯誤即停止請依檔案回報異常https://github.com/LmeSzinc/StarRailCopilot/wiki/RogueMap_cn"
}
},
"Daemon": {
"_info": {
"name": "劇情連點器",
"help": "工具需要停止調度器再單獨運作"
},
"Enable": {
"name": "劇情連點器",
"help": "監聽畫面自動點擊劇情、手機聊天、模擬宇宙祝福(遵循模擬宇宙任務設定)",
"True": "已啟用"
}
},
"Gui": {

View File

@ -617,7 +617,7 @@ class AlasGUI(Frame):
[
put_scope("scheduler-bar"),
put_scope("groups"),
put_scope("log-bar"),
put_scope("daemon-log-bar"),
put_scope("log", [put_html("")]),
],
)
@ -631,7 +631,7 @@ class AlasGUI(Frame):
[
put_scope(
"_daemon_upper",
[put_scope("scheduler-bar"), put_scope("log-bar")],
[put_scope("scheduler-bar"), put_scope("daemon-log-bar")],
),
put_scope("groups"),
put_scope("log", [put_html("")]),
@ -660,16 +660,17 @@ class AlasGUI(Frame):
scope="scheduler_btn",
)
with use_scope("log-bar"):
put_text(t("Gui.Overview.Log")).style(
"font-size: 1.25rem; margin: auto .5rem auto;"
)
put_scope(
"log-bar-btns",
[
put_scope("log_scroll_btn"),
],
)
with use_scope("daemon-log-bar"):
with use_scope("log-title"):
put_text(t("Gui.Overview.Log")).style(
"font-size: 1.25rem; margin: auto .5rem auto;"
)
put_scope(
"log-bar-btns",
[
put_scope("log_scroll_btn"),
],
)
switch_log_scroll = BinarySwitchButton(
label_on=t("Gui.Button.ScrollON"),

View File

@ -147,6 +147,10 @@ class ProcessManager:
if e is not None:
AzurLaneAutoScript.stop_event = e
StarRailCopilot(config_name=config_name).loop()
elif func == "Daemon":
from tasks.base.daemon import Daemon
Daemon(config=config_name, task="Daemon").run()
else:
logger.critical(f"No function matched: {func}")
logger.info(f"[{config_name}] exited. Reason: Finish\n")

View File

@ -0,0 +1,45 @@
from module.base.button import Button, ButtonWrapper
# This file was auto-generated, do not modify it manually. To generate:
# ``` python -m dev_tools.button_extract ```
CHAT_CLOSE = ButtonWrapper(
name='CHAT_CLOSE',
share=Button(
file='./assets/share/base/daemon/CHAT_CLOSE.png',
area=(1115, 96, 1145, 126),
search=(1095, 76, 1165, 146),
color=(180, 180, 180),
button=(1115, 96, 1145, 126),
),
)
CHAT_OPTION = ButtonWrapper(
name='CHAT_OPTION',
share=Button(
file='./assets/share/base/daemon/CHAT_OPTION.png',
area=(628, 483, 648, 537),
search=(608, 463, 668, 557),
color=(217, 215, 214),
button=(649, 496, 1129, 525),
),
)
STORY_NEXT = ButtonWrapper(
name='STORY_NEXT',
share=Button(
file='./assets/share/base/daemon/STORY_NEXT.png',
area=(631, 673, 649, 682),
search=(611, 653, 669, 702),
color=(124, 108, 83),
button=(927, 606, 1219, 693),
),
)
STORY_OPTION = ButtonWrapper(
name='STORY_OPTION',
share=Button(
file='./assets/share/base/daemon/STORY_OPTION.png',
area=(783, 456, 795, 485),
search=(763, 436, 815, 505),
color=(158, 167, 171),
button=(813, 453, 1069, 488),
),
)

58
tasks/base/daemon.py Normal file
View File

@ -0,0 +1,58 @@
from module.base.timer import Timer
from module.logger import logger
from tasks.base.assets.assets_base_daemon import *
from tasks.base.main_page import MainPage
from tasks.base.page import page_main, page_rogue
from tasks.daily.assets.assets_daily_camera import PICTURE_TAKEN
from tasks.map.assets.assets_map_bigmap import TELEPORT_RIGHT
from tasks.rogue.route.base import RouteBase
class Daemon(RouteBase):
def run(self):
# Rebind daemon settings along with rogue settings
self.config.bind('Daemon', func_list=['Rogue'])
self.device.disable_stuck_detection()
teleport_confirm = Timer(1, count=5)
while 1:
self.device.screenshot()
# Check lang
if not MainPage._lang_checked and self.ui_page_appear(page_main, interval=5):
self.handle_lang_check(page=page_main)
# Check again
if not MainPage._lang_check_success:
MainPage._lang_checked = False
# Story
if self.appear_then_click(STORY_NEXT, interval=0.7):
self.interval_reset(STORY_OPTION)
continue
if self.appear_then_click(STORY_OPTION, interval=1):
continue
# Story teleport
if self.appear_then_click(TELEPORT_RIGHT, interval=3):
teleport_confirm.reset()
continue
if teleport_confirm.started() and not teleport_confirm.reached():
if self.handle_popup_confirm():
logger.info(f'{TELEPORT_RIGHT} -> popup')
continue
# Chat
if self.appear_then_click(CHAT_OPTION, interval=3):
continue
if self.appear_then_click(CHAT_CLOSE, interval=3):
continue
# Popup
if self.handle_reward(interval=1.5):
continue
if self.handle_ui_close(PICTURE_TAKEN, interval=1):
continue
# Rogue
if self.handle_blessing():
continue
if self.ui_page_appear(page_rogue):
if self.handle_event_continue():
continue
if self.handle_event_option():
continue

View File

@ -18,12 +18,13 @@ class UI(MainPage):
ui_current: Page
ui_main_confirm_timer = Timer(0.2, count=0)
def ui_page_appear(self, page):
def ui_page_appear(self, page, interval=0):
"""
Args:
page (Page):
interval:
"""
return self.appear(page.check_button)
return self.appear(page.check_button, interval=interval)
def ui_get_current_page(self, skip_first_screenshot=True):
"""