Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pur1fying committed Jan 17, 2024
1 parent 097d4e3 commit 14aa319
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 257 deletions.
123 changes: 87 additions & 36 deletions module/clear_special_task_power.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
from core import color, image, picture
from gui.util import log

x = {
'request-select': (658, 141, 935, 186),
'level-list': (887, 98, 979, 123),
'task-info': (578, 124, 702, 153),
}


def implement(self):
self.quick_method_to_main_page()
Expand All @@ -28,69 +22,126 @@ def implement(self):
just_do_task = False

for i in range(0, 2):
if just_do_task:
self.quick_method_to_main_page()
if count[i] == "max" or count[i] > 0:
self.logger.info("Start commissions task: " + commissions_name[i] + " count : " + str(count[i]))
if just_do_task:
to_request_select(self, True)
self.quick_method_to_main_page()
just_do_task = True
to_commissions(self, i + 1, skip_first_screenshot=True)
res = commissions_common_operation(self, i + 1, count[i])
self.logger.info("Finish commissions task: " + commissions_name[i])
if res == "sweep_complete" or res == "skip_sweep_complete":
if res == "sweep_complete":
self.commissions_status[i] = True
if count[i] == "max":
return True
elif res == "purchase_ap_notice":
elif res == "inadequate_ap":
self.logger.warning("INADEQUATE AP")
return True
elif res == "0SWEEPABLE":
self.logger.warning("0 SWEEPABLE COMMISSIONS")
self.logger.info("COMMISSIONS STATUS: " + str(self.commissions_status))
return True


def start_sweep(self, skip_first_screenshot=False):

img_ends = [
"purchase_ap_notice",
"puechase_ap_notice",
"normal_task_start-sweep-notice",
]
img_possibles = {"special_task_task-info": (941, 411)}
res = picture.co_detect(self, None,None, img_ends, img_possibles, skip_first_screenshot)
if res == "purchase_ap_notice":
if res == "purchase_ap_notice" or res == "buy_ap_notice":
return "inadequate_ap"
rgb_ends = [
"skip_sweep_complete",
"sweep_complete"
]
rgb_possibles = {"start_sweep_notice": (765, 501)}
img_ends = [
"normal_task_skip-sweep-complete",
"normal_task_sweep-complete",
]
img_possibles = {"normal_task_start-sweep-notice": (765, 501)}
picture.co_detect(self, None,None, img_ends, img_possibles, skip_first_screenshot)
picture.co_detect(self, rgb_ends, rgb_possibles, img_ends, img_possibles, skip_first_screenshot)
return "sweep_complete"


def to_commissions(self, num, skip_first_screenshot=False):
commissions_y = {
'CN': [0, 277, 406],
'Global': [0, 206, 309],
'JP': [0, 206, 309]
}
select_commissions_y = {
'CN': 581,
'Global': 515,
'JP': 515
}
rgb_ends = "commissions"
rgb_possibles = {
"main_page":(1198, 580),
"campaign":(746, select_commissions_y[self.server]),
"choose_commissions":(992, commissions_y[self.server][num]),
"reward_acquired":(640, 116),
"mission_info":(1129, 142),
"start_sweep_notice":(886, 164),
"skip_sweep_complete":(649, 508),
}
img_ends = 'special_task_level-list'
img_possibles = {
"main_page_home-feature": (1198, 580),
"main_page_bus": (724, select_commissions_y[self.server]),
"special_task_request-select": (992, commissions_y[self.server][num]),
"special_task_task-info": (1085, 141),
}
picture.co_detect(self, rgb_ends, rgb_possibles, img_ends, img_possibles, skip_first_screenshot)


def one_detect(self,a,b):
i = 675
line = self.latest_img_array[:, 1076, :]
los = []
while i > 196:
if 131 <= line[i][2] <= 151 and 218 <= line[i][1] <= 238 and 245 <= line[i][0] <= 255 and \
131 <= line[i - 30][2] <= 151 and 218 <= line[i - 30][1] <= 238 and 245 <= line[i - 30][0] <= 255:
los.append(i - 35)
i -= 100
else:
i -= 1
for i in range(0, len(los)):
rgb_possibles = {"commissions":(1118, los[i])}
rgb_ends = "mission_info"
img_possibles = {"special_task_level-list": (1118, los[i])}
img_ends = "special_task_task-info"
picture.co_detect(self, rgb_ends, rgb_possibles, img_ends, img_possibles, skip_first_screenshot=True)
t = color.check_sweep_availability(self.latest_img_array, server=self.server)
if t == "sss":
if b == "max":
self.click(1085, 300, duration=1, wait_over=True)
else:
if b > 1:
duration = 0
if b > 4:
duration = 1
self.click(1014, 300, count=b - 1, duration=duration, wait_over=True)
return start_sweep(self, skip_first_screenshot=True)
elif t == "no-pass" or t == "pass":
to_commissions(self, a, skip_first_screenshot=True)

return "0SWEEPABLE"


def commissions_common_operation(self, a, b):
res = one_detect(self, a, b)
res = one_detect(self,a,b)
if res != "0SWEEPABLE":
return res
self.swipe(926, 140, 926, 640, duration=1)
time.sleep(1)
self.latest_img_array = self.get_screenshot_array()
res = one_detect(self,a,b)
if res != "0SWEEPABLE":
return res
self.swipe(926, 188, 926, 381, duration=1)
time.sleep(1)
self.latest_img_array = self.get_screenshot_array()
return one_detect(self,a,b)


def to_request_select(self, skip_first_screenshot=False):
task_info_cross_x = {
'CN': 1085,
'JP': 1129,
'Global': 1129
}
img_ends = "special_task_request-select"
img_possibles = {
'special_task_level-list': (57, 41),
"normal_task_sweep-complete": (643, 585),
"normal_task_skip-sweep-complete": (643, 471),
"special_task_task-info": (task_info_cross_x[self.server], 141),
"main_page_home-feature": (1198, 580),
"main_page_bus": (731, 431),
}
rgb_possibles = {"main_page": (1198, 580)}
picture.co_detect(self, None, rgb_possibles, img_ends, img_possibles,
skip_first_screenshot=skip_first_screenshot)
Loading

0 comments on commit 14aa319

Please sign in to comment.