Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/utilities/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.")
Expand All @@ -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 # 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
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.
Expand Down