mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2025-12-16 22:05:12 +00:00
Compare commits
3 Commits
96b5f1db85
...
bea794386c
| Author | SHA1 | Date | |
|---|---|---|---|
| bea794386c | |||
| 57c0ed8531 | |||
| 75e6417620 |
BIN
assets/jp/cafe/CAFE_FIRST.png
Normal file
BIN
assets/jp/cafe/CAFE_FIRST.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
BIN
assets/jp/cafe/CAFE_SECOND.png
Normal file
BIN
assets/jp/cafe/CAFE_SECOND.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
BIN
assets/jp/cafe/CHANGE_CAFE_NOT_SELECTED.png
Normal file
BIN
assets/jp/cafe/CHANGE_CAFE_NOT_SELECTED.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
BIN
assets/jp/cafe/CHANGE_CAFE_SELECTED.png
Normal file
BIN
assets/jp/cafe/CHANGE_CAFE_SELECTED.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
@ -43,7 +43,8 @@
|
|||||||
"Cafe": {
|
"Cafe": {
|
||||||
"Reward": true,
|
"Reward": true,
|
||||||
"Touch": true,
|
"Touch": true,
|
||||||
"AutoAdjust": true
|
"AutoAdjust": true,
|
||||||
|
"SecondCafe": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Mail": {
|
"Mail": {
|
||||||
|
|||||||
@ -128,6 +128,14 @@ class ModuleBase:
|
|||||||
self.device.click(button)
|
self.device.click(button)
|
||||||
return appear
|
return appear
|
||||||
|
|
||||||
|
def click_with_interval(self, button, interval=5):
|
||||||
|
if interval and not self.interval_is_reached(button, interval=interval):
|
||||||
|
return False
|
||||||
|
self.device.click(button)
|
||||||
|
if interval:
|
||||||
|
self.interval_reset(button, interval=interval)
|
||||||
|
return True
|
||||||
|
|
||||||
def wait_until_stable(self, button, timer=Timer(0.3, count=1), timeout=Timer(5, count=10)):
|
def wait_until_stable(self, button, timer=Timer(0.3, count=1), timeout=Timer(5, count=10)):
|
||||||
"""
|
"""
|
||||||
A terrible method, don't rely too much on it.
|
A terrible method, don't rely too much on it.
|
||||||
|
|||||||
@ -194,6 +194,10 @@
|
|||||||
"AutoAdjust": {
|
"AutoAdjust": {
|
||||||
"type": "checkbox",
|
"type": "checkbox",
|
||||||
"value": true
|
"value": true
|
||||||
|
},
|
||||||
|
"SecondCafe": {
|
||||||
|
"type": "checkbox",
|
||||||
|
"value": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -79,6 +79,7 @@ Cafe:
|
|||||||
Reward: true
|
Reward: true
|
||||||
Touch: true
|
Touch: true
|
||||||
AutoAdjust: true
|
AutoAdjust: true
|
||||||
|
SecondCafe: true
|
||||||
|
|
||||||
TacticalChallenge:
|
TacticalChallenge:
|
||||||
PlayerSelect:
|
PlayerSelect:
|
||||||
|
|||||||
@ -43,6 +43,7 @@ class GeneratedConfig:
|
|||||||
Cafe_Reward = True
|
Cafe_Reward = True
|
||||||
Cafe_Touch = True
|
Cafe_Touch = True
|
||||||
Cafe_AutoAdjust = True
|
Cafe_AutoAdjust = True
|
||||||
|
Cafe_SecondCafe = True
|
||||||
|
|
||||||
# Group `TacticalChallenge`
|
# Group `TacticalChallenge`
|
||||||
TacticalChallenge_PlayerSelect = 0 # 0, 1, 2, 3
|
TacticalChallenge_PlayerSelect = 0 # 0, 1, 2, 3
|
||||||
|
|||||||
@ -201,6 +201,10 @@
|
|||||||
"AutoAdjust": {
|
"AutoAdjust": {
|
||||||
"name": "Cafe.AutoAdjust.name",
|
"name": "Cafe.AutoAdjust.name",
|
||||||
"help": "Cafe.AutoAdjust.help"
|
"help": "Cafe.AutoAdjust.help"
|
||||||
|
},
|
||||||
|
"SecondCafe": {
|
||||||
|
"name": "Cafe.SecondCafe.name",
|
||||||
|
"help": "Cafe.SecondCafe.help"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"TacticalChallenge": {
|
"TacticalChallenge": {
|
||||||
|
|||||||
@ -201,6 +201,10 @@
|
|||||||
"AutoAdjust": {
|
"AutoAdjust": {
|
||||||
"name": "自动调整界面",
|
"name": "自动调整界面",
|
||||||
"help": "在进行学生互动点击前对咖啡馆界面进行缩放和位置调整,以增加互动成功率"
|
"help": "在进行学生互动点击前对咖啡馆界面进行缩放和位置调整,以增加互动成功率"
|
||||||
|
},
|
||||||
|
"SecondCafe": {
|
||||||
|
"name": "第二咖啡厅",
|
||||||
|
"help": "自动切换第二咖啡厅进行互动点击"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"TacticalChallenge": {
|
"TacticalChallenge": {
|
||||||
|
|||||||
@ -13,6 +13,46 @@ BOX_CAFE = ButtonWrapper(
|
|||||||
button=(33, 130, 1247, 569),
|
button=(33, 130, 1247, 569),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
CAFE_FIRST = ButtonWrapper(
|
||||||
|
name='CAFE_FIRST',
|
||||||
|
jp=Button(
|
||||||
|
file='./assets/jp/cafe/CAFE_FIRST.png',
|
||||||
|
area=(82, 152, 136, 175),
|
||||||
|
search=(62, 132, 156, 195),
|
||||||
|
color=(111, 127, 147),
|
||||||
|
button=(82, 152, 136, 175),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
CAFE_SECOND = ButtonWrapper(
|
||||||
|
name='CAFE_SECOND',
|
||||||
|
jp=Button(
|
||||||
|
file='./assets/jp/cafe/CAFE_SECOND.png',
|
||||||
|
area=(219, 152, 279, 175),
|
||||||
|
search=(199, 132, 299, 195),
|
||||||
|
color=(110, 126, 146),
|
||||||
|
button=(219, 152, 279, 175),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
CHANGE_CAFE_NOT_SELECTED = ButtonWrapper(
|
||||||
|
name='CHANGE_CAFE_NOT_SELECTED',
|
||||||
|
jp=Button(
|
||||||
|
file='./assets/jp/cafe/CHANGE_CAFE_NOT_SELECTED.png',
|
||||||
|
area=(84, 89, 178, 109),
|
||||||
|
search=(64, 69, 198, 129),
|
||||||
|
color=(185, 193, 203),
|
||||||
|
button=(84, 89, 178, 109),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
CHANGE_CAFE_SELECTED = ButtonWrapper(
|
||||||
|
name='CHANGE_CAFE_SELECTED',
|
||||||
|
jp=Button(
|
||||||
|
file='./assets/jp/cafe/CHANGE_CAFE_SELECTED.png',
|
||||||
|
area=(40, 87, 191, 112),
|
||||||
|
search=(20, 67, 211, 132),
|
||||||
|
color=(82, 105, 130),
|
||||||
|
button=(40, 87, 191, 112),
|
||||||
|
),
|
||||||
|
)
|
||||||
CHECK_REWARD = ButtonWrapper(
|
CHECK_REWARD = ButtonWrapper(
|
||||||
name='CHECK_REWARD',
|
name='CHECK_REWARD',
|
||||||
jp=Button(
|
jp=Button(
|
||||||
@ -47,20 +87,20 @@ GET_REWARD_CLOSE = ButtonWrapper(
|
|||||||
name='GET_REWARD_CLOSE',
|
name='GET_REWARD_CLOSE',
|
||||||
jp=Button(
|
jp=Button(
|
||||||
file='./assets/jp/cafe/GET_REWARD_CLOSE.png',
|
file='./assets/jp/cafe/GET_REWARD_CLOSE.png',
|
||||||
area=(891, 144, 917, 170),
|
area=(970, 134, 996, 160),
|
||||||
search=(871, 124, 937, 190),
|
search=(950, 114, 1016, 180),
|
||||||
color=(173, 179, 189),
|
color=(172, 179, 188),
|
||||||
button=(891, 144, 917, 170),
|
button=(970, 134, 996, 160),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
GOT_REWARD = ButtonWrapper(
|
GOT_REWARD = ButtonWrapper(
|
||||||
name='GOT_REWARD',
|
name='GOT_REWARD',
|
||||||
jp=Button(
|
jp=Button(
|
||||||
file='./assets/jp/cafe/GOT_REWARD.png',
|
file='./assets/jp/cafe/GOT_REWARD.png',
|
||||||
area=(609, 507, 672, 535),
|
area=(561, 501, 718, 556),
|
||||||
search=(589, 487, 692, 555),
|
search=(541, 481, 738, 576),
|
||||||
color=(174, 175, 174),
|
color=(209, 210, 209),
|
||||||
button=(609, 507, 672, 535),
|
button=(561, 501, 718, 556),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
OCR_CAFE = ButtonWrapper(
|
OCR_CAFE = ButtonWrapper(
|
||||||
|
|||||||
@ -7,11 +7,21 @@ from module.base.timer import Timer
|
|||||||
from module.base.button import ClickButton
|
from module.base.button import ClickButton
|
||||||
from module.base.utils.utils import area_offset
|
from module.base.utils.utils import area_offset
|
||||||
from module.ocr.ocr import Digit
|
from module.ocr.ocr import Digit
|
||||||
|
from module.ui.switch import Switch
|
||||||
from tasks.base.page import page_cafe
|
from tasks.base.page import page_cafe
|
||||||
from tasks.base.ui import UI
|
from tasks.base.ui import UI
|
||||||
from tasks.cafe.assets.assets_cafe import *
|
from tasks.cafe.assets.assets_cafe import *
|
||||||
|
|
||||||
|
|
||||||
|
SWITCH_CAFE = Switch('Cafe_switch')
|
||||||
|
SWITCH_CAFE.add_state('off', CHANGE_CAFE_NOT_SELECTED)
|
||||||
|
SWITCH_CAFE.add_state('on', CHANGE_CAFE_SELECTED)
|
||||||
|
|
||||||
|
SWITCH_CAFE_SELECT = Switch('Cafe_switch_select')
|
||||||
|
SWITCH_CAFE_SELECT.add_state('1', CAFE_FIRST)
|
||||||
|
SWITCH_CAFE_SELECT.add_state('2', CAFE_SECOND)
|
||||||
|
|
||||||
|
|
||||||
class CafeStatus(Enum):
|
class CafeStatus(Enum):
|
||||||
STUDENT_LIST = 0
|
STUDENT_LIST = 0
|
||||||
OCR = 1
|
OCR = 1
|
||||||
@ -133,7 +143,8 @@ class Cafe(UI):
|
|||||||
case CafeStatus.GOT:
|
case CafeStatus.GOT:
|
||||||
logger.info('Cafe reward have been got')
|
logger.info('Cafe reward have been got')
|
||||||
self.appear_then_click(GET_REWARD_CLOSE)
|
self.appear_then_click(GET_REWARD_CLOSE)
|
||||||
return CafeStatus.CLICK
|
if not self.appear(GET_REWARD_CLOSE):
|
||||||
|
return CafeStatus.CLICK
|
||||||
case CafeStatus.CLICK:
|
case CafeStatus.CLICK:
|
||||||
buttons = self._get_clickable_buttons(offset=(45, 10))
|
buttons = self._get_clickable_buttons(offset=(45, 10))
|
||||||
self.click = len(buttons)
|
self.click = len(buttons)
|
||||||
@ -176,6 +187,7 @@ class Cafe(UI):
|
|||||||
is_reward_on = self.config.Cafe_Reward
|
is_reward_on = self.config.Cafe_Reward
|
||||||
is_touch_on = self.config.Cafe_Touch
|
is_touch_on = self.config.Cafe_Touch
|
||||||
self.is_adjust_on = self.config.Cafe_AutoAdjust
|
self.is_adjust_on = self.config.Cafe_AutoAdjust
|
||||||
|
is_second_cafe_on = self.config.Cafe_SecondCafe
|
||||||
|
|
||||||
self.ui_ensure(page_cafe)
|
self.ui_ensure(page_cafe)
|
||||||
|
|
||||||
@ -185,20 +197,45 @@ class Cafe(UI):
|
|||||||
check_timer = Timer(1, count=1)
|
check_timer = Timer(1, count=1)
|
||||||
is_list = False
|
is_list = False
|
||||||
is_reset = False
|
is_reset = False
|
||||||
|
is_second = False
|
||||||
is_enable = is_reward_on or is_touch_on
|
is_enable = is_reward_on or is_touch_on
|
||||||
|
|
||||||
while is_enable:
|
while 1:
|
||||||
|
if not is_enable:
|
||||||
|
break
|
||||||
|
|
||||||
self.device.screenshot()
|
self.device.screenshot()
|
||||||
|
|
||||||
if self.ui_additional():
|
if self.ui_additional():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if is_second_cafe_on and not is_second and status == CafeStatus.FINISHED:
|
||||||
|
if not SWITCH_CAFE.appear(main=self):
|
||||||
|
logger.warning('Cafe switch not found')
|
||||||
|
continue
|
||||||
|
if SWITCH_CAFE.get(main=self) == 'off':
|
||||||
|
SWITCH_CAFE.set('on', main=self)
|
||||||
|
logger.info('Switching to second cafe')
|
||||||
|
if not SWITCH_CAFE_SELECT.appear(main=self):
|
||||||
|
logger.info('Cafe switch select not found')
|
||||||
|
continue
|
||||||
|
match (SWITCH_CAFE_SELECT.get(main=self)):
|
||||||
|
case '1':
|
||||||
|
if self.click_with_interval(CAFE_SECOND):
|
||||||
|
continue
|
||||||
|
case '2':
|
||||||
|
logger.info('Cafe second arrived')
|
||||||
|
status = CafeStatus.STUDENT_LIST
|
||||||
|
is_list = False
|
||||||
|
is_second = True
|
||||||
|
self.check = 0
|
||||||
|
|
||||||
if not loading_timer.reached():
|
if not loading_timer.reached():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not is_list and status == CafeStatus.STUDENT_LIST and self.appear(STUDENT_LIST):
|
if not is_list and status == CafeStatus.STUDENT_LIST and self.appear(STUDENT_LIST):
|
||||||
is_list = True
|
is_list = True
|
||||||
loading_timer = Timer(5).start()
|
loading_timer = Timer(4).start()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not is_reward_on and status == CafeStatus.OCR:
|
if not is_reward_on and status == CafeStatus.OCR:
|
||||||
@ -223,7 +260,11 @@ class Cafe(UI):
|
|||||||
status = self._handle_cafe(status)
|
status = self._handle_cafe(status)
|
||||||
logger.attr('Status', status)
|
logger.attr('Status', status)
|
||||||
|
|
||||||
if status is CafeStatus.FINISHED:
|
if not is_second_cafe_on:
|
||||||
break
|
if status is CafeStatus.FINISHED:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
if is_second and status is CafeStatus.FINISHED:
|
||||||
|
break
|
||||||
|
|
||||||
self.config.task_delay(server_update=True, minute=180)
|
self.config.task_delay(server_update=True, minute=180)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user