-
-
Notifications
You must be signed in to change notification settings - Fork 8
ZoneManager & SubZoneMapper
The ZoneManager is a domain-level utility, meaning it combines multiple focused utilities to produce a higher-level, feature-specific function.
Its purpose is to dynamically map out key UI zones, enabling more accurate and efficient detection of colour-based objects and image-based sprites on the game screen.
-
Initial Zone Detection (Template Matching)
TheZoneManageruses template matching to locate core UI regions:- Control panel (inventory, tabs, etc.)
- Mini-map area (orbs, compass, map)
- Chatbox
- Game view (calculated as the remaining screen space after subtracting the above)
-
Zone Expansion (SubZoneMapper)
Once the main regions are identified,ZoneManageruses the helper classSubZoneMapperto map additional sub-zones within each. These are derived using hardcoded offsets relative to the parent region. -
Final Output
The result is aMap<String, Rectangle>:- The
Stringkey is a semantic name, e.g.,"hpText". - The
Rectanglerepresents an exact screen region, e.g.,new Rectangle(zone.x + 4, zone.y + 55, 20, 13).
- The
controller().zones().getGameView()Returns a cropped BufferedImage of the game view region. This is not always a clean rectangle and is ideal for operations like template matching and colour detection.
controller().zones().getInventorySlots().get(27)Returns a List<Rectangle> representing each inventory slot, indexed 0–27 from left to right, then top to bottom.
Access all mapped zones via ZoneManager's public getters using their associated string keys.
Zone keys such as "hpText" are defined in
SubZoneMapper.
Because ZoneManager is stateful (e.g., depends on fixed vs resizable client), you must access it through the controller.
Rectangle hp = controller().zones().getCtrlPanel().get("hpText");
Rectangle runOrb = controller().zones().getMinimap().get("runOrb");
Rectangle chatbox = controller().zones().getChatTabs().get("chat");
Rectangle invSlot5 = controller().zones().getInventorySlots().get(5);
BufferedImage gameView = controller().zones().getGameView();Taking a screenshot of a zone
BufferedImage screenshot = ScreenManager.captureZone(invSlot5)