def overlayImage(self, call_id, x, y, img_str, img_width, timeout): if not self.app.has_permission("overlay"): raise ApiPermissionDeniedException("overlay") img_bytes = base64.b64decode(img_str) self._overlay.enqueue(call_id, "overlay_image", img_bytes, x, y, img_width, timeout)
def setTaskbarProgress(self, type_: QJsonValue, progress: QJsonValue): if not self.app.has_permission("overlay"): raise ApiPermissionDeniedException("overlay") type_map = { 0: "RESET", 1: "IN_PROGRESS", 2: "ERROR", 3: "LOADING", 4: "PAUSED", } # This can be called with null, but since the default value is 0 we call RESET anyway self.app.game_instance.set_taskbar_progress( type_map[type_.toDouble(0)], progress.toDouble(0))
def bind_get_region_raw(self, id, x, y, w, h): if not self.app.has_permission("pixel"): raise ApiPermissionDeniedException("pixel") if id == 0: return "" try: image = self._bound_regions[id - 1] except IndexError: self.logger.warning("bindGetRegionRaw(%d) but image not bound", id) return "" return image_to_stream(image.image, x, y, w, h, mode="rgba")
def overlayTextEx(self, call_id, message, color, size, x, y, timeout, font_name, centered, shadow): if not self.app.has_permission("overlay"): raise ApiPermissionDeniedException("overlay") self._overlay.enqueue( call_id, "overlay_text", message, color, size, x, y, timeout, font_name, centered, shadow, )
def overlaySetGroupZIndex(self, call_id, group, zIndex): if not self.app.has_permission("overlay"): raise ApiPermissionDeniedException("overlay") self._overlay.enqueue(call_id, "overlay_set_group_z", group, zIndex)
def overlayRefreshGroup(self, call_id, name): if not self.app.has_permission("overlay"): raise ApiPermissionDeniedException("overlay") self._overlay.enqueue(call_id, "overlay_refresh_group", name)
def overlayContinueGroup(self, call_id, name): if not self.app.has_permission("overlay"): raise ApiPermissionDeniedException("overlay") self._overlay.enqueue(call_id, "overlay_continue_group", name)
def overlayLine(self, call_id, color, width, x1, y1, x2, y2, timeout): if not self.app.has_permission("overlay"): raise ApiPermissionDeniedException("overlay") self._overlay.enqueue(call_id, "overlay_line", color, width, x1, y1, x2, y2, timeout)
def overlayRect(self, call_id, color, x, y, w, h, timeout, line_width): if not self.app.has_permission("overlay"): raise ApiPermissionDeniedException("overlay") self._overlay.enqueue(call_id, "overlay_rect", color, x, y, w, h, timeout, line_width)
def showNotification(self, title, message, icon): if not self.app.has_permission("overlay"): raise ApiPermissionDeniedException("overlay") tray_icon().showMessage(title, message)
def setTooltip(self, text: str): if not self.app.has_permission("overlay"): raise ApiPermissionDeniedException("overlay") self.app.host.notifier.notify(str(text))
def get_region_raw(self, x, y, w, h): if not self.app.has_permission("pixel"): raise ApiPermissionDeniedException("pixel") return image_to_stream(self.app.game_instance.grab_region(x, y, w, h), mode="rgba")
def get_region(self, x, y, w, h): if not self.app.has_permission("pixel"): raise ApiPermissionDeniedException("pixel") return base64.b64encode( image_to_stream(self.app.game_instance.grab_region(x, y, w, h)))