From f06029832c825447f8717f17e781854134b0607f Mon Sep 17 00:00:00 2001 From: aeon0 Date: Wed, 15 Nov 2023 17:24:47 +0100 Subject: [PATCH] adapt scripts --- config/game_1920x1080.ini | 1 + config/game_2560x1080.ini | 1 + config/game_2560x1440.ini | 1 + config/game_3440x1440.ini | 1 + config/game_3840x2160.ini | 1 + config/game_5120x1440.ini | 1 + config/params.ini | 1 + src/overlay.py | 1 + src/scripts/rogue_tb.py | 14 ++++++++++---- src/ui/hud.py | 18 +++++++++--------- 10 files changed, 27 insertions(+), 13 deletions(-) diff --git a/config/game_1920x1080.ini b/config/game_1920x1080.ini index 7452e608..a3a2ac35 100644 --- a/config/game_1920x1080.ini +++ b/config/game_1920x1080.ini @@ -33,6 +33,7 @@ sort_icon=1220,666,63,62 ; for scripts core_skill=1094,981,47,47 skill4=967,981,47,47 +skill3=904,981,49,49 rel_skill_cd=6,4,22,12 mini_map_visible=1719,123,60,60 hud_detection=702,978,59,53 diff --git a/config/game_2560x1080.ini b/config/game_2560x1080.ini index c584d7fe..a8a45c64 100644 --- a/config/game_2560x1080.ini +++ b/config/game_2560x1080.ini @@ -27,6 +27,7 @@ rel_fav_flag=3,3,10,10 sort_icon=1860,666,63,62 core_skill=1734,981,47,47 skill4=1607,981,47,47 +skill3=904,981,49,49 rel_skill_cd=6,4,22,12 mini_map_visible=2359,123,60,60 hud_detection=702,978,59,53 diff --git a/config/game_2560x1440.ini b/config/game_2560x1440.ini index 9ebad629..f5cdde65 100644 --- a/config/game_2560x1440.ini +++ b/config/game_2560x1440.ini @@ -27,6 +27,7 @@ rel_fav_flag=4,4,13,13 sort_icon=1626,888,84,82 core_skill=1458,1308,62,62 skill4=1289,1308,62,62 +skill3=1205,1308,65,65 rel_skill_cd=8,5,29,16 mini_map_visible=2292,164,80,80 hud_detection=936,1304,78,70 diff --git a/config/game_3440x1440.ini b/config/game_3440x1440.ini index 0551d7e1..7f2bec99 100644 --- a/config/game_3440x1440.ini +++ b/config/game_3440x1440.ini @@ -27,6 +27,7 @@ rel_fav_flag=4,4,13,13 sort_icon=2506,888,84,82 core_skill=2338,1308,62,62 skill4=2169,1308,62,62 +skill3=1205,1308,65,65 rel_skill_cd=8,5,29,16 mini_map_visible=3172,164,80,80 hud_detection=936,1304,78,70 diff --git a/config/game_3840x2160.ini b/config/game_3840x2160.ini index 8400c6f8..4a2f286e 100644 --- a/config/game_3840x2160.ini +++ b/config/game_3840x2160.ini @@ -27,6 +27,7 @@ rel_fav_flag=6,6,20,20 sort_icon=2440,1332,126,124 core_skill=2188,1962,94,94 skill4=1934,1962,94,94 +skill3=1808,1962,98,98 rel_skill_cd=12,8,44,24 mini_map_visible=3438,246,120,120 hud_detection=1404,1956,118,106 diff --git a/config/game_5120x1440.ini b/config/game_5120x1440.ini index 9ca0833b..6e978c74 100644 --- a/config/game_5120x1440.ini +++ b/config/game_5120x1440.ini @@ -27,6 +27,7 @@ rel_fav_flag=4,4,13,13 sort_icon=3786,888,84,82 core_skill=3618,1308,62,62 skill4=3449,1308,62,62 +skill3=1605,1308,65,65 rel_skill_cd=8,5,29,16 mini_map_visible=4452,164,80,80 hud_detection=1336,1304,78,70 diff --git a/config/params.ini b/config/params.ini index eac09333..50f0b3b5 100644 --- a/config/params.ini +++ b/config/params.ini @@ -22,6 +22,7 @@ run_scripts= ; Hotkey to open inventory inventory=i skill4=4 +skill3=3 health_pot=q [advanced_options] diff --git a/src/overlay.py b/src/overlay.py index e8c1b885..617d2dc8 100644 --- a/src/overlay.py +++ b/src/overlay.py @@ -171,6 +171,7 @@ def filter_items(self): self.loot_filter_thread.start() self.filter_button.config(text="stop") finally: + self.filter_button.config(text="filter") lock.release() else: return diff --git a/src/scripts/rogue_tb.py b/src/scripts/rogue_tb.py index 29ac1dc1..6a9c3723 100644 --- a/src/scripts/rogue_tb.py +++ b/src/scripts/rogue_tb.py @@ -14,11 +14,17 @@ def run_rogue_tb(): while True: img = Cam().grab() if hud.is_ingame(img): - ready = hud.is_skill_ready(img) + ready4 = hud.is_skill_ready(img) + ready3 = hud.is_skill_ready(img, "skill3") imbued = hud.is_imbued(img) - if ready and not imbued: - keyboard.send(Config().char["skill4"]) - Logger.debug("Casting imbuement") + # Logger.debug(f"imbued: {imbued} s3: {ready3} s4: {ready4}") + if not imbued: + if ready4: + keyboard.send(Config().char["skill4"]) + Logger.debug("Casting imbuement (skill4)") + elif ready3: + keyboard.send(Config().char["skill3"]) + Logger.debug("Casting imbuement (skill3)") wait(0.1, 0.15) diff --git a/src/ui/hud.py b/src/ui/hud.py index 561ff5b3..69a106bc 100644 --- a/src/ui/hud.py +++ b/src/ui/hud.py @@ -35,9 +35,9 @@ def is_skill_ready(img: np.ndarray = None, roi_name: str = "skill4") -> bool: cropped = crop(cropped, Config().ui_roi["rel_skill_cd"]) mask, _ = color_filter(cropped, Config().colors[f"skill_cd"], False) # at least half of the row must be filled - target_sum = (mask.shape[0] * mask.shape[1] * 255) * 0.8 + target_sum = (mask.shape[0] * mask.shape[1] * 255) * 0.85 cd_sum = np.sum(mask) - ready = avg_saturation > 100 and cd_sum < target_sum + ready = avg_saturation > 90 and cd_sum < target_sum return ready @staticmethod @@ -50,7 +50,7 @@ def is_imbued(img: np.ndarray = None, roi_name: str = "core_skill") -> bool: cropped = crop(img, roi) mask, _ = color_filter(cropped, Config().colors[color], False) # at least half of the row must be filled - target_sum = (mask.shape[0] * mask.shape[1] * 255) * 0.3 + target_sum = (mask.shape[0] * mask.shape[1] * 255) * 0.35 cd_sum = np.sum(mask) if cd_sum > target_sum: return True @@ -63,14 +63,14 @@ def get_health(img: np.ndarray = None) -> float: sobel_y = cv2.Sobel(cut_img, cv2.CV_64F, 0, 1, ksize=3) _, binary = cv2.threshold(np.abs(sobel_y), 100, 255, cv2.THRESH_BINARY) blue, green, red = cv2.split(binary) - lines_red = cv2.HoughLinesP(red.astype(np.uint8), 1, math.pi / 2, 2, None, 30, 1) - lines_green = cv2.HoughLinesP(green.astype(np.uint8), 1, math.pi / 2, 2, None, 30, 1) + # lines_red = cv2.HoughLinesP(red.astype(np.uint8), 1, math.pi / 2, 2, None, 30, 1) + # lines_green = cv2.HoughLinesP(green.astype(np.uint8), 1, math.pi / 2, 2, None, 30, 1) + combined = cv2.bitwise_or(red, green) + lines_combined = cv2.HoughLinesP(combined.astype(np.uint8), 1, math.pi / 2, 2, None, 30, 1) lines_blue = cv2.HoughLinesP(blue.astype(np.uint8), 1, math.pi / 2, 2, None, 30, 1) lines = [] - if lines_red is not None: - lines.extend(lines_red) - if lines_green is not None: - lines.extend(lines_green) + if lines_combined is not None: + lines.extend(lines_combined) if lines_blue is not None: lines.extend(lines_blue) # for line in lines[0]: