Skip to content

Commit

Permalink
fix global
Browse files Browse the repository at this point in the history
  • Loading branch information
pur1fying committed Dec 22, 2023
1 parent d4f0213 commit c79049e
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 18 deletions.
4 changes: 1 addition & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,6 @@ def init_ocr(self):
self.logger.info("Test ocrCN : " + self.ocrCN.ocr_for_single_line(img_CN)['text'])
elif self.server == 'Global':
self.ocrEN = CnOcr(det_model_name="en_PP-OCRv3_det", rec_model_name='en_number_mobile_v2.0',
rec_model_fp='src/ocr_models/en_number_mobile_v2.0_rec_infer.onnx',
det_model_fp='src/ocr_models/en_PP-OCRv3_rec_infer.onnx',
context='gpu')
img_EN = cv2.imread('src/test_ocr/EN.png')
self.logger.info("Test ocrEN : " + self.ocrEN.ocr_for_single_line(img_EN)['text'])
Expand Down Expand Up @@ -598,7 +596,7 @@ def init_package_name(self):
# # print(time.time())
t = Main()
# t.thread_starter()
t.solve('lesson')
t.solve('scrimmage')
t.flag_run = True
# t.solve('de_clothes')
# t.solve('common_shop')
Expand Down
5 changes: 4 additions & 1 deletion module/arena.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ def implement(self):
ends = [
"attack_team_formation",
]
image.detect(self, 'arena_edit-force', {}, pre_func=color.detect_rgb_one_time,
if self.server == 'CN':
image.detect(self, 'arena_edit-force', {}, pre_func=color.detect_rgb_one_time,
pre_argv=(self, click_pos, los, ends))
elif self.server == 'Global':
color.common_rgb_detect_method(self, click_pos, los, ends)
res = check_skip_button(self.latest_img_array, self.server)
if res == "OFF":
self.logger.info("TURN ON SKIP")
Expand Down
2 changes: 2 additions & 0 deletions module/cafe_reward.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def implement(self):
if self.server == "CN":
cn_implement(self)
elif self.server == "Global":
time.sleep(1)
global_implement(self)
return True

Expand Down Expand Up @@ -102,6 +103,7 @@ def cn_implement(self):


def global_implement(self):
self.latest_img_array = self.get_screenshot_array()
op = np.full(2, False, dtype=bool)
op[0] = get_invitation_ticket_status(self)
op[1] = get_cafe_earning_status1(self)
Expand Down
3 changes: 2 additions & 1 deletion module/collect_daily_power.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def to_tasks(self):
color.common_rgb_detect_method(self, click_pos, los, ends)
elif self.server == "CN":
possibles = {
"main_page_home-feature": (70, 232, 3)
"main_page_home-feature": (70, 232),
'main_page_full-notice': (887, 165),
}
image.detect(self, "work_task_menu", possibles)

Expand Down
2 changes: 1 addition & 1 deletion module/common_shop.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def implement(self):
if self.server == 'CN':
pass
elif self.server == 'Global':
self.logger.info("asset_required : ", asset_required)
self.logger.info("asset_required : " + str(asset_required))
if asset_required > creditpoints != -1:
self.logger.info("INADEQUATE assets for BUYING")
return True
Expand Down
11 changes: 6 additions & 5 deletions module/hard_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ def read_task(self, task_string):
try:
region = 0
mainline_available_missions = [1, 2, 3]
mainline_available_regions = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
mainline_available_regions = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, ]
for i in range(0, len(task_string)):
if task_string[i].isdigit():
region = region * 10 + int(task_string[i])
Expand Down Expand Up @@ -140,7 +141,7 @@ def to_hard_event(self):
elif self.server == 'Global':
click_pos = [
[1077, 98],
[805, 165],
[1186, 165],
[1198, 580],
[823, 261],
[640, 116],
Expand All @@ -153,7 +154,7 @@ def to_hard_event(self):
]
los = [
"sweep_complete",
"event_hard",
"event_normal",
"main_page",
"campaign",
"reward_acquired",
Expand All @@ -164,7 +165,7 @@ def to_hard_event(self):
"unlock_notice",
]
ends = [
"event_normal",
"event_hard",
]
color.common_rgb_detect_method(self, click_pos, los, ends)

