From 37614e12d83f58fe6de6a296b12372ea9233098c Mon Sep 17 00:00:00 2001 From: v0rkath Date: Tue, 2 May 2023 22:09:21 +0100 Subject: [PATCH 1/2] __locate_skill_boxes() added. Provides the rectangles for each skill box (0 -> 23) which can be used for antiban functionality. --- src/model/osrs/__init__.py | 2 +- src/utilities/window.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/model/osrs/__init__.py b/src/model/osrs/__init__.py index 4cc62dd3..a3f8d773 100644 --- a/src/model/osrs/__init__.py +++ b/src/model/osrs/__init__.py @@ -1,2 +1,2 @@ from .combat.combat import OSRSCombat -from .woodcutter import OSRSWoodcutter +from .woodcutter import OSRSWoodcutter \ No newline at end of file diff --git a/src/utilities/window.py b/src/utilities/window.py index 6e963bbe..1ff8149f 100644 --- a/src/utilities/window.py +++ b/src/utilities/window.py @@ -41,6 +41,7 @@ class Window: inventory_slots: List[Rectangle] = [] # https://i.imgur.com/gBwhAwE.png spellbook_normal: List[Rectangle] = [] # https://i.imgur.com/vkKAfV5.png prayers: List[Rectangle] = [] # https://i.imgur.com/KRmC3YB.png + skill_boxes: List[Rectangle] = [] # https://i.imgur.com/Ipm0BWr.png # Chat Area chat: Rectangle = None # https://i.imgur.com/u544ouI.png @@ -172,6 +173,7 @@ def __locate_control_panel(self, client_rect: Rectangle) -> bool: self.__locate_inv_slots(cp) self.__locate_prayers(cp) self.__locate_spells(cp) + self.__locate_skill_boxes(cp) self.control_panel = cp return True print("Window.__locate_control_panel(): Failed to find control panel.") @@ -193,6 +195,21 @@ def __locate_cp_tabs(self, cp: Rectangle) -> None: y = 303 # 303px from top for second row slot_h = 28 # slightly taller tab Rectangles for second row + def __locate_skill_boxes(self, cp: Rectangle) -> None: + """ + Creates Rectangles for each skill box relative to the control panel, storing it in the class property. + """ + self.skill_boxes = [] + slot_w, slot_h = 59, 29 + gap_x, gap_y = 2, 3 + y = 38 + cp.top # change y rel to top + for _ in range(8): # value probably should change + x = 27 + cp.left # change value + for _ in range(3): + self.skill_boxes.append(Rectangle(left=x, top=y, width=slot_w, height=slot_h)) + x += slot_w + gap_x + y += slot_h + gap_y + def __locate_inv_slots(self, cp: Rectangle) -> None: """ Creates Rectangles for each inventory slot relative to the control panel, storing it in the class property. From 1af719bf25781d5c0dc892c44f65907cc2292d76 Mon Sep 17 00:00:00 2001 From: v0rkath Date: Tue, 2 May 2023 22:28:47 +0100 Subject: [PATCH 2/2] Added whitespace in __init__.py. Removed/changed comments in window.py --- src/model/osrs/__init__.py | 2 +- src/utilities/window.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/model/osrs/__init__.py b/src/model/osrs/__init__.py index a3f8d773..4cc62dd3 100644 --- a/src/model/osrs/__init__.py +++ b/src/model/osrs/__init__.py @@ -1,2 +1,2 @@ from .combat.combat import OSRSCombat -from .woodcutter import OSRSWoodcutter \ No newline at end of file +from .woodcutter import OSRSWoodcutter diff --git a/src/utilities/window.py b/src/utilities/window.py index 1ff8149f..814549fb 100644 --- a/src/utilities/window.py +++ b/src/utilities/window.py @@ -200,11 +200,11 @@ def __locate_skill_boxes(self, cp: Rectangle) -> None: Creates Rectangles for each skill box relative to the control panel, storing it in the class property. """ self.skill_boxes = [] - slot_w, slot_h = 59, 29 - gap_x, gap_y = 2, 3 - y = 38 + cp.top # change y rel to top - for _ in range(8): # value probably should change - x = 27 + cp.left # change value + slot_w, slot_h = 59, 29 # dimensions of a skill box + gap_x, gap_y = 2, 3 # pixel gap between skills + y = 38 + cp.top + for _ in range(8): + x = 27 + cp.left for _ in range(3): self.skill_boxes.append(Rectangle(left=x, top=y, width=slot_w, height=slot_h)) x += slot_w + gap_x