1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2026-06-23 20:34:51 +00:00

14 Commits

45 changed files with 256 additions and 150 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

+1
View File
@@ -377,6 +377,7 @@ pre.rich-traceback-code {
#pywebio-scope-scheduler-bar, #pywebio-scope-scheduler-bar,
#pywebio-scope-log-bar, #pywebio-scope-log-bar,
#pywebio-scope-log, #pywebio-scope-log,
#pywebio-scope-daemon-log-bar,
#pywebio-scope-daemon-overview #pywebio-scope-groups { #pywebio-scope-daemon-overview #pywebio-scope-groups {
font-weight: 500; font-weight: 500;
margin: 0.3125rem; margin: 0.3125rem;
+4 -3
View File
@@ -133,12 +133,13 @@ pre.rich-traceback-code {
color: #c9d1d9; color: #c9d1d9;
} }
#pywebio-scope-scheduler-bar,
#pywebio-scope-log-bar,
#pywebio-scope-log,
#pywebio-scope-running, #pywebio-scope-running,
#pywebio-scope-pending, #pywebio-scope-pending,
#pywebio-scope-waiting, #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 { #pywebio-scope-daemon-overview #pywebio-scope-groups {
background-color: #2f3136; background-color: #2f3136;
border: 1px solid #21262d; border: 1px solid #21262d;
+4 -3
View File
@@ -133,12 +133,13 @@ pre.rich-traceback-code {
border: 1px solid lightgrey; border: 1px solid lightgrey;
} }
#pywebio-scope-scheduler-bar,
#pywebio-scope-log-bar,
#pywebio-scope-log,
#pywebio-scope-running, #pywebio-scope-running,
#pywebio-scope-pending, #pywebio-scope-pending,
#pywebio-scope-waiting, #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 { #pywebio-scope-daemon-overview #pywebio-scope-groups {
background-color: white; background-color: white;
border: 1px solid lightgrey; border: 1px solid lightgrey;
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

+2 -5
View File
@@ -250,11 +250,8 @@
} }
}, },
"Momotalk": { "Momotalk": {
"Scheduler": { "Momotalk": {
"Enable": false, "Enable": true
"NextRun": "2020-01-01 00:00:00",
"Command": "Momotalk",
"ServerUpdate": "04:00"
} }
} }
} }
+2 -20
View File
@@ -1062,28 +1062,10 @@
} }
}, },
"Momotalk": { "Momotalk": {
"Scheduler": { "Momotalk": {
"Enable": { "Enable": {
"type": "checkbox", "type": "checkbox",
"value": false, "value": true,
"option": [
true,
false
]
},
"NextRun": {
"type": "datetime",
"value": "2020-01-01 00:00:00",
"validate": "datetime"
},
"Command": {
"type": "input",
"value": "Momotalk",
"display": "hide"
},
"ServerUpdate": {
"type": "input",
"value": "04:00",
"display": "hide" "display": "hide"
} }
} }
+7
View File
@@ -267,3 +267,10 @@ ItemStorage:
stored: StoredTacticalChallengeTicket stored: StoredTacticalChallengeTicket
order: 6 order: 6
color: "#7ac8e5" color: "#7ac8e5"
# ==================== Momotalk ====================
Momotalk:
Enable:
value: true
display: hide
+7 -1
View File
@@ -33,7 +33,13 @@
"tasks": [ "tasks": [
"Circle", "Circle",
"Task", "Task",
"Mail", "Mail"
]
},
"Tool": {
"menu": "collapse",
"page": "tool",
"tasks": [
"Momotalk" "Momotalk"
] ]
} }
+8 -1
View File
@@ -80,5 +80,12 @@ Reward:
- Scheduler - Scheduler
Mail: Mail:
- Scheduler - Scheduler
# ==================== Tool ====================
Tool:
menu: 'collapse'
page: 'tool'
tasks:
Momotalk: Momotalk:
- Scheduler - Momotalk
+3
View File
@@ -166,3 +166,6 @@ class GeneratedConfig:
ItemStorage_BountyTicket = {} ItemStorage_BountyTicket = {}
ItemStorage_ScrimmageTicket = {} ItemStorage_ScrimmageTicket = {}
ItemStorage_TacticalChallengeTicket = {} ItemStorage_TacticalChallengeTicket = {}
# Group `Momotalk`
Momotalk_Enable = True
+17 -3
View File
@@ -15,6 +15,10 @@
"Reward": { "Reward": {
"name": "Reward", "name": "Reward",
"help": "" "help": ""
},
"Tool": {
"name": "Tools",
"help": ""
} }
}, },
"Task": { "Task": {
@@ -503,7 +507,7 @@
"7": "07 - Overpass G", "7": "07 - Overpass G",
"8": "08 - Overpass H", "8": "08 - Overpass H",
"9": "09 - Overpass I", "9": "09 - Overpass I",
"10": "10 - Overpass J (JP Server Only)" "10": "10 - Overpass J"
}, },
"Count": { "Count": {
"name": "Sweep X times", "name": "Sweep X times",
@@ -528,7 +532,7 @@
"7": "07 - Abandoned Train G", "7": "07 - Abandoned Train G",
"8": "08 - Abandoned Train H", "8": "08 - Abandoned Train H",
"9": "09 - Abandoned Train I", "9": "09 - Abandoned Train I",
"10": "10 - Abandoned Train J (JP Server Only)" "10": "10 - Abandoned Train J"
}, },
"Count": { "Count": {
"name": "Sweep X times", "name": "Sweep X times",
@@ -553,7 +557,7 @@
"7": "07 - Besieged Classroom G", "7": "07 - Besieged Classroom G",
"8": "08 - Besieged Classroom H", "8": "08 - Besieged Classroom H",
"9": "09 - Besieged Classroom I", "9": "09 - Besieged Classroom I",
"10": "10 - Besieged Classroom J (JP Server Only)" "10": "10 - Besieged Classroom J"
}, },
"Count": { "Count": {
"name": "Sweep X times", "name": "Sweep X times",
@@ -849,6 +853,16 @@
"help": "" "help": ""
} }
}, },
"Momotalk": {
"_info": {
"name": "Momotalk",
"help": "Tools need to stop the scheduler and then run independently"
},
"Enable": {
"name": "",
"help": ""
}
},
"Gui": { "Gui": {
"Aside": { "Aside": {
"Install": "Install", "Install": "Install",
+17 -3
View File
@@ -15,6 +15,10 @@
"Reward": { "Reward": {
"name": "收菜", "name": "收菜",
"help": "" "help": ""
},
"Tool": {
"name": "工具",
"help": ""
} }
}, },
"Task": { "Task": {
@@ -503,7 +507,7 @@
"7": "07 - 高架公路 G", "7": "07 - 高架公路 G",
"8": "08 - 高架公路 H", "8": "08 - 高架公路 H",
"9": "09 - 高架公路 I", "9": "09 - 高架公路 I",
"10": "10 - 高架公路 J(仅日服)" "10": "10 - 高架公路 J"
}, },
"Count": { "Count": {
"name": "扫荡次数", "name": "扫荡次数",
@@ -528,7 +532,7 @@
"7": "07 - 被遗弃的列车 G", "7": "07 - 被遗弃的列车 G",
"8": "08 - 被遗弃的列车 H", "8": "08 - 被遗弃的列车 H",
"9": "09 - 被遗弃的列车 I", "9": "09 - 被遗弃的列车 I",
"10": "10 - 被遗弃的列车 J(仅日服)" "10": "10 - 被遗弃的列车 J"
}, },
"Count": { "Count": {
"name": "扫荡次数", "name": "扫荡次数",
@@ -553,7 +557,7 @@
"7": "07 - 被袭击的教室 G", "7": "07 - 被袭击的教室 G",
"8": "08 - 被袭击的教室 H", "8": "08 - 被袭击的教室 H",
"9": "09 - 被袭击的教室 I", "9": "09 - 被袭击的教室 I",
"10": "10 - 被袭击的教室 J(仅日服)" "10": "10 - 被袭击的教室 J"
}, },
"Count": { "Count": {
"name": "扫荡次数", "name": "扫荡次数",
@@ -849,6 +853,16 @@
"help": "" "help": ""
} }
}, },
"Momotalk": {
"_info": {
"name": "Momotalk",
"help": "工具需要停止调度器再单独运行"
},
"Enable": {
"name": "",
"help": ""
}
},
"Gui": { "Gui": {
"Aside": { "Aside": {
"Install": "安装", "Install": "安装",
+13 -12
View File
@@ -611,7 +611,7 @@ class AlasGUI(Frame):
[ [
put_scope("scheduler-bar"), put_scope("scheduler-bar"),
put_scope("groups"), put_scope("groups"),
put_scope("log-bar"), put_scope("daemon-log-bar"),
put_scope("log", [put_html("")]), put_scope("log", [put_html("")]),
], ],
) )
@@ -625,7 +625,7 @@ class AlasGUI(Frame):
[ [
put_scope( put_scope(
"_daemon_upper", "_daemon_upper",
[put_scope("scheduler-bar"), put_scope("log-bar")], [put_scope("scheduler-bar"), put_scope("daemon-log-bar")],
), ),
put_scope("groups"), put_scope("groups"),
put_scope("log", [put_html("")]), put_scope("log", [put_html("")]),
@@ -654,16 +654,17 @@ class AlasGUI(Frame):
scope="scheduler_btn", scope="scheduler_btn",
) )
with use_scope("log-bar"): with use_scope("daemon-log-bar"):
put_text(t("Gui.Overview.Log")).style( with use_scope("log-title"):
"font-size: 1.25rem; margin: auto .5rem auto;" put_text(t("Gui.Overview.Log")).style(
) "font-size: 1.25rem; margin: auto .5rem auto;"
put_scope( )
"log-bar-btns", put_scope(
[ "log-bar-btns",
put_scope("log_scroll_btn"), [
], put_scope("log_scroll_btn"),
) ],
)
switch_log_scroll = BinarySwitchButton( switch_log_scroll = BinarySwitchButton(
label_on=t("Gui.Button.ScrollON"), label_on=t("Gui.Button.ScrollON"),
+6 -1
View File
@@ -6,11 +6,12 @@ from multiprocessing import Process
from typing import Dict, List, Union from typing import Dict, List, Union
from filelock import FileLock from filelock import FileLock
from rich.console import Console, ConsoleRenderable
from module.config.utils import filepath_config from module.config.utils import filepath_config
from module.logger import logger, set_file_logger, set_func_logger from module.logger import logger, set_file_logger, set_func_logger
from module.webui.fake import get_config_mod, mod_instance from module.webui.fake import get_config_mod, mod_instance
from module.webui.setting import State from module.webui.setting import State
from rich.console import Console, ConsoleRenderable
class ProcessManager: class ProcessManager:
@@ -147,6 +148,10 @@ class ProcessManager:
if e is not None: if e is not None:
AzurLaneAutoScript.stop_event = e AzurLaneAutoScript.stop_event = e
ArisuAutoSweeper(config_name=config_name).loop() ArisuAutoSweeper(config_name=config_name).loop()
elif func == "Momotalk":
from tasks.momotalk.momotalk import MomoTalk
MomoTalk(config=config_name, task="Momotalk").run()
else: else:
logger.critical(f"No function matched: {func}") logger.critical(f"No function matched: {func}")
logger.info(f"[{config_name}] exited. Reason: Finish\n") logger.info(f"[{config_name}] exited. Reason: Finish\n")
+129 -52
View File
@@ -207,6 +207,13 @@ GACHA_CHECK = ButtonWrapper(
) )
HOME = ButtonWrapper( HOME = ButtonWrapper(
name='HOME', name='HOME',
jp=Button(
file='./assets/jp/base/page/HOME.png',
area=(1224, 10, 1250, 35),
search=(1204, 0, 1270, 55),
color=(162, 176, 202),
button=(1224, 10, 1250, 35),
),
share=Button( share=Button(
file='./assets/share/base/page/HOME.png', file='./assets/share/base/page/HOME.png',
area=(1218, 8, 1253, 41), area=(1218, 8, 1253, 41),
@@ -251,6 +258,13 @@ MAIL_CHECK = ButtonWrapper(
) )
MAIN_GO_TO_CAFE = ButtonWrapper( MAIN_GO_TO_CAFE = ButtonWrapper(
name='MAIN_GO_TO_CAFE', name='MAIN_GO_TO_CAFE',
jp=Button(
file='./assets/jp/base/page/MAIN_GO_TO_CAFE.png',
area=(86, 632, 113, 670),
search=(66, 612, 133, 690),
color=(174, 222, 246),
button=(86, 632, 113, 670),
),
share=Button( share=Button(
file='./assets/share/base/page/MAIN_GO_TO_CAFE.png', file='./assets/share/base/page/MAIN_GO_TO_CAFE.png',
area=(81, 638, 102, 668), area=(81, 638, 102, 668),
@@ -261,6 +275,13 @@ MAIN_GO_TO_CAFE = ButtonWrapper(
) )
MAIN_GO_TO_CIRCLE = ButtonWrapper( MAIN_GO_TO_CIRCLE = ButtonWrapper(
name='MAIN_GO_TO_CIRCLE', name='MAIN_GO_TO_CIRCLE',
jp=Button(
file='./assets/jp/base/page/MAIN_GO_TO_CIRCLE.png',
area=(531, 631, 561, 659),
search=(511, 611, 581, 679),
color=(182, 230, 254),
button=(531, 631, 561, 659),
),
share=Button( share=Button(
file='./assets/share/base/page/MAIN_GO_TO_CIRCLE.png', file='./assets/share/base/page/MAIN_GO_TO_CIRCLE.png',
area=(542, 630, 581, 665), area=(542, 630, 581, 665),
@@ -271,6 +292,13 @@ MAIN_GO_TO_CIRCLE = ButtonWrapper(
) )
MAIN_GO_TO_CRAFTING = ButtonWrapper( MAIN_GO_TO_CRAFTING = ButtonWrapper(
name='MAIN_GO_TO_CRAFTING', name='MAIN_GO_TO_CRAFTING',
jp=Button(
file='./assets/jp/base/page/MAIN_GO_TO_CRAFTING.png',
area=(645, 627, 667, 662),
search=(625, 607, 687, 682),
color=(206, 235, 251),
button=(645, 627, 667, 662),
),
share=Button( share=Button(
file='./assets/share/base/page/MAIN_GO_TO_CRAFTING.png', file='./assets/share/base/page/MAIN_GO_TO_CRAFTING.png',
area=(665, 622, 693, 664), area=(665, 622, 693, 664),
@@ -281,6 +309,13 @@ MAIN_GO_TO_CRAFTING = ButtonWrapper(
) )
MAIN_GO_TO_GACHA = ButtonWrapper( MAIN_GO_TO_GACHA = ButtonWrapper(
name='MAIN_GO_TO_GACHA', name='MAIN_GO_TO_GACHA',
jp=Button(
file='./assets/jp/base/page/MAIN_GO_TO_GACHA.png',
area=(871, 626, 893, 671),
search=(851, 606, 913, 691),
color=(172, 223, 242),
button=(871, 626, 893, 671),
),
share=Button( share=Button(
file='./assets/share/base/page/MAIN_GO_TO_GACHA.png', file='./assets/share/base/page/MAIN_GO_TO_GACHA.png',
area=(900, 623, 924, 670), area=(900, 623, 924, 670),
@@ -291,6 +326,13 @@ MAIN_GO_TO_GACHA = ButtonWrapper(
) )
MAIN_GO_TO_MAIL = ButtonWrapper( MAIN_GO_TO_MAIL = ButtonWrapper(
name='MAIN_GO_TO_MAIL', name='MAIN_GO_TO_MAIL',
jp=Button(
file='./assets/jp/base/page/MAIN_GO_TO_MAIL.png',
area=(1144, 27, 1165, 44),
search=(1124, 7, 1185, 64),
color=(102, 125, 168),
button=(1144, 27, 1165, 44),
),
share=Button( share=Button(
file='./assets/share/base/page/MAIN_GO_TO_MAIL.png', file='./assets/share/base/page/MAIN_GO_TO_MAIL.png',
area=(1130, 29, 1156, 49), area=(1130, 29, 1156, 49),
@@ -301,33 +343,47 @@ MAIN_GO_TO_MAIL = ButtonWrapper(
) )
MAIN_GO_TO_MOMOTALK = ButtonWrapper( MAIN_GO_TO_MOMOTALK = ButtonWrapper(
name='MAIN_GO_TO_MOMOTALK', name='MAIN_GO_TO_MOMOTALK',
jp=Button(
file='./assets/jp/base/page/MAIN_GO_TO_MOMOTALK.png',
area=(125, 118, 146, 151),
search=(105, 98, 166, 171),
color=(244, 200, 211),
button=(125, 118, 146, 151),
),
share=Button( share=Button(
file='./assets/share/base/page/MAIN_GO_TO_MOMOTALK.png', file='./assets/share/base/page/MAIN_GO_TO_MOMOTALK.png',
area=(154, 134, 177, 158), area=(138, 130, 159, 161),
search=(134, 114, 197, 178), search=(118, 110, 179, 181),
color=(255, 219, 227), color=(251, 215, 224),
button=(154, 134, 177, 158), button=(138, 130, 159, 161),
), ),
) )
MAIN_GO_TO_PURCHASE = ButtonWrapper( MAIN_GO_TO_PURCHASE = ButtonWrapper(
name='MAIN_GO_TO_PURCHASE', name='MAIN_GO_TO_PURCHASE',
jp=Button( jp=Button(
file='./assets/jp/base/page/MAIN_GO_TO_PURCHASE.png', file='./assets/jp/base/page/MAIN_GO_TO_PURCHASE.png',
area=(147, 214, 179, 254), area=(122, 209, 148, 243),
search=(127, 194, 199, 274), search=(102, 189, 168, 263),
color=(171, 216, 241), color=(190, 222, 246),
button=(147, 214, 179, 254), button=(122, 209, 148, 243),
), ),
share=Button( share=Button(
file='./assets/share/base/page/MAIN_GO_TO_PURCHASE.png', file='./assets/share/base/page/MAIN_GO_TO_PURCHASE.png',
area=(148, 204, 183, 253), area=(136, 210, 165, 250),
search=(128, 184, 203, 273), search=(116, 190, 185, 270),
color=(172, 214, 239), color=(175, 216, 240),
button=(148, 204, 183, 253), button=(136, 210, 165, 250),
), ),
) )
MAIN_GO_TO_SCHEDULE = ButtonWrapper( MAIN_GO_TO_SCHEDULE = ButtonWrapper(
name='MAIN_GO_TO_SCHEDULE', name='MAIN_GO_TO_SCHEDULE',
jp=Button(
file='./assets/jp/base/page/MAIN_GO_TO_SCHEDULE.png',
area=(198, 634, 217, 667),
search=(178, 614, 237, 687),
color=(176, 222, 243),
button=(198, 634, 217, 667),
),
share=Button( share=Button(
file='./assets/share/base/page/MAIN_GO_TO_SCHEDULE.png', file='./assets/share/base/page/MAIN_GO_TO_SCHEDULE.png',
area=(194, 638, 216, 672), area=(194, 638, 216, 672),
@@ -338,6 +394,13 @@ MAIN_GO_TO_SCHEDULE = ButtonWrapper(
) )
MAIN_GO_TO_SHOP = ButtonWrapper( MAIN_GO_TO_SHOP = ButtonWrapper(
name='MAIN_GO_TO_SHOP', name='MAIN_GO_TO_SHOP',
jp=Button(
file='./assets/jp/base/page/MAIN_GO_TO_SHOP.png',
area=(752, 628, 786, 665),
search=(732, 608, 806, 685),
color=(168, 221, 248),
button=(752, 628, 786, 665),
),
share=Button( share=Button(
file='./assets/share/base/page/MAIN_GO_TO_SHOP.png', file='./assets/share/base/page/MAIN_GO_TO_SHOP.png',
area=(773, 630, 816, 667), area=(773, 630, 816, 667),
@@ -348,36 +411,43 @@ MAIN_GO_TO_SHOP = ButtonWrapper(
) )
MAIN_GO_TO_TASK = ButtonWrapper( MAIN_GO_TO_TASK = ButtonWrapper(
name='MAIN_GO_TO_TASK', name='MAIN_GO_TO_TASK',
jp=Button(
file='./assets/jp/base/page/MAIN_GO_TO_TASK.png',
area=(30, 214, 55, 248),
search=(10, 194, 75, 268),
color=(186, 218, 245),
button=(30, 214, 55, 248),
),
share=Button( share=Button(
file='./assets/share/base/page/MAIN_GO_TO_TASK.png', file='./assets/share/base/page/MAIN_GO_TO_TASK.png',
area=(52, 220, 78, 248), area=(47, 219, 70, 246),
search=(32, 200, 98, 268), search=(27, 199, 90, 266),
color=(226, 207, 203), color=(212, 204, 208),
button=(52, 220, 78, 248), button=(47, 219, 70, 246),
), ),
) )
MAIN_GO_TO_WORK = ButtonWrapper( MAIN_GO_TO_WORK = ButtonWrapper(
name='MAIN_GO_TO_WORK', name='MAIN_GO_TO_WORK',
jp=Button( jp=Button(
file='./assets/jp/base/page/MAIN_GO_TO_WORK.png', file='./assets/jp/base/page/MAIN_GO_TO_WORK.png',
area=(1169, 588, 1239, 612), area=(1167, 668, 1222, 688),
search=(1149, 568, 1259, 632), search=(1147, 648, 1242, 708),
color=(150, 162, 180), color=(141, 156, 174),
button=(1169, 588, 1239, 612), button=(1167, 668, 1222, 688),
), ),
en=Button( en=Button(
file='./assets/en/base/page/MAIN_GO_TO_WORK.png', file='./assets/en/base/page/MAIN_GO_TO_WORK.png',
area=(1127, 605, 1250, 637), area=(1143, 591, 1241, 613),
search=(1107, 585, 1270, 657), search=(1123, 571, 1261, 633),
color=(90, 112, 141), color=(110, 129, 154),
button=(1127, 605, 1250, 637), button=(1143, 591, 1241, 613),
), ),
zht=Button( zht=Button(
file='./assets/zht/base/page/MAIN_GO_TO_WORK.png', file='./assets/zht/base/page/MAIN_GO_TO_WORK.png',
area=(1167, 595, 1277, 637), area=(1188, 586, 1241, 613),
search=(1147, 575, 1280, 657), search=(1168, 566, 1261, 633),
color=(73, 100, 133), color=(141, 155, 174),
button=(1167, 595, 1277, 637), button=(1188, 586, 1241, 613),
), ),
) )
MISSION_CHECK = ButtonWrapper( MISSION_CHECK = ButtonWrapper(
@@ -406,6 +476,13 @@ MISSION_CHECK = ButtonWrapper(
) )
MOMOTALK_CHECK = ButtonWrapper( MOMOTALK_CHECK = ButtonWrapper(
name='MOMOTALK_CHECK', name='MOMOTALK_CHECK',
jp=Button(
file='./assets/jp/base/page/MOMOTALK_CHECK.png',
area=(144, 107, 169, 130),
search=(124, 87, 189, 150),
color=(253, 211, 219),
button=(144, 107, 169, 130),
),
share=Button( share=Button(
file='./assets/share/base/page/MOMOTALK_CHECK.png', file='./assets/share/base/page/MOMOTALK_CHECK.png',
area=(144, 107, 169, 130), area=(144, 107, 169, 130),
@@ -596,10 +673,10 @@ WORK_GO_TO_BOUNTY = ButtonWrapper(
name='WORK_GO_TO_BOUNTY', name='WORK_GO_TO_BOUNTY',
jp=Button( jp=Button(
file='./assets/jp/base/page/WORK_GO_TO_BOUNTY.png', file='./assets/jp/base/page/WORK_GO_TO_BOUNTY.png',
area=(667, 383, 764, 409), area=(679, 401, 741, 417),
search=(647, 363, 784, 429), search=(659, 381, 761, 437),
color=(171, 187, 212), color=(155, 164, 186),
button=(667, 383, 764, 409), button=(679, 401, 741, 417),
), ),
en=Button( en=Button(
file='./assets/en/base/page/WORK_GO_TO_BOUNTY.png', file='./assets/en/base/page/WORK_GO_TO_BOUNTY.png',
@@ -620,10 +697,10 @@ WORK_GO_TO_COMMISSIONS = ButtonWrapper(
name='WORK_GO_TO_COMMISSIONS', name='WORK_GO_TO_COMMISSIONS',
jp=Button( jp=Button(
file='./assets/jp/base/page/WORK_GO_TO_COMMISSIONS.png', file='./assets/jp/base/page/WORK_GO_TO_COMMISSIONS.png',
area=(653, 475, 749, 501), area=(661, 504, 724, 521),
search=(633, 455, 769, 521), search=(641, 484, 744, 541),
color=(171, 185, 208), color=(155, 163, 184),
button=(653, 475, 749, 501), button=(661, 504, 724, 521),
), ),
en=Button( en=Button(
file='./assets/en/base/page/WORK_GO_TO_COMMISSIONS.png', file='./assets/en/base/page/WORK_GO_TO_COMMISSIONS.png',
@@ -668,10 +745,10 @@ WORK_GO_TO_MISSION = ButtonWrapper(
name='WORK_GO_TO_MISSION', name='WORK_GO_TO_MISSION',
jp=Button( jp=Button(
file='./assets/jp/base/page/WORK_GO_TO_MISSION.png', file='./assets/jp/base/page/WORK_GO_TO_MISSION.png',
area=(722, 155, 807, 199), area=(710, 220, 769, 249),
search=(702, 135, 827, 219), search=(690, 200, 789, 269),
color=(173, 188, 211), color=(137, 153, 180),
button=(722, 155, 807, 199), button=(710, 220, 769, 249),
), ),
en=Button( en=Button(
file='./assets/en/base/page/WORK_GO_TO_MISSION.png', file='./assets/en/base/page/WORK_GO_TO_MISSION.png',
@@ -692,10 +769,10 @@ WORK_GO_TO_SCHOOL_EXCHANGE = ButtonWrapper(
name='WORK_GO_TO_SCHOOL_EXCHANGE', name='WORK_GO_TO_SCHOOL_EXCHANGE',
jp=Button( jp=Button(
file='./assets/jp/base/page/WORK_GO_TO_SCHOOL_EXCHANGE.png', file='./assets/jp/base/page/WORK_GO_TO_SCHOOL_EXCHANGE.png',
area=(636, 566, 753, 592), area=(642, 606, 721, 624),
search=(616, 546, 773, 612), search=(622, 586, 741, 644),
color=(176, 187, 207), color=(167, 174, 192),
button=(636, 566, 753, 592), button=(642, 606, 721, 624),
), ),
en=Button( en=Button(
file='./assets/en/base/page/WORK_GO_TO_SCHOOL_EXCHANGE.png', file='./assets/en/base/page/WORK_GO_TO_SCHOOL_EXCHANGE.png',
@@ -716,10 +793,10 @@ WORK_GO_TO_STORY = ButtonWrapper(
name='WORK_GO_TO_STORY', name='WORK_GO_TO_STORY',
jp=Button( jp=Button(
file='./assets/jp/base/page/WORK_GO_TO_STORY.png', file='./assets/jp/base/page/WORK_GO_TO_STORY.png',
area=(998, 155, 1078, 199), area=(993, 220, 1081, 250),
search=(978, 135, 1098, 219), search=(973, 200, 1101, 270),
color=(215, 221, 232), color=(209, 214, 224),
button=(998, 155, 1078, 199), button=(993, 220, 1081, 250),
), ),
en=Button( en=Button(
file='./assets/en/base/page/WORK_GO_TO_STORY.png', file='./assets/en/base/page/WORK_GO_TO_STORY.png',
@@ -740,10 +817,10 @@ WORK_GO_TO_TACTICAL_CHALLENGE = ButtonWrapper(
name='WORK_GO_TO_TACTICAL_CHALLENGE', name='WORK_GO_TO_TACTICAL_CHALLENGE',
jp=Button( jp=Button(
file='./assets/jp/base/page/WORK_GO_TO_TACTICAL_CHALLENGE.png', file='./assets/jp/base/page/WORK_GO_TO_TACTICAL_CHALLENGE.png',
area=(801, 565, 920, 593), area=(821, 600, 911, 620),
search=(781, 545, 940, 613), search=(801, 580, 931, 640),
color=(172, 186, 209), color=(156, 164, 185),
button=(801, 565, 920, 593), button=(821, 600, 911, 620),
), ),
en=Button( en=Button(
file='./assets/en/base/page/WORK_GO_TO_TACTICAL_CHALLENGE.png', file='./assets/en/base/page/WORK_GO_TO_TACTICAL_CHALLENGE.png',
+4 -3
View File
@@ -1,10 +1,10 @@
from module.base.button import ButtonWrapper from module.base.button import ButtonWrapper
from module.base.decorator import run_once, Config from module.base.decorator import Config, run_once
from module.base.timer import Timer from module.base.timer import Timer
from module.base.utils import get_color from module.base.utils import get_color
from module.exception import GameNotRunningError, GamePageUnknownError, RequestHumanTakeover from module.exception import GameNotRunningError, GamePageUnknownError, RequestHumanTakeover
from module.logger import logger from module.logger import logger
from module.ocr.ocr import Ocr, Digit from module.ocr.ocr import Digit, Ocr
from tasks.base.assets.assets_base_page import BACK from tasks.base.assets.assets_base_page import BACK
from tasks.base.main_page import MainPage from tasks.base.main_page import MainPage
from tasks.base.page import Page, page_main from tasks.base.page import Page, page_main
@@ -23,7 +23,8 @@ class UI(MainPage):
# temporary block check for jp # temporary block check for jp
@Config.when(Emulator_GameLanguage='jp') @Config.when(Emulator_GameLanguage='jp')
def appear_trademark_year(self): def appear_trademark_year(self):
return False # this disables using back button in jp due to a login issue
return True
@Config.when(Emulator_GameLanguage=None) @Config.when(Emulator_GameLanguage=None)
def appear_trademark_year(self): def appear_trademark_year(self):
+14 -14
View File
@@ -7,33 +7,33 @@ OCR_AP = ButtonWrapper(
name='OCR_AP', name='OCR_AP',
jp=Button( jp=Button(
file='./assets/jp/item/data/OCR_AP.png', file='./assets/jp/item/data/OCR_AP.png',
area=(512, 13, 597, 32),
search=(492, 0, 617, 52),
color=(199, 204, 208),
button=(512, 13, 597, 32),
),
share=Button(
file='./assets/share/item/data/OCR_AP.png',
area=(535, 13, 660, 36), area=(535, 13, 660, 36),
search=(515, 0, 680, 56), search=(515, 0, 680, 56),
color=(207, 215, 220), color=(207, 215, 220),
button=(535, 13, 660, 36), button=(535, 13, 660, 36),
), ),
share=Button(
file='./assets/share/item/data/OCR_AP.png',
area=(560, 11, 667, 37),
search=(540, 0, 687, 57),
color=(211, 216, 219),
button=(560, 11, 667, 37),
),
) )
OCR_DATA = ButtonWrapper( OCR_DATA = ButtonWrapper(
name='OCR_DATA', name='OCR_DATA',
jp=Button( jp=Button(
file='./assets/jp/item/data/OCR_DATA.png', file='./assets/jp/item/data/OCR_DATA.png',
area=(716, 14, 1058, 33),
search=(696, 0, 1078, 53),
color=(211, 219, 224),
button=(716, 14, 1058, 33),
),
share=Button(
file='./assets/share/item/data/OCR_DATA.png',
area=(745, 11, 1069, 39), area=(745, 11, 1069, 39),
search=(725, 0, 1089, 59), search=(725, 0, 1089, 59),
color=(216, 223, 227), color=(216, 223, 227),
button=(745, 11, 1069, 39), button=(745, 11, 1069, 39),
), ),
share=Button(
file='./assets/share/item/data/OCR_DATA.png',
area=(768, 12, 1072, 37),
search=(748, 0, 1092, 57),
color=(212, 220, 224),
button=(768, 12, 1072, 37),
),
) )
+18 -29
View File
@@ -1,9 +1,7 @@
import cv2
import numpy as np import numpy as np
from module.base.base import ModuleBase
from module.base.timer import Timer from module.base.timer import Timer
from module.base.utils import point_in_area, area_size from module.base.utils import area_size
from module.logger import logger from module.logger import logger
from module.ui.switch import Switch from module.ui.switch import Switch
from tasks.base.page import page_main, page_momo_talk from tasks.base.page import page_main, page_momo_talk
@@ -24,23 +22,19 @@ SWITCH_SORT.add_state("descending", SORT_DESCENDING)
"""Required for template matching as reply and story """Required for template matching as reply and story
button can be found in different locations""" button can be found in different locations"""
REPLY_TEMPLATE = REPLY.matched_button.image REPLY_TEMPLATE = REPLY
STORY_TEMPLATE = STORY.matched_button.image STORY_TEMPLATE = STORY
CHATTING_TEMPLATE = CHATTING.matched_button.image CHATTING_TEMPLATE = CHATTING
class MomoTalkUI(UI): class MomoTalkUI(UI):
def __init__(self, config, device): swipe_vector_range = (0.65, 0.85)
super().__init__(config, device) list = CHAT_AREA
self.swipe_vector_range = (0.65, 0.85)
self.list = CHAT_AREA
self.click_coords = self.device.click_methods.get(self.config.Emulator_ControlMethod, self.device.click_adb)
def swipe_page(self, direction: str, main: ModuleBase, vector_range=None, reverse=False): def swipe_page(self, direction: str, vector_range=None, reverse=False):
""" """
Args: Args:
direction: up, down direction: up, down
main:
vector_range (tuple[float, float]): vector_range (tuple[float, float]):
reverse (bool): reverse (bool):
""" """
@@ -58,7 +52,7 @@ class MomoTalkUI(UI):
if reverse: if reverse:
vector = (-vector[0], -vector[1]) vector = (-vector[0], -vector[1])
main.device.swipe_vector(vector, self.list.button) self.device.swipe_vector(vector, self.list.button)
def select_then_disappear(self, dest_enter: ButtonWrapper, dest_check: ButtonWrapper): def select_then_disappear(self, dest_enter: ButtonWrapper, dest_check: ButtonWrapper):
timer = Timer(5, 10).start() timer = Timer(5, 10).start()
@@ -83,24 +77,19 @@ class MomoTalkUI(UI):
return True return True
def click_all(self, template, x_add=0, y_add=0): def click_all(self, template: ButtonWrapper, offset: tuple[int, int] = (0, 0)) -> bool:
""" """
Find the all the locations of the template adding an offset if specified and click them. Find the all the locations of the template adding an offset if specified and click them.
If after filter, no coords then swipe. If after filter, no coords then swipe.
""" """
image = self.device.screenshot() template.load_search(self.list.area)
result = cv2.matchTemplate(image, template, cv2.TM_CCOEFF_NORMED) template.matched_button._button_offset = offset
threshold = 0.8 seen = template.match_multi_template(self.device.image, similarity=0.8)
locations = np.where(result >= threshold)
seen = set()
for pt in zip(*locations[::-1]):
center_pt = (int(pt[0] + template.shape[1] / 2 + x_add), int(pt[1] + template.shape[0] / 2 + y_add))
seen.add(center_pt)
if seen: if seen:
if y_add != 0: if any(offset):
seen = filter(lambda x: point_in_area(x, CHAT_AREA.area), seen) for button in seen:
[self.click_coords(coords[0], coords[1]) for coords in seen] self.device.click(button)
self.swipe_page("down", self) self.swipe_page("down")
return True return True
return False return False
@@ -157,10 +146,10 @@ class MomoTalkUI(UI):
return True return True
elif self.click_all(CHATTING_TEMPLATE): elif self.click_all(CHATTING_TEMPLATE):
timer.reset() timer.reset()
elif self.click_all(REPLY_TEMPLATE, y_add=62): elif self.click_all(REPLY_TEMPLATE, offset=(0, 62)):
logger.info("Clicked on reply") logger.info("Clicked on reply")
timer.reset() timer.reset()
elif self.click_all(STORY_TEMPLATE, y_add=62): elif self.click_all(STORY_TEMPLATE, offset=(0, 62)):
logger.info("Clicked on story") logger.info("Clicked on story")
timer.reset() timer.reset()
elif timer.reached(): elif timer.reached():