mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2026-01-06 07:45:12 +00:00
Compare commits
3 Commits
15bf77da3d
...
f92dba92c9
| Author | SHA1 | Date | |
|---|---|---|---|
| f92dba92c9 | |||
| 86ce04cff9 | |||
| f2065507c2 |
@ -47,14 +47,6 @@
|
|||||||
"SecondCafe": true
|
"SecondCafe": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Mail": {
|
|
||||||
"Scheduler": {
|
|
||||||
"Enable": true,
|
|
||||||
"NextRun": "2020-01-01 00:00:00",
|
|
||||||
"Command": "Mail",
|
|
||||||
"ServerUpdate": "04:00"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Circle": {
|
"Circle": {
|
||||||
"Scheduler": {
|
"Scheduler": {
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
@ -63,6 +55,14 @@
|
|||||||
"ServerUpdate": "04:00"
|
"ServerUpdate": "04:00"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Mail": {
|
||||||
|
"Scheduler": {
|
||||||
|
"Enable": true,
|
||||||
|
"NextRun": "2020-01-01 00:00:00",
|
||||||
|
"Command": "Mail",
|
||||||
|
"ServerUpdate": "04:00"
|
||||||
|
}
|
||||||
|
},
|
||||||
"Bounty": {
|
"Bounty": {
|
||||||
"Scheduler": {
|
"Scheduler": {
|
||||||
"Enable": true,
|
"Enable": true,
|
||||||
|
|||||||
@ -207,33 +207,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Mail": {
|
|
||||||
"Scheduler": {
|
|
||||||
"Enable": {
|
|
||||||
"type": "checkbox",
|
|
||||||
"value": true,
|
|
||||||
"option": [
|
|
||||||
true,
|
|
||||||
false
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"NextRun": {
|
|
||||||
"type": "datetime",
|
|
||||||
"value": "2020-01-01 00:00:00",
|
|
||||||
"validate": "datetime"
|
|
||||||
},
|
|
||||||
"Command": {
|
|
||||||
"type": "input",
|
|
||||||
"value": "Mail",
|
|
||||||
"display": "hide"
|
|
||||||
},
|
|
||||||
"ServerUpdate": {
|
|
||||||
"type": "input",
|
|
||||||
"value": "04:00",
|
|
||||||
"display": "hide"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Circle": {
|
"Circle": {
|
||||||
"Scheduler": {
|
"Scheduler": {
|
||||||
"Enable": {
|
"Enable": {
|
||||||
@ -261,6 +234,33 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Mail": {
|
||||||
|
"Scheduler": {
|
||||||
|
"Enable": {
|
||||||
|
"type": "checkbox",
|
||||||
|
"value": true,
|
||||||
|
"option": [
|
||||||
|
true,
|
||||||
|
false
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"NextRun": {
|
||||||
|
"type": "datetime",
|
||||||
|
"value": "2020-01-01 00:00:00",
|
||||||
|
"validate": "datetime"
|
||||||
|
},
|
||||||
|
"Command": {
|
||||||
|
"type": "input",
|
||||||
|
"value": "Mail",
|
||||||
|
"display": "hide"
|
||||||
|
},
|
||||||
|
"ServerUpdate": {
|
||||||
|
"type": "input",
|
||||||
|
"value": "04:00",
|
||||||
|
"display": "hide"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Bounty": {
|
"Bounty": {
|
||||||
"Scheduler": {
|
"Scheduler": {
|
||||||
"Enable": {
|
"Enable": {
|
||||||
|
|||||||
@ -12,8 +12,8 @@
|
|||||||
"page": "setting",
|
"page": "setting",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
"Cafe",
|
"Cafe",
|
||||||
"Mail",
|
|
||||||
"Circle",
|
"Circle",
|
||||||
|
"Mail",
|
||||||
"Bounty",
|
"Bounty",
|
||||||
"Scrimmage",
|
"Scrimmage",
|
||||||
"TacticalChallenge",
|
"TacticalChallenge",
|
||||||
|
|||||||
@ -25,10 +25,10 @@ Daily:
|
|||||||
Cafe:
|
Cafe:
|
||||||
- Scheduler
|
- Scheduler
|
||||||
- Cafe
|
- Cafe
|
||||||
Mail:
|
|
||||||
- Scheduler
|
|
||||||
Circle:
|
Circle:
|
||||||
- Scheduler
|
- Scheduler
|
||||||
|
Mail:
|
||||||
|
- Scheduler
|
||||||
Bounty:
|
Bounty:
|
||||||
- Scheduler
|
- Scheduler
|
||||||
- Bounty
|
- Bounty
|
||||||
|
|||||||
@ -22,14 +22,14 @@
|
|||||||
"name": "Cafe",
|
"name": "Cafe",
|
||||||
"help": ""
|
"help": ""
|
||||||
},
|
},
|
||||||
"Mail": {
|
|
||||||
"name": "Mailbox",
|
|
||||||
"help": ""
|
|
||||||
},
|
|
||||||
"Circle": {
|
"Circle": {
|
||||||
"name": "Club",
|
"name": "Club",
|
||||||
"help": ""
|
"help": ""
|
||||||
},
|
},
|
||||||
|
"Mail": {
|
||||||
|
"name": "Mailbox",
|
||||||
|
"help": ""
|
||||||
|
},
|
||||||
"Bounty": {
|
"Bounty": {
|
||||||
"name": "Bounty",
|
"name": "Bounty",
|
||||||
"help": ""
|
"help": ""
|
||||||
|
|||||||
@ -22,14 +22,14 @@
|
|||||||
"name": "咖啡厅",
|
"name": "咖啡厅",
|
||||||
"help": ""
|
"help": ""
|
||||||
},
|
},
|
||||||
"Mail": {
|
|
||||||
"name": "邮箱",
|
|
||||||
"help": ""
|
|
||||||
},
|
|
||||||
"Circle": {
|
"Circle": {
|
||||||
"name": "公会",
|
"name": "公会",
|
||||||
"help": "社团 / 小组"
|
"help": "社团 / 小组"
|
||||||
},
|
},
|
||||||
|
"Mail": {
|
||||||
|
"name": "邮箱",
|
||||||
|
"help": ""
|
||||||
|
},
|
||||||
"Bounty": {
|
"Bounty": {
|
||||||
"name": "悬赏通缉",
|
"name": "悬赏通缉",
|
||||||
"help": ""
|
"help": ""
|
||||||
|
|||||||
@ -4,14 +4,14 @@ import numpy as np
|
|||||||
from module.base.base import ModuleBase
|
from module.base.base import ModuleBase
|
||||||
from module.base.button import ClickButton, match_template
|
from module.base.button import ClickButton, match_template
|
||||||
from module.base.timer import Timer
|
from module.base.timer import Timer
|
||||||
from module.base.utils import area_pad, area_size, area_offset, random_rectangle_vector_opted
|
from module.base.utils import area_pad, area_size, area_offset
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
from module.ocr.ocr import Ocr
|
from module.ocr.ocr import Ocr
|
||||||
from tasks.stage.assets.assets_stage_list import *
|
from tasks.stage.assets.assets_stage_list import *
|
||||||
|
|
||||||
|
|
||||||
class StageList:
|
class StageList:
|
||||||
drag_vector_range = (0.65, 0.85)
|
swipe_vector_range = (0.65, 0.85)
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@ -21,7 +21,7 @@ class StageList:
|
|||||||
button_item: ButtonWrapper = None,
|
button_item: ButtonWrapper = None,
|
||||||
button_enter: ButtonWrapper = None,
|
button_enter: ButtonWrapper = None,
|
||||||
button_stars: ButtonWrapper = None,
|
button_stars: ButtonWrapper = None,
|
||||||
drag_direction: str = "down"
|
swipe_direction: str = "down"
|
||||||
):
|
):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.stage = button_list if button_list else STAGE_LIST
|
self.stage = button_list if button_list else STAGE_LIST
|
||||||
@ -29,7 +29,7 @@ class StageList:
|
|||||||
self.stage_item = (button_item if button_item else STAGE_ITEM).button
|
self.stage_item = (button_item if button_item else STAGE_ITEM).button
|
||||||
self.enter = button_enter if button_enter else STAGE_ENTER
|
self.enter = button_enter if button_enter else STAGE_ENTER
|
||||||
self.sweepable = button_stars if button_stars else STAGE_STARS
|
self.sweepable = button_stars if button_stars else STAGE_STARS
|
||||||
self.drag_direction = drag_direction
|
self.swipe_direction = swipe_direction
|
||||||
|
|
||||||
self.current_index_min = 1
|
self.current_index_min = 1
|
||||||
self.current_index_max = 1
|
self.current_index_max = 1
|
||||||
@ -63,7 +63,7 @@ class StageList:
|
|||||||
self.current_index_max = max(indexes)
|
self.current_index_max = max(indexes)
|
||||||
logger.attr(self.index_ocr.name, f'Index range: {self.current_index_min} - {self.current_index_max}')
|
logger.attr(self.index_ocr.name, f'Index range: {self.current_index_min} - {self.current_index_max}')
|
||||||
|
|
||||||
def drag_page(self, direction: str, main: ModuleBase, vector_range=None, reverse=False):
|
def swipe_page(self, direction: str, main: ModuleBase, vector_range=None, reverse=False):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
direction: up, down
|
direction: up, down
|
||||||
@ -72,7 +72,7 @@ class StageList:
|
|||||||
reverse (bool):
|
reverse (bool):
|
||||||
"""
|
"""
|
||||||
if vector_range is None:
|
if vector_range is None:
|
||||||
vector_range = self.drag_vector_range
|
vector_range = self.swipe_vector_range
|
||||||
vector = np.random.uniform(*vector_range)
|
vector = np.random.uniform(*vector_range)
|
||||||
width, height = area_size(self.stage.button)
|
width, height = area_size(self.stage.button)
|
||||||
if direction == 'up':
|
if direction == 'up':
|
||||||
@ -80,13 +80,12 @@ class StageList:
|
|||||||
elif direction == 'down':
|
elif direction == 'down':
|
||||||
vector = (0, -vector * height)
|
vector = (0, -vector * height)
|
||||||
else:
|
else:
|
||||||
logger.warning(f'Unknown drag direction: {direction}')
|
logger.warning(f'Unknown swipe direction: {direction}')
|
||||||
return
|
return
|
||||||
|
|
||||||
if reverse:
|
if reverse:
|
||||||
vector = (-vector[0], -vector[1])
|
vector = (-vector[0], -vector[1])
|
||||||
p1, p2 = random_rectangle_vector_opted(vector, box=self.stage.button)
|
main.device.swipe_vector(vector, self.stage.button, name=f'{self.name}_SWIPE')
|
||||||
main.device.drag(p1, p2, name=f'{self.name}_DRAG')
|
|
||||||
|
|
||||||
def insight_index(self, index: int, main: ModuleBase, skip_first_screenshot=True) -> bool:
|
def insight_index(self, index: int, main: ModuleBase, skip_first_screenshot=True) -> bool:
|
||||||
"""
|
"""
|
||||||
@ -113,9 +112,9 @@ class StageList:
|
|||||||
break
|
break
|
||||||
|
|
||||||
if index < self.current_index_min:
|
if index < self.current_index_min:
|
||||||
self.drag_page(self.drag_direction, main, reverse=True)
|
self.swipe_page(self.swipe_direction, main, reverse=True)
|
||||||
elif index > self.current_index_max:
|
elif index > self.current_index_max:
|
||||||
self.drag_page(self.drag_direction, main)
|
self.swipe_page(self.swipe_direction, main)
|
||||||
|
|
||||||
main.wait_until_stable(
|
main.wait_until_stable(
|
||||||
self.stage.button,
|
self.stage.button,
|
||||||
|
|||||||
@ -204,7 +204,7 @@ class StageSweep:
|
|||||||
if not self.set_mode(mode, num):
|
if not self.set_mode(mode, num):
|
||||||
return False
|
return False
|
||||||
timer = Timer(0.5, 1)
|
timer = Timer(0.5, 1)
|
||||||
timer_stable = Timer(0.5, 1).start()
|
timer_stable = Timer(1, 1).start()
|
||||||
status = SweepStatus.SELECT
|
status = SweepStatus.SELECT
|
||||||
while 1:
|
while 1:
|
||||||
if not timer_stable.reached():
|
if not timer_stable.reached():
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user