Java Code Examples for net.runelite.api.widgets.Widget#getOriginalY()
The following examples show how to use
net.runelite.api.widgets.Widget#getOriginalY() .
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: CombatLevelPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private void appendAttackLevelRangeText() { final Widget wildernessLevelWidget = client.getWidget(WidgetInfo.PVP_WILDERNESS_LEVEL); if (wildernessLevelWidget == null) { return; } final String wildernessLevelText = wildernessLevelWidget.getText(); final Matcher m = WILDERNESS_LEVEL_PATTERN.matcher(wildernessLevelText); if (!m.matches() || WorldType.isPvpWorld(client.getWorldType())) { return; } final Widget skullContainer = client.getWidget(WidgetInfo.PVP_SKULL_CONTAINER); if (originalWildernessLevelTextPosition == -1) { originalWildernessLevelTextPosition = wildernessLevelWidget.getOriginalY(); } if (originalSkullContainerPosition == -1) { originalSkullContainerPosition = skullContainer.getRelativeY(); } final int wildernessLevel = Integer.parseInt(m.group(1)); final int combatLevel = client.getLocalPlayer().getCombatLevel(); wildernessLevelWidget.setText(wildernessLevelText + "<br>" + combatAttackRange(combatLevel, wildernessLevel)); wildernessLevelWidget.setOriginalY(WILDERNESS_LEVEL_TEXT_ADJUSTED_ORIGINAL_Y); skullContainer.setOriginalY(SKULL_CONTAINER_ADJUSTED_ORIGINAL_Y); clientThread.invoke(wildernessLevelWidget::revalidate); clientThread.invoke(skullContainer::revalidate); }
Example 2
Source File: CombatLevelPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private void appendAttackLevelRangeText() { final Widget wildernessLevelWidget = client.getWidget(WidgetInfo.PVP_WILDERNESS_LEVEL); if (wildernessLevelWidget == null) { return; } final String wildernessLevelText = wildernessLevelWidget.getText(); final Matcher m = WILDERNESS_LEVEL_PATTERN.matcher(wildernessLevelText); if (!m.matches() || WorldType.isPvpWorld(client.getWorldType())) { return; } final Widget skullContainer = client.getWidget(WidgetInfo.PVP_SKULL_CONTAINER); if (originalWildernessLevelTextPosition == -1) { originalWildernessLevelTextPosition = wildernessLevelWidget.getOriginalY(); } if (originalSkullContainerPosition == -1) { originalSkullContainerPosition = skullContainer.getRelativeY(); } final int wildernessLevel = Integer.parseInt(m.group(1)); final int combatLevel = client.getLocalPlayer().getCombatLevel(); wildernessLevelWidget.setText(wildernessLevelText + "<br>" + combatAttackRange(combatLevel, wildernessLevel)); wildernessLevelWidget.setOriginalY(WILDERNESS_LEVEL_TEXT_ADJUSTED_ORIGINAL_Y); skullContainer.setOriginalY(SKULL_CONTAINER_ADJUSTED_ORIGINAL_Y); clientThread.invoke(wildernessLevelWidget::revalidate); clientThread.invoke(skullContainer::revalidate); }