From 3f9771a0fad1d1440af3f56228aa32e66187688c Mon Sep 17 00:00:00 2001 From: Thaloria Date: Sat, 7 May 2022 01:54:41 +0200 Subject: [PATCH] impl staff --- digging_main2.py | 4 ++-- equipment_main.py | 24 ++++++++++++++++++++++-- utils.py | 2 +- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/digging_main2.py b/digging_main2.py index 18667aa..0a212c6 100644 --- a/digging_main2.py +++ b/digging_main2.py @@ -44,9 +44,9 @@ def run(): if level >= 28: break if level == 23: - DIG_TIME = 850 + DIG_TIME = 800 if level == 26: - DIG_TIME = 1850 + DIG_TIME = 1800 if level <= 10: plot_size = plot_size - 1 elif level % 2 == 0: diff --git a/equipment_main.py b/equipment_main.py index 5fcab23..2e8c3d7 100644 --- a/equipment_main.py +++ b/equipment_main.py @@ -12,10 +12,11 @@ EMITTER_MAIN = "main" EMITTER_MUSH = "mushroom" EMITTER_AMU = "amulett" EMITTER_SWORD = "sword" +EMITTER_STAFF = "staff" def run(): - EMITTER_TO_USE = EMITTER_MAIN + EMITTER_TO_USE = EMITTER_STAFF # initialize the user-class config = UserConfigs() @@ -59,6 +60,10 @@ def run(): include_books(needles, hsv) include_swords(needles, hsv) include_bags(needles, hsv) + elif EMITTER_TO_USE == EMITTER_STAFF: + include_books(needles, hsv) + include_staffs(needles, hsv) + include_bags(needles, hsv) pause = True while True: @@ -284,6 +289,17 @@ def include_swords(needles, hsv): needles.append(cv.imread("equip/sword_5_32.jpg", cv.IMREAD_UNCHANGED)) hsv.append(HsvFilter(0, 0, 0, 179, 255, 255, 0, 0, 0, 0)) +def include_staffs(needles, hsv): + needles.append(cv.imread("equip/staff_1_32.jpg", cv.IMREAD_UNCHANGED)) + hsv.append(HsvFilter(0, 0, 0, 179, 255, 255, 0, 0, 0, 0)) + needles.append(cv.imread("equip/staff_2_32.jpg", cv.IMREAD_UNCHANGED)) + hsv.append(HsvFilter(0, 0, 0, 179, 255, 255, 0, 0, 0, 0)) + needles.append(cv.imread("equip/staff_3_32.jpg", cv.IMREAD_UNCHANGED)) + hsv.append(HsvFilter(0, 0, 0, 179, 255, 255, 0, 0, 0, 0)) + needles.append(cv.imread("equip/staff_4_32.jpg", cv.IMREAD_UNCHANGED)) + hsv.append(HsvFilter(0, 0, 0, 179, 255, 255, 0, 0, 0, 0)) + #needles.append(cv.imread("equip/sword_5_32.jpg", cv.IMREAD_UNCHANGED)) + #hsv.append(HsvFilter(0, 0, 0, 179, 255, 255, 0, 0, 0, 0)) def move_tile(conf, point_source, point_dest): offset_left = conf.returnEquipmentWindowPos()[2] @@ -318,7 +334,11 @@ def find_emitter(emitter_to_use, vis, screen, layer): return vis.find(screen, cv.imread("equip/sword_e1_32.jpg", cv.IMREAD_UNCHANGED), 0.8, 1) else: return vis.find(screen, cv.imread("equip/sword_e2_32.jpg", cv.IMREAD_UNCHANGED), 0.7, 1) - + elif emitter_to_use == EMITTER_STAFF: + if layer == 0: + return vis.find(screen, cv.imread("equip/staff_e1_32.jpg", cv.IMREAD_UNCHANGED), 0.8, 1) + else: + return vis.find(screen, cv.imread("equip/staff_e2_32.jpg", cv.IMREAD_UNCHANGED), 0.7, 1) def check_and_move_tile(capture_win, visio, conf, rect, needl, hsv, point_source, point_dest): screenshot_pos = capture_win.get_screenshot_by_area(rect) diff --git a/utils.py b/utils.py index 6b0203a..e383ed0 100644 --- a/utils.py +++ b/utils.py @@ -156,7 +156,7 @@ def update_screenshot_with_short_pic_list(short_pic_lst, lst_bl_items): def dig_point(point1, point2, dig_time): pydirectinput.moveTo(point1, point2) - cv.waitKey(50) + cv.waitKey(100) pydirectinput.mouseDown() w = random.randint(1, 50) cv.waitKey(dig_time + w)