1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2026-02-06 21:55:13 +00:00

Compare commits

..

No commits in common. "f7b165f5891e7d8861367756cb84b5ba82c0b449" and "930c741de6e461e3c23578624ff16084f8b2537a" have entirely different histories.

20 changed files with 69 additions and 390 deletions

View File

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -86,29 +86,6 @@
"Count": 2 "Count": 2
} }
}, },
"Scrimmage": {
"Scheduler": {
"Enable": true,
"NextRun": "2020-01-01 00:00:00",
"Command": "Scrimmage",
"ServerUpdate": "04:00"
},
"Scrimmage": {
"OnError": "skip"
},
"Trinity": {
"Stage": 1,
"Count": 2
},
"Gehenna": {
"Stage": 1,
"Count": 2
},
"Millennium": {
"Stage": 1,
"Count": 2
}
},
"TacticalChallenge": { "TacticalChallenge": {
"Scheduler": { "Scheduler": {
"Enable": true, "Enable": true,

View File

@ -357,91 +357,6 @@
} }
} }
}, },
"Scrimmage": {
"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": "Scrimmage",
"display": "hide"
},
"ServerUpdate": {
"type": "input",
"value": "04:00",
"display": "hide"
}
},
"Scrimmage": {
"OnError": {
"type": "select",
"value": "skip",
"option": [
"stop",
"skip"
]
}
},
"Trinity": {
"Stage": {
"type": "select",
"value": 1,
"option": [
1,
2,
3,
4
]
},
"Count": {
"type": "input",
"value": 2
}
},
"Gehenna": {
"Stage": {
"type": "select",
"value": 1,
"option": [
1,
2,
3,
4
]
},
"Count": {
"type": "input",
"value": 2
}
},
"Millennium": {
"Stage": {
"type": "select",
"value": 1,
"option": [
1,
2,
3,
4
]
},
"Count": {
"type": "input",
"value": 2
}
}
},
"TacticalChallenge": { "TacticalChallenge": {
"Scheduler": { "Scheduler": {
"Enable": { "Enable": {

View File

@ -102,27 +102,6 @@ Schoolhouse:
option: [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] option: [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
Count: 2 Count: 2
Scrimmage:
OnError:
value: skip
option: [ stop, skip ]
Trinity:
Stage:
value: 1
option: [ 1, 2, 3, 4 ]
Count: 2
Gehenna:
Stage:
value: 1
option: [ 1, 2, 3, 4 ]
Count: 2
Millennium:
Stage:
value: 1
option: [ 1, 2, 3, 4 ]
Count: 2
TacticalChallenge: TacticalChallenge:
PlayerSelect: PlayerSelect:
value: 0 value: 0

View File

@ -16,9 +16,6 @@ Circle:
Bounty: Bounty:
Scheduler: Scheduler:
Enable: true Enable: true
Scrimmage:
Scheduler:
Enable: true
TacticalChallenge: TacticalChallenge:
Scheduler: Scheduler:
Enable: true Enable: true

View File

@ -15,7 +15,6 @@
"Mail", "Mail",
"Circle", "Circle",
"Bounty", "Bounty",
"Scrimmage",
"TacticalChallenge", "TacticalChallenge",
"DataUpdate" "DataUpdate"
] ]

View File

@ -35,12 +35,6 @@ Daily:
- Highway - Highway
- DesertRailroad - DesertRailroad
- Schoolhouse - Schoolhouse
Scrimmage:
- Scheduler
- Scrimmage
- Trinity
- Gehenna
- Millennium
TacticalChallenge: TacticalChallenge:
- Scheduler - Scheduler
- TacticalChallenge - TacticalChallenge

View File

@ -60,21 +60,6 @@ class GeneratedConfig:
Schoolhouse_Stage = 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9 Schoolhouse_Stage = 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9
Schoolhouse_Count = 2 Schoolhouse_Count = 2
# Group `Scrimmage`
Scrimmage_OnError = 'skip' # stop, skip
# Group `Trinity`
Trinity_Stage = 1 # 1, 2, 3, 4
Trinity_Count = 2
# Group `Gehenna`
Gehenna_Stage = 1 # 1, 2, 3, 4
Gehenna_Count = 2
# Group `Millennium`
Millennium_Stage = 1 # 1, 2, 3, 4
Millennium_Count = 2
# Group `TacticalChallenge` # Group `TacticalChallenge`
TacticalChallenge_PlayerSelect = 0 # 0, 1, 2, 3 TacticalChallenge_PlayerSelect = 0 # 0, 1, 2, 3

View File

@ -34,10 +34,6 @@
"name": "Bounty", "name": "Bounty",
"help": "" "help": ""
}, },
"Scrimmage": {
"name": "Scrimmage",
"help": ""
},
"TacticalChallenge": { "TacticalChallenge": {
"name": "Tactical Challenge", "name": "Tactical Challenge",
"help": "" "help": ""
@ -298,72 +294,6 @@
"help": "Sweep the selected stage for X times" "help": "Sweep the selected stage for X times"
} }
}, },
"Scrimmage": {
"_info": {
"name": "Scrimmage Settings",
"help": ""
},
"OnError": {
"name": "Error Handling",
"help": "Perform the selected action when an error occurs (ticket not enough or any invalid setting)",
"stop": "Stop script",
"skip": "Skip current task"
}
},
"Trinity": {
"_info": {
"name": "Trinity",
"help": ""
},
"Stage": {
"name": "Select Stage",
"help": "",
"1": "01 - Trinity A",
"2": "02 - Trinity B",
"3": "03 - Trinity C",
"4": "04 - Trinity D"
},
"Count": {
"name": "Sweep X times",
"help": "Sweep the selected stage for X times"
}
},
"Gehenna": {
"_info": {
"name": "Gehenna",
"help": ""
},
"Stage": {
"name": "Select Stage",
"help": "",
"1": "01 - Gehenna A",
"2": "02 - Gehenna B",
"3": "03 - Gehenna C",
"4": "04 - Gehenna D"
},
"Count": {
"name": "Sweep X times",
"help": "Sweep the selected stage for X times"
}
},
"Millennium": {
"_info": {
"name": "Millennium",
"help": ""
},
"Stage": {
"name": "Select Stage",
"help": "",
"1": "01 - Millennium A",
"2": "02 - Millennium B",
"3": "03 - Millennium C",
"4": "04 - Millennium D"
},
"Count": {
"name": "Sweep X times",
"help": "Sweep the selected stage for X times"
}
},
"TacticalChallenge": { "TacticalChallenge": {
"_info": { "_info": {
"name": "Tactical Challenge Settings", "name": "Tactical Challenge Settings",

View File

@ -34,10 +34,6 @@
"name": "通缉悬赏", "name": "通缉悬赏",
"help": "" "help": ""
}, },
"Scrimmage": {
"name": "学院交流会",
"help": ""
},
"TacticalChallenge": { "TacticalChallenge": {
"name": "战术对抗赛", "name": "战术对抗赛",
"help": "战术大赛 / 竞技场" "help": "战术大赛 / 竞技场"
@ -298,72 +294,6 @@
"help": "扫荡所选择关卡 X 次" "help": "扫荡所选择关卡 X 次"
} }
}, },
"Scrimmage": {
"_info": {
"name": "学院交流会设置",
"help": ""
},
"OnError": {
"name": "错误处理",
"help": "当出现票券不足或设置有误等错误时,执行该操作",
"stop": "停止脚本运行",
"skip": "跳过当前任务"
}
},
"Trinity": {
"_info": {
"name": "三一",
"help": ""
},
"Stage": {
"name": "选择关卡",
"help": "",
"1": "01 - 三一 A",
"2": "02 - 三一 B",
"3": "03 - 三一 C",
"4": "04 - 三一 D"
},
"Count": {
"name": "扫荡次数",
"help": "扫荡所选择关卡 X 次"
}
},
"Gehenna": {
"_info": {
"name": "格黑娜",
"help": ""
},
"Stage": {
"name": "选择关卡",
"help": "",
"1": "01 - 格黑娜 A",
"2": "02 - 格黑娜 B",
"3": "03 - 格黑娜 C",
"4": "04 - 格黑娜 D"
},
"Count": {
"name": "扫荡次数",
"help": "扫荡所选择关卡 X 次"
}
},
"Millennium": {
"_info": {
"name": "千年",
"help": ""
},
"Stage": {
"name": "选择关卡",
"help": "",
"1": "01 - 千年 A",
"2": "02 - 千年 B",
"3": "03 - 千年 C",
"4": "04 - 千年 D"
},
"Count": {
"name": "扫荡次数",
"help": "扫荡所选择关卡 X 次"
}
},
"TacticalChallenge": { "TacticalChallenge": {
"_info": { "_info": {
"name": "战术对抗赛设置", "name": "战术对抗赛设置",

View File

@ -6,7 +6,7 @@ from module.base.button import Button, ButtonWrapper
CHECK_GEHENNA = ButtonWrapper( CHECK_GEHENNA = ButtonWrapper(
name='CHECK_GEHENNA', name='CHECK_GEHENNA',
jp=Button( jp=Button(
file='./assets/jp/scrimmage/CHECK_GEHENNA.png', file='./assets/jp/school_exchange/CHECK_GEHENNA.png',
area=(109, 149, 195, 177), area=(109, 149, 195, 177),
search=(89, 129, 215, 197), search=(89, 129, 215, 197),
color=(201, 205, 206), color=(201, 205, 206),
@ -17,7 +17,7 @@ CHECK_GEHENNA = ButtonWrapper(
CHECK_MILLENNIUM = ButtonWrapper( CHECK_MILLENNIUM = ButtonWrapper(
name='CHECK_MILLENNIUM', name='CHECK_MILLENNIUM',
jp=Button( jp=Button(
file='./assets/jp/scrimmage/CHECK_MILLENNIUM.png', file='./assets/jp/school_exchange/CHECK_MILLENNIUM.png',
area=(108, 148, 254, 178), area=(108, 148, 254, 178),
search=(88, 128, 274, 198), search=(88, 128, 274, 198),
color=(202, 206, 208), color=(202, 206, 208),
@ -25,21 +25,10 @@ CHECK_MILLENNIUM = ButtonWrapper(
), ),
en=None, en=None,
) )
CHECK_SCRIMMAGE = ButtonWrapper(
name='CHECK_SCRIMMAGE',
jp=Button(
file='./assets/jp/scrimmage/CHECK_SCRIMMAGE.png',
area=(651, 90, 889, 130),
search=(631, 70, 909, 150),
color=(96, 119, 144),
button=(651, 90, 889, 130),
),
en=None,
)
CHECK_TRINITY = ButtonWrapper( CHECK_TRINITY = ButtonWrapper(
name='CHECK_TRINITY', name='CHECK_TRINITY',
jp=Button( jp=Button(
file='./assets/jp/scrimmage/CHECK_TRINITY.png', file='./assets/jp/school_exchange/CHECK_TRINITY.png',
area=(115, 148, 250, 178), area=(115, 148, 250, 178),
search=(95, 128, 270, 198), search=(95, 128, 270, 198),
color=(204, 208, 210), color=(204, 208, 210),
@ -47,21 +36,10 @@ CHECK_TRINITY = ButtonWrapper(
), ),
en=None, en=None,
) )
OCR_TICKET = ButtonWrapper(
name='OCR_TICKET',
jp=Button(
file='./assets/jp/scrimmage/OCR_TICKET.png',
area=(195, 85, 235, 113),
search=(175, 65, 255, 133),
color=(206, 211, 215),
button=(195, 85, 235, 113),
),
en=None,
)
SELECT_GEHENNA = ButtonWrapper( SELECT_GEHENNA = ButtonWrapper(
name='SELECT_GEHENNA', name='SELECT_GEHENNA',
jp=Button( jp=Button(
file='./assets/jp/scrimmage/SELECT_GEHENNA.png', file='./assets/jp/school_exchange/SELECT_GEHENNA.png',
area=(1125, 275, 1224, 310), area=(1125, 275, 1224, 310),
search=(1105, 255, 1244, 330), search=(1105, 255, 1244, 330),
color=(207, 217, 225), color=(207, 217, 225),
@ -72,7 +50,7 @@ SELECT_GEHENNA = ButtonWrapper(
SELECT_MILLENNIUM = ButtonWrapper( SELECT_MILLENNIUM = ButtonWrapper(
name='SELECT_MILLENNIUM', name='SELECT_MILLENNIUM',
jp=Button( jp=Button(
file='./assets/jp/scrimmage/SELECT_MILLENNIUM.png', file='./assets/jp/school_exchange/SELECT_MILLENNIUM.png',
area=(1069, 381, 1217, 417), area=(1069, 381, 1217, 417),
search=(1049, 361, 1237, 437), search=(1049, 361, 1237, 437),
color=(206, 214, 222), color=(206, 214, 222),
@ -83,7 +61,7 @@ SELECT_MILLENNIUM = ButtonWrapper(
SELECT_TRINITY = ButtonWrapper( SELECT_TRINITY = ButtonWrapper(
name='SELECT_TRINITY', name='SELECT_TRINITY',
jp=Button( jp=Button(
file='./assets/jp/scrimmage/SELECT_TRINITY.png', file='./assets/jp/school_exchange/SELECT_TRINITY.png',
area=(1074, 165, 1221, 204), area=(1074, 165, 1221, 204),
search=(1054, 145, 1241, 224), search=(1054, 145, 1241, 224),
color=(213, 221, 228), color=(213, 221, 228),

View File

@ -3,9 +3,15 @@ from enum import Enum
from module.base.timer import Timer from module.base.timer import Timer
from module.logger import logger from module.logger import logger
from module.ocr.ocr import DigitCounter
from module.ui.switch import Switch
from tasks.base.page import page_tactical_challenge from tasks.base.page import page_tactical_challenge
from tasks.base.ui import UI
from tasks.tactical_challenge.assets.assets_tactical_challenge import * from tasks.tactical_challenge.assets.assets_tactical_challenge import *
from tasks.tactical_challenge.ui import TacticalChallengeUI
SWITCH_SKIP = Switch('Skip_switch')
SWITCH_SKIP.add_state('on', SKIP_ON)
SWITCH_SKIP.add_state('off', SKIP_OFF)
class TCStatus(Enum): class TCStatus(Enum):
@ -25,12 +31,50 @@ class TCStatus(Enum):
FINISHED = -1 FINISHED = -1
class TacticalChallenge(TacticalChallengeUI): class TacticalChallenge(UI):
select_players = (PLAYER_SELECT_FIRST, PLAYER_SELECT_SECOND, PLAYER_SELECT_THIRD) select_players = (PLAYER_SELECT_FIRST, PLAYER_SELECT_SECOND, PLAYER_SELECT_THIRD)
@property def _get_ticket(self):
def current_ticket(self): """
return self.config.stored.TacticalChallengeTicket.value Page:
in: page_tactical_challenge
"""
ocr = DigitCounter(OCR_TICKET).ocr_single_line(self.device.image)
# number of tickets remaining
ticket, _, total = ocr
if total == 0:
logger.warning('Invalid ticket')
return False, 5
logger.attr('Ticket', ticket)
return True, ticket
def _get_reward(self):
if self.match_color(GET_REWARD_DAILY):
self.device.click(GET_REWARD_DAILY)
logger.info('Get tc daily reward')
return True
if self.match_color(GET_REWARD_CREDIT):
self.device.click(GET_REWARD_CREDIT)
logger.info('Get tc credit reward')
return True
if self.match_color(GOT_REWARD_DAILY) and self.match_color(GOT_REWARD_CREDIT):
logger.info('Both tc reward got')
return True
return False
def _set_skip(self):
"""
Set skip switch to on
:returns: True if switch is set, False if switch not found
"""
if not SWITCH_SKIP.appear(main=self):
logger.info('Skip switch not found')
return False
SWITCH_SKIP.set('on', main=self)
return True
def _player_select(self, select): def _player_select(self, select):
if select: if select:
@ -41,11 +85,13 @@ class TacticalChallenge(TacticalChallengeUI):
def _handle_challenge(self, status): def _handle_challenge(self, status):
match status: match status:
case TCStatus.REWARD: case TCStatus.REWARD:
if self.get_reward(): if self._get_reward():
return TCStatus.OCR return TCStatus.OCR
case TCStatus.OCR: case TCStatus.OCR:
if self.get_ticket(): is_valid, ticket = self._get_ticket()
if self.current_ticket == 0: if not is_valid:
return status
if ticket == 0:
return TCStatus.FINISHED return TCStatus.FINISHED
return TCStatus.SELECT return TCStatus.SELECT
case TCStatus.SELECT: case TCStatus.SELECT:
@ -57,7 +103,7 @@ class TacticalChallenge(TacticalChallengeUI):
if not self.appear(PREPARE_CHALLENGE): if not self.appear(PREPARE_CHALLENGE):
return TCStatus.SKIP return TCStatus.SKIP
case TCStatus.SKIP: case TCStatus.SKIP:
if not self.set_skip(): if not self._set_skip():
return TCStatus.SKIP return TCStatus.SKIP
return TCStatus.START return TCStatus.START
case TCStatus.START: case TCStatus.START:
@ -72,8 +118,10 @@ class TacticalChallenge(TacticalChallengeUI):
case TCStatus.WIN | TCStatus.LOSE: case TCStatus.WIN | TCStatus.LOSE:
if self.appear_then_click(CHALLENGE_WIN) or self.appear_then_click(CHALLENGE_LOSE): if self.appear_then_click(CHALLENGE_WIN) or self.appear_then_click(CHALLENGE_LOSE):
return status return status
if self.get_ticket(): is_valid, ticket = self._get_ticket()
if self.current_ticket == 0: if not is_valid:
return status
if ticket == 0:
return TCStatus.FINISHED return TCStatus.FINISHED
return TCStatus.FINAL return TCStatus.FINAL
case TCStatus.FINAL | TCStatus.FINISHED: case TCStatus.FINAL | TCStatus.FINISHED:

View File

@ -1,53 +0,0 @@
from module.base.timer import Timer
from module.logger import logger
from module.ocr.ocr import DigitCounter
from module.ui.switch import Switch
from tasks.base.ui import UI
from tasks.tactical_challenge.assets.assets_tactical_challenge import *
SWITCH_SKIP = Switch('Skip_switch')
SWITCH_SKIP.add_state('on', SKIP_ON)
SWITCH_SKIP.add_state('off', SKIP_OFF)
class TacticalChallengeUI(UI):
def get_ticket(self):
"""
Page:
in: page_tactical_challenge
"""
ticket, _, total = DigitCounter(OCR_TICKET).ocr_single_line(self.device.image)
if total == 0:
logger.warning('Invalid ticket')
return False
logger.attr('TacticalChallengeTicket', ticket)
self.config.stored.TacticalChallengeTicket.set(ticket)
return True
def get_reward(self):
timer = Timer(10, 10).start()
while 1:
self.device.screenshot()
if self.match_color(GOT_REWARD_DAILY) and self.match_color(GOT_REWARD_CREDIT):
return True
if self.match_color(GET_REWARD_DAILY):
self.device.click(GET_REWARD_DAILY)
logger.info('Get daily reward')
if self.match_color(GET_REWARD_CREDIT):
self.device.click(GET_REWARD_CREDIT)
logger.info('Get credit reward')
if timer.reached():
return False
def set_skip(self):
"""
Set skip switch to on
Returns:
True if switch is set, False if switch not found
"""
if not SWITCH_SKIP.appear(main=self):
logger.info('Skip switch not found')
return False
SWITCH_SKIP.set('on', main=self)
return True