Expand All @@ -188,7 +189,7 @@ def to_task_info(self, x, y):
[x, y],
]
los = [
"event_normal"
"event_hard"
]
ends = [
"mission_info",
Expand Down
2 changes: 1 addition & 1 deletion module/normal_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def read_task(self, task_string):
try:
region = 0
mainline_available_missions = [1, 2, 3, 4, 5]
mainline_available_regions = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
mainline_available_regions = [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
for i in range(0, len(task_string)):
if task_string[i].isdigit():
region = region * 10 + int(task_string[i])
Expand Down
2 changes: 1 addition & 1 deletion module/rewarded_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def implement(self):
return True

if self.server == 'Global':
buy_ticket_times = min(0, self.config['purchase_bounty_ticket_times']) # ** 购买悬赏委托券的次数
buy_ticket_times = min(0, self.config['purchase_rewarded_task_ticket_times']) # ** 购买悬赏委托券的次数
if buy_ticket_times > 0:
to_choose_bounty(self)
purchase_bounty_ticket(self, buy_ticket_times)
Expand Down
4 changes: 2 additions & 2 deletions module/scrimmage.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def scrimmage_common_operation(self, a, b):
click_pos[0][1] = los[i]
color.common_rgb_detect_method(self, click_pos, pd_los, ends)
t = color.check_sweep_availability(self.latest_img_array, server=self.server)
if t == "AVAILABLE":
if t == "sss":
if b == "max":
self.click(1085, 300)
time.sleep(1)
Expand All @@ -69,7 +69,7 @@ def scrimmage_common_operation(self, a, b):
return "sweep_complete"
if res == "purchase_ap_notice":
return "inadequate_ap"
elif t == "UNAVAILABLE":
elif t == "no-pass" or t == "pass":
to_scrimmage(self, a)

return True
Expand Down
4 changes: 2 additions & 2 deletions module/tactical_challenge_shop.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def implement(self):
[700, 204], [857, 204], [1000, 204], [1162, 204],
[700, 461], [857, 461], [1000, 461], [1162, 461]
]
buy_list = np.array(self.config["TacticalChallengeShopList"])
if self.server == 'CN':
price = np.array([
50, 50, 50, 15,
Expand All @@ -26,7 +27,6 @@ def implement(self):
50, 15, 30, 5,
25, 60, 100, 4,
20, 60, 100], dtype=int)
buy_list = np.array(self.config["TacticalChallengeShopList"])
if buy_list.shape != price.shape:
self.logger.error("buy_list and price shape not match")
return True
Expand Down Expand Up @@ -109,7 +109,7 @@ def to_tactical_challenge_shop(self):
elif self.server == 'Global':
click_pos = [
[796, 653], # main_page
[160, 456], # common shop
[160, 531], # common shop
[922, 192], # buy notice bright
[922, 192], # buy notice grey
[886, 213], # shop refresh guide
Expand Down
2 changes: 1 addition & 1 deletion src/rgb_feature/rgb_feature_Global.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"club":[[[1130,668],[64,42],[240,668]],[[109,129,211,231,245,255],[60,80,89,109,142,162],[109,129,211,231,245,255]]],
"momotalk2":[[[172, 283], [181, 283], [163, 305]],[[245, 255, 245, 255, 245, 255], [245, 255, 245, 255, 245, 255], [93, 113, 110, 130, 131, 151]]],
"momotalk1":[[[170, 195], [197, 201], [142, 197]],[[245, 255, 245, 255, 245, 255], [93, 113, 110, 130, 131, 151], [93, 113, 110, 130, 131, 151]]],
"tactical_challenge_shop":[[[172, 135], [1123,657], [170, 216],[17,456],[641,664]],[[245,255,245,255,245,255], [35,55,60,80,89,109], [245,255,245,255,245,255],[35,55,60,80,89,109],[0,10,117,137,199,219]]],
"tactical_challenge_shop":[[[172, 135], [1123,657], [170, 216],[17,522],[641,664]],[[245,255,245,255,245,255], [35,55,60,80,89,109], [245,255,245,255,245,255],[35,55,60,80,89,109],[0,10,117,137,199,219]]],
"common_shop":[[[172, 135], [1123,657], [170, 216],[17,456],[641,664]],[[35,55,60,80,89,109], [35,55,60,80,89,109], [245,255,245,255,245,255],[245,255,245,255,245,255],[0,10,117,137,199,219]]],
"shop_buy_notice_bright":[[[691,487],[845,476],[586,381],[733,380],[457,332],[806,329],[607,186],[898,174]],[[235,255,222,242,64,84],[235,255,222,242,64,84],[53,73,73,93,95,115],[53,73,73,93,95,115],[229,249,229,249,229,249],[229,249,229,249,229,249],[35,55,60,80,89,109],[35,55,60,80,89,109]]],
"shop_refresh_guide":[[[691, 466], [839, 466], [886,210], [589,373],[712,371],[476,357]],[[235,255,222,242,64,84],[235,255,222,242,64,84],[5,25,23,43,54,74],[55,75,72,92,95,115],[55,75,72,92,95,115],[229,249,229,249,229,249]]],
Expand Down

0 comments on commit c79049e

Please sign in to comment.