net.runelite.api.widgets.WidgetInfo Java Examples
The following examples show how to use
net.runelite.api.widgets.WidgetInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BanListPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
/** * Event to keep making sure player names are highlighted red in clan chat, since the red name goes away frequently */ @Subscribe private void onWidgetHiddenChanged(WidgetHiddenChanged widgetHiddenChanged) { if (client.getGameState() != GameState.LOGGED_IN || client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN) != null || client.getViewportWidget() == null || client.getWidget(WidgetInfo.FRIENDS_CHAT) == null || !config.highlightInClan()) { return; } clientThread.invokeLater(() -> { if (!client.getWidget(WidgetInfo.FRIENDS_CHAT).isHidden()) { highlightRedInCC(); } }); }
Example #2
Source File: MouseHighlightPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private void resetTips() { if (client.getGameState() != GameState.LOGGED_IN) { return; } try { setTipHidden(WidgetInfo.SPELL_TOOLTIP, false); setTipHidden(WidgetInfo.COMBAT_TOOLTIP, false); } catch (Exception e) { //swallow } }
Example #3
Source File: FriendNotesPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private void rebuildIgnoreList() { clientThread.invokeLater(() -> { log.debug("Rebuilding ignore list"); client.runScript( ScriptID.IGNORE_UPDATE, WidgetInfo.IGNORE_FULL_CONTAINER.getPackedId(), WidgetInfo.IGNORE_SORT_BY_NAME_BUTTON.getPackedId(), WidgetInfo.IGNORE_LEGACY_SORT_BUTTON.getPackedId(), WidgetInfo.IGNORE_NAMES_CONTAINER.getPackedId(), WidgetInfo.IGNORE_SCROLL_BAR.getPackedId(), WidgetInfo.IGNORE_LOADING_TEXT.getPackedId(), WidgetInfo.IGNORE_PREVIOUS_NAME_HOLDER.getPackedId() ); }); }
Example #4
Source File: RaidsPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
@Override protected void startUp() { overlayManager.add(overlay); overlayManager.add(pointsOverlay); if (config.partyDisplay()) { overlayManager.add(partyOverlay); } updateLists(); clientThread.invokeLater(() -> checkRaidPresence(true)); chatCommandManager.registerCommandAsync(LAYOUT_COMMAND, this::lookupRaid, this::submitRaid); widgetOverlay = overlayManager.getWidgetOverlay(WidgetInfo.RAIDS_POINTS_INFOBOX); RaidsPanel panel = injector.getInstance(RaidsPanel.class); panel.init(); final BufferedImage icon = ImageUtil.getResourceStreamFromClass(this.getClass(), "instancereloadhelper.png"); navButton = NavigationButton.builder() .tooltip("Raids Reload") .icon(icon) .priority(8) .panel(panel) .build(); clientToolbar.addNavigation(navButton); }
Example #5
Source File: BankSearch.java From plugins with GNU General Public License v3.0 | 6 votes |
public void layoutBank() { Widget bankContainer = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER); if (bankContainer == null || bankContainer.isHidden()) { return; } Object[] scriptArgs = bankContainer.getOnInvTransmit(); if (scriptArgs == null) { return; } client.runScript(scriptArgs); }
Example #6
Source File: MinimapPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private void updateMinimapWidgetVisibility(boolean enable) { final Widget resizableStonesWidget = client.getWidget(WidgetInfo.RESIZABLE_MINIMAP_STONES_WIDGET); if (resizableStonesWidget != null) { resizableStonesWidget.setHidden(enable); } final Widget resizableNormalWidget = client.getWidget(WidgetInfo.RESIZABLE_MINIMAP_WIDGET); if (resizableNormalWidget != null && !resizableNormalWidget.isSelfHidden()) { for (Widget widget : resizableNormalWidget.getStaticChildren()) { if (widget.getId() != WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_LOGOUT_BUTTON.getId() && widget.getId() != WidgetInfo.RESIZABLE_MINIMAP_LOGOUT_BUTTON.getId()) { widget.setHidden(enable); } } } }
Example #7
Source File: ScreenshotPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
/** * Receives a WidgetInfo pointing to the middle widget of the level-up dialog, * and parses it into a shortened string for filename usage. * * @param levelUpLevel WidgetInfo pointing to the required text widget, * with the format "Your Skill (level is/are) now 99." * @return Shortened string in the format "Skill(99)" */ String parseLevelUpWidget(WidgetInfo levelUpLevel) { Widget levelChild = client.getWidget(levelUpLevel); if (levelChild == null) { return null; } Matcher m = LEVEL_UP_PATTERN.matcher(levelChild.getText()); if (!m.matches()) { return null; } String skillName = m.group(1); String skillLevel = m.group(2); return skillName + "(" + skillLevel + ")"; }
Example #8
Source File: BlastMineOreCountOverlay.java From plugins with GNU General Public License v3.0 | 6 votes |
@Override public Dimension render(Graphics2D graphics) { final Widget blastMineWidget = client.getWidget(WidgetInfo.BLAST_MINE); if (blastMineWidget == null) { return null; } if (config.showOreOverlay()) { blastMineWidget.setHidden(true); panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.COAL, client.getVar(Varbits.BLAST_MINE_COAL)))); panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.GOLD_ORE, client.getVar(Varbits.BLAST_MINE_GOLD)))); panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.MITHRIL_ORE, client.getVar(Varbits.BLAST_MINE_MITHRIL)))); panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.ADAMANTITE_ORE, client.getVar(Varbits.BLAST_MINE_ADAMANTITE)))); panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.RUNITE_ORE, client.getVar(Varbits.BLAST_MINE_RUNITE)))); } else { blastMineWidget.setHidden(false); } return super.render(graphics); }
Example #9
Source File: BankPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private void updateSeedVaultTotal() { final Widget titleContainer = client.getWidget(WidgetInfo.SEED_VAULT_TITLE_CONTAINER); if (titleContainer == null) { return; } final Widget[] children = titleContainer.getDynamicChildren(); if (children == null || children.length < 2) { return; } final ContainerPrices prices = calculate(getSeedVaultItems()); if (prices == null) { return; } final String titleText = createValueText(prices); final Widget title = children[1]; title.setText(SEED_VAULT_TITLE + titleText); }
Example #10
Source File: BlastMineOreCountOverlay.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Override public Dimension render(Graphics2D graphics) { final Widget blastMineWidget = client.getWidget(WidgetInfo.BLAST_MINE); if (blastMineWidget == null) { return null; } if (config.showOreOverlay()) { blastMineWidget.setHidden(true); panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.COAL, client.getVar(Varbits.BLAST_MINE_COAL)))); panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.GOLD_ORE, client.getVar(Varbits.BLAST_MINE_GOLD)))); panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.MITHRIL_ORE, client.getVar(Varbits.BLAST_MINE_MITHRIL)))); panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.ADAMANTITE_ORE, client.getVar(Varbits.BLAST_MINE_ADAMANTITE)))); panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.RUNITE_ORE, client.getVar(Varbits.BLAST_MINE_RUNITE)))); } else { blastMineWidget.setHidden(false); } return super.render(graphics); }
Example #11
Source File: OneClickPlugin.java From ExternalPlugins with GNU General Public License v3.0 | 6 votes |
public Pair<Integer, Integer> findItem(Collection<Integer> ids) { final Widget inventoryWidget = client.getWidget(WidgetInfo.INVENTORY); final List<WidgetItem> itemList = (List<WidgetItem>) inventoryWidget.getWidgetItems(); for (int i = itemList.size() - 1; i >= 0; i--) { final WidgetItem item = itemList.get(i); if (ids.contains(item.getId())) { return Pair.of(item.getId(), item.getIndex()); } } return Pair.of(-1, -1); }
Example #12
Source File: KeyRemappingPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Subscribe public void onScriptCallbackEvent(ScriptCallbackEvent scriptCallbackEvent) { switch (scriptCallbackEvent.getEventName()) { case SCRIPT_EVENT_SET_CHATBOX_INPUT: Widget chatboxInput = client.getWidget(WidgetInfo.CHATBOX_INPUT); if (chatboxInput != null) { if (chatboxFocused() && !typing) { setChatboxWidgetInput(chatboxInput, PRESS_ENTER_TO_CHAT); } } break; case SCRIPT_EVENT_BLOCK_CHAT_INPUT: if (!typing) { int[] intStack = client.getIntStack(); int intStackSize = client.getIntStackSize(); intStack[intStackSize - 1] = 1; } break; } }
Example #13
Source File: FriendsChatPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private void loadFriendsChats() { Widget chatList = client.getWidget(WidgetInfo.FRIENDS_CHAT_LIST); if (chatList == null) { return; } int y = 2; chatList.setChildren(null); for (String chat : Lists.reverse(chats)) { Widget widget = chatList.createChild(-1, WidgetType.TEXT); widget.setFontId(494); widget.setTextColor(0xffffff); widget.setText(chat); widget.setOriginalHeight(14); widget.setOriginalWidth(142); widget.setOriginalY(y); widget.setOriginalX(20); widget.revalidate(); y += 14; } }
Example #14
Source File: InterfaceStylesPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private void overrideWidgetSprites() { final Skin configuredSkin = config.skin(); for (WidgetOverride widgetOverride : WidgetOverride.values()) { if (widgetOverride.getSkin() == configuredSkin || widgetOverride.getSkin() == configuredSkin.getExtendSkin()) { final String configSkin = configuredSkin.getExtendSkin() != null ? configuredSkin.getExtendSkin().toString() : configuredSkin.toString(); String file = configSkin + "/widget/" + widgetOverride.getName() + ".png"; SpritePixels spritePixels = getFileSpritePixels(file); if (spritePixels != null) { for (WidgetInfo widgetInfo : widgetOverride.getWidgetInfo()) { client.getWidgetSpriteOverrides().put(widgetInfo.getPackedId(), spritePixels); } } } } }
Example #15
Source File: FairyRingPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private void setWidgetTextToDestination() { Widget fairyRingTeleportButton = client.getWidget(WidgetInfo.FAIRY_RING_TELEPORT_BUTTON); if (fairyRingTeleportButton != null && !fairyRingTeleportButton.isHidden()) { String destination; try { FairyRings fairyRingDestination = getFairyRingDestination(client.getVar(Varbits.FAIRY_RING_DIAL_ADCB), client.getVar(Varbits.FAIRY_RIGH_DIAL_ILJK), client.getVar(Varbits.FAIRY_RING_DIAL_PSRQ)); destination = fairyRingDestination.getDestination(); } catch (IllegalArgumentException ex) { destination = "Invalid location"; } fairyRingTeleportButton.setText(destination); } }
Example #16
Source File: DiaryRequirementsPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
@Subscribe private void onWidgetLoaded(final WidgetLoaded event) { if (event.getGroupId() == WidgetID.DIARY_QUEST_GROUP_ID) { String widgetTitle = Text.removeTags( client.getWidget( WidgetInfo.DIARY_QUEST_WIDGET_TITLE) .getText()) .replace(' ', '_') .toUpperCase(); if (widgetTitle.startsWith("ACHIEVEMENT_DIARY")) { showDiaryRequirements(); } } }
Example #17
Source File: FriendNotesPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private void rebuildFriendsList() { clientThread.invokeLater(() -> { log.debug("Rebuilding friends list"); client.runScript( ScriptID.FRIENDS_UPDATE, WidgetInfo.FRIEND_LIST_FULL_CONTAINER.getPackedId(), WidgetInfo.FRIEND_LIST_SORT_BY_NAME_BUTTON.getPackedId(), WidgetInfo.FRIEND_LIST_SORT_BY_LAST_WORLD_CHANGE_BUTTON.getPackedId(), WidgetInfo.FRIEND_LIST_SORT_BY_WORLD_BUTTON.getPackedId(), WidgetInfo.FRIEND_LIST_LEGACY_SORT_BUTTON.getPackedId(), WidgetInfo.FRIEND_LIST_NAMES_CONTAINER.getPackedId(), WidgetInfo.FRIEND_LIST_SCROLL_BAR.getPackedId(), WidgetInfo.FRIEND_LIST_LOADING_TEXT.getPackedId(), WidgetInfo.FRIEND_LIST_PREVIOUS_NAME_HOLDER.getPackedId() ); }); }
Example #18
Source File: CameraOverlay.java From plugins with GNU General Public License v3.0 | 6 votes |
@Override public Dimension render(final Graphics2D graphics) { final Widget slider = client.getWidget(WidgetInfo.OPTIONS_CAMERA_ZOOM_SLIDER_HANDLE); final Point mousePos = client.getMouseCanvasPosition(); if (slider == null || slider.isHidden() || !slider.getBounds().contains(mousePos.getX(), mousePos.getY())) { return null; } final int value = client.getVar(VarClientInt.CAMERA_ZOOM_RESIZABLE_VIEWPORT); final int max = config.innerLimit() ? config.INNER_ZOOM_LIMIT : CameraPlugin.DEFAULT_INNER_ZOOM_LIMIT; tooltipManager.add(new Tooltip("Camera Zoom: " + value + " / " + max)); return null; }
Example #19
Source File: KeyRemappingPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
@Subscribe private void onConfigChanged(ConfigChanged configChanged) { if (!configChanged.getGroup().equals("keyremapping")) { return; } clientThread.invoke(() -> { Widget chatboxInput = client.getWidget(WidgetInfo.CHATBOX_INPUT); if (chatboxInput != null && chatboxInput.getText().endsWith(PRESS_ENTER_TO_CHAT)) { setChatboxWidgetInput(chatboxInput, PRESS_ENTER_TO_CHAT); } } ); }
Example #20
Source File: ItemStatPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private Widget getInventoryContainer() { if (client.isResized()) { if (client.getVar(Varbits.SIDE_PANELS) == 1) { return client.getWidget(WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_CONTAINER); } else { return client.getWidget(WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_CONTAINER); } } else { return client.getWidget(WidgetInfo.FIXED_VIEWPORT_INVENTORY_CONTAINER); } }
Example #21
Source File: CombatLevelPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
@Subscribe private void onGameTick(GameTick event) { if (client.getGameState() != GameState.LOGGED_IN) { return; } Widget combatLevelWidget = client.getWidget(WidgetInfo.COMBAT_LEVEL); if (combatLevelWidget == null || !config.showPreciseCombatLevel()) { return; } double combatLevelPrecise = Experience.getCombatLevelPrecise( client.getRealSkillLevel(Skill.ATTACK), client.getRealSkillLevel(Skill.STRENGTH), client.getRealSkillLevel(Skill.DEFENCE), client.getRealSkillLevel(Skill.HITPOINTS), client.getRealSkillLevel(Skill.MAGIC), client.getRealSkillLevel(Skill.RANGED), client.getRealSkillLevel(Skill.PRAYER) ); combatLevelWidget.setText("Combat Lvl: " + DECIMAL_FORMAT.format(combatLevelPrecise)); }
Example #22
Source File: TimersPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onWidgetHiddenChanged(WidgetHiddenChanged event) { Widget widget = event.getWidget(); if (WorldType.isPvpWorld(client.getWorldType()) && WidgetInfo.TO_GROUP(widget.getId()) == WidgetID.PVP_GROUP_ID) { widgetHiddenChangedOnPvpWorld = true; } }
Example #23
Source File: BankPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private void updateBankPinSizes() { for (final WidgetInfo widgetInfo : BANK_PINS) { final Widget pin = client.getWidget(widgetInfo); if (pin == null) { continue; } final Widget[] children = pin.getDynamicChildren(); if (children.length < 2) { continue; } final Widget button = children[0]; final Widget number = children[1]; // Change to a bigger font size number.setFontId(FontID.QUILL_CAPS_LARGE); number.setYTextAlignment(0); // Change size to match container widths number.setOriginalWidth(button.getWidth()); // The large font id text isn't centered, we need to offset it slightly number.setOriginalHeight(button.getHeight() + PIN_FONT_OFFSET); number.setOriginalY(-PIN_FONT_OFFSET); number.setOriginalX(0); number.revalidate(); } }
Example #24
Source File: AttackStylesPluginTest.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private boolean isStrHidden() { if (attackPlugin.getHiddenWidgets().size() == 0) { return false; } return attackPlugin.getHiddenWidgets().get(WeaponType.TYPE_4, WidgetInfo.COMBAT_STYLE_TWO); }
Example #25
Source File: PrayerPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private void setPrayerOrbText(String text) { Widget prayerOrbText = client.getWidget(WidgetInfo.MINIMAP_PRAYER_ORB_TEXT); if (prayerOrbText != null) { prayerOrbText.setText(text); } }
Example #26
Source File: KeyRemappingPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
void unlockChat() { Widget chatboxInput = client.getWidget(WidgetInfo.CHATBOX_INPUT); if (chatboxInput != null && client.getGameState() == GameState.LOGGED_IN) { final boolean isChatboxTransparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1; final Color textColor = isChatboxTransparent ? JagexColors.CHAT_TYPED_TEXT_TRANSPARENT_BACKGROUND : JagexColors.CHAT_TYPED_TEXT_OPAQUE_BACKGROUND; setChatboxWidgetInput(chatboxInput, ColorUtil.wrapWithColorTag(client.getVar(VarClientStr.CHATBOX_TYPED_TEXT) + "*", textColor)); } }
Example #27
Source File: MouseHighlightPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private void setTipHidden(WidgetInfo widgetInfo, boolean hidden) { Widget widget = client.getWidget(widgetInfo); if (widget == null) { return; } widget.setHidden(hidden); }
Example #28
Source File: WorldHopperPingOverlay.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Override public Dimension render(Graphics2D graphics) { if (!worldHopperConfig.displayPing()) { return null; } final int ping = worldHopperPlugin.getCurrentPing(); if (ping < 0) { return null; } final String text = ping + " ms"; final int textWidth = graphics.getFontMetrics().stringWidth(text); final int textHeight = graphics.getFontMetrics().getAscent() - graphics.getFontMetrics().getDescent(); // Adjust ping offset for logout button Widget logoutButton = client.getWidget(WidgetInfo.RESIZABLE_MINIMAP_LOGOUT_BUTTON); int xOffset = X_OFFSET; if (logoutButton != null && !logoutButton.isHidden()) { xOffset += logoutButton.getWidth(); } final int width = (int) client.getRealDimensions().getWidth(); final Point point = new Point(width - textWidth - xOffset, textHeight + Y_OFFSET); OverlayUtil.renderTextLocation(graphics, point, text, Color.YELLOW); return null; }
Example #29
Source File: TabInterface.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private void openTag(final String tag) { bankSearch.search(InputType.SEARCH, TAG_SEARCH + tag, true); activateTab(tabManager.find(tag)); // When tab is selected with search window open, the search window closes but the search button // stays highlighted, this solves that issue Widget searchBackground = client.getWidget(WidgetInfo.BANK_SEARCH_BUTTON_BACKGROUND); searchBackground.setSpriteId(SpriteID.EQUIPMENT_SLOT_TILE); }
Example #30
Source File: QuestListPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private void addQuestButtons() { Widget header = client.getWidget(WidgetInfo.QUESTLIST_BOX); if (header != null) { header.deleteAllChildren(); questSearchButton = header.createChild(-1, WidgetType.GRAPHIC); questSearchButton.setSpriteId(SpriteID.GE_SEARCH); questSearchButton.setOriginalWidth(18); questSearchButton.setOriginalHeight(17); questSearchButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT); questSearchButton.setOriginalX(5); questSearchButton.setOriginalY(0); questSearchButton.setHasListener(true); questSearchButton.setAction(1, MENU_OPEN); questSearchButton.setOnOpListener((JavaScriptCallback) e -> openSearch()); questSearchButton.setName(MENU_SEARCH); questSearchButton.revalidate(); questHideButton = header.createChild(-1, WidgetType.GRAPHIC); redrawHideButton(); questHideButton.setOriginalWidth(13); questHideButton.setOriginalHeight(13); questHideButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT); questHideButton.setOriginalX(24); questHideButton.setOriginalY(2); questHideButton.setHasListener(true); questHideButton.setOnOpListener((JavaScriptCallback) e -> toggleHidden()); questHideButton.setAction(1, MENU_TOGGLE); questHideButton.revalidate(); questSet = new EnumMap<>(QuestContainer.class); updateFilter(); } }