-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
169 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
[general] | ||
; How many tabs should be checked for items in chest. Note: All 5 Tabs must be unlocked! | ||
check_chest_tabs=2 | ||
; Which additional scripts should be run. Seperated by comma | ||
; Currently available: | ||
; 1920x1080: rogue_tb | ||
; 2560x1440: rogue_tb | ||
run_scripts= | ||
|
||
[char] | ||
; Hotkey to open inventory | ||
inventory=i | ||
skill4=4 | ||
|
||
[advanced_options] | ||
run_scripts=f9 | ||
run_key=f11 | ||
exit_key=f12 | ||
log_lvl=info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import keyboard | ||
import traceback | ||
from cam import Cam | ||
from config import Config | ||
from ui.hud import Hud | ||
from utils.misc import wait | ||
from logger import Logger | ||
|
||
|
||
def run_rogue_tb(): | ||
hud = Hud() | ||
|
||
Logger.info("Starting Rogue Script") | ||
while True: | ||
img = Cam().grab() | ||
# find the skill at position 3a | ||
if hud.is_ingame(img): | ||
# skills | ||
ready = hud.is_skill_ready(img) | ||
imbued = hud.is_imbued(img) | ||
# print(ready, poison, shadow) | ||
if ready and not imbued: | ||
keyboard.send(Config().char["skill4"]) | ||
Logger.debug("Casting imbuement") | ||
wait(0.4, 0.6) | ||
|
||
|
||
if __name__ == "__main__": | ||
try: | ||
from utils.window import start_detecting_window | ||
|
||
start_detecting_window() | ||
while not Cam().is_offset_set(): | ||
wait(0.2) | ||
run_rogue_tb() | ||
except: | ||
traceback.print_exc() | ||
print("Press Enter to exit ...") | ||
input() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import cv2 | ||
import numpy as np | ||
|
||
from cam import Cam | ||
from config import Config | ||
from utils.image_operations import color_filter, crop | ||
from template_finder import SearchArgs | ||
|
||
|
||
class Hud(SearchArgs): | ||
def __init__(self): | ||
self.ref = ["HUD_DETECTION_LEFT"] | ||
self.threshold = 0.94 | ||
self.roi = "hud_detection" | ||
self.use_grayscale = True | ||
self.do_multi_process = False | ||
|
||
def is_ingame(self, img: np.ndarray = None) -> bool: | ||
img = img if img is not None else Cam().grab() | ||
cropped_img = cv2.cvtColor(crop(img, Config().ui_roi["mini_map_visible"]), cv2.COLOR_BGR2GRAY) | ||
_, binary_mask = cv2.threshold(cropped_img, 155, 255, cv2.THRESH_BINARY) | ||
mini_map_visible = cv2.countNonZero(binary_mask) > 40 | ||
return self.is_visible(img=img) and mini_map_visible | ||
|
||
@staticmethod | ||
def is_skill_ready(img: np.ndarray = None, roi_name: str = "skill4") -> bool: | ||
img = Cam().grab() if img is None else img | ||
# Check avg saturation | ||
roi = Config().ui_roi[roi_name] | ||
cropped = crop(img, roi) | ||
hsv_image = cv2.cvtColor(cropped, cv2.COLOR_BGR2HSV) | ||
_, saturation, _ = cv2.split(hsv_image) | ||
avg_saturation = np.mean(saturation) | ||
# Check if on cd | ||
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 | ||
cd_sum = np.sum(mask) | ||
ready = avg_saturation > 100 and cd_sum < target_sum | ||
return ready | ||
|
||
@staticmethod | ||
def is_imbued(img: np.ndarray = None, roi_name: str = "core_skill") -> bool: | ||
colors = ["shadow_imbued", "posion_imbued", "cold_imbued"] | ||
for color in colors: | ||
img = Cam().grab() if img is None else img | ||
# Check avg saturation | ||
roi = Config().ui_roi[roi_name] | ||
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 | ||
cd_sum = np.sum(mask) | ||
if cd_sum > target_sum: | ||
return True | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters