1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2025-12-16 22:05:12 +00:00

feat: tasks

Added module tasks for EN
This commit is contained in:
RedDeadDepresso 2023-12-16 23:46:31 +00:00
parent 0f6dd93608
commit 991831a9c6
19 changed files with 160 additions and 1 deletions

4
aas.py
View File

@ -46,6 +46,10 @@ class ArisuAutoSweeper(AzurLaneAutoScript):
from tasks.tactical_challenge.tactical_challenge import TacticalChallenge from tasks.tactical_challenge.tactical_challenge import TacticalChallenge
TacticalChallenge(config=self.config, device=self.device).run() TacticalChallenge(config=self.config, device=self.device).run()
def task(self):
from tasks.task.task import Task
Task(config=self.config, device=self.device).run()
def data_update(self): def data_update(self):
from tasks.item.data_update import DataUpdate from tasks.item.data_update import DataUpdate
DataUpdate(config=self.config, device=self.device).run() DataUpdate(config=self.config, device=self.device).run()

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

BIN
assets/en/task/CLAIM.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
assets/en/task/CLAIMED.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@ -127,6 +127,14 @@
"PlayerSelect": 0 "PlayerSelect": 0
} }
}, },
"Task": {
"Scheduler": {
"Enable": false,
"NextRun": "2020-01-01 00:00:00",
"Command": "Task",
"ServerUpdate": "04:00"
}
},
"DataUpdate": { "DataUpdate": {
"Scheduler": { "Scheduler": {
"Enable": true, "Enable": true,

View File

@ -523,6 +523,33 @@
} }
} }
}, },
"Task": {
"Scheduler": {
"Enable": {
"type": "checkbox",
"value": false,
"option": [
true,
false
]
},
"NextRun": {
"type": "datetime",
"value": "2020-01-01 00:00:00",
"validate": "datetime"
},
"Command": {
"type": "input",
"value": "Task",
"display": "hide"
},
"ServerUpdate": {
"type": "input",
"value": "04:00",
"display": "hide"
}
}
},
"DataUpdate": { "DataUpdate": {
"Scheduler": { "Scheduler": {
"Enable": { "Enable": {

View File

@ -17,6 +17,7 @@
"Bounty", "Bounty",
"Scrimmage", "Scrimmage",
"TacticalChallenge", "TacticalChallenge",
"Task",
"DataUpdate" "DataUpdate"
] ]
} }

View File

@ -45,6 +45,8 @@ Daily:
TacticalChallenge: TacticalChallenge:
- Scheduler - Scheduler
- TacticalChallenge - TacticalChallenge
Task:
- Scheduler
DataUpdate: DataUpdate:
- Scheduler - Scheduler
- ItemStorage - ItemStorage

View File

@ -9,7 +9,7 @@ class ManualConfig:
SCHEDULER_PRIORITY = """ SCHEDULER_PRIORITY = """
Restart Restart
> Cafe > Circle > Mail > DataUpdate > Bounty > Cafe > Circle > Mail > DataUpdate > Bounty
> Scrimmage > TacticalChallenge > Scrimmage > TacticalChallenge > Task
""" """
""" """

View File

@ -42,6 +42,10 @@
"name": "Tactical Challenge", "name": "Tactical Challenge",
"help": "" "help": ""
}, },
"Task": {
"name": "Tasks",
"help": ""
},
"DataUpdate": { "DataUpdate": {
"name": "Dashboard Upd", "name": "Dashboard Upd",
"help": "" "help": ""

View File

@ -42,6 +42,10 @@
"name": "战术对抗赛", "name": "战术对抗赛",
"help": "战术大赛 / 竞技场" "help": "战术大赛 / 竞技场"
}, },
"Task": {
"name": "Task.Task.name",
"help": "Task.Task.help"
},
"DataUpdate": { "DataUpdate": {
"name": "仪表盘更新", "name": "仪表盘更新",
"help": "" "help": ""

View File

@ -1,6 +1,10 @@
from module.config.stored.classes import ( from module.config.stored.classes import (
StoredAP, StoredAP,
StoredBase,
StoredBountyTicket, StoredBountyTicket,
StoredCounter,
StoredExpiredAt0400,
StoredExpiredAtMonday0400,
StoredInt, StoredInt,
StoredScrimmageTicket, StoredScrimmageTicket,
StoredTacticalChallengeTicket, StoredTacticalChallengeTicket,

View File

@ -0,0 +1,49 @@
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 ```
CLAIM = ButtonWrapper(
name='CLAIM',
jp=None,
en=Button(
file='./assets/en/task/CLAIM.png',
area=(941, 656, 1009, 684),
search=(921, 636, 1029, 704),
color=(213, 190, 58),
button=(935, 639, 1015, 698),
),
)
CLAIMED = ButtonWrapper(
name='CLAIMED',
jp=None,
en=Button(
file='./assets/en/task/CLAIMED.png',
area=(941, 653, 1007, 682),
search=(921, 633, 1027, 702),
color=(205, 205, 204),
button=(936, 643, 1012, 698),
),
)
CLAIMED_ALL = ButtonWrapper(
name='CLAIMED_ALL',
jp=None,
en=Button(
file='./assets/en/task/CLAIMED_ALL.png',
area=(1088, 650, 1215, 687),
search=(1068, 630, 1235, 707),
color=(181, 182, 185),
button=(1052, 644, 1250, 700),
),
)
CLAIM_ALL = ButtonWrapper(
name='CLAIM_ALL',
jp=None,
en=Button(
file='./assets/en/task/CLAIM_ALL.png',
area=(1086, 652, 1216, 685),
search=(1066, 632, 1236, 705),
color=(215, 198, 64),
button=(1054, 642, 1243, 700),
),
)

56
tasks/task/task.py Normal file
View File

@ -0,0 +1,56 @@
from enum import Enum
from module.base.timer import Timer
from module.logger import logger
from tasks.base.page import page_task
from tasks.base.ui import UI
from tasks.task.assets.assets_task import *
class TaskStatus(Enum):
"""
Task status
"""
CLAIM_ALL = 0
CLAIM = 1
FINISHED = -1
class Task(UI):
def _handle_task(self, status):
match status:
case TaskStatus.CLAIM_ALL:
if self.match_color(CLAIM_ALL):
self.device.click(CLAIM_ALL)
logger.info("Click Claim All")
else:
return TaskStatus.CLAIM
case TaskStatus.CLAIM:
if self.match_color(CLAIM):
self.device.click(CLAIM)
logger.info("Click Claim")
else:
return TaskStatus.FINISHED
case _:
logger.warning(f"Invalid status: {status}")
return status
def run(self):
self.ui_ensure(page_task)
status = TaskStatus.CLAIM_ALL
action_timer = Timer(0.5)
while 1:
self.device.screenshot()
if self.ui_additional():
continue
if action_timer.reached_and_reset():
logger.attr('Status', status)
status = self._handle_task(status)
if status is TaskStatus.FINISHED:
break
self.config.task_delay(server_update=True)